Index: issm/trunk/src/Makefile.am
===================================================================
--- issm/trunk/src/Makefile.am	(revision 25994)
+++ issm/trunk/src/Makefile.am	(revision 26744)
@@ -1,2 +1,2 @@
 EXTRA_DIST =  perl
-SUBDIRS = c m wrappers mobile
+SUBDIRS = c m wrappers
Index: issm/trunk/src/c/Makefile.am
===================================================================
--- issm/trunk/src/c/Makefile.am	(revision 25994)
+++ issm/trunk/src/c/Makefile.am	(revision 26744)
@@ -1,3 +1,3 @@
-AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @CODIPACKINCL@ @GSLINCL@ @BOOSTINCL@ @ANDROID_NDKINCL@ @METEOIOINCL@ @SNOWPACKINCL@ @PROJINCL@ @ESMFINCL@
+AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @SHAPELIBINCL@ @TRIANGLEINCL@ @PETSCINCL@ @SLEPCINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @PARMETISINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @CODIPACKINCL@ @GSLINCL@ @BOOSTINCL@ @ANDROID_NDKINCL@ @METEOIOINCL@ @SNOWPACKINCL@ @PROJINCL@ @ESMFINCL@ @PROJINCL@
 AM_FCFLAGS = @SEMICINCL@
 
@@ -6,7 +6,10 @@
 EXEEXT=$(ISSMEXT)
 
-#Library declaration {{{
+# Library declaration {{{
 if !WINDOWS
-lib_LTLIBRARIES = libISSMCore.la libISSMOverload.la
+lib_LTLIBRARIES = libISSMCore.la
+if !MSYS2
+lib_LTLIBRARIES += libISSMOverload.la
+endif
 if WRAPPERS
 lib_LTLIBRARIES += libISSMModules.la
@@ -20,8 +23,8 @@
 #}}}
 
-#Core sources
+# Core sources
 issm_sources =
 
-#BAMG sources  {{{
+# BAMG sources {{{
 if BAMG
 issm_sources += \
@@ -54,5 +57,5 @@
 	./modules/BamgTriangulatex/BamgTriangulatex.cpp
 
-#do not include AmrBamg with AD
+# Do not include AmrBamg with AD
 if ADOLC
 issm_sources += \
@@ -68,5 +71,5 @@
 endif
 #}}}
-#Core sources{{{
+# Core sources {{{
 issm_sources += \
 	./datastructures/DataSet.cpp \
@@ -88,4 +91,5 @@
 	./classes/Cfdragcoeffabsgrad.cpp \
 	./classes/Cfsurfacelogvel.cpp \
+	./classes/Cflevelsetmisfit.cpp \
 	./classes/Regionaloutput.cpp \
 	./classes/Nodalvalue.cpp \
@@ -94,4 +98,5 @@
 	./classes/Hook.cpp \
 	./classes/Radar.cpp \
+	./classes/BarystaticContributions.cpp \
 	./classes/ExternalResults/Results.cpp \
 	./classes/Elements/Element.cpp \
@@ -182,4 +187,6 @@
 	./shared/Elements/DrainageFunctionWaterfraction.cpp \
 	./shared/Elements/EstarComponents.cpp \
+	./shared/Random/random.cpp \
+	./shared/Random/randomgenerator.cpp \
 	./shared/String/DescriptorIndex.cpp \
 	./toolkits/issm/IssmToolkitUtils.cpp \
@@ -191,4 +198,5 @@
 	./toolkits/mpi/commops/GetOwnershipBoundariesFromRange.cpp \
 	./toolkits/ToolkitOptions.cpp \
+	./modules/MmeToInputFromIdx/MmeToInputFromIdx.cpp\
 	./modules/ModelProcessorx/ModelProcessorx.cpp \
 	./modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp \
@@ -208,4 +216,5 @@
 	./modules/NodalValuex/NodalValuex.cpp \
 	./modules/VertexCoordinatesx/VertexCoordinatesx.cpp \
+	./modules/ElementCoordinatesx/ElementCoordinatesx.cpp \
 	./modules/OutputResultsx/OutputResultsx.cpp \
 	./modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp \
@@ -239,8 +248,10 @@
 	./modules/ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.cpp \
 	./modules/Solverx/Solverx.cpp \
+	./modules/StochasticForcingx/StochasticForcingx.cpp \
 	./modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp \
 	./cores/ProcessArguments.cpp \
 	./cores/ResetBoundaryConditions.cpp \
 	./cores/WrapperCorePointerFromSolutionEnum.cpp \
+	./cores/WrapperPreCorePointerFromSolutionEnum.cpp \
 	./cores/CorePointerFromSolutionEnum.cpp \
 	./cores/ad_core.cpp \
@@ -256,4 +267,5 @@
 	./solutionsequences/solutionsequence_fct.cpp \
 	./solutionsequences/solutionsequence_schurcg.cpp \
+	./solutionsequences/solutionsequence_sampling.cpp \
 	./solutionsequences/convergence.cpp \
 	./classes/Options/Options.cpp \
@@ -264,4 +276,5 @@
 	./cores/steadystate_core.cpp \
 	./cores/masstransport_core.cpp \
+	./cores/oceantransport_core.cpp \
 	./cores/depthaverage_core.cpp \
 	./cores/extrudefrombase_core.cpp \
@@ -334,5 +347,5 @@
 	./classes/Inputs/ArrayInput.cpp
 #}}}
-#ADJOINTMPI/MeDiPack sources {{{
+# ADJOINTMPI/MeDiPack sources {{{
 if ADJOINTMPI
 issm_sources += ./toolkits/codipack/ampi_interface.cpp
@@ -341,6 +354,6 @@
 issm_sources += ./toolkits/codipack/ampi_interface.cpp
 endif
-# }}}
-#DAKOTA sources  {{{
+#}}}
+# DAKOTA sources {{{
 if DAKOTA
 issm_sources += \
@@ -359,5 +372,5 @@
 endif
 #}}}
-#Petsc sources  {{{
+# PETSc sources {{{
 if PETSC
 issm_sources += \
@@ -365,5 +378,5 @@
 	./toolkits/petsc/patches \
 	./toolkits/petsc/patches/VecToMPISerial.cpp \
-	./toolkits/petsc/patches/MatToSerial.cpp \
+	./toolkits/petsc/patches/MatToMPISerial.cpp \
 	./toolkits/petsc/patches/NewVec.cpp \
 	./toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp \
@@ -381,20 +394,20 @@
 endif
 #}}}
-#Mumps sources  {{{
+# MUMPS sources {{{
 if MUMPS
 issm_sources += ./toolkits/mumps/MumpsSolve.cpp
 endif
 #}}}
-#Gsl sources  {{{
+#GSL sources {{{
 if GSL
 issm_sources += ./toolkits/gsl/DenseGslSolve.cpp
 endif
 #}}}
-#proj sources  {{{
+# PROJ sources {{{
 if PROJ
 issm_sources += ./modules/CoordinateSystemTransformx/CoordinateSystemTransformx.cpp
 endif
 #}}}
-#Analyses{{{
+# Analyses {{{
 if ADJOINTBALANCETHICKNESS
 issm_sources += ./analyses/AdjointBalancethicknessAnalysis.cpp
@@ -446,4 +459,8 @@
 issm_sources += ./analyses/HydrologyShreveAnalysis.cpp
 endif
+if HYDROLOGYTWS
+issm_sources += ./analyses/HydrologyTwsAnalysis.cpp
+endif
+
 if HYDROLOGYSHAKTI
 issm_sources += ./analyses/HydrologyShaktiAnalysis.cpp
@@ -469,4 +486,7 @@
 if MASSTRANSPORT
 issm_sources += ./analyses/MasstransportAnalysis.cpp
+endif
+if OCEANTRANSPORT
+issm_sources += ./analyses/OceantransportAnalysis.cpp
 endif
 if SMB
@@ -504,10 +524,49 @@
 endif
 #}}}
-#Gia sources (only if have fortran){{{
-if GIA
+# Love sources (only if have Fortran) {{{
+if LOVE
 if FORTRAN
 issm_sources += \
-	./cores/gia_core.cpp \
-	./analyses/GiaAnalysis.cpp \
+	./cores/love_core.cpp \
+	./analyses/LoveAnalysis.cpp \
+	./modules/FourierLoveCorex/FourierLoveCorex.cpp \
+	./modules/FourierLoveCorex/lnb_param.f90 \
+	./modules/FourierLoveCorex/model.f90 \
+	./modules/FourierLoveCorex/util.f90 \
+	./modules/FourierLoveCorex/lovenb_sub.f90 \
+	./modules/FourierLoveCorex/love_numbers.f90
+endif
+endif
+#}}}
+# Esa sources {{{
+if ESA
+issm_sources += \
+	./cores/esa_core.cpp \
+	./analyses/EsaAnalysis.cpp
+endif
+#}}}
+# Ocean sources {{{
+if OCEAN
+issm_sources += ./modules/OceanExchangeDatax/OceanExchangeDatax.cpp
+endif
+#}}}
+# Sampling sources {{{
+if SAMPLING
+issm_sources += \
+	./cores/sampling_core.cpp \
+	./analyses/SamplingAnalysis.cpp
+endif
+#}}}
+# SLC sources {{{
+if SEALEVELCHANGE
+issm_sources += \
+	./cores/sealevelchange_core.cpp \
+	./analyses/SealevelchangeAnalysis.cpp\
+	./classes/GrdLoads.cpp\
+	./classes/SealevelGeometry.cpp
+
+# GIA Ivins physics (only if have Fortran)
+if FORTRAN
+issm_sources += \
 	./modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp \
 	./modules/GiaDeflectionCorex/distme.f \
@@ -519,51 +578,18 @@
 	./modules/GiaDeflectionCorex/what0.f
 endif
-endif
-#}}}
-#Love sources (only if have fortran){{{
-if LOVE
-if FORTRAN
-issm_sources += \
-	./cores/love_core.cpp \
-	./analyses/LoveAnalysis.cpp \
-	./modules/FourierLoveCorex/FourierLoveCorex.cpp \
-	./modules/FourierLoveCorex/lnb_param.f90 \
-	./modules/FourierLoveCorex/model.f90 \
-	./modules/FourierLoveCorex/util.f90 \
-	./modules/FourierLoveCorex/lovenb_sub.f90 \
-	./modules/FourierLoveCorex/love_numbers.f90
-endif
-endif
-#}}}
-#Esa sources  {{{
-if ESA
-issm_sources += \
-	./cores/esa_core.cpp \
-	./analyses/EsaAnalysis.cpp
-endif
-#}}}
-#Oceansources  {{{
-if OCEAN
-issm_sources += ./modules/OceanExchangeDatax/OceanExchangeDatax.cpp
-endif
-#}}}
-#Slr sources  {{{
-if SEALEVELRISE
-issm_sources += \
-	./cores/sealevelchange_core.cpp \
-	./analyses/SealevelriseAnalysis.cpp
-endif
-#}}}
-#Metis sources  {{{
+
+endif
+#}}}
+# METIS sources {{{
 if METIS
 issm_sources += ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
 endif
 #}}}
-#Esmf sources  {{{
+# Esmf sources {{{
 if ESMF
 issm_sources += ./main/esmfbinders.cpp
 endif
 #}}}
-#SEMIC sources  {{{
+# SEMIC sources {{{
 if SEMIC
 if FORTRAN
@@ -572,6 +598,6 @@
 endif
 #}}}
-#Wrapper sources
-#Kml sources  {{{
+# Wrapper sources
+# Kml sources {{{
 kml_sources = \
 	./modules/Exp2Kmlx/Exp2Kmlx.cpp \
@@ -609,8 +635,8 @@
 	./kml/KMLFileReadUtils.cpp
 #}}}
-#NEOPZ sources  {{{
+# NEOPZ sources {{{
 neopz_sources = ./classes/AmrNeopz.cpp
 #}}}
-#Modules sources{{{
+# Modules sources {{{
 modules_sources = \
 	./shared/Threads/LaunchThread.cpp \
@@ -641,5 +667,5 @@
 	./modules/NodeConnectivityx/NodeConnectivityx.cpp \
 	./modules/ElementConnectivityx/ElementConnectivityx.cpp \
-	./modules/PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.cpp 
+	./modules/PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.cpp
 
 if CHACO
@@ -655,6 +681,6 @@
 #}}}
 
-#kriging (WRAPPER and executable)
-#Kriging sources  {{{
+# Kriging (wrapper and executable)
+# Kriging sources {{{
 if KRIGING
 issm_sources += \
@@ -674,14 +700,19 @@
 endif
 #}}}
-#Library flags and sources {{{
-ALLCXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
+# Library flags and sources {{{
+ALL_CXXFLAGS = $(CXXFLAGS) $(CXXOPTFLAGS)
+
+if MSYS2
+ALL_CXXFLAGS += -D_DO_NOT_LOAD_GLOBALS_ # Cannot have undefined symbols under MSYS2
+ALL_CXXFLAGS += -D_USE_MATH_DEFINES # Need to open fence to math.h definitions when --std=c++ is used (which is the default)
+endif
 
 libISSMCore_la_SOURCES  = $(issm_sources)
-libISSMCore_la_CXXFLAGS = $(ALLCXXFLAGS) $(DAKOTAFLAGS)
+libISSMCore_la_CXXFLAGS = $(ALL_CXXFLAGS) $(DAKOTAFLAGS)
 libISSMCore_la_FFLAGS = $(AM_FFLAGS)
 
 if !WINDOWS
 if !STANDALONE_LIBRARIES
-libISSMCore_la_LIBADD = $(PETSCLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(ADJOINTMPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
+libISSMCore_la_LIBADD = $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(ADJOINTMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(OSLIBS)
 if FORTRAN
 libISSMCore_la_LIBADD += $(FLIBS) $(FORTRANLIB)
@@ -704,10 +735,10 @@
 endif
 
-libISSMModules_la_CXXFLAGS = $(ALLCXXFLAGS)
+libISSMModules_la_CXXFLAGS = $(ALL_CXXFLAGS)
 if !WINDOWS
 if STANDALONE_LIBRARIES
 libISSMModules_la_LIBADD = ./libISSMCore.la
 else
-libISSMModules_la_LIBADD = ./libISSMCore.la $(TRIANGLELIB) $(CHACOLIB)
+libISSMModules_la_LIBADD = ./libISSMCore.la $(TRIANGLELIB) $(CHACOLIB) $(BLASLAPACKLIB) $(OSLIBS)
 endif
 endif
@@ -736,27 +767,44 @@
 endif
 
+if VERSION
+libISSMCore_la_LDFLAGS =
+if WRAPPERS
+libISSMModules_la_LDFLAGS =
+endif
+else
+libISSMCore_la_LDFLAGS = -avoid-version
+if WRAPPERS
+libISSMModules_la_LDFLAGS = -avoid-version
+endif
+endif
+
 if STANDALONE_LIBRARIES
-libISSMCore_la_LDFLAGS = -static
-libISSMOverload_la_LDFLAGS = -static
+libISSMCore_la_LDFLAGS += -static
 if WRAPPERS
-libISSMModules_la_LDFLAGS = -static
-else
-libISSMModules_la_LDFLAGS =
-endif
-else
-libISSMCore_la_LDFLAGS =
+libISSMModules_la_LDFLAGS += -static
+endif
+endif
+#}}}
+
+if !MSYS2
+# Overload library, to overload any non-standard symbols {{{
+libISSMOverload_la_SOURCES = ./shared/String/ApiPrintf.cpp
+libISSMOverload_la_CFLAGS  = -D_C_ -fPIC $(COPTFLAGS) $(CFLAGS)
+
+if VERSION
 libISSMOverload_la_LDFLAGS =
-endif
-
-#}}}
-#Overload library, to overload any non-standard symbols. {{{
-libISSMOverload_la_SOURCES = ./shared/String/ApiPrintf.cpp
-
-libISSMOverload_la_CFLAGS  = -D_C_ -fPIC $(COPTFLAGS) $(CFLAGS)
-#}}}
-#Executable {{{
+else
+libISSMOverload_la_LDFLAGS = -avoid-version
+endif
+
+if STANDALONE_LIBRARIES
+libISSMOverload_la_LDFLAGS += -static
+endif
+endif
+#}}}
+# Executable {{{
 if ANDROID
 if ANDROIDEXE
-bin_PROGRAMS = issm issm_slr
+bin_PROGRAMS = issm issm_slc
 else
 bin_PROGRAMS =
@@ -766,16 +814,21 @@
 bin_PROGRAMS =
 else
-bin_PROGRAMS = issm issm_slr
-endif
-endif
-
-#Standard libraries
-LDADD = ./libISSMCore.la ./libISSMOverload.la
+bin_PROGRAMS = issm issm_slc
+endif
+endif
+
+# Standard libraries
+LDADD = ./libISSMCore.la
+
+if !MSYS2
+LDADD += ./libISSMOverload.la
+endif
+
 if WRAPPERS
 LDADD += ./libISSMModules.la $(TRIANGLELIB)
 endif
 
-#External packages
-LDADD += $(NEOPZLIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(PETSCLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(ESMFLIB)
+# External packages
+LDADD += $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(ESMFLIB) $(OSLIBS)
 
 if FORTRAN
@@ -783,9 +836,9 @@
 endif
 
-issm_SOURCES = main/issm.cpp 
+issm_SOURCES = main/issm.cpp
 issm_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
 
-issm_slr_SOURCES = main/issm_slr.cpp
-issm_slr_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
+issm_slc_SOURCES = main/issm_slc.cpp
+issm_slc_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
 
 if OCEAN
Index: issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 26744)
@@ -28,4 +28,7 @@
 /*Finite Element Analysis*/
 void           AdjointBalancethickness2Analysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           AdjointBalancethickness2Analysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.h
===================================================================
--- issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointBalancethickness2Analysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	(revision 26744)
@@ -28,4 +28,7 @@
 /*Finite Element Analysis*/
 void           AdjointBalancethicknessAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           AdjointBalancethicknessAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -148,5 +151,5 @@
 	xDelete<IssmDouble>(basis);
 	xDelete<IssmDouble>(dbasis);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete gauss;
 	return pe;
@@ -224,9 +227,9 @@
 	/*Transpose and return Ke*/
 	Ke->Transpose();
-	_assert_(Ke->nrows == numvertices && Ke->ncols == numvertices);
+	_assert_(Ke->nrows == numvertices);
 
 	for(int i=0;i<numvertices;i++){
 		for(int j=0;j<numvertices;j++){
-			ge[i] += Ke->values[i*Ke->ncols + j] * lambda[j];
+			ge[i] += Ke->values[i*Ke->nrows + j] * lambda[j];
 		}
 		//ge[i]=-lambda[i];
Index: issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 26744)
@@ -28,4 +28,7 @@
 /*Finite Element Analysis*/
 void AdjointHorizAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void AdjointHorizAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -49,4 +52,8 @@
 		case FSApproximationEnum: 
 			return CreateKMatrixFS(element);
+      case MLHOApproximationEnum:
+		// a more accurate option, but integrate in the vertical direction numerically.
+		//	return CreateKMatrixMLHOVerticalIntergrated(element);
+			return CreateKMatrixMLHO(element);
 		case NoneApproximationEnum:
 			return NULL;
@@ -147,5 +154,5 @@
 }/*}}}*/
 ElementMatrix* AdjointHorizAnalysis::CreateKMatrixHO(Element* element){/*{{{*/
-	
+
 	/* Check if ice in element */
 	if(!element->IsIceInElement()) return NULL;
@@ -213,4 +220,277 @@
 	return Ke;
 }/*}}}*/
+ElementMatrix* AdjointHorizAnalysis::CreateKMatrixMLHO(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries */
+	bool        incomplete_adjoint;
+	IssmDouble  Jdet,mu_prime,n,thickness,mu,effmu;
+	IssmDouble *xyz_list = NULL;
+	IssmDouble  viscosity[9]; //9 mu for different integrand
+   int			domaintype;
+	int			dim=2;
+
+	IssmDouble  eb1i,eb1j,esh1i,esh1j,eb2i,eb2j,esh2i,esh2j;
+	IssmDouble  epsilon[5],epsilonbase[5],epsilonshear[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+	IssmDouble  e1b[2], e2b[2], e1sh[2], e2sh[2];
+	IssmDouble  vxshear, vyshear;
+
+   Element* basalelement;
+
+   /*Get basal element*/
+   element->FindParam(&domaintype,DomainTypeEnum);
+   switch(domaintype){
+      case Domain2DhorizontalEnum:
+         basalelement = element;
+         break;
+      case Domain3DEnum: case Domain2DverticalEnum:
+         _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+         break;
+      default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+   }
+	/*Fetch number of nodes and dof for this finite element*/
+   int numnodes = basalelement->GetNumberOfNodes();
+   IssmDouble* dbasis = xNew<IssmDouble>(2*numnodes); // like SSA
+   IssmDouble* basis  = xNew<IssmDouble>(numnodes); // like SSA
+
+	/*Initialize Jacobian with regular HO (first part of the Gateau derivative)*/
+	element->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
+	ElementMatrix* Ke=analysis->CreateKMatrix(basalelement);
+	delete analysis;
+	if(incomplete_adjoint) return Ke;
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+   Input* vx_input       = element->GetInput(VxEnum);        _assert_(vx_input); //vertically integrated vx
+   Input* vy_input       = element->GetInput(VyEnum);        _assert_(vy_input); //vertically integrated vy
+   Input* vxbase_input   = element->GetInput(VxBaseEnum);    _assert_(vxbase_input);
+   Input* vybase_input   = element->GetInput(VyBaseEnum);    _assert_(vybase_input);
+   Input* vxshear_input  = element->GetInput(VxShearEnum);   _assert_(vxshear_input);
+   Input* vyshear_input  = element->GetInput(VyShearEnum);   _assert_(vyshear_input);
+   Input* thickness_input= element->GetInput(ThicknessEnum); _assert_(thickness_input);
+   Input* n_input        = element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
+
+	/* Start  looping on the number of gaussian points: */
+   Gauss* gauss      = element->NewGauss(5);
+   Gauss* gauss_base = basalelement->NewGauss();
+   while(gauss->next()){
+      gauss->SynchronizeGaussBase(gauss_base);
+
+      element->JacobianDeterminant(&Jdet,xyz_list,gauss_base);
+      basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss_base);
+      basalelement->NodalFunctions(basis, gauss_base);
+
+      thickness_input->GetInputValue(&thickness, gauss);
+      n_input->GetInputValue(&n,gauss);
+
+      vxshear_input->GetInputValue(&vxshear,gauss);
+      vyshear_input->GetInputValue(&vyshear,gauss);
+
+		element->material->ViscosityMLHOAdjoint(&viscosity[0],dim,xyz_list,gauss,vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input);
+
+		effmu = 2.0*(1-n)/2.0/n;
+
+		element->StrainRateHO(&epsilonbase[0],xyz_list,gauss,vxbase_input, vybase_input);
+		element->StrainRateHO(&epsilonshear[0],xyz_list,gauss,vxshear_input, vyshear_input);
+
+		e1b[0] = 2*epsilonbase[0]+epsilonbase[1];		e1b[1] = epsilonbase[2];
+		e2b[1] = epsilonbase[0]+2*epsilonbase[1];		e2b[0] = epsilonbase[2];
+
+		e1sh[0] = 2*epsilonshear[0]+epsilonshear[1];		e1sh[1] = epsilonshear[2];
+		e2sh[1] = epsilonshear[0]+2*epsilonshear[1];		e2sh[0] = epsilonshear[2];
+
+		for(int i=0;i<numnodes;i++){
+			for(int j=0;j<numnodes;j++){
+				eb1i = e1b[0]*dbasis[0*numnodes+i]+e1b[1]*dbasis[1*numnodes+i];
+				eb1j = e1b[0]*dbasis[0*numnodes+j]+e1b[1]*dbasis[1*numnodes+j];
+				eb2i = e2b[0]*dbasis[0*numnodes+i]+e2b[1]*dbasis[1*numnodes+i];
+				eb2j = e2b[0]*dbasis[0*numnodes+j]+e2b[1]*dbasis[1*numnodes+j];
+            esh1i = e1sh[0]*dbasis[0*numnodes+i]+e1sh[1]*dbasis[1*numnodes+i];
+            esh1j = e1sh[0]*dbasis[0*numnodes+j]+e1sh[1]*dbasis[1*numnodes+j];
+            esh2i = e2sh[0]*dbasis[0*numnodes+i]+e2sh[1]*dbasis[1*numnodes+i];
+            esh2j = e2sh[0]*dbasis[0*numnodes+j]+e2sh[1]*dbasis[1*numnodes+j];
+
+				Ke->values[4*numnodes*(4*i+0)+4*j+0]+=gauss->weight*Jdet*effmu*(viscosity[0]*eb1j*eb1i+viscosity[1]*(esh1j*eb1i+eb1j*esh1i)+viscosity[2]*esh1j*esh1i);
+				Ke->values[4*numnodes*(4*i+1)+4*j+0]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb1j*eb1i+viscosity[2]*(esh1j*eb1i+eb1j*esh1i)+viscosity[4]*esh1j*esh1i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*eb1j*basis[i]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*esh1j*basis[i]);
+				Ke->values[4*numnodes*(4*i+2)+4*j+0]+=gauss->weight*Jdet*effmu*(viscosity[0]*eb1j*eb2i+viscosity[1]*(esh1j*eb2i+eb1j*esh2i)+viscosity[2]*esh1j*esh2i);
+				Ke->values[4*numnodes*(4*i+3)+4*j+0]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb1j*eb2i+viscosity[2]*(esh1j*eb2i+eb1j*esh2i)+viscosity[4]*esh1j*esh2i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*eb1j*basis[i]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*esh1j*basis[i]);
+
+				Ke->values[4*numnodes*(4*i+0)+4*j+1]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb1j*eb1i+viscosity[2]*(esh1j*eb1i+eb1j*esh1i)+viscosity[4]*esh1j*esh1i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*eb1i*basis[j]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*esh1i*basis[j]);
+				Ke->values[4*numnodes*(4*i+1)+4*j+1]+=gauss->weight*Jdet*effmu*(viscosity[2]*eb1j*eb1i+viscosity[4]*(esh1j*eb1i+eb1j*esh1i)+viscosity[5]*esh1j*esh1i+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*(eb1i*basis[j]+eb1j*basis[i])+viscosity[7]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*(esh1i*basis[j]+esh1j*basis[i])+viscosity[8]*(n+1)*(n+1)*(n+1)*(n+1)/4.0/thickness/thickness/thickness/thickness*vxshear*vxshear*basis[j]*basis[i]);
+				Ke->values[4*numnodes*(4*i+2)+4*j+1]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb1j*eb2i+viscosity[2]*(esh1j*eb2i+eb1j*esh2i)+viscosity[4]*esh1j*esh2i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*eb2i*basis[j]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*esh2i*basis[j]);
+				Ke->values[4*numnodes*(4*i+3)+4*j+1]+=gauss->weight*Jdet*effmu*(viscosity[2]*eb1j*eb2i+viscosity[4]*(esh1j*eb2i+eb1j*esh2i)+viscosity[5]*esh1j*esh2i+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*(vxshear*eb2i*basis[j]+vyshear*eb1j*basis[i])+viscosity[7]*(n+1)*(n+1)/2.0/thickness/thickness*(vxshear*esh2i*basis[j]+vyshear*esh1j*basis[i])+viscosity[8]*(n+1)*(n+1)*(n+1)*(n+1)/4.0/thickness/thickness/thickness/thickness*vxshear*vyshear*basis[j]*basis[i]);
+				
+
+				Ke->values[4*numnodes*(4*i+0)+4*j+2]+=gauss->weight*Jdet*effmu*(viscosity[0]*eb2j*eb1i+viscosity[1]*(esh2j*eb1i+eb2j*esh1i)+viscosity[2]*esh2j*esh1i);
+				Ke->values[4*numnodes*(4*i+1)+4*j+2]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb2j*eb1i+viscosity[2]*(esh2j*eb1i+eb2j*esh1i)+viscosity[4]*esh2j*esh1i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*eb2j*basis[i]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vxshear*esh2j*basis[i]);
+				Ke->values[4*numnodes*(4*i+2)+4*j+2]+=gauss->weight*Jdet*effmu*(viscosity[0]*eb2j*eb2i+viscosity[1]*(esh2j*eb2i+eb2j*esh2i)+viscosity[2]*esh2j*esh2i);
+				Ke->values[4*numnodes*(4*i+3)+4*j+2]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb2j*eb2i+viscosity[2]*(esh2j*eb2i+eb2j*esh2i)+viscosity[4]*esh2j*esh2i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*eb2j*basis[i]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*esh2j*basis[i]);
+
+
+				Ke->values[4*numnodes*(4*i+0)+4*j+3]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb2j*eb1i+viscosity[2]*(esh2j*eb1i+eb2j*esh1i)+viscosity[4]*esh2j*esh1i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*eb1i*basis[j]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*esh1i*basis[j]);
+				Ke->values[4*numnodes*(4*i+1)+4*j+3]+=gauss->weight*Jdet*effmu*(viscosity[2]*eb2j*eb1i+viscosity[4]*(esh2j*eb1i+eb2j*esh1i)+viscosity[5]*esh2j*esh1i+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*(vyshear*eb1i*basis[j]+vxshear*eb2j*basis[i])+viscosity[7]*(n+1)*(n+1)/2.0/thickness/thickness*(vxshear*esh2j*basis[i]+vyshear*esh1i*basis[j])+viscosity[8]*(n+1)*(n+1)*(n+1)*(n+1)/4.0/thickness/thickness/thickness/thickness*vxshear*vxshear*basis[j]*basis[i]);
+				Ke->values[4*numnodes*(4*i+2)+4*j+3]+=gauss->weight*Jdet*effmu*(viscosity[1]*eb2j*eb2i+viscosity[2]*(esh2j*eb2i+eb2j*esh2i)+viscosity[4]*esh2j*esh2i+viscosity[3]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*eb2i*basis[j]+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*esh2i*basis[j]);
+				Ke->values[4*numnodes*(4*i+3)+4*j+3]+=gauss->weight*Jdet*effmu*(viscosity[2]*eb2j*eb2i+viscosity[4]*(esh2j*eb2i+eb2j*esh2i)+viscosity[5]*esh2j*esh2i+viscosity[6]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*(eb2i*basis[j]+eb1j*basis[i])+viscosity[7]*(n+1)*(n+1)/2.0/thickness/thickness*vyshear*(esh2i*basis[j]+esh1j*basis[i])+viscosity[8]*(n+1)*(n+1)*(n+1)*(n+1)/4.0/thickness/thickness/thickness/thickness*vyshear*vyshear*basis[j]*basis[i]);
+			}
+		}
+	}
+
+	/*Transform Coordinate System*/
+	/*element->TransformStiffnessMatrixCoord(Ke,XYEnum);*/
+
+   /*Clean up and return*/
+   delete gauss;
+   delete gauss_base;
+   if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+   xDelete<IssmDouble>(xyz_list);
+   xDelete<IssmDouble>(dbasis);
+   xDelete<IssmDouble>(basis);
+   return Ke;
+}/*}}}*/
+ElementMatrix* AdjointHorizAnalysis::CreateKMatrixMLHOVerticalIntergrated(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries */
+	bool        incomplete_adjoint;
+	IssmDouble  Jdet,mu_prime,n,thickness,mu,effmu;
+	IssmDouble *xyz_list = NULL;
+	IssmDouble	zeta, epsilon_eff;
+   int			domaintype;
+	int			dim=2;
+
+	IssmDouble  e1phi1i, e1phi1j, e2phi1i, e2phi1j, e1phi2i, e1phi2j, e2phi2i, e2phi2j;
+	IssmDouble  epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+	IssmDouble	e1[3],e2[3];
+
+   Element* basalelement;
+
+   /*Get basal element*/
+   element->FindParam(&domaintype,DomainTypeEnum);
+   switch(domaintype){
+      case Domain2DhorizontalEnum:
+         basalelement = element;
+         break;
+      case Domain3DEnum: case Domain2DverticalEnum:
+         _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+         break;
+      default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+   }
+	/*Fetch number of nodes and dof for this finite element*/
+   int numnodes = basalelement->GetNumberOfNodes();
+   IssmDouble* dbasis = xNew<IssmDouble>(2*numnodes); // like SSA
+   IssmDouble* basis  = xNew<IssmDouble>(numnodes); // like SSA
+
+	/*Initialize Jacobian with regular HO (first part of the Gateau derivative)*/
+	element->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+	StressbalanceAnalysis* analysis = new StressbalanceAnalysis();
+	ElementMatrix* Ke=analysis->CreateKMatrix(basalelement);
+	delete analysis;
+	if(incomplete_adjoint) return Ke;
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+   Input* vxbase_input   = element->GetInput(VxBaseEnum);    _assert_(vxbase_input);
+   Input* vybase_input   = element->GetInput(VyBaseEnum);    _assert_(vybase_input);
+   Input* vxshear_input  = element->GetInput(VxShearEnum);   _assert_(vxshear_input);
+   Input* vyshear_input  = element->GetInput(VyShearEnum);   _assert_(vyshear_input);
+   Input* thickness_input= element->GetInput(ThicknessEnum); _assert_(thickness_input);
+   Input* n_input        = element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
+
+	/* Start  looping on the number of gaussian points: */
+   Gauss* gauss      = element->NewGauss(10);
+   Gauss* gauss_base = basalelement->NewGauss();
+	
+	GaussSeg* gauss_seg=new GaussSeg(5);
+
+   while(gauss->next()){
+      gauss->SynchronizeGaussBase(gauss_base);
+
+      element->JacobianDeterminant(&Jdet,xyz_list,gauss_base);
+      basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss_base);
+      basalelement->NodalFunctions(basis, gauss_base);
+
+      thickness_input->GetInputValue(&thickness, gauss);
+      n_input->GetInputValue(&n,gauss);
+
+		effmu = 2*(1-n)/2.0/n;
+
+		/* Get the integration in the vertical direction */
+		gauss_seg->Reset();
+		while(gauss_seg->next()){
+			/*Compute zeta for gauss_seg point (0=surface, 1=base)*/
+	      zeta=0.5*(gauss_seg->coord1+1);
+
+		   /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy (for a given zeta)*/
+			element->StrainRateMLHO(&epsilon[0],xyz_list,gauss,
+                  vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+			epsilon_eff=sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2]
+                    +  epsilon[3]*epsilon[3] + epsilon[4]*epsilon[4] + epsilon[0]*epsilon[1]);
+
+			/*Get viscosity at zeta*/
+			element->material->GetViscosity(&mu,epsilon_eff,gauss);
+			/*the adjoint viscosity with zeta dependent term*/
+			mu = mu /epsilon_eff/epsilon_eff;
+
+			e1[0] = 2.0*epsilon[0]+epsilon[1];
+			e1[1] = epsilon[2];
+			e1[2] = epsilon[3];
+	
+			e2[0] = epsilon[2];
+			e2[1] = epsilon[0]+2.0*epsilon[1];
+			e2[2] = epsilon[4];
+
+			for(int i=0;i<numnodes;i++){
+				for(int j=0;j<numnodes;j++){
+					e1phi1i = e1[0]*dbasis[0*numnodes+i]+e1[1]*dbasis[1*numnodes+i];
+					e2phi1i = e2[0]*dbasis[0*numnodes+i]+e2[1]*dbasis[1*numnodes+i];
+					e1phi1j = e1[0]*dbasis[0*numnodes+j]+e1[1]*dbasis[1*numnodes+j];
+					e2phi1j = e2[0]*dbasis[0*numnodes+j]+e2[1]*dbasis[1*numnodes+j];
+	
+					e1phi2i = (1-pow(zeta, n+1))*(e1[0]*dbasis[0*numnodes+i]+e1[1]*dbasis[1*numnodes+i])+(n+1)/thickness*pow(zeta, n)*e1[2]*basis[i];
+					e2phi2i = (1-pow(zeta, n+1))*(e2[0]*dbasis[0*numnodes+i]+e2[1]*dbasis[1*numnodes+i])+(n+1)/thickness*pow(zeta, n)*e2[2]*basis[i];
+					e1phi2j = (1-pow(zeta, n+1))*(e1[0]*dbasis[0*numnodes+j]+e1[1]*dbasis[1*numnodes+j])+(n+1)/thickness*pow(zeta, n)*e1[2]*basis[j];
+					e2phi2j = (1-pow(zeta, n+1))*(e2[0]*dbasis[0*numnodes+j]+e2[1]*dbasis[1*numnodes+j])+(n+1)/thickness*pow(zeta, n)*e2[2]*basis[j];
+
+					Ke->values[4*numnodes*(4*i+0)+4*j+0]+=gauss->weight*Jdet*effmu*mu*e1phi1i*e1phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+1)+4*j+0]+=gauss->weight*Jdet*effmu*mu*e1phi2i*e1phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+2)+4*j+0]+=gauss->weight*Jdet*effmu*mu*e2phi1i*e1phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+3)+4*j+0]+=gauss->weight*Jdet*effmu*mu*e2phi2i*e1phi1j*thickness*0.5*gauss_seg->weight;
+					
+					Ke->values[4*numnodes*(4*i+0)+4*j+1]+=gauss->weight*Jdet*effmu*mu*e1phi1i*e1phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+1)+4*j+1]+=gauss->weight*Jdet*effmu*mu*e1phi2i*e1phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+2)+4*j+1]+=gauss->weight*Jdet*effmu*mu*e2phi1i*e1phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+3)+4*j+1]+=gauss->weight*Jdet*effmu*mu*e2phi2i*e1phi2j*thickness*0.5*gauss_seg->weight;
+					
+					Ke->values[4*numnodes*(4*i+0)+4*j+2]+=gauss->weight*Jdet*effmu*mu*e1phi1i*e2phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+1)+4*j+2]+=gauss->weight*Jdet*effmu*mu*e1phi2i*e2phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+2)+4*j+2]+=gauss->weight*Jdet*effmu*mu*e2phi1i*e2phi1j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+3)+4*j+2]+=gauss->weight*Jdet*effmu*mu*e2phi2i*e2phi1j*thickness*0.5*gauss_seg->weight;
+
+					Ke->values[4*numnodes*(4*i+0)+4*j+3]+=gauss->weight*Jdet*effmu*mu*e1phi1i*e2phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+1)+4*j+3]+=gauss->weight*Jdet*effmu*mu*e1phi2i*e2phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+2)+4*j+3]+=gauss->weight*Jdet*effmu*mu*e2phi1i*e2phi2j*thickness*0.5*gauss_seg->weight;
+					Ke->values[4*numnodes*(4*i+3)+4*j+3]+=gauss->weight*Jdet*effmu*mu*e2phi2i*e2phi2j*thickness*0.5*gauss_seg->weight;
+				}
+			}
+		}
+	}
+	/*Transform Coordinate System*/
+	/*element->TransformStiffnessMatrixCoord(Ke,XYEnum);*/
+
+   /*Clean up and return*/
+   delete gauss;
+   delete gauss_base;
+	delete gauss_seg;
+   if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+   xDelete<IssmDouble>(xyz_list);
+   xDelete<IssmDouble>(dbasis);
+   xDelete<IssmDouble>(basis);
+   return Ke;
+}/*}}}*/
 ElementMatrix* AdjointHorizAnalysis::CreateKMatrixL1L2(Element* element){/*{{{*/
 
@@ -268,5 +548,5 @@
 	delete analysis;
 	if(incomplete_adjoint){
-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return Ke;
 	}
@@ -316,5 +596,5 @@
 	xDelete<IssmDouble>(dbasis);
 	xDelete<IssmDouble>(xyz_list);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -332,4 +612,6 @@
 		case FSApproximationEnum: 
 			return CreatePVectorFS(element);
+      case MLHOApproximationEnum:
+			return CreatePVectorMLHO(element);
 		case NoneApproximationEnum:
 			return NULL;
@@ -507,5 +789,5 @@
 					for(i=0;i<vnumnodes;i++){
 						if (domaintype!=Domain2DverticalEnum){
-							scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+							scale=1./(S*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
 							dux=scale*(vxobs-vx);
 							duy=scale*(vyobs-vy);
@@ -514,5 +796,5 @@
 						}
 						else{
-							scale=1./(S*2*fabs(vx-vxobs)+epsvel);
+							scale=1./(S*fabs(vx-vxobs)+epsvel);
 							dux=scale*(vxobs-vx);
 							pe->values[i*2+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
@@ -743,5 +1025,5 @@
 					for(i=0;i<numnodes;i++){
 						if(domaintype!=Domain2DverticalEnum){
-							scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+							scale=1./(S*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
 							dux=scale*(vxobs-vx);
 							duy=scale*(vyobs-vy);
@@ -816,4 +1098,259 @@
 	return pe;
 
+}/*}}}*/
+ElementVector* AdjointHorizAnalysis::CreatePVectorMLHO(Element* element){/*{{{*/
+
+	/*Intermediaries*/
+	int      domaintype;
+	Element* basalelement;
+
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
+	/*Get basal element*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			basalelement = element;
+			break;
+		case Domain2DverticalEnum:
+			if(!element->IsOnBase()) return NULL;
+			basalelement = element->SpawnBasalElement();
+			break;
+		case Domain3DEnum:
+			if(!element->IsOnBase()) return NULL;
+			basalelement = element->SpawnBasalElement(true);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Intermediaries */
+	int         num_responses,i;
+	IssmDouble  Jdet,obs_velocity_mag,velocity_mag;
+	IssmDouble  vx,vy,vxobs,vyobs,dux,duy,weight;
+	IssmDouble scalex,scaley,scale,S,thickness,n;
+	int        *responses = NULL;
+	IssmDouble *xyz_list  = NULL;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = basalelement->GetNumberOfNodes();
+
+	/*Initialize Element vector and vectors*/
+	ElementVector* pe    = basalelement->NewElementVector(MLHOApproximationEnum);
+	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	basalelement->GetVerticesCoordinates(&xyz_list);
+	basalelement->FindParam(&num_responses,InversionNumCostFunctionsEnum);
+	basalelement->FindParam(&responses,NULL,InversionCostFunctionsEnum);
+	DatasetInput* weights_input = basalelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+	Input* vx_input      = basalelement->GetInput(VxSurfaceEnum);                                        _assert_(vx_input);
+	Input* vxobs_input   = basalelement->GetInput(InversionVxObsEnum);                                   _assert_(vxobs_input);
+   Input* thickness_input=basalelement->GetInput(ThicknessEnum);													  _assert_(thickness_input);
+   Input*     n_input        =element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
+	Input* vy_input=NULL;
+	Input* vyobs_input=NULL;
+	if(domaintype!=Domain2DverticalEnum){
+		vy_input      = basalelement->GetInput(VySurfaceEnum);       _assert_(vy_input);
+		vyobs_input   = basalelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+	}
+	IssmDouble epsvel  = 2.220446049250313e-16;
+	IssmDouble meanvel = 3.170979198376458e-05; /*1000 m/yr*/
+
+	/*Get Surface if required by one response*/
+	Input* S_input = NULL;
+	for(int resp=0;resp<num_responses;resp++){
+		if(responses[resp]==SurfaceAverageVelMisfitEnum){
+			S_input = element->GetInput(SurfaceAreaEnum);  _assert_(S_input); break;
+		}
+	}
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=basalelement->NewGauss(4);
+	while(gauss->next()){
+
+		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		basalelement->NodalFunctions(basis, gauss);
+      
+		thickness_input->GetInputValue(&thickness,gauss);
+      n_input->GetInputValue(&n,gauss);
+		vx_input->GetInputValue(&vx,gauss);
+		vxobs_input->GetInputValue(&vxobs,gauss);
+		if(domaintype!=Domain2DverticalEnum){
+			vy_input->GetInputValue(&vy,gauss);
+			vyobs_input->GetInputValue(&vyobs,gauss);
+		}
+		/*Loop over all requested responses*/
+		for(int resp=0;resp<num_responses;resp++){
+			weights_input->GetInputValue(&weight,gauss,responses[resp]);
+
+			switch(responses[resp]){
+				case SurfaceAbsVelMisfitEnum:
+					/*
+					 *      1  [           2              2 ]
+					 * J = --- | (u - u   )  +  (v - v   )  |
+					 *      2  [       obs            obs   ]
+					 *
+					 *        dJ
+					 * DU = - -- = (u   - u )
+					 *        du     obs
+					 */
+					for(i=0;i<numnodes;i++){
+						if(domaintype!=Domain2DverticalEnum){
+							dux=vxobs-vx;
+							duy=vyobs-vy;
+							pe->values[i*4+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+1]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+2]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+3]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+						}
+						else {
+							_error_("2D vertical is not implemented for MLHO");
+						}
+					}
+					break;
+				case SurfaceRelVelMisfitEnum:
+					/*
+					 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
+					 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
+					 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
+					 *              obs                        obs                      
+					 *
+					 *        dJ     \bar{v}^2
+					 * DU = - -- = ------------- (u   - u )
+					 *        du   (u   + eps)^2    obs
+					 *               obs
+					 */
+					for(i=0;i<numnodes;i++){
+						if(domaintype!=Domain2DverticalEnum){
+							scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
+							scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
+							dux=scalex*(vxobs-vx);
+							duy=scaley*(vyobs-vy);
+							pe->values[i*4+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+1]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+2]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+3]+=duy*weight*Jdet*gauss->weight*basis[i];
+						}
+						else{
+							_error_("2D vertical is not implemented for MLHO");
+						}
+					}
+					break;
+				case SurfaceLogVelMisfitEnum:
+					/*
+					 *                 [        vel + eps     ] 2
+					 * J = 4 \bar{v}^2 | log ( -----------  ) |  
+					 *                 [       vel   + eps    ]
+					 *                            obs
+					 *
+					 *        dJ                 2 * log(...)
+					 * DU = - -- = - 4 \bar{v}^2 -------------  u
+					 *        du                 vel^2 + eps
+					 *            
+					 */
+					for(i=0;i<numnodes;i++){
+						if(domaintype!=Domain2DverticalEnum){
+							velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+							obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+							scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
+							dux=scale*vx;
+							duy=scale*vy;
+							pe->values[i*4+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+1]+=dux*weight*Jdet*gauss->weight*basis[i];
+							pe->values[i*4+2]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+3]+=duy*weight*Jdet*gauss->weight*basis[i];
+						}
+						else{
+							_error_("2D vertical is not implemented for MLHO");
+						}
+					}
+					break;
+				case SurfaceAverageVelMisfitEnum:
+					/*
+					 *      1                    2              2
+					 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
+					 *      S                obs            obs
+					 *
+					 *        dJ      1       1 
+					 * DU = - -- = - --- ----------- * 2 (u - u   )
+					 *        du      S  2 sqrt(...)           obs
+					 */
+					S_input->GetInputValue(&S,gauss);
+					for(i=0;i<numnodes;i++){
+						if(domaintype!=Domain2DverticalEnum){
+							scale=1./(S*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+							dux=scale*(vxobs-vx);
+							duy=scale*(vyobs-vy);
+							pe->values[i*4+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+1]+=dux*weight*Jdet*gauss->weight*basis[i];
+							pe->values[i*4+2]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+3]+=duy*weight*Jdet*gauss->weight*basis[i];
+						}
+						else{
+							_error_("2D vertical is not implemented for MLHO");
+						}
+					}
+					break;
+				case SurfaceLogVxVyMisfitEnum:
+					/*
+					 *      1            [        |u| + eps     2          |v| + eps     2  ]
+					 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
+					 *      2            [       |u    |+ eps              |v    |+ eps     ]
+					 *                              obs                       obs
+					 *        dJ                              1      u                             1
+					 * DU = - -- = - \bar{v}^2 log(u...) --------- ----  ~ - \bar{v}^2 log(u...) ------
+					 *        du                         |u| + eps  |u|                           u + eps
+					 */
+					for(i=0;i<numnodes;i++){
+						if(domaintype!=Domain2DverticalEnum){
+							dux = - meanvel*meanvel * log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)) / (vx+epsvel);
+							duy = - meanvel*meanvel * log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)) / (vy+epsvel);
+							pe->values[i*4+0]+=dux*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+1]+=dux*weight*Jdet*gauss->weight*basis[i];
+							pe->values[i*4+2]+=duy*weight*Jdet*gauss->weight*basis[i]; 
+							pe->values[i*4+3]+=duy*weight*Jdet*gauss->weight*basis[i];
+						}
+						else{
+							_error_("2D vertical is not implemented for MLHO");
+						}
+					}
+					break;
+				case DragCoefficientAbsGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case ThicknessAbsGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case ThicknessAlongGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case ThicknessAcrossGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case RheologyBbarAbsGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case RheologyBAbsGradientEnum:
+					/*Nothing in P vector*/
+					break;
+				case RheologyBInitialguessMisfitEnum:
+					/*Nothing in P vector*/
+					break;
+				default:
+					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
+			}
+		}
+	}
+
+	/*Transform coordinate system*/
+	//if(domaintype!=Domain2DverticalEnum)	basalelement->TransformLoadVectorCoord(pe,XYEnum);
+	/*Clean up and return*/
+	xDelete<int>(responses);
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+	delete gauss;
+	return pe;
 }/*}}}*/
 ElementVector* AdjointHorizAnalysis::CreatePVectorSSA(Element* element){/*{{{*/
@@ -995,5 +1532,5 @@
 					for(i=0;i<numnodes;i++){
 						if(domaintype!=Domain2DverticalEnum){
-							scale=1./(S*2*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
+							scale=1./(S*sqrt(pow(vx-vxobs,2)+pow(vy-vyobs,2))+epsvel);
 							dux=scale*(vxobs-vx);
 							duy=scale*(vyobs-vy);
@@ -1002,5 +1539,5 @@
 						}
 						else{
-							scale=1./(S*2*fabs(vx-vxobs)+epsvel);
+							scale=1./(S*fabs(vx-vxobs)+epsvel);
 							dux=scale*(vxobs-vx);
 							pe->values[i]+=dux*weight*Jdet*gauss->weight*basis[i]; 
@@ -1065,5 +1602,5 @@
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<IssmDouble>(basis);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete gauss;
 	return pe;
@@ -1126,4 +1663,5 @@
 				case L1L2ApproximationEnum:GradientJDragL1L2(element,gradient,control_interp,control_index); break;
 				case HOApproximationEnum:  GradientJDragHO( element,gradient,control_interp,control_index); break;
+				case MLHOApproximationEnum:  GradientJDragMLHO( element,gradient,control_interp,control_index); break;
 				case FSApproximationEnum:  GradientJDragFS( element,gradient,control_interp,control_index); break;
 				case NoneApproximationEnum: /*Gradient is 0*/                    break;
@@ -1146,4 +1684,5 @@
 				case L1L2ApproximationEnum:GradientJBbarL1L2(element,gradient,control_interp,control_index); break;
 				case HOApproximationEnum:  GradientJBbarHO( element,gradient,control_interp,control_index); break;
+				case MLHOApproximationEnum:  GradientJBbarMLHO( element,gradient,control_interp,control_index); break;
 				case FSApproximationEnum:  GradientJBbarFS( element,gradient,control_interp,control_index); break;
 				case NoneApproximationEnum: /*Gradient is 0*/                    break;
@@ -1155,4 +1694,5 @@
 				case SSAApproximationEnum: GradientJBSSA(element,gradient,control_interp,control_index); break;
 				case HOApproximationEnum:  GradientJBHO( element,gradient,control_interp,control_index); break;
+			//	case MLHOApproximationEnum:  GradientJBMLHO( element,gradient,control_interp,control_index); break;
 				case FSApproximationEnum:  GradientJBFS( element,gradient,control_interp,control_index); break;
 				case NoneApproximationEnum: /*Gradient is 0*/                    break;
@@ -1183,4 +1723,6 @@
 	int      domaintype;
 	Element* basalelement;
+
+	if(control_interp==P0Enum) _error_("cannot require regularization for P0 controls");
 
 	/*Get basal element*/
@@ -1250,5 +1792,5 @@
 	xDelete<int>(vertexpidlist);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJBbarL1L2(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
@@ -1261,4 +1803,132 @@
 	/*WARNING: We use SSA as an estimate for now*/
 	this->GradientJBbarSSA(element,gradient,control_interp,control_index);
+}/*}}}*/
+void           AdjointHorizAnalysis::GradientJBbarMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
+
+   if(control_interp!=P1Enum) _error_("not implemented yet...");
+	/*Intermediaries*/
+	int      domaintype,dim;
+	Element* basalelement;
+
+	/*Get basal element*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			basalelement = element;
+			dim          = 2;
+			break;
+		case Domain2DverticalEnum:
+			if(!element->IsOnBase()) return;
+			basalelement = element->SpawnBasalElement();
+			dim          = 1;
+			break;
+		case Domain3DEnum:
+			if(!element->IsOnBase()) return;
+			basalelement = element->SpawnBasalElement(true);
+			dim          = 2;
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Intermediaries*/
+	IssmDouble Jdet,weight;
+	IssmDouble thickness,dmudB,n;
+	IssmDouble dvx[3],dvy[3],dadjbx[3],dadjby[3],dadjshx[3],dadjshy[3]; 
+	IssmDouble *xyz_list= NULL;
+
+	/*Fetch number of vertices for this finite element*/
+	int numvertices = basalelement->GetNumberOfVertices();
+
+	/*Initialize some vectors*/
+	IssmDouble* basis         = xNew<IssmDouble>(numvertices);
+	IssmDouble* ge            = xNewZeroInit<IssmDouble>(numvertices);
+	int*        vertexpidlist = xNew<int>(numvertices);
+	IssmDouble  zeta;
+   IssmDouble  e1[3],e2[3], phishx[3], phishy[3];
+   IssmDouble  epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+	IssmDouble  adjshx, adjshy;
+
+	/*Retrieve all inputs we will be needing: */
+	basalelement->GetVerticesCoordinates(&xyz_list);
+	basalelement->GradientIndexing(&vertexpidlist[0],control_index);
+	Input* thickness_input	= basalelement->GetInput(ThicknessEnum);					_assert_(thickness_input);
+   Input* n_input				= basalelement->GetInput(MaterialsRheologyNEnum);		_assert_(n_input);
+   Input* vxbase_input		= basalelement->GetInput(VxBaseEnum);						_assert_(vxbase_input);
+   Input* vybase_input		= basalelement->GetInput(VyBaseEnum);						_assert_(vybase_input);
+   Input* vxshear_input		= basalelement->GetInput(VxShearEnum);						_assert_(vxshear_input);
+   Input* vyshear_input		= basalelement->GetInput(VyShearEnum);						_assert_(vyshear_input);
+
+	Input* adjointbx_input	= basalelement->GetInput(AdjointxBaseEnum);				_assert_(adjointbx_input);
+	Input* adjointby_input	= basalelement->GetInput(AdjointyBaseEnum);				_assert_(adjointby_input);
+	Input* adjointshx_input	= basalelement->GetInput(AdjointxShearEnum);				_assert_(adjointshx_input);
+	Input* adjointshy_input	= basalelement->GetInput(AdjointyShearEnum);				_assert_(adjointshy_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=basalelement->NewGauss(5);
+   GaussSeg* gauss_seg=new GaussSeg(2);
+
+	while(gauss->next()){
+
+		thickness_input->GetInputValue(&thickness,gauss);
+	   n_input->GetInputValue(&n,gauss);
+		adjointbx_input->GetInputDerivativeValue(&dadjbx[0],xyz_list,gauss);
+		adjointby_input->GetInputDerivativeValue(&dadjby[0],xyz_list,gauss);
+		adjointshx_input->GetInputDerivativeValue(&dadjshx[0],xyz_list,gauss);
+		adjointshy_input->GetInputDerivativeValue(&dadjshy[0],xyz_list,gauss);
+		adjointshx_input->GetInputValue(&adjshx, gauss);
+		adjointshy_input->GetInputValue(&adjshy, gauss);
+		
+		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		basalelement->NodalFunctionsP1(basis,gauss);
+
+	   /* Get the integration in the vertical direction */
+      gauss_seg->Reset();
+      while(gauss_seg->next()){
+			zeta=0.5*(gauss_seg->coord1+1);
+
+			basalelement->StrainRateMLHO(&epsilon[0],xyz_list,gauss,
+                  vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+
+			basalelement->dViscositydBMLHO(&dmudB,dim,xyz_list,gauss,vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+
+			e1[0] = 2.0*epsilon[0]+epsilon[1];
+         e1[1] = epsilon[2];
+         e1[2] = epsilon[3];
+
+         e2[0] = epsilon[2];
+         e2[1] = epsilon[0]+2.0*epsilon[1];
+         e2[2] = epsilon[4];
+
+			phishx[0] = dadjbx[0] + (1-pow(zeta, n+1))*dadjshx[0];
+			phishx[1] = dadjbx[1] + (1-pow(zeta, n+1))*dadjshx[1];
+			phishx[2] = (n+1)/thickness*pow(zeta, n)*adjshx;
+			phishy[0] = dadjby[0] + (1-pow(zeta, n+1))*dadjshy[0];
+			phishy[1] = dadjby[1] + (1-pow(zeta, n+1))*dadjshy[1];
+			phishy[2] = (n+1)/thickness*pow(zeta, n)*adjshy;
+
+			/*Build gradient vector (actually -dJ/dB): */
+			for(int i=0;i<numvertices;i++){
+				for (int j=0;j<3;j++){
+					ge[i]+=(-dmudB)*2*(e1[j]*phishx[j]+e2[j]*phishy[j])*Jdet*gauss->weight*basis[i]*thickness*0.5*gauss_seg->weight;
+					_assert_(!xIsNan<IssmDouble>(ge[i]));
+				}
+			}
+		}
+	}
+	if(control_interp==P1Enum){
+		gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+	}
+	else{
+		_error_("not supported");
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(ge);
+	xDelete<int>(vertexpidlist);
+	delete gauss;
+	delete gauss_seg;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJBbarSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
@@ -1362,5 +2032,5 @@
 	xDelete<int>(vertexpidlist);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJBFS(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
@@ -1372,4 +2042,6 @@
 	/*Intermediaries*/
 	int      domaintype;
+
+	if(control_interp==P0Enum) _error_("cannot require regularization for P0 controls");
 
 	/*Get basal element*/
@@ -1437,4 +2109,5 @@
 	/*Intermediaries*/
 	int      domaintype;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Get basal element*/
@@ -1499,4 +2172,5 @@
 	/*Intermediaries*/
 	int      domaintype,dim;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Get domaintype*/
@@ -1571,4 +2245,7 @@
 	delete gauss;
 }/*}}}*/
+void           AdjointHorizAnalysis::GradientJBMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
+	_error_("not implemented yet...");
+}/*}}}*/
 void           AdjointHorizAnalysis::GradientJBSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
 
@@ -1576,4 +2253,5 @@
 	int      domaintype,dim;
 	Element* basalelement;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Get basal element*/
@@ -1652,14 +2330,14 @@
 	xDelete<int>(vertexpidlist);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJDragGradient(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
 
 	/*return if floating (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
+	if(control_interp==P0Enum) _error_("cannot require regularization for P0 controls");
 
 	/*Intermediaries*/
 	int      domaintype,dim;
-	int frictionlaw;
 	Element* basalelement;
 
@@ -1702,5 +2380,5 @@
 
 	/* get the friction law: if 2-Weertman, 11-Schoof, use a special name for the coefficient*/
-	element->FindParam(&frictionlaw, FrictionLawEnum);
+	int frictionlaw; element->FindParam(&frictionlaw, FrictionLawEnum);
 	Input* dragcoefficient_input;
 	switch(frictionlaw) {
@@ -1745,5 +2423,5 @@
 	xDelete<int>(vertexpidlist);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 
 }/*}}}*/
@@ -1751,6 +2429,7 @@
 
 	/*return if floating or not on bed (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 	if(!element->IsOnBase()) return;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Intermediaries*/
@@ -1790,5 +2469,18 @@
 		adjointz_input  = element->GetInput(AdjointzEnum);             _assert_(adjointz_input);
 	}
-	Input* dragcoeff_input = element->GetInput(FrictionCoefficientEnum);  _assert_(dragcoeff_input);
+	/* get the friction law: 1- Budd, 11-Schoof*/
+	int frictionlaw; element->FindParam(&frictionlaw, FrictionLawEnum);
+	Input* dragcoeff_input = NULL;
+	switch(frictionlaw) {
+		case 1:
+			dragcoeff_input = element->GetInput(FrictionCoefficientEnum); _assert_(dragcoeff_input);
+			break;
+		case 2:
+		case 11:
+			dragcoeff_input = element->GetInput(FrictionCEnum); _assert_(dragcoeff_input);
+			break;
+		default:
+			_error_("Friction law "<< frictionlaw <<" not supported in the inversion.");
+	}
 
 	/* Start  looping on the number of gaussian points: */
@@ -1851,5 +2543,5 @@
 
 	/*return if floating or not on bed (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 	if(!element->IsOnBase()) return;
 
@@ -1882,9 +2574,23 @@
 	Input* adjointx_input  = element->GetInput(AdjointxEnum);             _assert_(adjointx_input);
 	Input* adjointy_input  = NULL;
-	Input* dragcoeff_input = element->GetInput(FrictionCoefficientEnum);  _assert_(dragcoeff_input);
 	if(domaintype!=Domain2DverticalEnum){
 		vy_input        = element->GetInput(VyEnum);                   _assert_(vy_input);
 		adjointy_input  = element->GetInput(AdjointyEnum);             _assert_(adjointy_input);
 	}
+	/* get the friction law: 1- Budd, 11-Schoof*/
+	int frictionlaw; element->FindParam(&frictionlaw, FrictionLawEnum);
+	Input* dragcoeff_input = NULL;
+	switch(frictionlaw) {
+		case 1:
+			dragcoeff_input = element->GetInput(FrictionCoefficientEnum); _assert_(dragcoeff_input);
+			break;
+		case 2:
+		case 11:
+			dragcoeff_input = element->GetInput(FrictionCEnum); _assert_(dragcoeff_input);
+			break;
+		default:
+			_error_("Friction law "<< frictionlaw <<" not supported in the inversion.");
+	}
+
 	/* Start  looping on the number of gaussian points: */
 	Gauss* gauss=element->NewGaussBase(4);
@@ -1905,11 +2611,29 @@
 
 		/*Build gradient vector (actually -dJ/dD): */
-		for(int i=0;i<numvertices;i++){
-			if(domaintype!=Domain2DverticalEnum) ge[i]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight*basis[i];
-			else ge[i]+=-2.*drag*dalpha2dk*(lambda*vx)*Jdet*gauss->weight*basis[i];
-			_assert_(!xIsNan<IssmDouble>(ge[i]));
-		}
-	}
-	gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+		if(control_interp==P1Enum){
+			for(int i=0;i<numvertices;i++){
+				if(domaintype!=Domain2DverticalEnum) ge[i]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight*basis[i];
+				else ge[i]+=-2.*drag*dalpha2dk*(lambda*vx)*Jdet*gauss->weight*basis[i];
+				_assert_(!xIsNan<IssmDouble>(ge[i]));
+			}
+		}
+		else if(control_interp==P0Enum){
+			if(domaintype!=Domain2DverticalEnum) ge[0]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight;
+			else ge[0]+=-2.*drag*dalpha2dk*(lambda*vx)*Jdet*gauss->weight;
+			_assert_(!xIsNan<IssmDouble>(ge[0]));
+		}
+		else{
+			_error_("not supported");
+		}
+	}
+	if(control_interp==P1Enum){
+		gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+	}
+	else if(control_interp==P0Enum){
+		gradient->SetValue(vertexpidlist[0],ge[0],ADD_VAL);
+	}
+	else{
+		_error_("not supported");
+	}
 
 	/*Clean up and return*/
@@ -1921,8 +2645,8 @@
 	delete friction;
 }/*}}}*/
-void           AdjointHorizAnalysis::GradientJDragSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
+void           AdjointHorizAnalysis::GradientJDragMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
 
 	/*return if floating (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 
 	/*Intermediaries*/
@@ -1958,5 +2682,122 @@
 	/*Fetch number of vertices for this finite element*/
 	int numvertices = basalelement->GetNumberOfVertices();
-	int frictionlaw;
+
+	/*Initialize some vectors*/
+	IssmDouble* basis         = xNew<IssmDouble>(numvertices);
+	IssmDouble* ge            = xNewZeroInit<IssmDouble>(numvertices);
+	int*        vertexpidlist = xNew<int>(numvertices);
+
+	/*Build friction element, needed later: */
+	Friction* friction=new Friction(basalelement,dim);
+
+	/*Retrieve all inputs we will be needing: */
+	basalelement->GetVerticesCoordinates(&xyz_list);
+	basalelement->GradientIndexing(&vertexpidlist[0],control_index);
+	Input* vx_input        = basalelement->GetInput(VxBaseEnum);                   _assert_(vx_input);
+	Input* vy_input        = basalelement->GetInput(VyBaseEnum);                   _assert_(vy_input);
+	Input* adjointx_input  = basalelement->GetInput(AdjointxBaseEnum);             _assert_(adjointx_input);
+	Input* adjointy_input  = basalelement->GetInput(AdjointyBaseEnum);             _assert_(adjointy_input);
+
+	/* get the friction law: 1- Budd, 11-Schoof*/
+	int frictionlaw;element->FindParam(&frictionlaw, FrictionLawEnum);
+	Input* dragcoeff_input = NULL;
+	switch(frictionlaw) {
+		case 1:
+			dragcoeff_input = basalelement->GetInput(FrictionCoefficientEnum); _assert_(dragcoeff_input);
+			break;
+		case 2:
+		case 11:
+			dragcoeff_input = basalelement->GetInput(FrictionCEnum); _assert_(dragcoeff_input);
+			break;
+		default:
+			_error_("Friction law "<< frictionlaw <<" not supported in the inversion.");
+	}
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=basalelement->NewGauss(4);
+	while(gauss->next()){
+
+		adjointx_input->GetInputValue(&lambda, gauss);
+		adjointy_input->GetInputValue(&mu, gauss);
+		vx_input->GetInputValue(&vx,gauss);
+		vy_input->GetInputValue(&vy,gauss);
+		dragcoeff_input->GetInputValue(&drag, gauss);
+
+		friction->GetAlphaComplement(&dalpha2dk,gauss);
+
+		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		basalelement->NodalFunctionsP1(basis,gauss);
+
+		/*Build gradient vector (actually -dJ/dD): */
+		if(control_interp==P1Enum){
+			for(int i=0;i<numvertices;i++){
+				ge[i]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight*basis[i];
+				_assert_(!xIsNan<IssmDouble>(ge[i]));
+			}
+		}
+		else if(control_interp==P0Enum){
+			ge[0]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight;
+			_assert_(!xIsNan<IssmDouble>(ge[0]));
+		}
+		else{
+			_error_("not supported");
+		}
+	}
+	if(control_interp==P1Enum){
+		gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+	}
+	else if(control_interp==P0Enum){
+		gradient->SetValue(vertexpidlist[0],ge[0],ADD_VAL);
+	}
+	else{
+		_error_("not supported");
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(ge);
+	xDelete<int>(vertexpidlist);
+	delete gauss;
+	delete friction;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+}/*}}}*/
+void           AdjointHorizAnalysis::GradientJDragSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
+
+	/*return if floating (gradient is 0)*/
+	if(element->IsAllFloating()) return;
+
+	/*Intermediaries*/
+	int      domaintype,dim;
+	Element* basalelement;
+
+	/*Get basal element*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			basalelement = element;
+			dim          = 2;
+			break;
+		case Domain2DverticalEnum:
+			if(!element->IsOnBase()) return;
+			basalelement = element->SpawnBasalElement();
+			dim          = 1;
+			break;
+		case Domain3DEnum:
+			if(!element->IsOnBase()) return;
+			basalelement = element->SpawnBasalElement();
+			dim          = 2;
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Intermediaries*/
+	IssmDouble Jdet,weight;
+	IssmDouble drag,dalpha2dk;
+	IssmDouble vx,vy,lambda,mu;
+	IssmDouble *xyz_list= NULL;
+
+	/*Fetch number of vertices for this finite element*/
+	int numvertices = basalelement->GetNumberOfVertices();
 
 	/*Initialize some vectors*/
@@ -1977,6 +2818,6 @@
 
 	/* get the friction law: 1- Budd, 11-Schoof*/
-	element->FindParam(&frictionlaw, FrictionLawEnum);
-	Input* dragcoeff_input;
+	int frictionlaw;element->FindParam(&frictionlaw, FrictionLawEnum);
+	Input* dragcoeff_input = NULL;
 	switch(frictionlaw) {
 		case 1:
@@ -2007,10 +2848,27 @@
 
 		/*Build gradient vector (actually -dJ/dD): */
-		for(int i=0;i<numvertices;i++){
-			ge[i]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight*basis[i];
-			_assert_(!xIsNan<IssmDouble>(ge[i]));
-		}
-	}
-	gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+		if(control_interp==P1Enum){
+			for(int i=0;i<numvertices;i++){
+				ge[i]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight*basis[i];
+				_assert_(!xIsNan<IssmDouble>(ge[i]));
+			}
+		}
+		else if(control_interp==P0Enum){
+			ge[0]+=-2.*drag*dalpha2dk*((lambda*vx+mu*vy))*Jdet*gauss->weight;
+			_assert_(!xIsNan<IssmDouble>(ge[0]));
+		}
+		else{
+			_error_("not supported");
+		}
+	}
+	if(control_interp==P1Enum){
+		gradient->SetValues(numvertices,vertexpidlist,ge,ADD_VAL);
+	}
+	else if(control_interp==P0Enum){
+		gradient->SetValue(vertexpidlist[0],ge[0],ADD_VAL);
+	}
+	else{
+		_error_("not supported");
+	}
 
 	/*Clean up and return*/
@@ -2021,11 +2879,12 @@
 	delete gauss;
 	delete friction;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJDragHydroFS(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
 
 	/*return if floating or not on bed (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 	if(!element->IsOnBase()) return;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Intermediaries*/
@@ -2124,6 +2983,7 @@
 
 	/*return if floating or not on bed (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 	if(!element->IsOnBase()) return;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Intermediaries*/
@@ -2195,5 +3055,6 @@
 
 	/*return if floating (gradient is 0)*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Intermediaries*/
@@ -2314,5 +3175,5 @@
 	delete gauss;
 	delete friction;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::GradientJDSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index){/*{{{*/
@@ -2321,4 +3182,5 @@
 	int      domaintype,dim;
 	Element* basalelement;
+	if(control_interp!=P1Enum) _error_("not implemented yet...");
 
 	/*Get basal element*/
@@ -2396,5 +3258,5 @@
 	xDelete<int>(vertexpidlist);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           AdjointHorizAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
@@ -2403,4 +3265,7 @@
 	if(approximation==FSApproximationEnum || approximation==NoneApproximationEnum){
 		InputUpdateFromSolutionFS(solution,element);
+	}
+	else if (approximation==MLHOApproximationEnum) {
+		InputUpdateFromSolutionMLHO(solution, element);
 	}
 	else{
@@ -2549,4 +3414,77 @@
 	xDelete<int>(doflist);
 }/*}}}*/
+void           AdjointHorizAnalysis::InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element){/*{{{*/
+	int  i;
+	int* doflist=NULL;
+
+	int    domaintype;
+	element->FindParam(&domaintype,DomainTypeEnum);
+	if (domaintype!=Domain2DhorizontalEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+	int numdof = numnodes * 4;
+
+	/*Fetch dof list and allocate solution vectors*/
+	element->GetDofListLocal(&doflist,MLHOApproximationEnum,GsetEnum);
+	IssmDouble* values  = xNew<IssmDouble>(numdof);
+	IssmDouble* lambdax = xNew<IssmDouble>(numnodes);
+	IssmDouble* lambday = xNew<IssmDouble>(numnodes);
+	IssmDouble* lambdabx = xNew<IssmDouble>(numnodes);
+	IssmDouble* lambdaby = xNew<IssmDouble>(numnodes);
+	IssmDouble* lambdashx = xNew<IssmDouble>(numnodes);
+	IssmDouble* lambdashy = xNew<IssmDouble>(numnodes);
+	IssmDouble* n			 = xNew<IssmDouble>(numnodes);
+
+	/*Use the dof list to index into the solution vector: */
+	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+
+	/*Transform solution in Cartesian Space*/
+	if(domaintype!=Domain2DverticalEnum)	element->TransformSolutionCoord(&values[0],XYEnum);
+
+	element->GetInputListOnNodes(&n[0],MaterialsRheologyNEnum,0.);
+
+	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+	for(i=0;i<numnodes;i++){
+		lambdabx[i] =values[i*4+0];
+		lambdashx[i]=values[i*4+1];
+		/*Check solution*/
+		if(xIsNan<IssmDouble>(lambdabx[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(lambdabx[i])) _error_("Inf found in solution vector");
+		if(xIsNan<IssmDouble>(lambdashx[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(lambdashx[i])) _error_("Inf found in solution vector");
+		/* adjoint for the surface velocity */
+		lambdax[i] = lambdabx[i] + lambdashx[i]*(n[i]+1)/(n[i]+2);
+
+		lambdaby[i] =values[i*4+2];
+		lambdashy[i]=values[i*4+3];
+		/*Check solution*/
+		if(xIsNan<IssmDouble>(lambdaby[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(lambdaby[i])) _error_("Inf found in solution vector");
+		if(xIsNan<IssmDouble>(lambdashy[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(lambdashy[i])) _error_("Inf found in solution vector");
+		/* adjoint for the surface velocity */
+		lambday[i] = lambdaby[i] + lambdashy[i]*(n[i]+1)/(n[i]+2);
+	}
+
+	/*Add vx and vy as inputs to the tria element: */
+	element->AddInput(AdjointxBaseEnum,lambdabx,element->GetElementType());
+	element->AddInput(AdjointyBaseEnum,lambdaby,element->GetElementType());
+	element->AddInput(AdjointxShearEnum,lambdashx,element->GetElementType());
+	element->AddInput(AdjointyShearEnum,lambdashy,element->GetElementType());
+
+	element->AddInput(AdjointxEnum,lambdax,element->GetElementType());
+	element->AddInput(AdjointyEnum,lambday,element->GetElementType());
+
+	/*Free ressources:*/
+	xDelete<IssmDouble>(values);
+	xDelete<IssmDouble>(lambdax);
+	xDelete<IssmDouble>(lambday);
+	xDelete<IssmDouble>(lambdabx);
+	xDelete<IssmDouble>(lambdaby);
+	xDelete<IssmDouble>(lambdashx);
+	xDelete<IssmDouble>(lambdashy);
+	xDelete<int>(doflist);
+}/*}}}*/
 void           AdjointHorizAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
 	/*Default, do nothing*/
Index: issm/trunk/src/c/analyses/AdjointHorizAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/AdjointHorizAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/AdjointHorizAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
@@ -27,4 +28,6 @@
 		ElementMatrix* CreateKMatrixFS(Element* element);
 		ElementMatrix* CreateKMatrixHO(Element* element);
+		ElementMatrix* CreateKMatrixMLHO(Element* element);
+		ElementMatrix* CreateKMatrixMLHOVerticalIntergrated(Element* element);
 		ElementMatrix* CreateKMatrixL1L2(Element* element);
 		ElementMatrix* CreateKMatrixSSA(Element* element);
@@ -33,4 +36,5 @@
 		ElementVector* CreatePVectorL1L2(Element* element);
 		ElementVector* CreatePVectorHO(Element* element);
+		ElementVector* CreatePVectorMLHO(Element* element);
 		ElementVector* CreatePVectorSSA(Element* element);
 		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
@@ -41,8 +45,10 @@
 		void           GradientJBbarL1L2(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBbarHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
+		void           GradientJBbarMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBbarSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBFS(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBGradient(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
+		void           GradientJBMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJBSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJDragFS(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
@@ -50,4 +56,5 @@
 		void           GradientJDragL1L2(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJDragHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
+		void           GradientJDragMLHO(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJDragSSA(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
 		void           GradientJDragHydroFS(Element* element,Vector<IssmDouble>* gradient,int control_interp,int control_index);
@@ -59,4 +66,5 @@
 		void           InputUpdateFromSolutionFS(IssmDouble* solution,Element* element);
 		void           InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element);
+		void           InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element);
 		void           UpdateConstraints(FemModel* femmodel);
 };
Index: issm/trunk/src/c/analyses/Analysis.h
===================================================================
--- issm/trunk/src/c/analyses/Analysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/Analysis.h	(revision 26744)
@@ -39,9 +39,10 @@
 		virtual void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false)=0;
 		virtual int  DofsPerNode(int** doflist,int domaintype,int approximation)=0;
-		virtual void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type)=0;
+		virtual void UpdateElements(Elements* elements,Inputs* inputs, IoModel* iomodel,int analysis_counter,int analysis_type)=0;
 		virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;
 
 		/*Finite element Analysis*/
 		virtual void           Core(FemModel* femmodel)=0;
+		virtual void           PreCore(FemModel* femmodel)=0;
 		virtual ElementVector* CreateDVector(Element* element)=0;
 		virtual ElementMatrix* CreateJacobianMatrix(Element* element)=0;
Index: issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp	(revision 26744)
@@ -32,5 +32,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
@@ -57,4 +57,7 @@
 /*Finite Element Analysis*/
 void           Balancethickness2Analysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
+void           Balancethickness2Analysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented yet");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/Balancethickness2Analysis.h
===================================================================
--- issm/trunk/src/c/analyses/Balancethickness2Analysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/Balancethickness2Analysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 26744)
@@ -99,5 +99,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
@@ -118,4 +118,7 @@
 /*Finite Element Analysis*/
 void           BalancethicknessAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           BalancethicknessAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -146,5 +149,5 @@
 	int domaintype;
 	element->FindParam(&domaintype,DomainTypeEnum);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -334,5 +337,5 @@
 	int domaintype;
 	element->FindParam(&domaintype,DomainTypeEnum);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
Index: issm/trunk/src/c/analyses/BalancethicknessAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/BalancethicknessAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancethicknessAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.cpp	(revision 26744)
@@ -29,4 +29,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           BalancethicknessSoftAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* BalancethicknessSoftAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
Index: issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancethicknessSoftAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 26744)
@@ -41,5 +41,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
@@ -59,4 +59,7 @@
 /*Finite Element Analysis*/
 void           BalancevelocityAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           BalancevelocityAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -231,5 +234,5 @@
 	xDelete<IssmDouble>(Ny);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
Index: issm/trunk/src/c/analyses/BalancevelocityAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/BalancevelocityAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/BalancevelocityAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 26744)
@@ -70,5 +70,4 @@
 		element->SetElementInput(inputs,DamageFEnum,0.);
 	}
-
 
 	/*What input do I need to run my damage evolution model?*/
@@ -121,4 +120,7 @@
 /*Finite Element Analysis*/
 void           DamageEvolutionAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           DamageEvolutionAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -806,4 +808,9 @@
 	return Me;
 }/*}}}*/
+ElementVector* DamageEvolutionAnalysis::CreateFctPVector(Element* element){/*{{{*/
+
+	return this->CreatePVector(element);
+
+}/*}}}*/
 void           DamageEvolutionAnalysis::FctKMatrix(Matrix<IssmDouble>** pKff,Matrix<IssmDouble>** pKfs,FemModel* femmodel){/*{{{*/
 
@@ -834,4 +841,24 @@
 	}
 }/*}}}*/
+void           DamageEvolutionAnalysis::FctPVector(Vector<IssmDouble>** ppf,FemModel* femmodel){/*{{{*/
+
+	/*Output*/
+	Vector<IssmDouble>* pf = NULL;
+
+	/*Initialize P vector*/
+	AllocateSystemMatricesx(NULL,NULL,NULL,&pf,femmodel);
+
+	/*Create and assemble matrix*/
+	for(Object* & object : femmodel->elements->objects){
+		Element*       element = xDynamicCast<Element*>(object);
+		ElementVector* pe      = this->CreateFctPVector(element);
+		if(pe) pe->AddToGlobal(pf);
+		delete pe;
+	}
+	pf->Assemble();
+
+	/*Assign output pointer*/
+	*ppf=pf;
+}/*}}}*/
 void           DamageEvolutionAnalysis::MassMatrix(Matrix<IssmDouble>** pMff,FemModel* femmodel){/*{{{*/
 
Index: issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		void           CreateDamageFInput(Element* element);
 		void           CreateDamageFInputArctan(Element* element);
@@ -38,6 +39,8 @@
 		ElementMatrix* CreateFctKMatrix(Element* element);
 		ElementMatrix* CreateMassMatrix(Element* element);
+		ElementVector* CreateFctPVector(Element* element);
 		void           FctKMatrix(Matrix<IssmDouble>** pKff,Matrix<IssmDouble>** pKfs,FemModel* femmodel);
 		void           MassMatrix(Matrix<IssmDouble>** pMff,FemModel* femmodel);
+		void				FctPVector(Vector<IssmDouble>** ppf,FemModel* femmodel);
 };
 #endif
Index: issm/trunk/src/c/analyses/DepthAverageAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/DepthAverageAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/DepthAverageAnalysis.cpp	(revision 26744)
@@ -38,4 +38,7 @@
 /*Finite Element Analysis*/
 void           DepthAverageAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           DepthAverageAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/DepthAverageAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/DepthAverageAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/DepthAverageAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp	(revision 26744)
@@ -136,5 +136,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
@@ -307,5 +307,5 @@
 
 /*Finite Element Analysis*/
-void           EnthalpyAnalysis::ApplyBasalConstraints(IssmDouble* serial_spc,Element* element){/*{{{*/
+void           EnthalpyAnalysis::ApplyBasalConstraints(IssmDouble* local_spc,Element* element){/*{{{*/
 
 	/* Do not check if ice in element, this may lead to inconsistencies between cpu partitions */
@@ -317,5 +317,4 @@
 	int         numindices;
 	int        *indices = NULL;
-	Node*       node = NULL;
 	IssmDouble	pressure;
 
@@ -325,5 +324,5 @@
 
 	/*Get parameters and inputs: */
-	Input* pressure_input		 = element->GetInput(PressureEnum);							 _assert_(pressure_input);
+	Input* pressure_input = element->GetInput(PressureEnum); _assert_(pressure_input);
 
 	/*Fetch indices of basal & surface nodes for this finite element*/
@@ -338,7 +337,7 @@
 
 		/*apply or release spc*/
-		node=element->GetNode(indices[i]);
+		Node* node=element->GetNode(indices[i]);
 		if(!node->IsActive()) continue;
-		if(serial_spc[node->Sid()]==1.){
+		if(local_spc[node->Lid()]==1.){
 			pressure_input->GetInputValue(&pressure, gauss);
 			node->ApplyConstraint(0,PureIceEnthalpy(element,pressure));
@@ -372,5 +371,5 @@
 
 	/* Only compute melt rates at the base of grounded ice*/
-	if(!element->IsOnBase() || element->IsFloating()) return;
+	if(!element->IsOnBase() || element->IsAllFloating()) return;
 
 	/* Intermediaries */
@@ -410,10 +409,7 @@
 	Input* pressure_input       = element->GetInput(PressureEnum);                    _assert_(pressure_input);
 	Input* geothermalflux_input = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
-	Input* vx_input             = element->GetInput(VxEnum);                          _assert_(vx_input);
-	Input* vy_input             = element->GetInput(VyEnum);                          _assert_(vy_input);
-	Input* vz_input             = element->GetInput(VzEnum);                          _assert_(vz_input);
 
 	/*Build friction element, needed later: */
-	Friction* friction=new Friction(element,dim);
+	Friction* friction=new Friction(element,3);
 
 	/******** MELTING RATES  ************************************//*{{{*/
@@ -471,5 +467,5 @@
 			/*basal friction*/
 			friction->GetAlpha2(&alpha2,gauss);
-			vx_input->GetInputValue(&vx,gauss);		vy_input->GetInputValue(&vy,gauss);		vz_input->GetInputValue(&vz,gauss);
+			friction->GetBasalSlidingSpeeds(&vx, &vy, &vz, gauss);
 			basalfriction=alpha2*(vx*vx + vy*vy + vz*vz);
 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
@@ -547,4 +543,7 @@
 	PostProcessing(femmodel);
 
+}/*}}}*/
+void           EnthalpyAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
 }/*}}}*/
 ElementVector* EnthalpyAnalysis::CreateDVector(Element* element){/*{{{*/
@@ -726,5 +725,5 @@
 
 	/*Initialize Element matrix and return if necessary*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	/*Intermediaries*/
@@ -920,5 +919,5 @@
 
 	/* implementation of the basal condition decision chart of Aschwanden 2012, Fig.5 */
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || element->IsAllFloating()) return NULL;
 
 	bool converged, isdynamicbasalspc;
@@ -945,7 +944,4 @@
 	if(dt==0. && !converged) enthalpy_enum=EnthalpyPicardEnum; // use enthalpy from last iteration
 	else enthalpy_enum=EnthalpyEnum; // use enthalpy from last time step
-	Input* vx_input             = element->GetInput(VxEnum);                          _assert_(vx_input);
-	Input* vy_input             = element->GetInput(VyEnum);                          _assert_(vy_input);
-	Input* vz_input             = element->GetInput(VzEnum);                          _assert_(vz_input);
 	Input* enthalpy_input		 = element->GetInput(enthalpy_enum);					 _assert_(enthalpy_input);
 	Input* pressure_input		 = element->GetInput(PressureEnum);							 _assert_(pressure_input);
@@ -986,7 +982,5 @@
 				geothermalflux_input->GetInputValue(&geothermalflux,gauss);
 				friction->GetAlpha2(&alpha2,gauss);
-				vx_input->GetInputValue(&vx,gauss);
-				vy_input->GetInputValue(&vy,gauss);
-				vz_input->GetInputValue(&vz,gauss);
+				friction->GetBasalSlidingSpeeds(&vx, &vy, &vz, gauss);
 				basalfriction=alpha2*(vx*vx+vy*vy+vz*vz);
 				heatflux=(basalfriction+geothermalflux)/(rho_ice);
@@ -1021,5 +1015,5 @@
 
 	/*Get basal element*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	IssmDouble  Hpmp,dt,Jdet,scalar_ocean,pressure;
@@ -1306,5 +1300,5 @@
 	/* Only update constraints at the base.
 	 * Floating ice is not affected by basal BC decision chart. */
-	if(!(element->IsOnBase()) || element->IsFloating()) return;
+	if(!(element->IsOnBase()) || element->IsAllFloating()) return;
 
 	/*Intermediary*/
@@ -1341,21 +1335,21 @@
 			case 0:
 				// cold, dry base: apply basal surface forcing
-				vec_spc->SetValue(element->nodes[i]->Sid(),0.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),0.,INS_VAL);
 				break;
 			case 1:
 				// cold, wet base: keep at pressure melting point
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			case 2:
 				// temperate, thin refreezing base:
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			case 3:
 				// temperate, thin melting base: set spc
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			case 4:
 				// temperate, thick melting base:
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			default:
@@ -1377,5 +1371,5 @@
 	/* Only update constraints at the base.
 	 * Floating ice is not affected by basal BC decision chart.*/
-	if(!(element->IsOnBase()) || element->IsFloating()) return;
+	if(!(element->IsOnBase()) || element->IsAllFloating()) return;
 
 	/*Intermediary*/
@@ -1414,21 +1408,21 @@
 			case 0:
 				// cold, dry base: apply basal surface forcing
-				vec_spc->SetValue(element->nodes[i]->Sid(),0.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),0.,INS_VAL);
 				break;
 			case 1:
 				// cold, wet base: keep at pressure melting point
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			case 2:
 				// temperate, thin refreezing base: release spc
-				vec_spc->SetValue(element->nodes[i]->Sid(),0.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),0.,INS_VAL);
 				break;
 			case 3:
 				// temperate, thin melting base: set spc
-				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),1.,INS_VAL);
 				break;
 			case 4:
 				// temperate, thick melting base: set grad H*n=0
-				vec_spc->SetValue(element->nodes[i]->Sid(),0.,INS_VAL);
+				vec_spc->SetValue(element->nodes[i]->Pid(),0.,INS_VAL);
 				break;
 			default:
@@ -1665,8 +1659,8 @@
 
 	/*Update basal dirichlet BCs for enthalpy: */
-	Vector<IssmDouble>* spc           = NULL;
-	IssmDouble*         serial_spc    = NULL;
-
-	spc=new Vector<IssmDouble>(femmodel->nodes->NumberOfNodes());
+	int numnodes            = femmodel->nodes->NumberOfNodes();
+   int localmasters        = femmodel->nodes->NumberOfNodesLocal();
+	Vector<IssmDouble>* spc = new Vector<IssmDouble>(localmasters,numnodes);
+
 	/*First create a vector to figure out what elements should be constrained*/
 	for(Object* & object : femmodel->elements->objects){
@@ -1675,7 +1669,10 @@
 	}
 
-	/*Assemble and serialize*/
+	/*Assemble*/
 	spc->Assemble();
-	serial_spc=spc->ToMPISerial();
+
+	/*Get local vector with both masters and slaves:*/
+	IssmDouble *local_spc = NULL;
+	femmodel->GetLocalVectorWithClonesNodes(&local_spc,spc);
 	delete spc;
 
@@ -1683,5 +1680,5 @@
 	for(Object* & object : femmodel->elements->objects){
 		Element* element=xDynamicCast<Element*>(object);
-		ApplyBasalConstraints(serial_spc,element);
+		ApplyBasalConstraints(local_spc,element);
 	}
 
@@ -1689,5 +1686,5 @@
 
 	/*Delete*/
-	xDelete<IssmDouble>(serial_spc);
+	xDelete<IssmDouble>(local_spc);
 }/*}}}*/
 void           EnthalpyAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
Index: issm/trunk/src/c/analyses/EnthalpyAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/EnthalpyAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/EnthalpyAnalysis.h	(revision 26744)
@@ -26,4 +26,5 @@
 		static void       ComputeBasalMeltingrate(Element* element);
 		void              Core(FemModel* femmodel);
+		void              PreCore(FemModel* femmodel);
 		ElementVector*    CreateDVector(Element* element);
 		ElementMatrix*    CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/EnumToAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/EnumToAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/EnumToAnalysis.cpp	(revision 26744)
@@ -14,4 +14,7 @@
 
 	switch(analysis_enum){
+		#ifdef _HAVE_HYDROLOGYTWS_
+		case HydrologyTwsAnalysisEnum : return new HydrologyTwsAnalysis();
+		#endif
 		#ifdef _HAVE_ADJOINTBALANCETHICKNESS2_
 		case AdjointBalancethickness2AnalysisEnum : return new AdjointBalancethickness2Analysis();
@@ -65,7 +68,4 @@
 		case GLheightadvectionAnalysisEnum : return new GLheightadvectionAnalysis();
 		#endif
-		#ifdef _HAVE_GIA_
-		case GiaAnalysisEnum : return new GiaAnalysis();
-		#endif
 		#ifdef _HAVE_HYDROLOGYDCEFFICIENT_
 		case HydrologyDCEfficientAnalysisEnum : return new HydrologyDCEfficientAnalysis();
@@ -74,15 +74,15 @@
 		case HydrologyDCInefficientAnalysisEnum : return new HydrologyDCInefficientAnalysis();
 		#endif
-		#ifdef _HAVE_HYDROLOGYSHREVE_
-		case HydrologyShreveAnalysisEnum : return new HydrologyShreveAnalysis();
-		#endif
 		#ifdef _HAVE_HYDROLOGYGLADS_
 		case HydrologyGlaDSAnalysisEnum : return new HydrologyGlaDSAnalysis();
+		#endif
+		#ifdef _HAVE_HYDROLOGYPISM_
+		case HydrologyPismAnalysisEnum : return new HydrologyPismAnalysis();
 		#endif
 		#ifdef _HAVE_HYDROLOGYSHAKTI_
 		case HydrologyShaktiAnalysisEnum : return new HydrologyShaktiAnalysis();
 		#endif
-		#ifdef _HAVE_HYDROLOGYPISM_
-		case HydrologyPismAnalysisEnum : return new HydrologyPismAnalysis();
+		#ifdef _HAVE_HYDROLOGYSHREVE_
+		case HydrologyShreveAnalysisEnum : return new HydrologyShreveAnalysis();
 		#endif
 		#ifdef _HAVE_L2PROJECTIONBASE_
@@ -104,6 +104,12 @@
 		case MeltingAnalysisEnum : return new MeltingAnalysis();
 		#endif
-		#ifdef _HAVE_SEALEVELRISE_
-		case SealevelriseAnalysisEnum : return new SealevelriseAnalysis();
+		#ifdef _HAVE_OCEANTRANSPORT_
+		case OceantransportAnalysisEnum : return new OceantransportAnalysis();
+		#endif
+		#ifdef _HAVE_SAMPLING_
+		case SamplingAnalysisEnum : return new SamplingAnalysis();
+		#endif
+		#ifdef _HAVE_SEALEVELCHANGE_
+		case SealevelchangeAnalysisEnum : return new SealevelchangeAnalysis();
 		#endif
 		#ifdef _HAVE_SMB_
Index: issm/trunk/src/c/analyses/EnumToAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/EnumToAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/EnumToAnalysis.h	(revision 26744)
@@ -17,4 +17,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/EsaAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/EsaAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/EsaAnalysis.cpp	(revision 26744)
@@ -32,5 +32,5 @@
 	/*Create inputs: */
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.esa.deltathickness",EsaDeltathicknessEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.esa.deltathickness",DeltaIceThicknessEnum);
 
 }/*}}}*/
@@ -61,5 +61,5 @@
 	/*some constant parameters: */
 	parameters->AddObject(iomodel->CopyConstantObject("md.esa.hemisphere",EsaHemisphereEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.rigid",SolidearthSettingsRigidEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.selfattraction",SolidearthSettingsSelfAttractionEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.horiz",SolidearthSettingsHorizEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.elastic",SolidearthSettingsElasticEnum));
@@ -189,4 +189,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           EsaAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* EsaAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
Index: issm/trunk/src/c/analyses/EsaAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/EsaAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/EsaAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 26744)
@@ -71,4 +71,7 @@
 		femmodel->RequestedOutputsx(&femmodel->results,&extvar_enum,1);
 	}
+}/*}}}*/
+void           ExtrapolationAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
 }/*}}}*/
 ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
Index: issm/trunk/src/c/analyses/ExtrapolationAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/ExtrapolationAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrapolationAnalysis.h	(revision 26744)
@@ -10,5 +10,5 @@
 
 class ExtrapolationAnalysis: public Analysis{
-	
+
  public:
 	/*Model processing*/
@@ -22,4 +22,5 @@
 	/*Finite element Analysis*/
 	void           Core(FemModel* femmodel);
+	void           PreCore(FemModel* femmodel);
 	ElementVector* CreateDVector(Element* element);
 	ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 26744)
@@ -38,4 +38,7 @@
 /*Finite Element Analysis*/
 void           ExtrudeFromBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           ExtrudeFromBaseAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 26744)
@@ -38,4 +38,7 @@
 /*Finite Element Analysis*/
 void           ExtrudeFromTopAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           ExtrudeFromTopAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 26744)
@@ -74,5 +74,5 @@
 
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.groundedice_melting_rate",BasalforcingsGroundediceMeltingRateEnum,0.);
@@ -88,9 +88,15 @@
 
 	/*Get what we need for ocean-induced basal melting*/
+	bool isstochastic;
 	int basalforcing_model;
 	iomodel->FindConstant(&basalforcing_model,"md.basalforcings.model");
+	iomodel->FindConstant(&isstochastic,"md.stochasticforcing.isstochasticforcing");
 	switch(basalforcing_model){
 		case FloatingMeltRateEnum:
 			iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BasalforcingsFloatingiceMeltingRateEnum);
+			if(isstochastic){
+            iomodel->FetchDataToInput(inputs,elements,"md.stochasticforcing.default_id",StochasticForcingDefaultIdEnum);
+            iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BaselineBasalforcingsFloatingiceMeltingRateEnum);
+         }
 			break;
 		case LinearFloatingMeltRateEnum:
@@ -127,4 +133,7 @@
 /*Finite Element Analysis*/
 void           FreeSurfaceBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           FreeSurfaceBaseAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -267,5 +276,5 @@
 	xDelete<IssmDouble>(D);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -341,5 +350,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 
Index: issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 26744)
@@ -77,5 +77,5 @@
 
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
@@ -101,4 +101,7 @@
 /*Finite Element Analysis*/
 void           FreeSurfaceTopAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           FreeSurfaceTopAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -244,5 +247,5 @@
 	xDelete<IssmDouble>(D);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	return Ke;
 }/*}}}*/
@@ -313,5 +316,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	return pe;
 
Index: issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/GLheightadvectionAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/GLheightadvectionAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/GLheightadvectionAnalysis.cpp	(revision 26744)
@@ -47,4 +47,7 @@
 /*Finite Element Analysis*/
 void           GLheightadvectionAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           GLheightadvectionAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -90,5 +93,4 @@
 	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
 	IssmDouble*    dbasis = xNew<IssmDouble>(dim*numnodes);
-	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
 	IssmDouble     D[2][2] = {0.};
 
@@ -175,5 +177,5 @@
 	xDelete<IssmDouble>(dbasis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 
Index: issm/trunk/src/c/analyses/GLheightadvectionAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/GLheightadvectionAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/GLheightadvectionAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/GiaAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/GiaAnalysis.cpp	(revision 25994)
+++ 	(revision )
@@ -1,117 +1,0 @@
-#include "./GiaAnalysis.h"
-#include "../toolkits/toolkits.h"
-#include "../classes/classes.h"
-#include "../shared/shared.h"
-#include "../modules/modules.h"
-
-/*Model processing*/
-void GiaAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
-	/*No constraints*/
-}/*}}}*/
-void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
-	/*No loads*/
-}/*}}}*/
-void GiaAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
-	::CreateNodes(nodes,iomodel,GiaAnalysisEnum,P1Enum);
-}/*}}}*/
-int  GiaAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
-	return 1;
-}/*}}}*/
-void GiaAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
-
-	int giamodel=0;
-	int nummodels=0;
-
-	/*Update elements: */
-	int counter=0;
-	for(int i=0;i<iomodel->numberofelements;i++){
-		if(iomodel->my_elements[i]){
-			Element* element=(Element*)elements->GetObjectByOffset(counter);
-			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
-			counter++;
-		}
-	}
-
-	/*fetch gia model type: */
-	iomodel->FetchData(&giamodel,"md.gia.model");
-	if(giamodel==1){ //GiaIvins
-		iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum);
-		iomodel->FetchDataToInput(inputs,elements,"md.gia.mantle_viscosity",GiaMantleViscosityEnum);
-		iomodel->FetchDataToInput(inputs,elements,"md.gia.lithosphere_thickness",GiaLithosphereThicknessEnum);
-		iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
-	}
-	else if(giamodel==2){ //GiaCaron: not implemneted yet
-	}
-	else if(giamodel==3){
-		/*take Ngia and Ugia from the offline models and plug into the element inputs:*/
-		iomodel->FetchDataToDatasetInput(inputs,elements,"md.gia.Ngia",GiaMmeNgiaEnum);
-		iomodel->FetchDataToDatasetInput(inputs,elements,"md.gia.Ugia",GiaMmeUgiaEnum);
-	}
-}/*}}}*/
-void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
-
-	int                 giamodel;
-	IssmDouble          modelid; 
-	int                 nummodels;
-
-	/*find gia model type: */
-	parameters->AddObject(iomodel->CopyConstantObject("md.gia.model",GiaModelEnum));
-	parameters->FindParam(&giamodel,GiaModelEnum);
-
-	if(giamodel==1){ //GiaIvins
-		parameters->AddObject(iomodel->CopyConstantObject("md.gia.cross_section_shape",GiaCrossSectionShapeEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.materials.lithosphere_shear_modulus",MaterialsLithosphereShearModulusEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.materials.lithosphere_density",MaterialsLithosphereDensityEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.materials.mantle_shear_modulus",MaterialsMantleShearModulusEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.materials.mantle_density",MaterialsMantleDensityEnum));
-	}
-	else if(giamodel==2){ //GiaCaron
-	}
-	else if(giamodel==3){ //GiaMme
-		
-		parameters->AddObject(iomodel->CopyConstantObject("md.gia.nummodels",GiaNummodelsEnum));
-		parameters->FindParam(&nummodels,GiaNummodelsEnum);
-
-		/*create double param, not int param, because Dakota will be updating it as 
-		 * a double potentially: */
-		iomodel->FetchData(&modelid,"md.gia.modelid");
-		parameters->AddObject(new DoubleParam(GiaModelidEnum,modelid));
-
-		/*quick checks: */
-		if(nummodels<=0)_error_("giamme object in  md.gia field should contain at least 1 ensemble model!");
-		if(modelid<=0 || modelid>nummodels)_error_("modelid field in giamme object of md.gia field should be between 1 and the number of ensemble runs!");
-	} 
-
-
-}/*}}}*/
-
-/*Finite Element Analysis*/
-void           GiaAnalysis::Core(FemModel* femmodel){/*{{{*/
-	_error_("not implemented");
-}/*}}}*/
-ElementVector* GiaAnalysis::CreateDVector(Element* element){/*{{{*/
-	/*Default, return NULL*/
-	return NULL;
-}/*}}}*/
-ElementMatrix* GiaAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
-_error_("Not implemented");
-}/*}}}*/
-ElementMatrix* GiaAnalysis::CreateKMatrix(Element* element){/*{{{*/
-	_error_("not implemented yet");
-}/*}}}*/
-ElementVector* GiaAnalysis::CreatePVector(Element* element){/*{{{*/
-_error_("not implemented yet");
-}/*}}}*/
-void           GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	   _error_("not implemented yet");
-}/*}}}*/
-void           GiaAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
-	_error_("Not implemented yet");
-}/*}}}*/
-void           GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
-	_error_("not implemented yet");
-}/*}}}*/
-void           GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	return;
-}/*}}}*/
Index: issm/trunk/src/c/analyses/GiaAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/GiaAnalysis.h	(revision 25994)
+++ 	(revision )
@@ -1,33 +1,0 @@
-/*! \file GiaAnalysis.h 
- *  \brief: header file for generic external result object
- */
-
-#ifndef _GiaAnalysis_
-#define _GiaAnalysis_
-
-/*Headers*/
-#include "./Analysis.h"
-
-class GiaAnalysis: public Analysis{
-
-	public:
-		/*Model processing*/
-		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
-		void CreateLoads(Loads* loads, IoModel* iomodel);
-		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
-		int  DofsPerNode(int** doflist,int domaintype,int approximation);
-		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
-		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
-
-		/*Finite element Analysis*/
-		void           Core(FemModel* femmodel);
-		ElementVector* CreateDVector(Element* element);
-		ElementMatrix* CreateJacobianMatrix(Element* element);
-		ElementMatrix* CreateKMatrix(Element* element);
-		ElementVector* CreatePVector(Element* element);
-		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
-		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
-		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
-		void           UpdateConstraints(FemModel* femmodel);
-};
-#endif
Index: issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 26744)
@@ -156,4 +156,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void HydrologyDCEfficientAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* HydrologyDCEfficientAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -186,8 +189,5 @@
 	/*Check that all nodes are active, else return empty matrix*/
 	if(!active_element) {
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -247,5 +247,5 @@
 	xDelete<IssmDouble>(dbasis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -274,8 +274,5 @@
 	/*Check that all nodes are active, else return empty matrix*/
 	if(!active_element) {
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -376,5 +373,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
@@ -425,5 +422,5 @@
 	xDelete<IssmDouble>(eplHeads);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 } /*}}}*/
 void HydrologyDCEfficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
@@ -538,5 +535,4 @@
 	int iseplthickcomp;
 
-
 	/*Skip if we don't want to compute thicknesses*/
 	femmodel->parameters->FindParam(&iseplthickcomp,HydrologydcEplThickCompEnum);
@@ -561,5 +557,4 @@
 	femmodel->parameters->FindParam(&gravity,ConstantsGEnum);
 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-
 
 	for(Object* & object : femmodel->elements->objects){
@@ -733,8 +728,5 @@
 	element->AddBasalInput(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType());
 
-	if(domaintype!=Domain2DhorizontalEnum){
-		basalelement->DeleteMaterials();
-		delete basalelement;
-	}
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(epl_thickness);
 	xDelete<IssmDouble>(old_active);
@@ -788,5 +780,5 @@
 		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
 	}
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(active);
 }
Index: issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 26744)
@@ -25,4 +25,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 26744)
@@ -178,4 +178,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           HydrologyDCInefficientAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* HydrologyDCInefficientAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -209,8 +212,5 @@
 	/*Check that all nodes are active, else return empty matrix*/
 	if(!thawed_element) {
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -280,8 +280,5 @@
 	xDelete<IssmDouble>(dbasis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){
-		basalelement->DeleteMaterials();
-		delete basalelement;
-	}
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -310,8 +307,5 @@
 	/*Check that all nodes are active, else return empty matrix*/
 	if(!thawed_element) {
-	if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -437,8 +431,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){
-		basalelement->DeleteMaterials();
-		delete basalelement;
-	}
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
@@ -532,8 +523,5 @@
 	xDelete<IssmDouble>(pressure);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){
-		basalelement->DeleteMaterials();
-		delete basalelement;
-	}
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void HydrologyDCInefficientAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
@@ -735,8 +723,5 @@
 	}
 
-	if(domaintype!=Domain2DhorizontalEnum){
-		basalelement->DeleteMaterials();
-		delete basalelement;
-	}
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(meltingrate);
 	xDelete<IssmDouble>(groundedice);
@@ -804,5 +789,5 @@
 		/*Do not do anything: at least one node is active for this element but this element is not solved for*/
 	}
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(active);
 }
Index: issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyDCInefficientAnalysis.h	(revision 26744)
@@ -23,4 +23,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.cpp	(revision 26744)
@@ -129,5 +129,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.bed",BedEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0); /*Needed for friction*/
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.geothermalflux",BasalforcingsGeothermalfluxEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.groundedice_melting_rate",BasalforcingsGroundediceMeltingRateEnum);
@@ -144,7 +144,14 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",HydrologySheetThicknessEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.hydraulic_potential",HydraulicPotentialEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum);
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	if(iomodel->domaintype==Domain2DhorizontalEnum){
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum);
+		iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	}
+	else{
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum);
+		iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	}
 
 	/*Friction law variables*/
@@ -213,4 +220,7 @@
 /*Finite Element Analysis*/
 void           HydrologyGlaDSAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           HydrologyGlaDSAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -322,5 +332,5 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return NULL;
+	if(element->IsAllFloating()) return NULL;
 
 	/*Intermediaries */
@@ -350,6 +360,4 @@
 	IssmDouble e_v       = element->FindParam(HydrologyEnglacialVoidRatioEnum);
 	Input* hr_input     = element->GetInput(HydrologyBumpHeightEnum);_assert_(hr_input);
-	Input* vx_input     = element->GetInput(VxEnum);_assert_(vx_input);
-	Input* vy_input     = element->GetInput(VyEnum);_assert_(vy_input);
 	Input* h_input      = element->GetInput(HydrologySheetThicknessEnum);_assert_(h_input);
 	Input* H_input      = element->GetInput(ThicknessEnum); _assert_(H_input);
@@ -373,6 +381,4 @@
 
 		/*Get input values at gauss points*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
 		h_input->GetInputValue(&h,gauss);
 		G_input->GetInputValue(&G,gauss);
@@ -385,4 +391,5 @@
 
 		/*Get basal velocity*/
+		friction->GetBasalSlidingSpeeds(&vx, &vy ,gauss);
 		ub = sqrt(vx*vx + vy*vy);
 
@@ -465,5 +472,5 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 
 	/*Intermediaries */
@@ -485,6 +492,6 @@
 	IssmDouble g         = element->FindParam(ConstantsGEnum);
 	Input* hr_input = element->GetInput(HydrologyBumpHeightEnum);_assert_(hr_input);
-	Input* vx_input = element->GetInput(VxEnum);_assert_(vx_input);
-	Input* vy_input = element->GetInput(VyEnum);_assert_(vy_input);
+	Input* vx_input = element->GetInput(VxBaseEnum);_assert_(vx_input);
+	Input* vy_input = element->GetInput(VyBaseEnum);_assert_(vy_input);
 	Input* H_input  = element->GetInput(ThicknessEnum); _assert_(H_input);
 	Input* b_input  = element->GetInput(BedEnum); _assert_(b_input);
@@ -554,6 +561,6 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return;
-	
+	if(element->IsAllFloating()) return;
+
 	/*Intermediary*/
 	IssmDouble phi_0, phi_m, p_i;
Index: issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyGlaDSAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/HydrologyPismAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyPismAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyPismAnalysis.cpp	(revision 26744)
@@ -64,4 +64,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           HydrologyPismAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* HydrologyPismAnalysis::CreateDVector(Element* element){/*{{{*/
 	_error_("not implemented");
@@ -101,5 +104,5 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 
 	/*Intermediaries */
@@ -131,5 +134,5 @@
 
 	/* Divide by connectivity, add degree of channelization as an input */
-	/*FIXME: should be changed to P1, this is due to the NR, IsFloating will return 0 on this element, but it should not be DG*/
+	/*FIXME: should be changed to P1, this is due to the NR, IsAllFloating will return 0 on this element, but it should not be DG*/
 	element->AddInput(WatercolumnEnum,&watercolumn[0],P1DGEnum);
 
Index: issm/trunk/src/c/analyses/HydrologyPismAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyPismAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyPismAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.cpp	(revision 26744)
@@ -119,4 +119,8 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum);
+	if(iomodel->domaintype==Domain2DhorizontalEnum){
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum);
+	}
 	iomodel->FindConstant(&frictionlaw,"md.friction.law");
 
@@ -151,4 +155,25 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.storage",HydrologyStorageEnum));
 
+	/*Deal with friction parameters*/
+	int frictionlaw;
+	iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	if(frictionlaw==6){
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+	}
+	if(frictionlaw==4){
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+	}
+	if(frictionlaw==1 || frictionlaw==3 || frictionlaw==7){
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+	}
+	if(frictionlaw==9){
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+		parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
+	}
+
   /*Requested outputs*/
   iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.hydrology.requested_outputs");
@@ -162,4 +187,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           HydrologyShaktiAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* HydrologyShaktiAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -174,4 +202,5 @@
 	IssmDouble Jdet;
 	IssmDouble* xyz_list = NULL;
+	IssmDouble  gap,bed,thickness,head,g,rho_ice,rho_water,A,B,n;
 
 	/*Fetch number of nodes and dof for this finite element*/
@@ -194,4 +223,15 @@
 	element->FindParam(&dt,TimesteppingTimeStepEnum);
 
+        /*Get all inputs and parameters*/
+        element->FindParam(&rho_water,MaterialsRhoFreshwaterEnum);
+        element->FindParam(&rho_ice,MaterialsRhoIceEnum);
+        element->FindParam(&g,ConstantsGEnum);
+        Input* B_input = element->GetInput(MaterialsRheologyBEnum);         _assert_(B_input);
+        Input* n_input = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
+        Input* gap_input = element->GetInput(HydrologyGapHeightEnum);         _assert_(gap_input);
+        Input* thickness_input = element->GetInput(ThicknessEnum);                  _assert_(thickness_input);
+        Input* head_input = element->GetInput(HydrologyHeadEnum);              _assert_(head_input);
+        Input* base_input = element->GetInput(BaseEnum);                      _assert_(base_input);
+
 	/* Start  looping on the number of gaussian points: */
 	Gauss* gauss=element->NewGauss(1);
@@ -202,8 +242,27 @@
 		element->NodalFunctions(basis,gauss);
 
+		/***/
+                base_input->GetInputValue(&bed,gauss);
+                thickness_input->GetInputValue(&thickness,gauss);
+                gap_input->GetInputValue(&gap,gauss);
+                head_input->GetInputValue(&head,gauss);
+
+                /*Get ice A parameter*/
+                B_input->GetInputValue(&B,gauss);
+                n_input->GetInputValue(&n,gauss);
+                A=pow(B,-n);
+
+                /*Get water and ice pressures*/
+                IssmDouble pressure_ice   = rho_ice*g*thickness;    _assert_(pressure_ice>0.);
+                IssmDouble pressure_water = rho_water*g*(head-bed);
+                if(pressure_water>pressure_ice) pressure_water = pressure_ice;
+
+
+
 		for(int i=0;i<numnodes;i++){
 			for(int j=0;j<numnodes;j++){
 				Ke->values[i*numnodes+j] += conductivity*gauss->weight*Jdet*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
-				  + gauss->weight*Jdet*storage/dt*basis[i]*basis[j];
+				  + gauss->weight*Jdet*storage/dt*basis[i]*basis[j]
+                			+gauss->weight*Jdet*A*(n)*(pow(fabs(pressure_ice-pressure_water),(n-1))*rho_water*g)*gap*basis[i]*basis[j];
 			}
 		}
@@ -220,13 +279,15 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return NULL;
+	if(element->IsAllFloating()) return NULL;
 
 	/*Intermediaries */
 	IssmDouble  Jdet,meltrate,G,dh[2],B,A,n;
 	IssmDouble  gap,bed,thickness,head,ieb,head_old;
-	IssmDouble  lr,br,vx,vy,beta;
+	IssmDouble  lr,br,vx,vy,beta,lc;
 	IssmDouble  alpha2,frictionheat;
    IssmDouble  PMPheat,dpressure_water[2],dbed[2];	
 	IssmDouble* xyz_list = NULL;
+//        IssmDouble dgapxx; /***/
+//	IssmDouble dgapyy; /***/
 
 	/*Fetch number of nodes and dof for this finite element*/
@@ -251,9 +312,9 @@
 	Input* n_input              = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
 	Input* englacial_input      = element->GetInput(HydrologyEnglacialInputEnum);    _assert_(englacial_input);
-	Input* vx_input             = element->GetInput(VxEnum);                         _assert_(vx_input);
-	Input* vy_input             = element->GetInput(VyEnum);                         _assert_(vy_input);
 	Input* lr_input             = element->GetInput(HydrologyBumpSpacingEnum);       _assert_(lr_input);
 	Input* br_input             = element->GetInput(HydrologyBumpHeightEnum);        _assert_(br_input);
    Input* headold_input        = element->GetInput(HydrologyHeadOldEnum);           _assert_(headold_input);
+//	Input* dgapxx_input	    = element->GetInput(HydrologyGapHeightXXEnum); /***/
+//	Input* dgapyy_input	    = element->GetInput(HydrologyGapHeightYYEnum); /***/
 
 	/*Get conductivity from inputs*/
@@ -284,7 +345,7 @@
 		lr_input->GetInputValue(&lr,gauss);
 		br_input->GetInputValue(&br,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
-      headold_input->GetInputValue(&head_old,gauss);
+                headold_input->GetInputValue(&head_old,gauss);
+//		dgapxx_input->GetInputValue(&dgapxx,gauss); /***/
+//		dgapyy_input->GetInputValue(&dgapyy,gauss); /***/
 
 		/*Get ice A parameter*/
@@ -301,7 +362,10 @@
 		/*Compute frictional heat flux*/
 		friction->GetAlpha2(&alpha2,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		friction->GetBasalSlidingSpeeds(&vx, &vy, gauss);
 		frictionheat=alpha2*(vx*vx+vy*vy);
+
+		/* Take out frictional heat for large gap height */
+		if(gap>br)
+		 frictionheat=0.;
 
 		/*Get water and ice pressures*/
@@ -322,12 +386,27 @@
 		_assert_(meltrate>0.);
 
-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*
-		 (
-		  meltrate*(1/rho_water-1/rho_ice)
-		  +A*pow(fabs(pressure_ice - pressure_water),n-1)*(pressure_ice - pressure_water)*gap
-		  -beta*sqrt(vx*vx+vy*vy)
-		  +ieb
-		  +storage*head_old/dt
-		  )*basis[i];     	
+                  for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*
+                   (
+                    meltrate*(1/rho_water-1/rho_ice)
+                    +A*pow(fabs(pressure_ice - pressure_water),n-1)*(pressure_ice + rho_water*g*bed)*gap
+                    +(n-1)*A*pow(fabs(pressure_ice - pressure_water),n-1)*(rho_water*g*head)*gap
+                    -beta*sqrt(vx*vx+vy*vy)
+                    +ieb
+                    +storage*head_old/dt
+                    )*basis[i];
+
+                /* Test with experimental diffusivity term*/
+//                   for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*
+ //                   (
+  //                   meltrate*(1/rho_water-1/rho_ice)
+   //                  +A*pow(fabs(pressure_ice - pressure_water),n-1)*(pressure_ice + rho_water*g*bed)*gap
+    //                 +(n-1)*A*pow(fabs(pressure_ice - pressure_water),n-1)*(rho_water*g*head)*gap
+     //                -beta*sqrt(vx*vx+vy*vy)
+      //               +ieb
+       //              +storage*head_old/dt
+        //             +0.e-5*(dgapxx+dgapyy)
+         //            )*basis[i];
+
+	
 	}
 	/*Clean up and return*/
@@ -362,5 +441,4 @@
 
 	/*Get thickness and base on nodes to apply cap on water head*/
-   IssmDouble* eff_pressure = xNew<IssmDouble>(numnodes);
 	IssmDouble* thickness = xNew<IssmDouble>(numnodes);
 	IssmDouble* bed       = xNew<IssmDouble>(numnodes);
@@ -380,20 +458,17 @@
 		values[i]=solution[doflist[i]];
 
-		/*make sure that p_water<p_ice ->  h<rho_i H/rho_w + zb*/
-		if(values[i]>rho_ice*thickness[i]/rho_water+bed[i]){
-			values[i] = rho_ice*thickness[i]/rho_water+bed[i];
-		}
+		/*overburden cap: make sure that p_water<p_ice ->  h<rho_i H/rho_w + zb*/
+//		if(values[i]>rho_ice*thickness[i]/rho_water+bed[i]){
+//			values[i] = rho_ice*thickness[i]/rho_water+bed[i];
+//		}
 
 		/*Make sure that negative pressure is not allowed*/
-  //    if(values[i]<bed[i]){
-	//		values[i] = bed[i];
-	//	}
+//      if(values[i]<bed[i]){
+//			values[i] = bed[i];
+//		}
 
 		/*Under-relaxation*/
 	   values[i] = head_old[i] - relaxation*(head_old[i]-values[i]);
 
-		/*Calculate effective pressure*/
-		eff_pressure[i] = rho_ice*g*thickness[i] - rho_water*g*(values[i]-bed[i]);
-
 		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
 		if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector");
@@ -402,5 +477,4 @@
 	/*Add input to the element: */
 	element->AddInput(HydrologyHeadEnum,values,element->GetElementType());
-   element->AddInput(EffectivePressureEnum,eff_pressure,P1Enum);
 
 	/*Update reynolds number according to new solution*/
@@ -416,4 +490,7 @@
 	IssmDouble reynolds = conductivity*sqrt(dh[0]*dh[0]+dh[1]*dh[1])/NU;
 	element->AddInput(HydrologyReynoldsEnum,&reynolds,P0Enum);
+
+   /*Compute new effective pressure*/
+   this->UpdateEffectivePressure(element);
 
 	/*Free resources:*/
@@ -423,5 +500,4 @@
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<int>(doflist);
-	xDelete<IssmDouble>(eff_pressure);
    xDelete<IssmDouble>(head_old);
 }/*}}}*/
@@ -464,5 +540,5 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return;
+	if(element->IsAllFloating()) return;
 
 	/*Intermediaries */
@@ -470,5 +546,5 @@
 	IssmDouble  Jdet,meltrate,G,dh[2],B,A,n,dt;
 	IssmDouble  gap,bed,thickness,head;
-	IssmDouble  lr,br,vx,vy,beta;
+	IssmDouble  lr,br,vx,vy,beta,lc;
 	IssmDouble  alpha2,frictionheat;
 	IssmDouble* xyz_list = NULL;
@@ -476,4 +552,6 @@
 	IssmDouble q = 0.;
    IssmDouble channelization = 0.;
+//	IssmDouble dgapxx; /***/
+//	IssmDouble dgapyy; /***/
 
 	/*Retrieve all inputs and parameters*/
@@ -491,8 +569,8 @@
 	Input* B_input              = element->GetInput(MaterialsRheologyBEnum);         _assert_(B_input);
 	Input* n_input              = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
-	Input* vx_input             = element->GetInput(VxEnum);                         _assert_(vx_input);
-	Input* vy_input             = element->GetInput(VyEnum);                         _assert_(vy_input);
 	Input* lr_input             = element->GetInput(HydrologyBumpSpacingEnum);       _assert_(lr_input);
 	Input* br_input             = element->GetInput(HydrologyBumpHeightEnum);        _assert_(br_input);
+ //       Input* dgapxx_input         = element->GetInput(HydrologyGapHeightXXEnum); /***/
+  //      Input* dgapyy_input         = element->GetInput(HydrologyGapHeightYYEnum); /***/
 
 	/*Get conductivity from inputs*/
@@ -520,6 +598,6 @@
 		lr_input->GetInputValue(&lr,gauss);
 		br_input->GetInputValue(&br,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+//		dgapxx_input->GetInputValue(&dgapxx,gauss); /***/
+//		dgapyy_input->GetInputValue(&dgapyy,gauss); /***/
 
 		/*Get ice A parameter*/
@@ -536,7 +614,10 @@
 		/*Compute frictional heat flux*/
 		friction->GetAlpha2(&alpha2,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		friction->GetBasalSlidingSpeeds(&vx, &vy, gauss);
 		frictionheat=alpha2*(vx*vx+vy*vy);
+
+		/* Take out frictional heat for large gap height */
+		if(gap>br)
+		 frictionheat=0.;
 
 		/*Get water and ice pressures*/
@@ -558,4 +639,14 @@
 					+beta*sqrt(vx*vx+vy*vy)
 					));
+
+		/* TEST with experimental gap height "diffusivity" for melting walls */
+//                newgap += gauss->weight*Jdet*(gap+dt*(
+ //                                        meltrate/rho_ice
+  //                                       -A*pow(fabs(pressure_ice-pressure_water),n-1)*(pressure_ice-pressure_water)*lc
+   //                                      +beta*sqrt(vx*vx+vy*vy)
+//					 +0.e-5*(dgapxx+dgapyy))
+ //                                        );
+
+
 		totalweights +=gauss->weight*Jdet;
 
@@ -592,2 +683,49 @@
 	delete gauss;
 }/*}}}*/
+void HydrologyShaktiAnalysis::UpdateEffectivePressure(FemModel* femmodel){/*{{{*/
+
+	for(Object* & object : femmodel->elements->objects){
+		Element* element=xDynamicCast<Element*>(object);
+		UpdateEffectivePressure(element);
+	}
+
+}/*}}}*/
+void HydrologyShaktiAnalysis::UpdateEffectivePressure(Element* element){/*{{{*/
+
+	/*Skip if water or ice shelf element*/
+	if(element->IsAllFloating()) return;
+
+	/*Intermediaries*/
+	IssmDouble bed,thickness,head;
+
+	/* Fetch number of nodes and allocate output*/
+   int numnodes = element->GetNumberOfNodes();
+   IssmDouble* N = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	IssmDouble  g          = element->FindParam(ConstantsGEnum);
+	IssmDouble  rho_ice    = element->FindParam(MaterialsRhoIceEnum);
+	IssmDouble  rho_water  = element->FindParam(MaterialsRhoFreshwaterEnum);
+	Input* head_input      = element->GetInput(HydrologyHeadEnum); _assert_(head_input);
+	Input* thickness_input = element->GetInput(ThicknessEnum);     _assert_(thickness_input);
+	Input* base_input      = element->GetInput(BaseEnum);          _assert_(base_input);
+
+
+   Gauss* gauss=element->NewGauss();
+   for (int i=0;i<numnodes;i++){
+      gauss->GaussNode(element->GetElementType(),i);
+
+		base_input->GetInputValue(&bed,gauss);
+		thickness_input->GetInputValue(&thickness,gauss);
+		head_input->GetInputValue(&head,gauss);
+
+		N[i] = rho_ice*g*thickness - rho_water*g*(head-bed);
+	}
+
+	/*Add new gap as an input*/
+	element->AddInput(EffectivePressureEnum,N,element->GetElementType());
+
+	/*Clean up and return*/
+   xDelete<IssmDouble>(N);
+	delete gauss;
+}/*}}}*/
Index: issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyShaktiAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
@@ -35,4 +36,6 @@
 		void UpdateGapHeight(FemModel* femmodel);
 		void UpdateGapHeight(Element* element);
+		void UpdateEffectivePressure(FemModel* femmodel);
+		void UpdateEffectivePressure(Element* element);
 };
 #endif
Index: issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 26744)
@@ -58,5 +58,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
 		iomodel->FetchDataToInput(inputs,elements,"md.mesh.vertexonbase",MeshVertexonbaseEnum);
@@ -93,4 +93,7 @@
 /*Finite Element Analysis*/
 void           HydrologyShreveAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           HydrologyShreveAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -231,5 +234,5 @@
 
 	/*Skip if water or ice shelf element*/
-	if(element->IsFloating()) return NULL;
+	if(element->IsAllFloating()) return NULL;
 
 	/*Intermediaries */
@@ -292,19 +295,33 @@
 	/*Fetch dof list and allocate solution vector*/
 	element->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
-	IssmDouble* values = xNew<IssmDouble>(numnodes);
+	IssmDouble* watercolumn = xNew<IssmDouble>(numnodes);
 
 	/*Use the dof list to index into the solution vector: */
 	for(int i=0;i<numnodes;i++){
-		values[i]=solution[doflist[i]];
-		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
-		if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector");
-		if (values[i]<10e-10) values[i]=10e-10; //correcting the water column to positive values
+		watercolumn[i]=solution[doflist[i]];
+		if(xIsNan<IssmDouble>(watercolumn[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(watercolumn[i])) _error_("Inf found in solution vector");
+		if (watercolumn[i]<10e-10) watercolumn[i]=10e-10; //correcting the water column to positive watercolumn
 	}
 
 	/*Add input to the element: */
-	element->AddInput(WatercolumnEnum,values,element->GetElementType());
+	element->AddInput(WatercolumnEnum,watercolumn,element->GetElementType());
+
+	/*Also update the hydrological loads for the sealevel core: */
+	IssmDouble* oldwatercolumn      = xNew<IssmDouble>(numnodes);
+	IssmDouble* deltawatercolumn = xNew<IssmDouble>(numnodes);
+
+	element->GetInputListOnVertices(&watercolumn[0],WatercolumnEnum);
+	element->GetInputListOnVertices(&oldwatercolumn[0],WaterColumnOldEnum);
+	element->GetInputListOnVertices(&deltawatercolumn[0],AccumulatedDeltaTwsEnum);
+	for(int i=0;i<numnodes;i++){
+		deltawatercolumn[i] += watercolumn[i]-oldwatercolumn[i];
+	}
+	element->AddInput(AccumulatedDeltaTwsEnum,deltawatercolumn,P1Enum);
 
 	/*Free ressources:*/
-	xDelete<IssmDouble>(values);
+	xDelete<IssmDouble>(oldwatercolumn);
+	xDelete<IssmDouble>(deltawatercolumn);
+	xDelete<IssmDouble>(watercolumn);
 	xDelete<int>(doflist);
 }/*}}}*/
Index: issm/trunk/src/c/analyses/HydrologyShreveAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyShreveAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/HydrologyShreveAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		void           CreateHydrologyWaterVelocityInput(Element* element);
Index: issm/trunk/src/c/analyses/HydrologyTwsAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyTwsAnalysis.cpp	(revision 26744)
+++ issm/trunk/src/c/analyses/HydrologyTwsAnalysis.cpp	(revision 26744)
@@ -0,0 +1,103 @@
+#include "./HydrologyTwsAnalysis.h"
+#include <math.h>
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../classes/Inputs/TransientInput.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+
+/*Model processing*/
+void HydrologyTwsAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+	/*No constraints*/
+}/*}}}*/
+void HydrologyTwsAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+	/*No loads*/
+}/*}}}*/
+void HydrologyTwsAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
+	::CreateNodes(nodes,iomodel,HydrologyTwsAnalysisEnum,P1Enum);
+}/*}}}*/
+int  HydrologyTwsAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+	return 1;
+}/*}}}*/
+void HydrologyTwsAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	int nature=0;
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
+			counter++;
+		}
+	}
+
+	/*Plug inputs into element:*/
+	iomodel->FetchDataToInput(inputs,elements,"md.hydrology.spcwatercolum", HydrologyTwsSpcEnum);
+
+	/*Initialize sea level cumulated sea level loads :*/
+	iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaTwsEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaTwsEnum,P1Enum);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",WatercolumnEnum);
+
+}/*}}}*/
+void HydrologyTwsAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+
+}/*}}}*/
+
+/*Finite Element Analysis*/
+void           HydrologyTwsAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           HydrologyTwsAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+ElementVector* HydrologyTwsAnalysis::CreateDVector(Element* element){/*{{{*/
+	/*Default, return NULL*/
+	return NULL;
+}/*}}}*/
+ElementMatrix* HydrologyTwsAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+_error_("Not implemented");
+}/*}}}*/
+ElementMatrix* HydrologyTwsAnalysis::CreateKMatrix(Element* element){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
+ElementVector* HydrologyTwsAnalysis::CreatePVector(Element* element){/*{{{*/
+_error_("not implemented yet");
+}/*}}}*/
+void           HydrologyTwsAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+	   _error_("not implemented yet");
+}/*}}}*/
+void           HydrologyTwsAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
+	_error_("Not implemented yet");
+}/*}}}*/
+void           HydrologyTwsAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+
+	/*Only update if on base*/
+	if(!element->IsOnBase()) return;
+
+	/*Fetch dof list and allocate solution vector*/
+	int *doflist = NULL;
+	element->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
+
+	int numnodes = element->GetNumberOfNodes();
+	IssmDouble* watercolumn = xNew<IssmDouble>(numnodes);
+
+	/*Use the dof list to index into the solution vector: */
+	for(int i=0;i<numnodes;i++){
+		watercolumn[i]=solution[doflist[i]];
+		/*Check solution*/
+		if(xIsNan<IssmDouble>(watercolumn[i])) _error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(watercolumn[i])) _error_("Inf found in solution vector");
+	}
+	element->AddBasalInput(WatercolumnEnum,watercolumn,element->GetElementType());
+
+	xDelete<int>(doflist);
+	xDelete<IssmDouble>(watercolumn);
+
+}/*}}}*/
+void           HydrologyTwsAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/analyses/HydrologyTwsAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/HydrologyTwsAnalysis.h	(revision 26744)
+++ issm/trunk/src/c/analyses/HydrologyTwsAnalysis.h	(revision 26744)
@@ -0,0 +1,34 @@
+/*! \file HydrologyTwsAnalysis.h 
+ *  \brief: header file for generic external result object
+ */
+
+#ifndef _HydrologyTwsAnalysis_
+#define _HydrologyTwsAnalysis_
+
+/*Headers*/
+#include "./Analysis.h"
+
+class HydrologyTwsAnalysis: public Analysis{
+
+	public:
+		/*Model processing*/
+		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+		void CreateLoads(Loads* loads, IoModel* iomodel);
+		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
+		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
+		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+
+		/*Finite element Analysis*/
+		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
+		ElementVector* CreateDVector(Element* element);
+		ElementMatrix* CreateJacobianMatrix(Element* element);
+		ElementMatrix* CreateKMatrix(Element* element);
+		ElementVector* CreatePVector(Element* element);
+		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
+		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
+		void           UpdateConstraints(FemModel* femmodel);
+};
+#endif
Index: issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 26744)
@@ -41,6 +41,6 @@
 
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
-   iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum & iomodel->domaintype!=Domain3DsurfaceEnum){
@@ -54,4 +54,7 @@
 /*Finite Element Analysis*/
 void           L2ProjectionBaseAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           L2ProjectionBaseAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -114,5 +117,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -164,4 +167,8 @@
 		case BaseSlopeXEnum:    input2 = basalelement->GetInput(BaseEnum);    _assert_(input2); break;
 		case BaseSlopeYEnum:    input2 = basalelement->GetInput(BaseEnum);    _assert_(input2); break;
+		case HydrologyGapHeightXEnum:    input2 = basalelement->GetInput(HydrologyGapHeightEnum);  _assert_(input2); break;
+		case HydrologyGapHeightXXEnum:   input2 = basalelement->GetInput(HydrologyGapHeightXEnum); _assert_(input2); break;
+		case HydrologyGapHeightYEnum:    input2 = basalelement->GetInput(HydrologyGapHeightEnum);  _assert_(input2); break;
+		case HydrologyGapHeightYYEnum:   input2 = basalelement->GetInput(HydrologyGapHeightYEnum); _assert_(input2); break;
 		case LevelsetfunctionSlopeXEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
 		case LevelsetfunctionSlopeYEnum: input2 = basalelement->GetInput(MaskIceLevelsetEnum);     _assert_(input2); break;
@@ -178,7 +185,14 @@
 		if(input2) input2->GetInputDerivativeValue(&slopes[0],xyz_list,gauss);
 		switch(input_enum){
-			case SurfaceSlopeXEnum: case BedSlopeXEnum: case BaseSlopeXEnum: case LevelsetfunctionSlopeXEnum: value = slopes[0]; break;
-			case SurfaceSlopeYEnum: case BedSlopeYEnum: case BaseSlopeYEnum: case LevelsetfunctionSlopeYEnum: value = slopes[1]; break;
-			default: input->GetInputValue(&value,gauss);
+			case SurfaceSlopeXEnum: case BedSlopeXEnum: case BaseSlopeXEnum: case LevelsetfunctionSlopeXEnum: 
+			case HydrologyGapHeightXEnum: case HydrologyGapHeightXXEnum:
+				value = slopes[0];
+				break;
+			case SurfaceSlopeYEnum: case BedSlopeYEnum: case BaseSlopeYEnum: case LevelsetfunctionSlopeYEnum: 
+			case HydrologyGapHeightYEnum: case HydrologyGapHeightYYEnum:
+				value = slopes[1];
+				break;
+			default:
+				input->GetInputValue(&value,gauss);
 		}
 
@@ -190,5 +204,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
Index: issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 26744)
@@ -74,4 +74,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           L2ProjectionEPLAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* L2ProjectionEPLAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -109,8 +112,5 @@
 	/* Check that all nodes are active, else return empty matrix */
 	if(!active_element){
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -144,5 +144,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -171,8 +171,5 @@
 	/*Check that all nodes are active, else return empty matrix*/
 	if(!active_element) {
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		return NULL;
 	}
@@ -215,5 +212,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
Index: issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/L2ProjectionEPLAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/LevelsetAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/LevelsetAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/LevelsetAnalysis.cpp	(revision 26744)
@@ -12,7 +12,37 @@
 
 void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+	
+	/*intermediary: */
 	int finiteelement;
+	int         code,vector_layout;
+	IssmDouble *spcdata = NULL;
+	int         M,N;
+
+	/*Get finite element type for this analysis*/
 	iomodel->FindConstant(&finiteelement,"md.levelset.fe");
-	IoModelToConstraintsx(constraints,iomodel,"md.levelset.spclevelset",LevelsetAnalysisEnum,finiteelement);
+
+	/*First of, find the record for the enum, and get code  of data type: */
+	iomodel->SetFilePointerToData(&code, &vector_layout,"md.levelset.spclevelset");
+	if(code!=7)_error_("expecting a IssmDouble vector for constraints md.levelset.spclevelset");
+	if(vector_layout!=1)_error_("expecting a nodal vector for constraints md.levelset.spclevelset");
+
+	/*Fetch vector:*/
+	iomodel->FetchData(&spcdata,&M,&N,"md.levelset.spclevelset");
+
+	/*Call IoModelToConstraintsx*/
+	if(N>1){
+		/*If it is a time series, most likely we are forcing the ice front position and do not want to have a Dynamic Constraint*/
+		_assert_(M==iomodel->numberofvertices+1);
+		IoModelToConstraintsx(constraints,iomodel,spcdata,M,N,LevelsetAnalysisEnum,finiteelement);
+	}
+	else{
+		/*This is not a time series, we probably have calving on, we need the levelset constraints to update as the levelset moves*/
+		_assert_(N==1);
+		_assert_(M==iomodel->numberofvertices);
+		IoModelToDynamicConstraintsx(constraints,iomodel,spcdata,M,N,LevelsetAnalysisEnum,finiteelement);
+	}
+
+	/*Clean up*/
+	xDelete<IssmDouble>(spcdata);
 }
 /*}}}*/
@@ -53,10 +83,16 @@
 
 	/*Get moving front parameters*/
-	int  calvinglaw;
-	iomodel->FindConstant(&calvinglaw,"md.calving.law");
-	switch(calvinglaw){
-		case DefaultCalvingEnum:
-			iomodel->FetchDataToInput(inputs,elements,"md.calving.calvingrate",CalvingCalvingrateEnum);
-			break;
+	bool isstochastic;
+   int  calvinglaw;
+   iomodel->FindConstant(&calvinglaw,"md.calving.law");
+   iomodel->FindConstant(&isstochastic,"md.stochasticforcing.isstochasticforcing");
+   switch(calvinglaw){
+      case DefaultCalvingEnum:
+         iomodel->FetchDataToInput(inputs,elements,"md.calving.calvingrate",CalvingCalvingrateEnum);
+         if(isstochastic){
+				iomodel->FetchDataToInput(inputs,elements,"md.stochasticforcing.default_id",StochasticForcingDefaultIdEnum);
+            iomodel->FetchDataToInput(inputs,elements,"md.calving.calvingrate",BaselineCalvingCalvingrateEnum);
+         }
+         break;	
 		case CalvingLevermannEnum:
 			iomodel->FetchDataToInput(inputs,elements,"md.calving.coeff",CalvinglevermannCoeffEnum);
@@ -92,8 +128,11 @@
 			break;
 		case FrontalForcingsRignotEnum:
-			iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.basin",FrontalForcingsBasinIdEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.subglacial_discharge",FrontalForcingsSubglacialDischargeEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.thermalforcing",FrontalForcingsThermalForcingEnum);
-			break;
+         /*Retrieve thermal forcing only in the case of non-autoregressive FrontalForcingsRignot*/
+         iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.thermalforcing",FrontalForcingsThermalForcingEnum);
+         /* Do not break here, still retrieve basin_ID,subglacial_discharge, etc.*/
+      case FrontalForcingsRignotAutoregressionEnum:
+         iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.basin_id",FrontalForcingsBasinIdEnum);
+         iomodel->FetchDataToInput(inputs,elements,"md.frontalforcings.subglacial_discharge",FrontalForcingsSubglacialDischargeEnum);
+         break;	
 		default:
 			_error_("Frontal forcings"<<EnumToStringx(melt_parameterization)<<" not supported yet");
@@ -124,4 +163,5 @@
 		case CalvingCrevasseDepthEnum:
 			parameters->AddObject(iomodel->CopyConstantObject("md.calving.crevasse_opening_stress",CalvingCrevasseDepthEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.calving.crevasse_threshold",CalvingCrevasseThresholdEnum));
 			break;
 		case CalvingDev2Enum:
@@ -135,9 +175,26 @@
 	int melt_parameterization;
 	iomodel->FindConstant(&melt_parameterization,"md.frontalforcings.parameterization");
+	int M,N;
+	IssmDouble* transparam = NULL;
 	switch(melt_parameterization){
 		case FrontalForcingsDefaultEnum:
 			break;
+		case FrontalForcingsRignotAutoregressionEnum:
+			/*Retrieve autoregressive parameters*/
+         parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.ar_order",FrontalForcingsAutoregressiveOrderEnum));
+         parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.ar_initialtime",FrontalForcingsAutoregressionInitialTimeEnum));
+         parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.ar_timestep",FrontalForcingsAutoregressionTimestepEnum));
+			iomodel->FetchData(&transparam,&M,&N,"md.frontalforcings.beta0");
+         parameters->AddObject(new DoubleVecParam(FrontalForcingsBeta0Enum,transparam,N));
+         xDelete<IssmDouble>(transparam);
+         iomodel->FetchData(&transparam,&M,&N,"md.frontalforcings.beta1");
+         parameters->AddObject(new DoubleVecParam(FrontalForcingsBeta1Enum,transparam,N));
+         xDelete<IssmDouble>(transparam);
+         iomodel->FetchData(&transparam,&M,&N,"md.frontalforcings.phi");
+         parameters->AddObject(new DoubleMatParam(FrontalForcingsPhiEnum,transparam,M,N));
+         xDelete<IssmDouble>(transparam);
+			/*Do not break here, generic FrontalForcingsRignot parameters still to be retrieved*/
 		case FrontalForcingsRignotEnum:
-			parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.numberofbasins",FrontalForcingsNumberofBasinsEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.num_basins",FrontalForcingsNumberofBasinsEnum));
 			break;
 		default:
@@ -172,4 +229,7 @@
 	}
 }/*}}}*/
+void           LevelsetAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* LevelsetAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -186,17 +246,15 @@
 
 	/*Intermediaries */
-	int  stabilization,dim, domaintype, calvinglaw;
+	int  stabilization,dim,domaintype;
 	int i,j,k,row, col;
 	IssmDouble kappa;
 	IssmDouble Jdet, dt, D_scalar;
 	IssmDouble h,hx,hy,hz;
-	IssmDouble vel,v[3],w[3],c[3],m[3],dlsf[3];
-	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
-	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble vel,w[3];
+	IssmDouble migrationmax;
 	IssmDouble* xyz_list = NULL;
 
 	/*Get problem dimension and whether there is moving front or not*/
 	basalelement->FindParam(&domaintype,DomainTypeEnum);
-	basalelement->FindParam(&calvinglaw,CalvingLawEnum);
 	basalelement->FindParam(&stabilization,LevelsetStabilizationEnum);
 	switch(domaintype){
@@ -206,7 +264,4 @@
 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
 	}
-
-	/*Calving threshold*/
-
 	/*Fetch number of nodes and dof for this finite element*/
 	int numnodes    = basalelement->GetNumberOfNodes();
@@ -216,8 +271,4 @@
 	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
 	IssmDouble*    dbasis   = xNew<IssmDouble>(2*numnodes);
-	IssmDouble*    Bprime = NULL;
-	if(stabilization==2){
-		Bprime   = xNew<IssmDouble>(dim*numnodes);
-	}
 
 	/*Retrieve all inputs and parameters*/
@@ -225,82 +276,24 @@
 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
 	basalelement->FindParam(&migrationmax,MigrationMaxEnum);
-	Input* vx_input           = NULL;
-	Input* vy_input           = NULL;
-	Input* calvingratex_input = NULL;
-	Input* calvingratey_input = NULL;
-	Input* lsf_slopex_input   = NULL;
-	Input* lsf_slopey_input   = NULL;
-	Input* calvingrate_input  = NULL;
-	Input* meltingrate_input  = NULL;
-	Input* gr_input           = NULL;
+
+	h = basalelement->CharacteristicLength();
+
+	Input* mf_vx_input        = NULL;
+	Input* mf_vy_input        = NULL;
 
 	/*Load velocities*/
 	switch(domaintype){
 		case Domain2DverticalEnum:
-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
 			break;
 		case Domain2DhorizontalEnum:
-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
-			vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
-			gr_input=basalelement->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
+			mf_vy_input=basalelement->GetInput(MovingFrontalVyEnum); _assert_(mf_vy_input);
 			break;
 		case Domain3DEnum:
-			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
-			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
-			gr_input=basalelement->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
+			mf_vy_input=basalelement->GetInput(MovingFrontalVyEnum); _assert_(mf_vy_input);
 			break;
 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-	}
-
-	/*Load calving inputs*/
-	switch(calvinglaw){
-		case DefaultCalvingEnum:
-		case CalvingVonmisesEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			calvingrate_input = basalelement->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingLevermannEnum:
-			switch(domaintype){
-				case Domain2DverticalEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
-					break;
-				case Domain2DhorizontalEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
-					calvingratey_input=basalelement->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
-					break;
-				case Domain3DEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
-					calvingratey_input=basalelement->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
-					break;
-				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-			}
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingMinthicknessEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingHabEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingCrevasseDepthEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingDev2Enum:
-			basalelement->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			calvingrate_input = basalelement->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		default:
-			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
 	}
 
@@ -324,163 +317,16 @@
 		}
 
-		/* Advection */
-		vx_input->GetInputValue(&v[0],gauss);
-		vy_input->GetInputValue(&v[1],gauss);
-		gr_input->GetInputValue(&groundedice,gauss);
-
-		/*Get calving speed*/
-		switch(calvinglaw){
-			case DefaultCalvingEnum:
-			case CalvingVonmisesEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				calvingrate_input->GetInputValue(&calvingrate,gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				/*Limit calving rate to c <= v + 3 km/yr */
-				vel=sqrt(v[0]*v[0] + v[1]*v[1]);
-				if(calvingrate>migrationmax+vel) calvingrate = vel+migrationmax;
-				if(groundedice<0) meltingrate = 0.;
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.; m[i]=0.;
-				 }
-				break;
-
-			case CalvingLevermannEnum:
-				calvingratex_input->GetInputValue(&c[0],gauss);
-				if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-				norm_calving=0.;
-				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
-				norm_calving=sqrt(norm_calving)+1.e-14;
-				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
-				break;
-
-			case CalvingMinthicknessEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingHabEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingCrevasseDepthEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				if(groundedice<0) meltingrate = 0.;
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingDev2Enum:
-				  {
-					lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-					calvingrate_input->GetInputValue(&calvingrate,gauss);
-					meltingrate_input->GetInputValue(&meltingrate,gauss);
-					gr_input->GetInputValue(&groundedice,gauss);
-
-					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
-					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
-					haf_eps=10.;
-					if(groundedice-calvinghaf<=-haf_eps){
-						// ice floats freely below calvinghaf: calve freely
-						// undercutting has no effect:
-						meltingrate=0.;
-					}
-					else if(groundedice-calvinghaf>=haf_eps){
-						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
-						calvingrate=min(calvingrate,vel);
-						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
-					}
-					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
-						//heaviside: 0 for floating, 1 for grounded
-						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI);
-						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
-						meltingrate=heaviside*meltingrate+0.;
-					}
-
-					norm_dlsf=0.;
-					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-					norm_dlsf=sqrt(norm_dlsf);
-
-					if(norm_dlsf>1.e-10)
-					 for(i=0;i<dim;i++){
-						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
-						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-					 }
-					else
-					 for(i=0;i<dim;i++){
-						 c[i]=0.;
-						 m[i]=0.;
-					 }
-					break;
-				  }
-
-			default:
-				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
-		}
-
-		/*Levelset speed is ice velocity - calving rate*/
-		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+		/* Levelset speed */
+		mf_vx_input->GetInputValue(&w[0], gauss);
+		mf_vy_input->GetInputValue(&w[1], gauss);
+
+		/* Apply limiter to the migration rate */		
+		vel = 0.;
+		for(i=0;i<dim;i++) vel += w[i]*w[i];
+		vel = sqrt(vel)+1e-14;
+		/* !!NOTE: This is different from the previous version 25838 (and before). The current threshold restrict both advance and retreat velocity. */
+		if (vel > migrationmax) {
+			for(i=0;i<dim;i++) w[i] = w[i]/vel*migrationmax;
+		}
 
 		/*Compute D*/
@@ -499,5 +345,5 @@
 		switch(stabilization){
 			case 0:
-				// no stabilization, do nothing
+				/*Nothing to be done*/
 				break;
 			case 1:
@@ -517,16 +363,41 @@
 				  {
 					/* Streamline Upwinding */
-					basalelement->ElementSizes(&hx,&hy,&hz);
-					h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) );
+					mf_vx_input->GetInputAverage(&w[0]);
+					mf_vy_input->GetInputAverage(&w[1]);
+					vel=sqrt(w[0]*w[0]+w[1]*w[1])+1.e-8;
+					IssmDouble tau=h/(2*vel);
 					for(int i=0;i<numnodes;i++){
 						for(int j=0;j<numnodes;j++){
-							Ke->values[i*numnodes+j] += D_scalar*h/(2.*vel)*(
-										dbasis[0*numnodes+i] *(w[0]*w[0]*dbasis[0*numnodes+j] + w[0]*w[1]*dbasis[1*numnodes+j]) +
-										dbasis[1*numnodes+i] *(w[1]*w[0]*dbasis[0*numnodes+j] + w[1]*w[1]*dbasis[1*numnodes+j]) 
-										);
+							Ke->values[i*numnodes+j]+=dt*gauss->weight*Jdet*tau*(
+										w[0]*dbasis[0*numnodes+i]+w[1]*dbasis[1*numnodes+i])*(w[0]*dbasis[0*numnodes+j]+w[1]*dbasis[1*numnodes+j]);
 						}
 					}
 				  }
 				break;
+			case 5:{
+				/*SUPG*/
+				IssmDouble vx,vy;
+				mf_vx_input->GetInputAverage(&vx);
+				mf_vy_input->GetInputAverage(&vy);
+				vel=sqrt(vx*vx+vy*vy)+1.e-8;
+				IssmPDouble xi=1.;
+				IssmDouble  tau=xi*h/(2*vel);
+
+				/*Mass matrix - part 2*/
+				for(int i=0;i<numnodes;i++){
+					for(int j=0;j<numnodes;j++){
+						Ke->values[i*numnodes+j]+=gauss->weight*Jdet*tau*basis[j]*(vx*dbasis[0*numnodes+i]+vy*dbasis[1*numnodes+i]);
+					}
+				}
+
+				/*Advection matrix - part 2, A*/
+				for(int i=0;i<numnodes;i++){
+					for(int j=0;j<numnodes;j++){
+						Ke->values[i*numnodes+j]+=dt*gauss->weight*Jdet*tau*(vx*dbasis[0*numnodes+j]+vy*dbasis[1*numnodes+j])*(vx*dbasis[0*numnodes+i]+vy*dbasis[1*numnodes+i]);
+					}
+				}
+
+				break;
+			}
 			default:
 				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
@@ -538,7 +409,6 @@
 	xDelete<IssmDouble>(basis);
 	xDelete<IssmDouble>(dbasis);
-	xDelete<IssmDouble>(Bprime);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -549,5 +419,5 @@
 
 	/*Intermediaries */
-	int domaintype;
+	int         domaintype,stabilization;
 	IssmDouble  Jdet,dt;
 	IssmDouble  lsf;
@@ -556,35 +426,56 @@
 	/*Fetch number of nodes and dof for this finite element*/
 	int numnodes = basalelement->GetNumberOfNodes();
+	basalelement->FindParam(&stabilization,LevelsetStabilizationEnum);
 
 	/*Initialize Element vector*/
 	ElementVector* pe = basalelement->NewElementVector();
-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
-
-	if(dt!=0.){
-		/*Initialize basis vector*/
-		IssmDouble*    basis = xNew<IssmDouble>(numnodes);
-
-		/*Retrieve all inputs and parameters*/
-		basalelement->GetVerticesCoordinates(&xyz_list);
-		Input* levelset_input     = basalelement->GetInput(MaskIceLevelsetEnum);                    _assert_(levelset_input);
-
-		/* Start  looping on the number of gaussian points: */
-		Gauss* gauss=basalelement->NewGauss(2);
-		while(gauss->next()){
-			basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
-			basalelement->NodalFunctions(basis,gauss);
-
-			/* old function value */
-			levelset_input->GetInputValue(&lsf,gauss);
-			for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*lsf*basis[i];
-		}
-
-		/*Clean up and return*/
-		xDelete<IssmDouble>(xyz_list);
-		xDelete<IssmDouble>(basis);
-		basalelement->FindParam(&domaintype,DomainTypeEnum);
-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
-		delete gauss;
-	}
+	basalelement->FindParam(&dt,TimesteppingTimeStepEnum); _assert_(dt>0.);
+
+	/*Initialize basis vector*/
+	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+	IssmDouble*    dbasis = NULL;
+	if(stabilization==5) dbasis= xNew<IssmDouble>(2*numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	basalelement->GetVerticesCoordinates(&xyz_list);
+	Input* levelset_input = basalelement->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+	Input* mf_vx_input    = basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
+	Input* mf_vy_input    = basalelement->GetInput(MovingFrontalVyEnum); _assert_(mf_vy_input);
+
+	IssmDouble h=basalelement->CharacteristicLength();
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=basalelement->NewGauss(2);
+	while(gauss->next()){
+		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		basalelement->NodalFunctions(basis,gauss);
+
+		/* old function value */
+		levelset_input->GetInputValue(&lsf,gauss);
+		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*lsf*basis[i];
+
+		if(stabilization==5){ /*SUPG*/
+         IssmDouble vx,vy,vel;
+			basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+			mf_vx_input->GetInputAverage(&vx);
+			mf_vy_input->GetInputAverage(&vy);
+			vel=sqrt(vx*vx+vy*vy)+1.e-8;
+			IssmPDouble xi=1.;
+			IssmDouble  tau=xi*h/(2*vel);
+
+			/*Force vector - part 2*/
+			for(int i=0;i<numnodes;i++){
+				pe->values[i]+=Jdet*gauss->weight*lsf*(tau*vx*dbasis[0*numnodes+i]+tau*vy*dbasis[1*numnodes+i]);
+			}
+		}
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+   xDelete<IssmDouble>(dbasis);
+	basalelement->FindParam(&domaintype,DomainTypeEnum);
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+	delete gauss;
 
 	return pe;
@@ -615,5 +506,5 @@
 }/*}}}*/
 void           LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	_error_("not implemented yet");
+	element->GetSolutionFromInputsOneDof(solution,MaskIceLevelsetEnum);
 }/*}}}*/
 void           LevelsetAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
@@ -637,17 +528,12 @@
 
 	/*Intermediaries*/
-	int         calvinglaw;
-	IssmDouble  min_thickness,thickness,hab_fraction;
-	IssmDouble	crevassedepth,surface_crevasse,surface,critical_fraction;
-	IssmDouble  rho_ice,rho_water;
-	IssmDouble  bed,water_depth;
-	IssmDouble  levelset,sealevel;
-
+	int  calvinglaw;
 	femmodel->parameters->FindParam(&calvinglaw,CalvingLawEnum);
 
 	if(calvinglaw==CalvingMinthicknessEnum || calvinglaw==CalvingVonmisesEnum){
 
-		/*Get minimum thickness threshold*/
-		femmodel->parameters->FindParam(&min_thickness,CalvingMinthicknessEnum);
+		/*Intermediaries*/
+		IssmDouble thickness,bed,sealevel;
+		IssmDouble min_thickness = femmodel->parameters->FindParam(CalvingMinthicknessEnum);
 
 		/*Loop over all elements of this partition*/
@@ -681,6 +567,8 @@
 		}
 	}
-
-	if(calvinglaw==CalvingHabEnum){
+   else if(calvinglaw==CalvingHabEnum){
+
+		/*Intermediaries*/
+		IssmDouble  thickness,water_depth,levelset,hab_fraction;
 
 		/*Get the fraction of the flotation thickness at the terminus*/
@@ -692,6 +580,6 @@
 			Element* element  = xDynamicCast<Element*>(object);
 
-			rho_ice = element->FindParam(MaterialsRhoIceEnum);
-			rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
+			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
+			IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
 
 			int      numnodes           = element->GetNumberOfNodes();
@@ -724,9 +612,8 @@
 		}
 	}
-
-	if(calvinglaw==CalvingCrevasseDepthEnum){
-
-		int                 nflipped,local_nflipped;
-		Vector<IssmDouble>* vec_constraint_nodes = NULL;
+   else if(calvinglaw==CalvingCrevasseDepthEnum){
+
+		/*Intermediaries*/
+		IssmDouble  levelset,crevassedepth,bed,surface_crevasse,thickness,surface;
 		IssmDouble* constraint_nodes = NULL;
 
@@ -736,15 +623,22 @@
 
 		/*Vector of size number of nodes*/
-		vec_constraint_nodes=new Vector<IssmDouble>(femmodel->nodes->NumberOfNodes());
+      int numnodes      = femmodel->nodes->NumberOfNodes();
+      int localmasters  = femmodel->nodes->NumberOfNodesLocal();
+      Vector<IssmDouble>* vec_constraint_nodes = vec_constraint_nodes=new Vector<IssmDouble>(localmasters,numnodes);
+
+		IssmDouble crevasse_threshold = femmodel->parameters->FindParam(CalvingCrevasseThresholdEnum);
+		IssmDouble mig_max            = femmodel->parameters->FindParam(MigrationMaxEnum);
+		IssmDouble dt                 = femmodel->parameters->FindParam(TimesteppingTimeStepEnum);
 
 		for(Object* & object : femmodel->elements->objects){
-			Element* element               = xDynamicCast<Element*>(object);
-			int      numnodes              = element->GetNumberOfNodes();
-			Gauss*   gauss                 = element->NewGauss();
-			Input*   crevassedepth_input   = element->GetInput(CrevasseDepthEnum); _assert_(crevassedepth_input);
-			Input*   bed_input             = element->GetInput(BedEnum); _assert_(bed_input);
+			Element* element   = xDynamicCast<Element*>(object);
+			int      numnodes  = element->GetNumberOfNodes();
+			Gauss*   gauss     = element->NewGauss();
+
+			Input*   crevassedepth_input    = element->GetInput(CrevasseDepthEnum); _assert_(crevassedepth_input);
+			Input*   bed_input              = element->GetInput(BedEnum); _assert_(bed_input);
 			Input*   surface_crevasse_input = element->GetInput(SurfaceCrevasseEnum); _assert_(surface_crevasse_input);
-			Input*   thickness_input       = element->GetInput(ThicknessEnum); _assert_(thickness_input);
-			Input*   surface_input         = element->GetInput(SurfaceEnum); _assert_(surface_input);
+			Input*   thickness_input        = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+			Input*   surface_input          = element->GetInput(SurfaceEnum); _assert_(surface_input);
 
 			/*First, look at ice front and figure out if any of the nodes will be calved*/
@@ -761,6 +655,6 @@
 					surface_input->GetInputValue(&surface,gauss);
 
-					if((surface_crevasse-surface>0. || crevassedepth-thickness>0.) && bed<0.){
-						vec_constraint_nodes->SetValue(node->Sid(),1.0,INS_VAL);
+					if((surface_crevasse>surface || crevassedepth>crevasse_threshold*thickness) && bed<0.){
+						vec_constraint_nodes->SetValue(node->Pid(),1.0,INS_VAL);
 					}
 				}
@@ -771,19 +665,19 @@
 		/*Assemble vector and serialize: */
 		vec_constraint_nodes->Assemble();
-		constraint_nodes=vec_constraint_nodes->ToMPISerial();
-
-		nflipped=1;
+      femmodel->GetLocalVectorWithClonesNodes(&constraint_nodes,vec_constraint_nodes);
+
+		int nflipped=1;
 		while(nflipped){
-			local_nflipped=0;
+			int local_nflipped=0;
 			for(Object* & object : femmodel->elements->objects){
-				Element* element                = xDynamicCast<Element*>(object);
-				int      numnodes               = element->GetNumberOfNodes();
-				Gauss*   gauss                  = element->NewGauss();
-				Input*   levelset_input         = element->GetInput(DistanceToCalvingfrontEnum); _assert_(levelset_input);
-				Input*   crevassedepth_input    = element->GetInput(CrevasseDepthEnum); _assert_(crevassedepth_input);
-				Input*   bed_input              = element->GetInput(BedEnum); _assert_(bed_input);
-				Input*   surface_crevasse_input = element->GetInput(SurfaceCrevasseEnum); _assert_(surface_crevasse_input);
-				Input*   thickness_input        = element->GetInput(ThicknessEnum); _assert_(thickness_input);
-				Input*   surface_input          = element->GetInput(SurfaceEnum); _assert_(surface_input);
+				Element* element  = xDynamicCast<Element*>(object);
+				int      numnodes = element->GetNumberOfNodes();
+
+				Input *levelset_input         = element->GetInput(DistanceToCalvingfrontEnum); _assert_(levelset_input);
+				Input *crevassedepth_input    = element->GetInput(CrevasseDepthEnum);          _assert_(crevassedepth_input);
+				Input *bed_input              = element->GetInput(BedEnum);                    _assert_(bed_input);
+				Input *surface_crevasse_input = element->GetInput(SurfaceCrevasseEnum);        _assert_(surface_crevasse_input);
+				Input *thickness_input        = element->GetInput(ThicknessEnum);              _assert_(thickness_input);
+				Input *surface_input          = element->GetInput(SurfaceEnum);                _assert_(surface_input);
 
 				/*Is this element connected to a node that should be calved*/
@@ -791,5 +685,5 @@
 				for(int in=0;in<numnodes;in++){
 					Node* node=element->GetNode(in);
-					if(constraint_nodes[node->Sid()]==1.){
+					if(constraint_nodes[node->Lid()]>0.){
 						isconnected = true;
 						break;
@@ -799,4 +693,5 @@
 				/*Check status if connected*/
 				if(isconnected){
+					Gauss* gauss = element->NewGauss();
 					for(int in=0;in<numnodes;in++){
 						gauss->GaussNode(element->GetElementType(),in);
@@ -809,9 +704,10 @@
 						surface_input->GetInputValue(&surface,gauss);
 
-						if((surface_crevasse-surface>0. || crevassedepth-thickness>0.) && bed<0. && levelset>-300. && levelset<0. && constraint_nodes[node->Sid()]==0.){
+                  if((surface_crevasse>surface || crevassedepth>crevasse_threshold*thickness) && bed<0. && levelset<0. && levelset>-mig_max*dt && constraint_nodes[node->Lid()]==0.){
 							local_nflipped++;
-							vec_constraint_nodes->SetValue(node->Sid(),1.0,INS_VAL);
+							vec_constraint_nodes->SetValue(node->Pid(),1.0,INS_VAL);
 						}
 					}
+					delete gauss;
 				}
 			}
@@ -819,11 +715,12 @@
 			/*Count how many new nodes were found*/
 			ISSM_MPI_Allreduce(&local_nflipped,&nflipped,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
-			//_printf0_("Found "<<nflipped<<" to flip\n");
+			_printf0_("Found "<<nflipped<<" to flip\n");
 
 			/*Assemble and serialize flag vector*/
 			vec_constraint_nodes->Assemble();
 			xDelete<IssmDouble>(constraint_nodes);
-			constraint_nodes=vec_constraint_nodes->ToMPISerial();
-		}
+         femmodel->GetLocalVectorWithClonesNodes(&constraint_nodes,vec_constraint_nodes);
+		}
+
 		/*Free ressources:*/
 		delete vec_constraint_nodes;
@@ -840,5 +737,5 @@
 				if(!node->IsActive()) continue;
 
-				if(constraint_nodes[node->Sid()]>0.){
+				if(constraint_nodes[node->Lid()]>0.){
 					node->ApplyConstraint(0,+1.);
 				}
Index: issm/trunk/src/c/analyses/LevelsetAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/LevelsetAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/LevelsetAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/LoveAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/LoveAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/LoveAnalysis.cpp	(revision 26744)
@@ -19,5 +19,4 @@
 }/*}}}*/
 void LoveAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
-
 	IssmDouble* frequencies = NULL;
 	int         nfreq;
@@ -33,7 +32,15 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.love.r0",LoveR0Enum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.love.mu0",LoveMu0Enum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.Gravitational_Constant",LoveGravitationalConstantEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.love.allow_layer_deletion",LoveAllowLayerDeletionEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.underflow_tol",LoveUnderflowTolEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.integration_steps_per_layer",LoveIntStepsPerLayerEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.istemporal",LoveIsTemporalEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.n_temporal_iterations",LoveNTemporalIterationsEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.love.love_kernels",LoveKernelsEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.love.forcing_type",LoveForcingTypeEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.inner_core_boundary",LoveInnerCoreBoundaryEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.core_mantle_boundary",LoveCoreMantleBoundaryEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.love.complex_computation",LoveComplexComputationEnum));
 }/*}}}*/
 void LoveAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
@@ -44,4 +51,7 @@
 /*Finite Element Analysis*/
 void           LoveAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_(" not needed!");
+}/*}}}*/
+void           LoveAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_(" not needed!");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/LoveAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/LoveAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/LoveAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/MasstransportAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/MasstransportAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/MasstransportAnalysis.cpp	(revision 26744)
@@ -4,4 +4,5 @@
 #include "../shared/shared.h"
 #include "../modules/modules.h"
+#include "../classes/Inputs/TransientInput.h"
 
 #define FINITEELEMENT P1Enum
@@ -61,5 +62,5 @@
 	IssmDouble *nodeonbase=NULL;
 	iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,"md.masstransport.vertex_pairing");
-	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,"md.mesh.vertexonbase");
+	if(iomodel->domaintype!=Domain2DhorizontalEnum && iomodel->domaintype!=Domain3DsurfaceEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,"md.mesh.vertexonbase");
 
 	for(int i=0;i<numvertex_pairing;i++){
@@ -99,5 +100,5 @@
 
 	/*Create Nodes either DG or CG depending on stabilization*/
-	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface");
+	if(iomodel->domaintype!=Domain2DhorizontalEnum && iomodel->domaintype!=Domain3DsurfaceEnum) iomodel->FetchData(2,"md.mesh.vertexonbase","md.mesh.vertexonsurface");
 	if(stabilization!=3){
 		::CreateNodes(nodes,iomodel,MasstransportAnalysisEnum,FINITEELEMENT,isamr);
@@ -119,4 +120,5 @@
 	bool   isoceancoupling;
 	bool   issmb;
+	int    grdmodel;
 
 	/*Fetch data needed: */
@@ -148,5 +150,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
@@ -155,15 +157,19 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum);
 	if(isgroundingline) 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.bed",BedEnum);
-	/*Initialize cumdeltalthickness input*/
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelriseCumDeltathicknessEnum);
 	/*Initialize ThicknessResidual input*/
 	InputUpdateFromConstantx(inputs,elements,0.,ThicknessResidualEnum);
 
 	/*Get what we need for ocean-induced basal melting*/
+	bool isstochastic;
 	int basalforcing_model;
 	iomodel->FindConstant(&basalforcing_model,"md.basalforcings.model");
+	iomodel->FindConstant(&isstochastic,"md.stochasticforcing.isstochasticforcing");
 	switch(basalforcing_model){
 		case FloatingMeltRateEnum:
 			iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BasalforcingsFloatingiceMeltingRateEnum);
+			if(isstochastic){
+            iomodel->FetchDataToInput(inputs,elements,"md.stochasticforcing.default_id",StochasticForcingDefaultIdEnum);
+            iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BaselineBasalforcingsFloatingiceMeltingRateEnum);
+         }
 			break;
 		case LinearFloatingMeltRateEnum:
@@ -221,8 +227,16 @@
 	}
 
-	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+	if(iomodel->domaintype!=Domain2DhorizontalEnum && iomodel->domaintype!=Domain3DsurfaceEnum){
 		iomodel->FetchDataToInput(inputs,elements,"md.mesh.vertexonbase",MeshVertexonbaseEnum);
 		iomodel->FetchDataToInput(inputs,elements,"md.mesh.vertexonsurface",MeshVertexonsurfaceEnum);
 	}
+
+	/*Initialize sea level cumulated sea level loads :*/
+	iomodel->ConstantToInput(inputs,elements,0,AccumulatedDeltaIceThicknessEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0,OldAccumulatedDeltaIceThicknessEnum,P1Enum);
+
+	/*for Ivins deformation model, initialize history of ice thickness changes:*/
+	iomodel->FindConstant(&grdmodel,"md.solidearth.settings.grdmodel");
+	if(grdmodel==IvinsEnum) inputs->SetTransientInput(TransientAccumulatedDeltaIceThicknessEnum,NULL,0);
 
 }/*}}}*/
@@ -248,4 +262,7 @@
 /*Finite Element Analysis*/
 void           MasstransportAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           MasstransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -280,5 +297,5 @@
 	int domaintype;
 	element->FindParam(&domaintype,DomainTypeEnum);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -572,7 +589,5 @@
 	}
 
-	int domaintype;
-	element->FindParam(&domaintype,DomainTypeEnum);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return pe;
 }/*}}}*/
@@ -798,4 +813,13 @@
 	if(!element->IsOnBase()) return;
 
+	/*deal with logic of accumulating thickness if we are coupled to a 
+	 * sea level core:*/
+	int frequency,count,isgrd;
+	element->FindParam(&isgrd,SolidearthSettingsGRDEnum);
+	if(isgrd){
+		element->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+		element->FindParam(&count,SealevelchangeRunCountEnum);
+	}
+
 	/*Fetch dof list and allocate solution vector*/
 	int *doflist = NULL;
@@ -839,6 +863,4 @@
 	newthickness  = xNew<IssmDouble>(numvertices);
 	IssmDouble* oldthickness      = xNew<IssmDouble>(numvertices);
-	IssmDouble* cumdeltathickness = xNew<IssmDouble>(numvertices);
-	IssmDouble* deltathickness    = xNew<IssmDouble>(numvertices);
 	IssmDouble* newbase           = xNew<IssmDouble>(numvertices);
 	IssmDouble* bed               = xNew<IssmDouble>(numvertices);
@@ -856,5 +878,4 @@
 	basalelement->GetInputListOnVertices(&phi[0],MaskOceanLevelsetEnum);
 	basalelement->GetInputListOnVertices(&sealevel[0],SealevelEnum);
-	basalelement->GetInputListOnVertices(&cumdeltathickness[0],SealevelriseCumDeltathicknessOldEnum);
 
 	/*Do we do grounding line migration?*/
@@ -862,10 +883,4 @@
 	element->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
 	if(isgroundingline) basalelement->GetInputListOnVertices(&bed[0],BedEnum);
-
-	/*What is the delta thickness forcing the sea-level rise core: cumulated over time, hence the +=:*/
-	for(int i=0;i<numvertices;i++){
-		cumdeltathickness[i] += newthickness[i]-oldthickness[i];
-		deltathickness[i]     = newthickness[i]-oldthickness[i];
-	}
 
 	/*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
@@ -902,14 +917,10 @@
 	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
 	element->AddBasalInput(BaseEnum,newbase,P1Enum);
-	element->AddBasalInput(SealevelriseCumDeltathicknessEnum,cumdeltathickness,P1Enum);
-	element->AddBasalInput(SurfaceloadIceThicknessChangeEnum,deltathickness,P1Enum);
 
 	/*Free ressources:*/
 	xDelete<IssmDouble>(newthickness);
-	xDelete<IssmDouble>(cumdeltathickness);
 	xDelete<IssmDouble>(newbase);
 	xDelete<IssmDouble>(newsurface);
 	xDelete<IssmDouble>(oldthickness);
-	xDelete<IssmDouble>(deltathickness);
 	xDelete<IssmDouble>(oldbase);
 	xDelete<IssmDouble>(oldsurface);
@@ -918,5 +929,5 @@
 	xDelete<IssmDouble>(bed);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
Index: issm/trunk/src/c/analyses/MasstransportAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/MasstransportAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/MasstransportAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/MeltingAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/MeltingAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/MeltingAnalysis.cpp	(revision 26744)
@@ -56,5 +56,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -69,4 +69,7 @@
 /*Finite Element Analysis*/
 void           MeltingAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           MeltingAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
@@ -115,5 +118,5 @@
 	xDelete<IssmDouble>(basis);
 	delete gauss;
-	basalelement->DeleteMaterials(); delete basalelement;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
Index: issm/trunk/src/c/analyses/MeltingAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/MeltingAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/MeltingAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/OceantransportAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/OceantransportAnalysis.cpp	(revision 26744)
+++ issm/trunk/src/c/analyses/OceantransportAnalysis.cpp	(revision 26744)
@@ -0,0 +1,210 @@
+#include "./OceantransportAnalysis.h"
+#include <math.h>
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../classes/Inputs/TransientInput.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+
+/*Model processing*/
+void OceantransportAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+	/*No constraints*/
+}/*}}}*/
+void OceantransportAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+	/*No loads*/
+}/*}}}*/
+void OceantransportAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
+	::CreateNodes(nodes,iomodel,OceantransportAnalysisEnum,P1Enum);
+}/*}}}*/
+int  OceantransportAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+	return 3;
+}/*}}}*/
+void OceantransportAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	int  nature=0;
+	bool isdakota=0;
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
+			counter++;
+		}
+	}
+
+	/*Plug inputs into element:*/
+	iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_water_pressure_at_sea_floor", OceantransportSpcbottompressureEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_surface_height_above_geoid",  OceantransportSpcdslEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.dsl.global_average_thermosteric_sea_level",OceantransportSpcstrEnum);
+
+	/*Resolve mmes if we not running Dakota. Otherwise, Dakota will provide a modelid, which will be use to resolve Mme, 
+	 *but it will be done in InputUpdateFromDakota:*/
+	iomodel->FetchData(&isdakota,"md.qmu.isdakota");
+	if (inputs->GetInputObjectEnum(OceantransportSpcbottompressureEnum)==DatasetInputEnum && isdakota){
+		int modelid;
+
+		/*retrieve model id: */
+		iomodel->FetchData(&modelid,"md.dsl.modelid");
+
+		/*replace dataset of forcings with only one, the modelid'th:*/
+		MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcbottompressureEnum, P1Enum);
+		MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcdslEnum, P1Enum);
+		MmeToInputFromIdx(inputs,elements,modelid,OceantransportSpcstrEnum, P0Enum);
+	}
+
+	/*Initialize sea level cumulated sea level loads :*/
+	iomodel->ConstantToInput(inputs,elements,0.,AccumulatedDeltaBottomPressureEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0.,OldAccumulatedDeltaBottomPressureEnum,P1Enum);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.bottompressure",BottomPressureEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.dsl",DslEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.str",StrEnum);
+
+}/*}}}*/
+void OceantransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+
+	int dslmodel=0;
+	int     numoutputs;
+	char**  requestedoutputs = NULL;
+
+	/*Deal with dsl multi-model ensembles: {{{*/
+	iomodel->FetchData(&dslmodel,"md.dsl.model");
+	if(dslmodel==2){
+		IssmDouble modelid; 
+		int nummodels;
+
+		/*create double param, not int param, because Dakota will be updating it as 
+		 * a double potentially: */
+		iomodel->FetchData(&modelid,"md.dsl.modelid");
+		parameters->AddObject(new DoubleParam(DslModelidEnum,modelid));
+		parameters->AddObject(iomodel->CopyConstantObject("md.dsl.nummodels",DslNummodelsEnum));
+		iomodel->FetchData(&nummodels,"md.dsl.nummodels");
+
+		/*quick checks: */
+		if(nummodels<=0)_error_("dslmme object in  md.dsl field should contain at least 1 ensemble model!");
+		if(modelid<=0 || modelid>nummodels)_error_("modelid field in dslmme object of md.dsl field should be between 1 and the number of ensemble runs!");
+	} /*}}}*/
+	/*Requested outputs {{{*/
+	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.solidearth.requested_outputs");
+	if(numoutputs)parameters->AddObject(new StringArrayParam(SealevelchangeRequestedOutputsEnum,requestedoutputs,numoutputs));
+	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs");
+	/*}}}*/
+
+}/*}}}*/
+
+/*Finite Element Analysis*/
+void           OceantransportAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           OceantransportAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+ElementVector* OceantransportAnalysis::CreateDVector(Element* element){/*{{{*/
+	/*Default, return NULL*/
+	return NULL;
+}/*}}}*/
+ElementMatrix* OceantransportAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+_error_("Not implemented");
+}/*}}}*/
+ElementMatrix* OceantransportAnalysis::CreateKMatrix(Element* element){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
+ElementVector* OceantransportAnalysis::CreatePVector(Element* element){/*{{{*/
+_error_("not implemented yet");
+}/*}}}*/
+void           OceantransportAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+
+	/*retrieve bottom pressure, dsl and str from the spcs in our element:*/
+
+	IssmDouble bp,dsl,str;
+	int       *doflist = NULL;
+
+	/*Fetch number of nodes and initialize values*/
+	int         numnodes = element->GetNumberOfNodes();
+	int         numdof   = numnodes*3;
+	IssmDouble* values   = xNew<IssmDouble>(numdof);
+
+	/*Get dof list and inputs */
+	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+	Input* bp_input=element->GetInput(OceantransportSpcbottompressureEnum); _assert_(bp_input);
+	Input* dsl_input=element->GetInput(OceantransportSpcdslEnum); _assert_(dsl_input);
+	Input* str_input=element->GetInput(OceantransportSpcstrEnum); _assert_(str_input);
+
+	/*Ok, we have the velocities in inputs, fill in solution */
+	Gauss* gauss=element->NewGauss();
+	for(int i=0;i<numnodes;i++){
+		gauss->GaussVertex(i);
+		bp_input->GetInputValue(&bp,gauss);
+		dsl_input->GetInputValue(&dsl,gauss);
+		str_input->GetInputValue(&str,gauss);
+		values[i*3+0]=bp;
+		values[i*3+1]=dsl;
+		values[i*3+2]=str;
+	}
+
+	/*Add value to global vector*/
+	solution->SetValues(numdof,doflist,values,INS_VAL);
+
+	/*Free ressources:*/
+	delete gauss;
+	xDelete<int>(doflist);
+	xDelete<IssmDouble>(values);
+}/*}}}*/
+void           OceantransportAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
+	_error_("Not implemented yet");
+}/*}}}*/
+void           OceantransportAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+
+	int         i,domaintype;
+	int*        doflist=NULL;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+	int numdof   = numnodes*3;
+
+	/*Fetch dof list and allocate solution vectors*/
+	element->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
+	IssmDouble* values    = xNew<IssmDouble>(numdof);
+	IssmDouble* bp        = xNew<IssmDouble>(numnodes);
+	IssmDouble* dsl        = xNew<IssmDouble>(numnodes);
+	IssmDouble* str        = xNew<IssmDouble>(numnodes);
+	IssmDouble  strmean;
+
+	/*Use the dof list to index into the solution vector: */
+	for(i=0;i<numdof;i++) values[i]=solution[doflist[i]];
+
+	/*Retrieve bp,dsl and str:*/
+	strmean=0;
+	for(i=0;i<numnodes;i++){
+		bp[i]=values[i*3+0];
+		dsl[i]=values[i*3+1];
+		str[i]=values[i*3+2];
+		strmean+=str[i]/numnodes;
+
+		/*Check solution*/
+		if(xIsNan<IssmDouble>(bp[i])) _error_("NaN found in bottom pressure solution vector");
+		if(xIsInf<IssmDouble>(bp[i])) _error_("Inf found in bottom pressure  solution vector");
+		if(xIsNan<IssmDouble>(dsl[i])) _error_("NaN found in dsl solution vector");
+		if(xIsInf<IssmDouble>(dsl[i])) _error_("Inf found in dsl solution vector");
+		if(xIsNan<IssmDouble>(str[i])) _error_("NaN found in str solution vector");
+		if(xIsInf<IssmDouble>(str[i])) _error_("Inf found in str solution vector");
+	}
+
+	/*Add bp, dsl and str as inputs to the tria element: */
+	element->AddInput(BottomPressureEnum,bp,P1Enum);
+	element->AddInput(DslEnum,dsl,P1Enum);
+	element->AddInput(StrEnum,&strmean,P0Enum); 
+
+	/*Free ressources:*/
+	xDelete<IssmDouble>(bp);
+	xDelete<IssmDouble>(str);
+	xDelete<IssmDouble>(dsl);
+	xDelete<IssmDouble>(values);
+	xDelete<int>(doflist);
+
+}/*}}}*/
+void           OceantransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/analyses/OceantransportAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/OceantransportAnalysis.h	(revision 26744)
+++ issm/trunk/src/c/analyses/OceantransportAnalysis.h	(revision 26744)
@@ -0,0 +1,34 @@
+/*! \file OceantransportAnalysis.h 
+ *  \brief: header file for generic external result object
+ */
+
+#ifndef _OceantransportAnalysis_
+#define _OceantransportAnalysis_
+
+/*Headers*/
+#include "./Analysis.h"
+
+class OceantransportAnalysis: public Analysis{
+
+	public:
+		/*Model processing*/
+		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+		void CreateLoads(Loads* loads, IoModel* iomodel);
+		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
+		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
+		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+
+		/*Finite element Analysis*/
+		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
+		ElementVector* CreateDVector(Element* element);
+		ElementMatrix* CreateJacobianMatrix(Element* element);
+		ElementMatrix* CreateKMatrix(Element* element);
+		ElementVector* CreatePVector(Element* element);
+		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
+		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
+		void           UpdateConstraints(FemModel* femmodel);
+};
+#endif
Index: issm/trunk/src/c/analyses/SamplingAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/SamplingAnalysis.cpp	(revision 26744)
+++ issm/trunk/src/c/analyses/SamplingAnalysis.cpp	(revision 26744)
@@ -0,0 +1,419 @@
+#include "./SamplingAnalysis.h" //
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+#include <random>
+
+#define FINITEELEMENT P1Enum
+#define 	NUMVERTICES   3
+
+/* Reimplementation of IsFaceOnBoundary with two edges on boundary supported */
+bool IsFaceOnBoundary(Element*  element)
+{
+
+	IssmDouble values[NUMVERTICES];
+	IssmDouble sum;
+
+	/*Retrieve all inputs and parameters*/
+	element->GetInputListOnVertices(&values[0],MeshVertexonboundaryEnum);
+	sum = values[0]+values[1]+values[2];
+
+	_assert_(sum==0. || sum==1. || sum==2. || sum==3.);
+
+	if(sum>1.){
+	 	return true;
+	}
+	else{
+	 return false;
+	}
+}
+
+/*Model processing*/
+void SamplingAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
+void SamplingAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
+void SamplingAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
+
+	int finiteelement;
+	finiteelement = FINITEELEMENT;
+
+	/*Check in 2d*/
+	if(iomodel->domaintype!=Domain2DhorizontalEnum) _error_("Only 2D horizontal domain is implemented.");
+
+	::CreateNodes(nodes,iomodel,SamplingAnalysisEnum,finiteelement);
+
+}/*}}}*/
+int  SamplingAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+	return 1;
+}/*}}}*/
+void SamplingAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	int    finiteelement;
+
+	/*Finite element type*/
+	finiteelement = FINITEELEMENT;
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,finiteelement);
+			counter++;
+		}
+	}
+
+	/*Create inputs: */
+	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.mesh.vertexonboundary",MeshVertexonboundaryEnum);
+
+  iomodel->FetchDataToInput(inputs,elements,"md.sampling.kappa",SamplingKappaEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.sampling.beta",SamplingBetaEnum,0.);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sample",SampleEnum,0.);
+
+}/*}}}*/
+void SamplingAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+
+	int     numoutputs;
+	char**  requestedoutputs = NULL;
+
+	parameters->AddObject(iomodel->CopyConstantObject("md.sampling.tau",SamplingTauEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.sampling.alpha",SamplingAlphaEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.sampling.robin",SamplingRobinEnum));
+	if(solution_enum==TransientSolutionEnum) parameters->AddObject(iomodel->CopyConstantObject("md.sampling.phi",SamplingPhiEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.sampling.seed",SamplingSeedEnum));
+
+	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.sampling.requested_outputs");
+	parameters->AddObject(new IntParam(SamplingNumRequestedOutputsEnum,numoutputs));
+	if(numoutputs)parameters->AddObject(new StringArrayParam(SamplingRequestedOutputsEnum,requestedoutputs,numoutputs));
+	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.sampling.requested_outputs");
+
+}/*}}}*/
+
+/*Finite Element Analysis*/
+void           SamplingAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           SamplingAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+ElementVector* SamplingAnalysis::CreateDVector(Element* element){/*{{{*/
+	/*Default, return NULL*/
+	return NULL;
+}/*}}}*/
+ElementMatrix* SamplingAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+_error_("not implemented");
+}/*}}}*/
+ElementMatrix* SamplingAnalysis::CreateKMatrix(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	//if(!element->IsIceInElement()) return NULL; // Ice in element not required for sampling capability
+
+	/*Intermediaries*/
+	bool robin;
+	int      domaintype;
+
+	/*compute all stiffness matrices for this element*/
+
+	ElementMatrix* Ke = NULL;
+	element->FindParam(&robin,SamplingRobinEnum);
+
+  if(!robin) Ke=CreateKMatrixModifiedHelmholtz(element);
+  else{
+		ElementMatrix* Ke1=CreateKMatrixModifiedHelmholtz(element);
+		ElementMatrix* Ke2=CreateKMatrixRobinBC(element);
+		Ke =new ElementMatrix(Ke1,Ke2);
+
+		delete Ke1;
+		delete Ke2;
+  }
+
+	/*clean-up and return*/
+	return Ke;
+
+}/*}}}*/
+ElementMatrix* SamplingAnalysis::CreateKMatrixModifiedHelmholtz(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	//if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries*/
+	int dim;
+	IssmDouble  D,Jdet;
+	IssmDouble* xyz_list = NULL;
+	IssmDouble kappa;
+
+	/*Get problem dimension*/
+	dim=2;	// Only 2D horizontal domain is implemented so far
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element vector and other vectors*/
+	ElementMatrix* Ke     = element->NewElementMatrix();
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+	IssmDouble*    dbasis = xNew<IssmDouble>(dim*numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	Input*	kappa_input=element->GetInput(SamplingKappaEnum); _assert_(kappa_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(2);
+	while(gauss->next()){
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		element->NodalFunctions(basis,gauss);
+		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+
+		kappa_input->GetInputValue(&kappa,gauss); _assert_(kappa>0);
+
+		D=gauss->weight*Jdet;
+
+		/* Laplacian operator */
+		for(int i=0;i<numnodes;i++){
+				for(int j=0;j<numnodes;j++){
+						Ke->values[i*numnodes+j] += D*(dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]);
+			}
+ 		}
+
+		/* Identity identity */
+		for(int i=0;i<numnodes;i++){
+				for(int j=0;j<numnodes;j++){
+					Ke->values[i*numnodes+j] += D*kappa*kappa*(basis[j]*basis[i]);
+			}
+ 		}
+
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(dbasis);
+	delete gauss;
+	return Ke;
+
+}/*}}}*/
+ElementMatrix* SamplingAnalysis::CreateKMatrixRobinBC(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	//if(!element->IsIceInElement()) return NULL;
+
+	/*If no boundary, return NULL*/
+	if(!IsFaceOnBoundary(element)) return NULL;
+
+	/*Intermediaries*/
+	IssmDouble  D,Jdet;
+	IssmDouble* xyz_list = NULL;
+	IssmDouble* xyz_list_boundary = NULL;
+	IssmDouble beta;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element vector and other vectors*/
+	ElementMatrix* Ke     = element->NewElementMatrix();
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	element->GetLevelCoordinates(&xyz_list_boundary,xyz_list,MeshVertexonboundaryEnum,1.);
+	Input*	beta_input=element->GetInput(SamplingBetaEnum); _assert_(beta_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_boundary,3);
+	while(gauss->next()){
+
+		element->JacobianDeterminantSurface(&Jdet,xyz_list_boundary,gauss);
+		element->NodalFunctions(basis,gauss);
+
+		beta_input->GetInputValue(&beta,gauss); _assert_(beta>=0);
+
+		D=gauss->weight*Jdet;
+
+		for(int i=0;i<numnodes;i++){
+				for(int j=0;j<numnodes;j++){
+						Ke->values[i*numnodes+j] += D*beta*(basis[j]*basis[i]);
+			}
+ 		}
+
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(xyz_list_boundary);
+	xDelete<IssmDouble>(basis);
+	delete gauss;
+	return Ke;
+
+}/*}}}*/
+ElementVector* SamplingAnalysis::CreatePVector(Element* element){/*{{{*/
+	//_error_("not supported");
+	return NULL;
+}/*}}}*/
+void           SamplingAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+	element->GetSolutionFromInputsOneDof(solution,SampleEnum);
+}/*}}}*/
+void           SamplingAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
+	_error_("not supported");
+}/*}}}*/
+void           SamplingAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+
+    /*Fetch number of nodes and dof for this finite element*/
+    int numnodes = element->GetNumberOfNodes();
+
+		/*Fetch dof list and allocate solution vector*/
+		int* doflist=NULL;
+    element->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
+    IssmDouble* newsample = xNew<IssmDouble>(numnodes);
+
+    /*Use the dof list to index into the solution vector: */
+    for(int i=0;i<numnodes;i++){
+			newsample[i]=solution[doflist[i]];
+			/*Check solution*/
+			if(xIsNan<IssmDouble>(newsample[i])) _error_("NaN found in solution vector");
+			if(xIsInf<IssmDouble>(newsample[i])) _error_("Inf found in solution vector");
+		}
+
+    /*Add sample inputs to the tria element: */
+    element->AddInput(SampleEnum,newsample,element->GetElementType());
+
+    /*Free ressources:*/
+    xDelete<IssmDouble>(newsample);
+    xDelete<int>(doflist);
+ }/*}}}*/
+void           SamplingAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+	/*Default, do nothing*/
+  return;
+}/*}}}*/
+
+ElementMatrix* SamplingAnalysis::CreateMassMatrix(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	//if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries*/
+	IssmDouble  D,Jdet;
+	IssmDouble* xyz_list = NULL;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element vector and other vectors*/
+	ElementMatrix* Me     = element->NewElementMatrix();
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(2);
+	while(gauss->next()){
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		element->NodalFunctions(basis,gauss);
+
+		D=gauss->weight*Jdet;
+		TripleMultiply(basis,1,numnodes,1,
+					&D,1,1,0,
+					basis,1,numnodes,0,
+					&Me->values[0],1);
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	delete gauss;
+	return Me;
+}/*}}}*/
+void           SamplingAnalysis::LumpedKMatrix(Vector<IssmDouble>** pKlff,FemModel* femmodel){/*{{{*/
+
+	/*Initialize Lumped mass matrix (actually we just save its diagonal)*/
+	int fsize      = femmodel->nodes->NumberOfDofs(FsetEnum);
+	int flocalsize = femmodel->nodes->NumberOfDofsLocal(FsetEnum);
+	Vector<IssmDouble>* Klff = new Vector<IssmDouble>(flocalsize,fsize);
+
+	/*Create and assemble matrix*/
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element*       element = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		ElementMatrix* KLe     = this->CreateKMatrix(element);
+		if(KLe){
+			KLe->Lump();
+			KLe->AddDiagonalToGlobal(Klff);
+		}
+		delete KLe;
+	}
+	Klff->Assemble();
+
+	/*Assign output pointer*/
+	*pKlff=Klff;
+}/*}}}*/
+void           SamplingAnalysis::KMatrix(Matrix<IssmDouble>** pKff,FemModel* femmodel){/*{{{*/
+
+	/*Initialize K matrix*/
+	Matrix<IssmDouble> *Kff = NULL;
+	AllocateSystemMatricesx(&Kff,NULL,NULL,NULL,femmodel);
+
+	/*Create and assemble matrix*/
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element*       element = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		ElementMatrix* Ke     = this->CreateKMatrix(element);
+		if(Ke){
+			Ke->AddToGlobal(Kff);
+		}
+		delete Ke;
+	}
+	Kff->Assemble();
+
+	/*Assign output pointer*/
+	*pKff=Kff;
+
+}/*}}}*/
+void           SamplingAnalysis::LumpedMassMatrix(Vector<IssmDouble>** pMlff,FemModel* femmodel){/*{{{*/
+
+	/*Initialize Lumped mass matrix (actually we just save its diagonal)*/
+	int fsize      = femmodel->nodes->NumberOfDofs(FsetEnum);
+	int flocalsize = femmodel->nodes->NumberOfDofsLocal(FsetEnum);
+	Vector<IssmDouble>* Mlff = new Vector<IssmDouble>(flocalsize,fsize);
+
+	/*Create and assemble matrix*/
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element*       element = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		ElementMatrix* MLe     = this->CreateMassMatrix(element);
+		if(MLe){
+			MLe->Lump();
+			MLe->AddDiagonalToGlobal(Mlff);
+		}
+		delete MLe;
+	}
+	Mlff->Assemble();
+
+	/*Assign output pointer*/
+	*pMlff=Mlff;
+}/*}}}*/
+void           SamplingAnalysis::MassMatrix(Matrix<IssmDouble>** pMff,FemModel* femmodel){/*{{{*/
+
+	/*Initialize Mass matrix*/
+	Matrix<IssmDouble> *Mff = NULL;
+	AllocateSystemMatricesx(&Mff,NULL,NULL,NULL,femmodel);
+
+	/*Create and assemble matrix*/
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element*       element = xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		ElementMatrix* MLe     = this->CreateMassMatrix(element);
+		if(MLe){
+			MLe->AddToGlobal(Mff);
+		}
+		delete MLe;
+	}
+	Mff->Assemble();
+
+	/*Assign output pointer*/
+	*pMff=Mff;
+}/*}}}*/
Index: issm/trunk/src/c/analyses/SamplingAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/SamplingAnalysis.h	(revision 26744)
+++ issm/trunk/src/c/analyses/SamplingAnalysis.h	(revision 26744)
@@ -0,0 +1,43 @@
+/*! \file SamplingAnalysis.h
+ *  \brief: header file for generic external result object
+ */
+
+#ifndef _SamplingAnalysis_
+#define _SamplingAnalysis_
+
+/*Headers*/
+#include "./Analysis.h"
+
+class SamplingAnalysis: public Analysis{
+
+	public:
+		/*Model processing*/
+		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+		void CreateLoads(Loads* loads, IoModel* iomodel);
+		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
+		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
+		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+
+		/*Finite element Analysis*/
+		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
+		ElementVector* CreateDVector(Element* element);
+		ElementMatrix* CreateJacobianMatrix(Element* element);
+		ElementMatrix* CreateKMatrix(Element* element);
+		ElementMatrix* CreateKMatrixModifiedHelmholtz(Element* element);
+		ElementMatrix* CreateKMatrixRobinBC(Element* element);
+		ElementMatrix* CreateMassMatrix(Element* element);
+    ElementVector* CreatePVector(Element* element);
+		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
+		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
+		void           UpdateConstraints(FemModel* femmodel);
+
+		void           LumpedKMatrix(Vector<IssmDouble>** pKLff,FemModel* femmodel);
+		void           KMatrix(Matrix<IssmDouble>** pKff,FemModel* femmodel);
+		void           LumpedMassMatrix(Vector<IssmDouble>** pMLff,FemModel* femmodel);
+		void           MassMatrix(Matrix<IssmDouble>** pMff,FemModel* femmodel);
+
+};
+#endif
Index: issm/trunk/src/c/analyses/SealevelchangeAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/SealevelchangeAnalysis.cpp	(revision 26744)
+++ issm/trunk/src/c/analyses/SealevelchangeAnalysis.cpp	(revision 26744)
@@ -0,0 +1,586 @@
+#include "./SealevelchangeAnalysis.h"
+#include <math.h>
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../classes/Inputs/TransientInput.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+#include "../cores/cores.h"
+
+/*Model processing*/
+void SealevelchangeAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+	/*No constraints*/
+}/*}}}*/
+void SealevelchangeAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+	/*No loads*/
+}/*}}}*/
+void SealevelchangeAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
+	::CreateNodes(nodes,iomodel,SealevelchangeAnalysisEnum,P1Enum);
+}/*}}}*/
+int  SealevelchangeAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+	return 1;
+}/*}}}*/
+void SealevelchangeAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	int isexternal=0;
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
+			counter++;
+		}
+	}
+
+	/*Create inputs: */
+	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
+	iomodel->FetchDataToInput(inputs,elements,"md.geometry.bed",BedEnum);
+
+	/*external solidearthsolution: solid-Earth model*/
+	iomodel->FetchData(&isexternal,"md.solidearth.isexternal");
+
+	if(isexternal){
+		iomodel->FetchDataToInput(inputs,elements,"md.solidearth.external.displacementeast",SolidearthExternalDisplacementEastRateEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.solidearth.external.displacementnorth",SolidearthExternalDisplacementNorthRateEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.solidearth.external.displacementup",SolidearthExternalDisplacementUpRateEnum);
+		iomodel->FetchDataToInput(inputs,elements,"md.solidearth.external.geoid",SolidearthExternalGeoidRateEnum);
+
+		/*Resolve Mmes using the modelid, if necessary:*/
+		if (inputs->GetInputObjectEnum(SolidearthExternalDisplacementEastRateEnum)==DatasetInputEnum){
+			int modelid;
+
+			/*retrieve model id: */
+			iomodel->FetchData(&modelid,"md.solidearth.external.modelid");
+
+			/*replace dataset of forcings with only one, the modelid'th:*/
+			MmeToInputFromIdx(inputs,elements,modelid,SolidearthExternalDisplacementNorthRateEnum, P1Enum);
+			MmeToInputFromIdx(inputs,elements,modelid,SolidearthExternalDisplacementEastRateEnum, P1Enum);
+			MmeToInputFromIdx(inputs,elements,modelid,SolidearthExternalDisplacementUpRateEnum, P1Enum);
+			MmeToInputFromIdx(inputs,elements,modelid,SolidearthExternalGeoidRateEnum, P1Enum);
+		}
+	}
+
+	/*Initialize solid earth motion and sea level: */
+	iomodel->ConstantToInput(inputs,elements,0.,BedEastEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0.,BedNorthEnum,P1Enum);
+    iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum);
+
+	/*Initialize loads:*/
+	iomodel->ConstantToInput(inputs,elements,0.,DeltaTwsEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0.,DeltaIceThicknessEnum,P1Enum);
+	iomodel->ConstantToInput(inputs,elements,0.,DeltaBottomPressureEnum,P1Enum);
+
+}/*}}}*/
+void SealevelchangeAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+
+	int         nl;
+	int         ntimesteps;
+	IssmDouble* love_h=NULL;
+	IssmDouble* love_k=NULL;
+	IssmDouble* love_l=NULL;
+	IssmDouble* love_th=NULL;
+	IssmDouble* love_tk=NULL;
+	IssmDouble* love_tl=NULL;
+	IssmDouble* love_timefreq=NULL;
+	bool        love_istime=true;
+	int         externalnature=0;
+	int         isexternal=0;
+
+	IssmDouble* G_gravi = NULL;
+	IssmDouble* G_gravi_local = NULL;
+	IssmDouble* G_viscoelastic = NULL;
+	IssmDouble* G_viscoelastic_interpolated = NULL;
+	IssmDouble* G_viscoelastic_local = NULL;
+	IssmDouble* U_viscoelastic = NULL;
+	IssmDouble* U_viscoelastic_interpolated = NULL;
+	IssmDouble* U_viscoelastic_local = NULL;
+	IssmDouble* H_viscoelastic = NULL;
+	IssmDouble* H_viscoelastic_interpolated= NULL;
+	IssmDouble* H_viscoelastic_local = NULL;
+	int         M,m,lower_row,upper_row;
+	IssmDouble  degacc=.01;
+	IssmDouble  timeacc;
+	IssmDouble  planetradius=0;
+	IssmDouble  planetarea=0;
+	bool		selfattraction=false;
+	bool		elastic=false;
+	bool		viscous=false;
+	bool		rotation=false;
+	int         ndeg;
+	int         horiz;
+
+	bool istime=true;
+	IssmDouble start_time,final_time;
+	int  nt,precomputednt;
+
+	int     numoutputs;
+	char**  requestedoutputs = NULL;
+
+	/*transition vectors: */
+	IssmDouble **transitions    = NULL;
+	int         *transitions_M    = NULL;
+	int         *transitions_N    = NULL;
+	int          ntransitions;
+	IssmDouble*  partitionice=NULL;
+	IssmDouble*  partitionhydro=NULL;
+	IssmDouble*  partitionocean=NULL;
+	IssmDouble*  bslcice_partition=NULL;
+	IssmDouble*  bslchydro_partition=NULL;
+	IssmDouble*  bslcocean_partition=NULL;
+	int          npartice,nparthydro,npartocean,nel;
+	int          grdmodel;
+
+	/*some constant parameters: */
+	parameters->AddObject(iomodel->CopyConstantObject("md.dsl.model",DslModelEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.isexternal",SolidearthIsExternalEnum));
+	iomodel->FetchData(&isexternal,"md.solidearth.isexternal");
+	if(isexternal) parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.external.nature",SolidearthExternalNatureEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.runfrequency",SolidearthSettingsRunFrequencyEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.reltol",SolidearthSettingsReltolEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.abstol",SolidearthSettingsAbstolEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.maxiter",SolidearthSettingsMaxiterEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.selfattraction",SolidearthSettingsSelfAttractionEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.horiz",SolidearthSettingsHorizEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.elastic",SolidearthSettingsElasticEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.viscous",SolidearthSettingsViscousEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.rotation",SolidearthSettingsRotationEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.equatorialmoi",RotationalEquatorialMoiEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.polarmoi",RotationalPolarMoiEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.angularvelocity",RotationalAngularVelocityEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.grdocean",SolidearthSettingsGrdOceanEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.ocean_area_scaling",SolidearthSettingsOceanAreaScalingEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.sealevelloading",SolidearthSettingsSealevelLoadingEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.isgrd",SolidearthSettingsGRDEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.compute_bp_grd",SolidearthSettingsComputeBpGrdEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.planetradius",SolidearthPlanetRadiusEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.cross_section_shape",SolidearthSettingsCrossSectionShapeEnum));
+
+	parameters->AddObject(new DoubleParam(CumBslcEnum,0.0));
+	parameters->AddObject(new DoubleParam(CumBslcIceEnum,0.0));
+	parameters->AddObject(new DoubleParam(CumBslcHydroEnum,0.0));
+	parameters->AddObject(new DoubleParam(CumGmtslcEnum,0.0));
+
+	/*compute planet area and plug into parameters:*/
+	iomodel->FetchData(&planetradius,"md.solidearth.planetradius");
+	planetarea=4*PI*planetradius*planetradius;
+	parameters->AddObject(new DoubleParam(SolidearthPlanetAreaEnum,planetarea));
+
+	/*Deal with partition of the barystatic contribution:*/
+	iomodel->FetchData(&npartice,"md.solidearth.npartice");
+	parameters->AddObject(new IntParam(SolidearthNpartIceEnum,npartice));
+	if(npartice){
+		iomodel->FetchData(&partitionice,&nel,NULL,"md.solidearth.partitionice");
+		parameters->AddObject(new DoubleMatParam(SolidearthPartitionIceEnum,partitionice,nel,1));
+		parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.npartice",SolidearthNpartIceEnum));
+		bslcice_partition=xNewZeroInit<IssmDouble>(npartice);
+		parameters->AddObject(new DoubleMatParam(CumBslcIcePartitionEnum,bslcice_partition,npartice,1));
+		xDelete<IssmDouble>(partitionice);
+	}
+
+	iomodel->FetchData(&nparthydro,"md.solidearth.nparthydro");
+	parameters->AddObject(new IntParam(SolidearthNpartHydroEnum,nparthydro));
+	if(nparthydro){
+		iomodel->FetchData(&partitionhydro,&nel,NULL,"md.solidearth.partitionhydro");
+		parameters->AddObject(new DoubleMatParam(SolidearthPartitionHydroEnum,partitionhydro,nel,1));
+		parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.nparthydro",SolidearthNpartHydroEnum));
+		bslchydro_partition=xNewZeroInit<IssmDouble>(nparthydro);
+		parameters->AddObject(new DoubleMatParam(CumBslcHydroPartitionEnum,bslchydro_partition,nparthydro,1));
+		xDelete<IssmDouble>(partitionhydro);
+	}
+
+	iomodel->FetchData(&npartocean,"md.solidearth.npartocean");
+	parameters->AddObject(new IntParam(SolidearthNpartOceanEnum,npartocean));
+	if(npartocean){
+		iomodel->FetchData(&partitionocean,&nel,NULL,"md.solidearth.partitionocean");
+		parameters->AddObject(new DoubleMatParam(SolidearthPartitionOceanEnum,partitionocean,nel,1));
+		parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.npartocean",SolidearthNpartOceanEnum));
+		bslcocean_partition=xNewZeroInit<IssmDouble>(npartocean);
+		parameters->AddObject(new DoubleMatParam(CumBslcOceanPartitionEnum,bslcocean_partition,npartocean,1));
+		xDelete<IssmDouble>(partitionocean);
+	}
+	/*New optimized code:*/
+	ToolkitsOptionsFromAnalysis(parameters,SealevelchangeAnalysisEnum); //this is requested by the BarystaticContributions class inner vectors.
+	BarystaticContributions* barystaticcontributions=new BarystaticContributions(iomodel);
+	parameters->AddObject(new GenericParam<BarystaticContributions*>(barystaticcontributions,BarystaticContributionsEnum));
+
+	/*Deal with external multi-model ensembles: {{{*/
+	if(isexternal){
+		iomodel->FetchData(&externalnature,"md.solidearth.external.nature");
+		if(externalnature>=3){
+			IssmDouble modelid; 
+			int nummodels;
+
+			/*create double param, not int param, because Dakota will be updating it as a double potentially: */
+			iomodel->FetchData(&modelid,"md.solidearth.external.modelid");
+			parameters->AddObject(new DoubleParam(SolidearthExternalModelidEnum,modelid));
+			parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.external.nummodels",SolidearthExternalNummodelsEnum));
+			iomodel->FetchData(&nummodels,"md.solidearth.external.nummodels");
+
+			/*quick checks: */
+			if(nummodels<=0)_error_("mme solidearth solution object in  md.solidearth.external field should contain at least 1 ensemble model!");
+			if(modelid<=0 || modelid>nummodels)_error_("modelid field in md.solidearth.external field should be between 1 and the number of ensemble runs!");
+		} /*}}}*/
+	}
+
+	parameters->FindParam(&grdmodel,GrdModelEnum);
+	if(grdmodel==ElasticEnum){
+		/*Deal with elasticity {{{*/
+		iomodel->FetchData(&selfattraction,"md.solidearth.settings.selfattraction");
+		iomodel->FetchData(&elastic,"md.solidearth.settings.elastic");
+		iomodel->FetchData(&viscous,"md.solidearth.settings.viscous");
+		iomodel->FetchData(&rotation,"md.solidearth.settings.rotation");
+		iomodel->FetchData(&horiz,"md.solidearth.settings.horiz");
+
+		if(selfattraction){
+			/*compute green functions for a range of angles*/
+			iomodel->FetchData(&degacc,"md.solidearth.settings.degacc");
+			M=reCast<int,IssmDouble>(180./degacc+1.);
+		}
+
+		/*love numbers: */
+		if(viscous || elastic){
+			int dummy;
+
+			iomodel->FetchData(&timeacc,"md.solidearth.settings.timeacc");
+			iomodel->FetchData(&start_time,"md.timestepping.start_time");
+			iomodel->FetchData(&final_time,"md.timestepping.final_time");
+			iomodel->FetchData(&love_istime,"md.solidearth.lovenumbers.istime");
+			iomodel->FetchData(&love_timefreq,&precomputednt,&dummy,"md.solidearth.lovenumbers.timefreq");
+			iomodel->FetchData(&love_h,&ndeg,&precomputednt,"md.solidearth.lovenumbers.h");
+			iomodel->FetchData(&love_k,&ndeg,&precomputednt,"md.solidearth.lovenumbers.k");
+			iomodel->FetchData(&love_l,&ndeg,&precomputednt,"md.solidearth.lovenumbers.l");
+			iomodel->FetchData(&love_th,&ndeg,&precomputednt,"md.solidearth.lovenumbers.th");
+			iomodel->FetchData(&love_tk,&ndeg,&precomputednt,"md.solidearth.lovenumbers.tk");
+			iomodel->FetchData(&love_tl,&ndeg,&precomputednt,"md.solidearth.lovenumbers.tl");
+
+			parameters->AddObject(new DoubleParam(SolidearthSettingsTimeAccEnum,timeacc));
+			parameters->AddObject(new DoubleMatParam(LoadLoveHEnum,love_h,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(LoadLoveKEnum,love_k,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(LoadLoveLEnum,love_l,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(TidalLoveHEnum,love_th,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(TidalLoveKEnum,love_tk,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(TidalLoveLEnum,love_tl,ndeg,precomputednt));
+			parameters->AddObject(new DoubleMatParam(LoveTimeFreqEnum,love_timefreq,precomputednt,1));
+			parameters->AddObject(new BoolParam(LoveIsTimeEnum,love_istime));
+
+			// AD performance is sensitive to calls to ensurecontiguous.
+			// // Providing "t" will cause ensurecontiguous to be called.
+			if(viscous){
+				IssmDouble* viscoustimes=NULL;
+				ntimesteps=precomputednt; 
+				nt=reCast<int,IssmDouble>((final_time-start_time)/timeacc)+1;
+
+				parameters->AddObject(new IntParam(SealevelchangeViscousNumStepsEnum,nt));
+				/*Initialize viscous stack times:*/
+				viscoustimes=xNew<IssmDouble>(nt);
+				for(int t=0;t<nt;t++){
+					viscoustimes[t]=start_time+timeacc*t;
+				}
+				parameters->AddObject(new DoubleVecParam(SealevelchangeViscousTimesEnum,viscoustimes,nt));
+				parameters->AddObject(new IntParam(SealevelchangeViscousIndexEnum,0));
+				xDelete<IssmDouble>(viscoustimes);
+			}
+			else {
+				ntimesteps=1;
+				nt=1;
+			}
+
+#ifdef _HAVE_AD_
+			G_viscoelastic=xNew<IssmDouble>(M*ntimesteps,"t");
+			U_viscoelastic=xNew<IssmDouble>(M*ntimesteps,"t");
+			if(horiz)H_viscoelastic=xNew<IssmDouble>(M*ntimesteps,"t");
+#else
+			G_viscoelastic=xNew<IssmDouble>(M*ntimesteps);
+			U_viscoelastic=xNew<IssmDouble>(M*ntimesteps);
+			if(horiz)H_viscoelastic=xNew<IssmDouble>(M*ntimesteps);
+#endif
+		}
+		if(selfattraction){
+#ifdef _HAVE_AD_
+			G_gravi=xNew<IssmDouble>(M,"t");
+#else
+			G_gravi=xNew<IssmDouble>(M);
+#endif
+		}
+
+		if(rotation)parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.lovenumbers.tk2secular",TidalLoveK2SecularEnum));
+
+		if(selfattraction){
+
+			/*compute combined legendre + love number (elastic green function:*/
+			m=DetermineLocalSize(M,IssmComm::GetComm());
+			GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,IssmComm::GetComm());
+		}
+		if(viscous | elastic){
+#ifdef _HAVE_AD_
+			G_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps,"t");
+			U_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps,"t");
+			if(horiz)H_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps,"t");
+#else
+			G_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps);
+			U_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps);
+			if(horiz)H_viscoelastic_local=xNew<IssmDouble>(m*ntimesteps);
+#endif
+		}
+		if(selfattraction){
+#ifdef _HAVE_AD_
+			G_gravi_local=xNew<IssmDouble>(m,"t");
+#else
+			G_gravi_local=xNew<IssmDouble>(m);
+#endif
+		}
+
+		if(selfattraction){
+			for(int i=lower_row;i<upper_row;i++){
+				IssmDouble alpha,x;
+				alpha= reCast<IssmDouble>(i)*degacc * M_PI / 180.0;
+				G_gravi_local[i-lower_row]= .5/sin(alpha/2.0);
+			}
+		}
+		if(viscous | elastic){
+			for(int i=lower_row;i<upper_row;i++){
+				IssmDouble alpha,x;
+				alpha= reCast<IssmDouble>(i)*degacc * M_PI / 180.0;
+
+				for(int t=0;t<ntimesteps;t++){
+					G_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_k[(ndeg-1)*precomputednt+t]-love_h[(ndeg-1)*precomputednt+t])*G_gravi_local[i-lower_row];
+					U_viscoelastic_local[(i-lower_row)*ntimesteps+t]= (love_h[(ndeg-1)*precomputednt+t])*G_gravi_local[i-lower_row];
+					if(horiz)H_viscoelastic_local[(i-lower_row)*ntimesteps+t]= 0; 
+				}
+
+				IssmDouble Pn = 0.; 
+				IssmDouble Pn1 = 0.; 
+				IssmDouble Pn2 = 0.; 
+				IssmDouble Pn_p = 0.; 
+				IssmDouble Pn_p1 = 0.; 
+				IssmDouble Pn_p2 = 0.; 
+
+				for (int n=0;n<ndeg;n++) {
+
+					/*compute legendre polynomials: P_n(cos\theta) & d P_n(cos\theta)/ d\theta: */
+					if(n==0){
+						Pn=1; 
+						Pn_p=0; 
+					}
+					else if(n==1){ 
+						Pn = cos(alpha); 
+						Pn_p = 1; 
+					}
+					else{
+						Pn = ( (2*n-1)*cos(alpha)*Pn1 - (n-1)*Pn2 ) /n;
+						Pn_p = ( (2*n-1)*(Pn1+cos(alpha)*Pn_p1) - (n-1)*Pn_p2 ) /n;
+					}
+					Pn2=Pn1; Pn1=Pn;
+					Pn_p2=Pn_p1; Pn_p1=Pn_p;
+
+					for(int t=0;t<ntimesteps;t++){
+						IssmDouble deltalove_G;
+						IssmDouble deltalove_U;
+
+						deltalove_G = (love_k[n*precomputednt+t]-love_k[(ndeg-1)*precomputednt+t]-love_h[n*precomputednt+t]+love_h[(ndeg-1)*precomputednt+t]);
+						deltalove_U = (love_h[n*precomputednt+t]-love_h[(ndeg-1)*precomputednt+t]);
+
+						G_viscoelastic_local[(i-lower_row)*ntimesteps+t] += deltalove_G*Pn;		                // gravitational potential 
+						U_viscoelastic_local[(i-lower_row)*ntimesteps+t] += deltalove_U*Pn;		                // vertical (up) displacement 
+						if(horiz)H_viscoelastic_local[(i-lower_row)*ntimesteps+t] += sin(alpha)*love_l[n*precomputednt+t]*Pn_p;		// horizontal displacements 
+					}
+				}
+			}
+		}
+		if(selfattraction){
+
+			/*merge G_viscoelastic_local into G_viscoelastic; U_viscoelastic_local into U_viscoelastic; H_viscoelastic_local to H_viscoelastic:{{{*/
+			int* recvcounts=xNew<int>(IssmComm::GetSize());
+			int* displs=xNew<int>(IssmComm::GetSize());
+			int  rc;
+			int  offset;
+
+			//deal with selfattraction first: 
+			ISSM_MPI_Allgather(&m,1,ISSM_MPI_INT,recvcounts,1,ISSM_MPI_INT,IssmComm::GetComm());
+
+			/*displs: */
+			ISSM_MPI_Allgather(&lower_row,1,ISSM_MPI_INT,displs,1,ISSM_MPI_INT,IssmComm::GetComm());
+
+			/*All gather:*/
+			ISSM_MPI_Allgatherv(G_gravi_local, m, ISSM_MPI_DOUBLE, G_gravi, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
+
+			if(elastic){
+				rc=m*ntimesteps;
+				offset=lower_row*ntimesteps;
+				ISSM_MPI_Allgather(&rc,1,ISSM_MPI_INT,recvcounts,1,ISSM_MPI_INT,IssmComm::GetComm());
+				ISSM_MPI_Allgather(&offset,1,ISSM_MPI_INT,displs,1,ISSM_MPI_INT,IssmComm::GetComm());
+
+				ISSM_MPI_Allgatherv(G_viscoelastic_local, m*ntimesteps, ISSM_MPI_DOUBLE, G_viscoelastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
+				ISSM_MPI_Allgatherv(U_viscoelastic_local, m*ntimesteps, ISSM_MPI_DOUBLE, U_viscoelastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
+				if(horiz)ISSM_MPI_Allgatherv(H_viscoelastic_local, m*ntimesteps, ISSM_MPI_DOUBLE, H_viscoelastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
+			}
+
+			/*free resources: */
+			xDelete<int>(recvcounts);
+			xDelete<int>(displs);
+
+			/*Avoid singularity at 0: */
+			G_gravi[0]=G_gravi[1];
+			if(elastic){
+				for(int t=0;t<ntimesteps;t++){
+					G_viscoelastic[t]=G_viscoelastic[ntimesteps+t];
+					U_viscoelastic[t]=U_viscoelastic[ntimesteps+t];
+					if(horiz)H_viscoelastic[t]=H_viscoelastic[ntimesteps+t];
+				}
+			}
+
+			/*Reinterpolate viscoelastic green kernels onto a regular gridded time 
+			 *with steps equal to timeacc:*/
+			if(viscous){
+				nt=reCast<int>((final_time-start_time)/timeacc)+1;
+#ifdef _HAVE_AD_
+				G_viscoelastic_interpolated=xNew<IssmDouble>(M*nt,"t");
+				U_viscoelastic_interpolated=xNew<IssmDouble>(M*nt,"t");
+				if(horiz)H_viscoelastic_interpolated=xNew<IssmDouble>(M*nt,"t");
+#else
+				G_viscoelastic_interpolated=xNew<IssmDouble>(M*nt);
+				U_viscoelastic_interpolated=xNew<IssmDouble>(M*nt);
+				if(horiz)H_viscoelastic_interpolated=xNew<IssmDouble>(M*nt);
+#endif
+
+				for(int t=0;t<nt;t++){
+					IssmDouble lincoeff;
+					IssmDouble viscoelastic_time=t*timeacc;
+					int        timeindex2=-1;
+
+					/*Find a way to interpolate precomputed Gkernels to our solution time stepping:*/
+					if(t!=0){
+						for(int t2=0;t2<ntimesteps;t2++){
+							if (viscoelastic_time<love_timefreq[t2]){
+								timeindex2=t2-1;
+								if(timeindex2<0)_error_("Temporal Love numbers are computed  with a time accuracy superior to the requested solution time step!");
+								lincoeff=(viscoelastic_time-love_timefreq[t2-1])/(love_timefreq[t2]-love_timefreq[t2-1]);
+								break;
+							}
+						}
+						if(timeindex2==-1)_error_("Temporal love numbers should be extended in time to encompass the requested solution time interval!");
+					}
+					else{
+						timeindex2=0;
+						lincoeff=0;
+					}
+
+					for(int index=0;index<M;index++){
+
+						int timeindex=index*nt+t;
+						int timepreindex= index*ntimesteps+timeindex2;
+						G_viscoelastic_interpolated[timeindex]=(1-lincoeff)*G_viscoelastic[timepreindex]+lincoeff*G_viscoelastic[timepreindex+1];
+						U_viscoelastic_interpolated[timeindex]=(1-lincoeff)*U_viscoelastic[timepreindex]+lincoeff*U_viscoelastic[timepreindex+1];
+						if(horiz)H_viscoelastic_interpolated[timeindex]=(1-lincoeff)*H_viscoelastic[timepreindex]+lincoeff*H_viscoelastic[timepreindex+1];
+					}
+				}
+
+			}
+			else if(elastic){
+				nt=1; //in elastic, or if we run only selfattraction, we need only one step
+#ifdef _HAVE_AD_
+				G_viscoelastic_interpolated=G_viscoelastic;
+				U_viscoelastic_interpolated=U_viscoelastic;
+				if(horiz)H_viscoelastic_interpolated=H_viscoelastic;
+#else
+				G_viscoelastic_interpolated=G_viscoelastic;
+				U_viscoelastic_interpolated=U_viscoelastic;
+				if(horiz)H_viscoelastic_interpolated=H_viscoelastic;
+#endif
+			}	
+
+			/*Save our precomputed tables into parameters*/
+			parameters->AddObject(new DoubleVecParam(SealevelchangeGSelfAttractionEnum,G_gravi,M));
+			if(viscous || elastic){
+				parameters->AddObject(new DoubleVecParam(SealevelchangeGViscoElasticEnum,G_viscoelastic_interpolated,M*nt));
+				parameters->AddObject(new DoubleVecParam(SealevelchangeUViscoElasticEnum,U_viscoelastic_interpolated,M*nt));
+				if(horiz)parameters->AddObject(new DoubleVecParam(SealevelchangeHViscoElasticEnum,H_viscoelastic_interpolated,M*nt));
+			}
+
+			/*free resources: */
+			xDelete<IssmDouble>(G_gravi);
+			xDelete<IssmDouble>(G_gravi_local);
+			if(elastic){
+				xDelete<IssmDouble>(love_h);
+				xDelete<IssmDouble>(love_k);
+				xDelete<IssmDouble>(love_l);
+				xDelete<IssmDouble>(love_th);
+				xDelete<IssmDouble>(love_tk);
+				xDelete<IssmDouble>(love_tl);
+				xDelete<IssmDouble>(G_viscoelastic);
+				xDelete<IssmDouble>(G_viscoelastic_local);
+				xDelete<IssmDouble>(U_viscoelastic);
+				xDelete<IssmDouble>(U_viscoelastic_local);
+				if(horiz){
+					xDelete<IssmDouble>(H_viscoelastic);
+					xDelete<IssmDouble>(H_viscoelastic_local);
+				}
+			}
+		} /*}}}*/
+
+		/*Indicate we have not yet run the Geometry Core module: */
+		parameters->AddObject(new BoolParam(SealevelchangeGeometryDoneEnum,false));
+		/*}}}*/
+	}
+
+	/*Transitions:{{{ */
+	iomodel->FetchData(&transitions,&transitions_M,&transitions_N,&ntransitions,"md.solidearth.transitions");
+	if(transitions){
+		parameters->AddObject(new DoubleMatArrayParam(SealevelchangeTransitionsEnum,transitions,ntransitions,transitions_M,transitions_N));
+
+		for(int i=0;i<ntransitions;i++){
+			IssmDouble* transition=transitions[i];
+			xDelete<IssmDouble>(transition);
+		}
+		xDelete<IssmDouble*>(transitions);
+		xDelete<int>(transitions_M);
+		xDelete<int>(transitions_N);
+	} /*}}}*/
+	/*Requested outputs {{{*/
+	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.solidearth.requested_outputs");
+	if(numoutputs)parameters->AddObject(new StringArrayParam(SealevelchangeRequestedOutputsEnum,requestedoutputs,numoutputs));
+	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs");
+	/*}}}*/
+
+}/*}}}*/
+
+/*Finite Element Analysis*/
+void           SealevelchangeAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           SealevelchangeAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+
+	/*run sea level change core geometry only once, after the Model Processor is done:*/
+	sealevelchange_initialgeometry(femmodel);
+
+}/*}}}*/
+ElementVector* SealevelchangeAnalysis::CreateDVector(Element* element){/*{{{*/
+	/*Default, return NULL*/
+	return NULL;
+}/*}}}*/
+ElementMatrix* SealevelchangeAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+_error_("Not implemented");
+}/*}}}*/
+ElementMatrix* SealevelchangeAnalysis::CreateKMatrix(Element* element){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
+ElementVector* SealevelchangeAnalysis::CreatePVector(Element* element){/*{{{*/
+_error_("not implemented yet");
+}/*}}}*/
+void           SealevelchangeAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+	   _error_("not implemented yet");
+}/*}}}*/
+void           SealevelchangeAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
+	_error_("Not implemented yet");
+}/*}}}*/
+void           SealevelchangeAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+	_error_("not implemeneted yet!");
+
+}/*}}}*/
+void           SealevelchangeAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/analyses/SealevelchangeAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/SealevelchangeAnalysis.h	(revision 26744)
+++ issm/trunk/src/c/analyses/SealevelchangeAnalysis.h	(revision 26744)
@@ -0,0 +1,34 @@
+/*! \file SealevelchangeAnalysis.h 
+ *  \brief: header file for generic external result object
+ */
+
+#ifndef _SealevelchangeAnalysis_
+#define _SealevelchangeAnalysis_
+
+/*Headers*/
+#include "./Analysis.h"
+
+class SealevelchangeAnalysis: public Analysis{
+
+	public:
+		/*Model processing*/
+		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+		void CreateLoads(Loads* loads, IoModel* iomodel);
+		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
+		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
+		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+
+		/*Finite element Analysis*/
+		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
+		ElementVector* CreateDVector(Element* element);
+		ElementMatrix* CreateJacobianMatrix(Element* element);
+		ElementMatrix* CreateKMatrix(Element* element);
+		ElementVector* CreatePVector(Element* element);
+		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
+		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
+		void           UpdateConstraints(FemModel* femmodel);
+};
+#endif
Index: issm/trunk/src/c/analyses/SealevelriseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/SealevelriseAnalysis.cpp	(revision 25994)
+++ 	(revision )
@@ -1,504 +1,0 @@
-#include "./SealevelriseAnalysis.h"
-#include <math.h>
-#include "../toolkits/toolkits.h"
-#include "../classes/classes.h"
-#include "../classes/Inputs/TransientInput.h"
-#include "../shared/shared.h"
-#include "../modules/modules.h"
-
-/*Model processing*/
-void SealevelriseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
-	/*No constraints*/
-}/*}}}*/
-void SealevelriseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
-	/*No loads*/
-}/*}}}*/
-void SealevelriseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr){/*{{{*/
-	::CreateNodes(nodes,iomodel,SealevelriseAnalysisEnum,P1Enum);
-}/*}}}*/
-int  SealevelriseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
-	return 1;
-}/*}}}*/
-void SealevelriseAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
-
-	int geodetic=0;
-	int dslmodel=0;
-
-	/*Update elements: */
-	int counter=0;
-	for(int i=0;i<iomodel->numberofelements;i++){
-		if(iomodel->my_elements[i]){
-			Element* element=(Element*)elements->GetObjectByOffset(counter);
-			element->Update(inputs,i,iomodel,analysis_counter,analysis_type,P1Enum);
-			counter++;
-		}
-	}
-
-	/*Create inputs: */
-	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
-	iomodel->FetchData(&geodetic,"md.solidearth.settings.computesealevelchange");
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.surfaceload.icethicknesschange",SurfaceloadIceThicknessChangeEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
-	iomodel->FetchDataToInput(inputs,elements,"md.geometry.bed",BedEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.surfaceload.waterheightchange",SurfaceloadWaterHeightChangeEnum);
-		
-	/*dynamic sea level: */
-	iomodel->FetchData(&dslmodel,"md.dsl.model");
-	if (dslmodel==1){ /*standard dsl model:{{{*/
-
-		/*deal with global mean steric rate: */
-		IssmDouble* str=NULL; 
-		IssmDouble* times = NULL;
-		int M,N;
-
-		/*fetch str vector:*/
-		iomodel->FetchData(&str,&M,&N,"md.dsl.global_average_thermosteric_sea_level_change"); _assert_(M==2);
-		
-		//recover time vector: 
-		times=xNew<IssmDouble>(N);
-		for(int t=0;t<N;t++) times[t] = str[N+t];
-
-		/*create transient input: */
-		inputs->SetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum,times,N);
-		TransientInput* transientinput = inputs->GetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum);
-		
-			
-		for(Object* & object : elements->objects){
-			Element* element=xDynamicCast<Element*>(object);
-
-			for(int t=0;t<N;t++){
-				switch(element->ObjectEnum()){
-					case TriaEnum:  transientinput->AddTriaTimeInput( t,1,&element->lid,&str[t],P0Enum); break;
-					case PentaEnum: transientinput->AddPentaTimeInput(t,1,&element->lid,&str[t],P0Enum); break;
-					default: _error_("Not implemented yet");
-				}
-			}
-		}
-
-		/*cleanup:*/
-		xDelete<IssmDouble>(times);
-		iomodel->DeleteData(str,"md.dsl.global_average_thermosteric_sea_level_change");
-
-		/*deal with dynamic sea level fields: */
-		iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_surface_height_change_above_geoid", DslSeaSurfaceHeightChangeAboveGeoidEnum);
-		iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_water_pressure_change_at_sea_floor", DslSeaWaterPressureChangeAtSeaFloorEnum);
-		
-	} /*}}}*/
-	else if (dslmodel==2){ /*multi-model ensemble dsl model:{{{*/
-	
-		/*variables:*/
-		int nummodels;
-		IssmDouble** pstr=NULL; 
-		IssmDouble*  str=NULL;
-		IssmDouble*  times = NULL;
-		int* pM = NULL;
-		int* pN = NULL;
-		int M,N;
-
-		/*deal with dsl.global_average_thermosteric_sea_level_change {{{*/
-		iomodel->FetchData(&pstr,&pM,&pN,&nummodels,"md.dsl.global_average_thermosteric_sea_level_change");
-
-		/*go through the mat array and create a dataset of transient inputs:*/
-		for (int i=0;i<nummodels;i++){
-
-			M=pM[i];
-			N=pN[i];
-			str=pstr[i];
-
-			//recover time vector: 
-			times=xNew<IssmDouble>(N);
-			for(int t=0;t<N;t++) times[t] = str[(M-1)*N+t];
-
-			TransientInput* transientinput=inputs->SetDatasetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum,i, times,N);
-			
-			for(Object* & object : elements->objects){
-				Element* element=xDynamicCast<Element*>(object);
-
-				for(int t=0;t<N;t++){
-					switch(element->ObjectEnum()){
-						case TriaEnum:  transientinput->AddTriaTimeInput( t,1,&element->lid,&str[t],P0Enum); break;
-						case PentaEnum: transientinput->AddPentaTimeInput(t,1,&element->lid,&str[t],P0Enum); break;
-						default: _error_("Not implemented yet");
-					}
-				}
-			}
-			xDelete<IssmDouble>(times);
-		}
-		/*Delete data:*/
-		for(int i=0;i<nummodels;i++){
-			IssmDouble* str=pstr[i];
-			xDelete<IssmDouble>(str);
-		}
-		xDelete<IssmDouble*>(pstr);
-		xDelete<int>(pM);
-		xDelete<int>(pN);
-		/*}}}*/
-		iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_surface_height_change_above_geoid",DslSeaSurfaceHeightChangeAboveGeoidEnum);
-		iomodel->FetchDataToInput(inputs,elements,"md.dsl.sea_water_pressure_change_at_sea_floor",DslSeaWaterPressureChangeAtSeaFloorEnum);
-
-	} /*}}}*/
-	else _error_("Dsl model " << dslmodel << " not implemented yet!");
-		
-	
-
-	/*Initialize cumdeltalthickness and sealevel rise rate input*/
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelriseCumDeltathicknessEnum);
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelNEsaRateEnum);
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelUEsaRateEnum);
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelRSLRateEnum);
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelEustaticMaskEnum);
-	InputUpdateFromConstantx(inputs,elements,0.,SealevelEustaticOceanMaskEnum);
-
-}/*}}}*/
-void SealevelriseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
-
-	int         nl;
-	IssmDouble* love_h=NULL;
-	IssmDouble* love_k=NULL;
-	IssmDouble* love_l=NULL;
-	IssmDouble* love_th=NULL;
-	IssmDouble* love_tk=NULL;
-	IssmDouble* love_tl=NULL;
-	int         dslmodel=0;
-
-	IssmDouble* G_rigid = NULL;
-	IssmDouble* G_rigid_local = NULL;
-	IssmDouble* G_elastic = NULL;
-	IssmDouble* G_elastic_local = NULL;
-	IssmDouble* U_elastic = NULL;
-	IssmDouble* U_elastic_local = NULL;
-	IssmDouble* H_elastic = NULL;
-	IssmDouble* H_elastic_local = NULL;
-	int         M,m,lower_row,upper_row;
-	IssmDouble  degacc=.01;
-	IssmDouble  planetradius=0;
-	IssmDouble  planetarea=0;
-	bool		rigid=false;
-	bool		elastic=false;
-	bool		rotation=false;
-
-	int     numoutputs;
-	char**  requestedoutputs = NULL;
-
-	/*transition vectors: */
-	IssmDouble **transitions    = NULL;
-	int         *transitions_M    = NULL;
-	int         *transitions_N    = NULL;
-	int          ntransitions;
-	IssmDouble*  partitionice=NULL;
-	IssmDouble*  partitionhydro=NULL;
-	IssmDouble*  bslrice_partition=NULL;
-	IssmDouble*  bslrhydro_partition=NULL;
-	int          npartice,nparthydro,nel;
-
-
-	/*some constant parameters: */
-	parameters->AddObject(iomodel->CopyConstantObject("md.dsl.model",DslModelEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.runfrequency",SolidearthSettingsRunFrequencyEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.reltol",SolidearthSettingsReltolEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.abstol",SolidearthSettingsAbstolEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.maxiter",SolidearthSettingsMaxiterEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.rigid",SolidearthSettingsRigidEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.horiz",SolidearthSettingsHorizEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.elastic",SolidearthSettingsElasticEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.rotation",SolidearthSettingsRotationEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.equatorialmoi",RotationalEquatorialMoiEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.polarmoi",RotationalPolarMoiEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.rotational.angularvelocity",RotationalAngularVelocityEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.ocean_area_scaling",SolidearthSettingsOceanAreaScalingEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.computesealevelchange",SolidearthSettingsComputesealevelchangeEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.isgrd",SolidearthSettingsGRDEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.planetradius",SolidearthPlanetRadiusEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.glfraction",SolidearthSettingsGlfractionEnum));
-	parameters->AddObject(new DoubleParam(CumBslrEnum,0.0));
-	parameters->AddObject(new DoubleParam(CumBslrIceEnum,0.0));
-	parameters->AddObject(new DoubleParam(CumBslrHydroEnum,0.0));
-	parameters->AddObject(new DoubleParam(CumGmtslrEnum,0.0));
-
-	/*compute planet area and plug into parameters:*/
-	iomodel->FetchData(&planetradius,"md.solidearth.planetradius");
-	planetarea=4*PI*planetradius*planetradius;
-	parameters->AddObject(new DoubleParam(SolidearthPlanetAreaEnum,planetarea));
-
-	/*Deal with partition of the barystatic contribution:*/
-	iomodel->FetchData(&npartice,"md.solidearth.npartice");
-	parameters->AddObject(new IntParam(SolidearthNpartIceEnum,npartice));
-	if(npartice){
-		iomodel->FetchData(&partitionice,&nel,NULL,"md.solidearth.partitionice");
-		parameters->AddObject(new DoubleMatParam(SolidearthPartitionIceEnum,partitionice,nel,1));
-		parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.npartice",SolidearthNpartIceEnum));
-		bslrice_partition=xNewZeroInit<IssmDouble>(npartice);
-		parameters->AddObject(new DoubleMatParam(CumBslrIcePartitionEnum,bslrice_partition,npartice,1));
-		xDelete<IssmDouble>(partitionice);
-	}
-	iomodel->FetchData(&nparthydro,"md.solidearth.nparthydro");
-	parameters->AddObject(new IntParam(SolidearthNpartHydroEnum,nparthydro));
-	if(nparthydro){
-		iomodel->FetchData(&partitionhydro,&nel,NULL,"md.solidearth.partitionhydro");
-		parameters->AddObject(new DoubleMatParam(SolidearthPartitionHydroEnum,partitionhydro,nel,1));
-		parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.nparthydro",SolidearthNpartHydroEnum));
-		bslrhydro_partition=xNewZeroInit<IssmDouble>(nparthydro);
-		parameters->AddObject(new DoubleMatParam(CumBslrHydroPartitionEnum,bslrhydro_partition,nparthydro,1));
-		xDelete<IssmDouble>(partitionhydro);
-	}
-
-	/*Deal with dsl multi-model ensembles: {{{*/
-	iomodel->FetchData(&dslmodel,"md.dsl.model");
-	parameters->AddObject(iomodel->CopyConstantObject("md.dsl.compute_fingerprints",DslComputeFingerprintsEnum));
-	if(dslmodel==2){
-		IssmDouble modelid; 
-		int nummodels;
-		
-		/*create double param, not int param, because Dakota will be updating it as 
-		 * a double potentially: */
-		iomodel->FetchData(&modelid,"md.dsl.modelid");
-		parameters->AddObject(new DoubleParam(DslModelidEnum,modelid));
-		parameters->AddObject(iomodel->CopyConstantObject("md.dsl.nummodels",DslNummodelsEnum));
-		iomodel->FetchData(&nummodels,"md.dsl.nummodels");
-
-		/*quick checks: */
-		if(nummodels<=0)_error_("dslmme object in  md.dsl field should contain at least 1 ensemble model!");
-		if(modelid<=0 || modelid>nummodels)_error_("modelid field in dslmme object of md.dsl field should be between 1 and the number of ensemble runs!");
-	} /*}}}*/
-	/*Deal with elasticity {{{*/
-	iomodel->FetchData(&rigid,"md.solidearth.settings.rigid");
-	iomodel->FetchData(&elastic,"md.solidearth.settings.elastic");
-	iomodel->FetchData(&rotation,"md.solidearth.settings.rotation");
-
-	if(elastic | rigid){
-		/*compute green functions for a range of angles*/
-		iomodel->FetchData(&degacc,"md.solidearth.settings.degacc");
-		M=reCast<int,IssmDouble>(180./degacc+1.);
-	}
-
-	/*love numbers: */
-	if(elastic){
-		iomodel->FetchData(&love_h,&nl,NULL,"md.solidearth.lovenumbers.h");
-		iomodel->FetchData(&love_k,&nl,NULL,"md.solidearth.lovenumbers.k");
-		iomodel->FetchData(&love_l,&nl,NULL,"md.solidearth.lovenumbers.l");
-		iomodel->FetchData(&love_th,&nl,NULL,"md.solidearth.lovenumbers.th");
-		iomodel->FetchData(&love_tk,&nl,NULL,"md.solidearth.lovenumbers.tk");
-		iomodel->FetchData(&love_tl,&nl,NULL,"md.solidearth.lovenumbers.tl");
-
-		parameters->AddObject(new DoubleMatParam(LoadLoveHEnum,love_h,nl,1));
-		parameters->AddObject(new DoubleMatParam(LoadLoveKEnum,love_k,nl,1));
-		parameters->AddObject(new DoubleMatParam(LoadLoveLEnum,love_l,nl,1));
-		parameters->AddObject(new DoubleMatParam(TidalLoveHEnum,love_th,nl,1));
-		parameters->AddObject(new DoubleMatParam(TidalLoveKEnum,love_tk,nl,1));
-		parameters->AddObject(new DoubleMatParam(TidalLoveLEnum,love_tl,nl,1));
-
-		// AD performance is sensitive to calls to ensurecontiguous.
-		// // Providing "t" will cause ensurecontiguous to be called.
-		#ifdef _HAVE_AD_
-		G_elastic=xNew<IssmDouble>(M,"t");
-		U_elastic=xNew<IssmDouble>(M,"t");
-		H_elastic=xNew<IssmDouble>(M,"t");
-		#else
-		G_elastic=xNew<IssmDouble>(M);
-		U_elastic=xNew<IssmDouble>(M);
-		H_elastic=xNew<IssmDouble>(M);
-		#endif
-	}
-	if(rigid){
-		#ifdef _HAVE_AD_
-		G_rigid=xNew<IssmDouble>(M,"t");
-		#else
-		G_rigid=xNew<IssmDouble>(M);
-		#endif
-	}
-	
-	if(rotation)parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.lovenumbers.tk2secular",TidalLoveK2SecularEnum));
-
-	if(rigid | elastic){
-
-		/*compute combined legendre + love number (elastic green function:*/
-		m=DetermineLocalSize(M,IssmComm::GetComm());
-		GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,IssmComm::GetComm());
-	}
-	if(elastic){
-		#ifdef _HAVE_AD_
-		G_elastic_local=xNew<IssmDouble>(m,"t");
-		U_elastic_local=xNew<IssmDouble>(m,"t");
-		H_elastic_local=xNew<IssmDouble>(m,"t");
-		#else
-		G_elastic_local=xNew<IssmDouble>(m);
-		U_elastic_local=xNew<IssmDouble>(m);
-		H_elastic_local=xNew<IssmDouble>(m);
-		#endif
-	}
-	if(rigid){
-		#ifdef _HAVE_AD_
-		G_rigid_local=xNew<IssmDouble>(m,"t");
-		#else
-		G_rigid_local=xNew<IssmDouble>(m);
-		#endif
-	}
-
-	if(rigid){
-		for(int i=lower_row;i<upper_row;i++){
-			IssmDouble alpha,x;
-			alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0;
-			G_rigid_local[i-lower_row]= .5/sin(alpha/2.0);
-		}
-	}
-	if(elastic){
-		for(int i=lower_row;i<upper_row;i++){
-			IssmDouble alpha,x;
-			alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0;
-
-			G_elastic_local[i-lower_row]= (love_k[nl-1]-love_h[nl-1])*G_rigid_local[i-lower_row];
-			U_elastic_local[i-lower_row]= (love_h[nl-1])*G_rigid_local[i-lower_row];
-			H_elastic_local[i-lower_row]= 0; 
-			IssmDouble Pn = 0.; 
-			IssmDouble Pn1 = 0.; 
-			IssmDouble Pn2 = 0.; 
-			IssmDouble Pn_p = 0.; 
-			IssmDouble Pn_p1 = 0.; 
-			IssmDouble Pn_p2 = 0.; 
-
-			for (int n=0;n<nl;n++) {
-				IssmDouble deltalove_G;
-				IssmDouble deltalove_U;
-
-				deltalove_G = (love_k[n]-love_k[nl-1]-love_h[n]+love_h[nl-1]);
-				deltalove_U = (love_h[n]-love_h[nl-1]);
-
-				/*compute legendre polynomials: P_n(cos\theta) & d P_n(cos\theta)/ d\theta: */
-				if(n==0){
-					Pn=1; 
-					Pn_p=0; 
-				}
-				else if(n==1){ 
-					Pn = cos(alpha); 
-					Pn_p = 1; 
-				}
-				else{
-					Pn = ( (2*n-1)*cos(alpha)*Pn1 - (n-1)*Pn2 ) /n;
-					Pn_p = ( (2*n-1)*(Pn1+cos(alpha)*Pn_p1) - (n-1)*Pn_p2 ) /n;
-				}
-				Pn2=Pn1; Pn1=Pn;
-				Pn_p2=Pn_p1; Pn_p1=Pn_p;
-
-				G_elastic_local[i-lower_row] += deltalove_G*Pn;		// gravitational potential 
-				U_elastic_local[i-lower_row] += deltalove_U*Pn;		// vertical (up) displacement 
-				H_elastic_local[i-lower_row] += sin(alpha)*love_l[n]*Pn_p;		// horizontal displacements 
-			}
-		}
-	}
-	if(rigid){
-
-		/*merge G_elastic_local into G_elastic; U_elastic_local into U_elastic; H_elastic_local to H_elastic:{{{*/
-		int* recvcounts=xNew<int>(IssmComm::GetSize());
-		int* displs=xNew<int>(IssmComm::GetSize());
-
-		//recvcounts:
-		ISSM_MPI_Allgather(&m,1,ISSM_MPI_INT,recvcounts,1,ISSM_MPI_INT,IssmComm::GetComm());
-
-		/*displs: */
-		ISSM_MPI_Allgather(&lower_row,1,ISSM_MPI_INT,displs,1,ISSM_MPI_INT,IssmComm::GetComm());
-
-		/*All gather:*/
-		ISSM_MPI_Allgatherv(G_rigid_local, m, ISSM_MPI_DOUBLE, G_rigid, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
-		if(elastic){
-			ISSM_MPI_Allgatherv(G_elastic_local, m, ISSM_MPI_DOUBLE, G_elastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
-			ISSM_MPI_Allgatherv(U_elastic_local, m, ISSM_MPI_DOUBLE, U_elastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
-			ISSM_MPI_Allgatherv(H_elastic_local, m, ISSM_MPI_DOUBLE, H_elastic, recvcounts, displs, ISSM_MPI_DOUBLE,IssmComm::GetComm());
-		}
-		
-		/*free resources: */
-		xDelete<int>(recvcounts);
-		xDelete<int>(displs);
-
-		/*Avoid singularity at 0: */
-		G_rigid[0]=G_rigid[1];
-		if(elastic){
-			G_elastic[0]=G_elastic[1];
-			U_elastic[0]=U_elastic[1];
-			H_elastic[0]=H_elastic[1];
-		}
-		
-
-		/*Save our precomputed tables into parameters*/
-		parameters->AddObject(new DoubleVecParam(SealevelriseGRigidEnum,G_rigid,M));
-		if(elastic){
-			parameters->AddObject(new DoubleVecParam(SealevelriseGElasticEnum,G_elastic,M));
-			parameters->AddObject(new DoubleVecParam(SealevelriseUElasticEnum,U_elastic,M));
-			parameters->AddObject(new DoubleVecParam(SealevelriseHElasticEnum,H_elastic,M));
-		}
-
-		/*free resources: */
-		xDelete<IssmDouble>(G_rigid);
-		xDelete<IssmDouble>(G_rigid_local);
-		if(elastic){
-			xDelete<IssmDouble>(love_h);
-			xDelete<IssmDouble>(love_k);
-			xDelete<IssmDouble>(love_l);
-			xDelete<IssmDouble>(love_th);
-			xDelete<IssmDouble>(love_tk);
-			xDelete<IssmDouble>(love_tl);
-			xDelete<IssmDouble>(G_elastic);
-			xDelete<IssmDouble>(G_elastic_local);
-			xDelete<IssmDouble>(U_elastic);
-			xDelete<IssmDouble>(U_elastic_local);
-			xDelete<IssmDouble>(H_elastic);
-			xDelete<IssmDouble>(H_elastic_local);
-		}
-	} /*}}}*/
-
-	/*Indicate we have not yet run the Geometry Core module: */
-	parameters->AddObject(new BoolParam(SealevelriseGeometryDoneEnum,false));
-	/*}}}*/
-
-	/*Transitions:{{{ */
-	iomodel->FetchData(&transitions,&transitions_M,&transitions_N,&ntransitions,"md.solidearth.transitions");
-	if(transitions){
-		parameters->AddObject(new DoubleMatArrayParam(SealevelriseTransitionsEnum,transitions,ntransitions,transitions_M,transitions_N));
-
-		for(int i=0;i<ntransitions;i++){
-			IssmDouble* transition=transitions[i];
-			xDelete<IssmDouble>(transition);
-		}
-		xDelete<IssmDouble*>(transitions);
-		xDelete<int>(transitions_M);
-		xDelete<int>(transitions_N);
-	} /*}}}*/
-	/*Requested outputs {{{*/
-	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.solidearth.requested_outputs");
-	if(numoutputs)parameters->AddObject(new StringArrayParam(SealevelriseRequestedOutputsEnum,requestedoutputs,numoutputs));
-	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs");
-	/*}}}*/
-
-}/*}}}*/
-
-/*Finite Element Analysis*/
-void           SealevelriseAnalysis::Core(FemModel* femmodel){/*{{{*/
-	_error_("not implemented");
-}/*}}}*/
-ElementVector* SealevelriseAnalysis::CreateDVector(Element* element){/*{{{*/
-	/*Default, return NULL*/
-	return NULL;
-}/*}}}*/
-ElementMatrix* SealevelriseAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
-_error_("Not implemented");
-}/*}}}*/
-ElementMatrix* SealevelriseAnalysis::CreateKMatrix(Element* element){/*{{{*/
-	_error_("not implemented yet");
-}/*}}}*/
-ElementVector* SealevelriseAnalysis::CreatePVector(Element* element){/*{{{*/
-_error_("not implemented yet");
-}/*}}}*/
-void           SealevelriseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	   _error_("not implemented yet");
-}/*}}}*/
-void           SealevelriseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index){/*{{{*/
-	_error_("Not implemented yet");
-}/*}}}*/
-void           SealevelriseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
-	_error_("not implemeneted yet!");
-
-}/*}}}*/
-void           SealevelriseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	return;
-}/*}}}*/
Index: issm/trunk/src/c/analyses/SealevelriseAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/SealevelriseAnalysis.h	(revision 25994)
+++ 	(revision )
@@ -1,33 +1,0 @@
-/*! \file SealevelriseAnalysis.h 
- *  \brief: header file for generic external result object
- */
-
-#ifndef _SealevelriseAnalysis_
-#define _SealevelriseAnalysis_
-
-/*Headers*/
-#include "./Analysis.h"
-
-class SealevelriseAnalysis: public Analysis{
-
-	public:
-		/*Model processing*/
-		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
-		void CreateLoads(Loads* loads, IoModel* iomodel);
-		void CreateNodes(Nodes* nodes,IoModel* iomodel,bool isamr=false);
-		int  DofsPerNode(int** doflist,int domaintype,int approximation);
-		void UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type);
-		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
-
-		/*Finite element Analysis*/
-		void           Core(FemModel* femmodel);
-		ElementVector* CreateDVector(Element* element);
-		ElementMatrix* CreateJacobianMatrix(Element* element);
-		ElementMatrix* CreateKMatrix(Element* element);
-		ElementVector* CreatePVector(Element* element);
-		void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
-		void           GradientJ(Vector<IssmDouble>* gradient,Element*  element,int control_type,int control_interp,int control_index);
-		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
-		void           UpdateConstraints(FemModel* femmodel);
-};
-#endif
Index: issm/trunk/src/c/analyses/SmbAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/SmbAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/SmbAnalysis.cpp	(revision 26744)
@@ -46,4 +46,5 @@
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.V",SmbVEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.dswrf",SmbDswrfEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.dswdiffrf",SmbDswdiffrfEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.dlwrf",SmbDlwrfEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.P",SmbPEnum);
@@ -70,8 +71,14 @@
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.Wini",SmbWiniEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.Aini",SmbAiniEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.Adiffini",SmbAdiffiniEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.Tini",SmbTiniEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.Sizeini",SmbSizeiniEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.aValue",SmbAValueEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.dulwrfValue",SmbDulwrfValueEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.teValue",SmbTeValueEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.szaValue",SmbSzaValueEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.cotValue",SmbCotValueEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.ccsnowValue",SmbCcsnowValueEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.smb.cciceValue",SmbCciceValueEnum);
 			break;
 		case SMBpddEnum:
@@ -173,4 +180,7 @@
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.b_min",SmbBMinEnum);
 			break;
+		case SMBautoregressionEnum:
+         iomodel->FetchDataToInput(inputs,elements,"md.smb.basin_id",SmbBasinsIdEnum);
+         break;
 		case SMBhenningEnum:
 			iomodel->FetchDataToInput(inputs,elements,"md.smb.smbref",SmbSmbrefEnum,0.);
@@ -212,5 +222,5 @@
 	int     numoutputs;
 	char**  requestedoutputs = NULL;
-	bool    isdelta18o,ismungsm,isd18opd,issetpddfac,interp,isfirnwarming;
+	bool    isdelta18o,ismungsm,isd18opd,issetpddfac,interp,cycle,isfirnwarming;
 	int     smb_model, smbslices, averaging;
 	IssmDouble *temp = NULL;
@@ -220,18 +230,18 @@
 
 	iomodel->FindConstant(&smb_model,"md.smb.model");
-	iomodel->FindConstant(&interp,"md.timestepping.interp_forcings");
+	iomodel->FindConstant(&interp,"md.timestepping.interp_forcing");
+	iomodel->FindConstant(&cycle,"md.timestepping.cycle_forcing");
 
 	iomodel->FindConstant(&smbslices,"md.smb.steps_per_step");
 	parameters->AddObject(new IntParam(SmbStepsPerStepEnum,smbslices));
 
-
 	parameters->AddObject(iomodel->CopyConstantObject("md.smb.averaging",SmbAveragingEnum));
 
 	switch(smb_model){
 		case SMBforcingEnum:
-			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
 			break;
 		case SMBgembEnum:
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIdx",SmbAIdxEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.smb.eIdx",SmbEIdxEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.swIdx",SmbSwIdxEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.denIdx",SmbDenIdxEnum));
@@ -252,9 +262,10 @@
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdensification",SmbIsdensificationEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isturbulentflux",SmbIsturbulentfluxEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isconstrainsurfaceT",SmbIsconstrainsurfaceTEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isdeltaLWup",SmbIsdeltaLWupEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.InitDensityScaling",SmbInitDensityScalingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.ThermoDeltaTScaling",SmbThermoDeltaTScalingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.adThresh",SmbAdThreshEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.smb.teThresh",SmbTeThreshEnum));
 			break;
 		case SMBpddEnum:
@@ -267,22 +278,22 @@
 			if(ismungsm){
 			  iomodel->FetchData(&temp,&N,&M,"md.smb.Pfac"); _assert_(N==2);
-			  parameters->AddObject(new TransientParam(SmbPfacEnum,&temp[0],&temp[M],interp,M));
+			  parameters->AddObject(new TransientParam(SmbPfacEnum,&temp[0],&temp[M],interp,cycle,M));
 			  iomodel->DeleteData(temp,"md.smb.Pfac");
 
 			  iomodel->FetchData(&temp,&N,&M,"md.smb.Tdiff"); _assert_(N==2);
-			  parameters->AddObject(new TransientParam(SmbTdiffEnum,&temp[0],&temp[M],interp,M));
+			  parameters->AddObject(new TransientParam(SmbTdiffEnum,&temp[0],&temp[M],interp,cycle,M));
 			  iomodel->DeleteData(temp,"md.smb.Tdiff");
 
 			  iomodel->FetchData(&temp,&N,&M,"md.smb.sealev"); _assert_(N==2);
-			  parameters->AddObject(new TransientParam(SmbSealevEnum,&temp[0],&temp[M],interp,M));
+			  parameters->AddObject(new TransientParam(SmbSealevEnum,&temp[0],&temp[M],interp,cycle,M));
 			  iomodel->DeleteData(temp,"md.smb.sealev");
 			}
 			if(isdelta18o){
 				iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.delta18o");
 
 				iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o_surface"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbDelta18oSurfaceEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbDelta18oSurfaceEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.delta18o_surface");
 			}
@@ -304,5 +315,5 @@
 				parameters->AddObject(iomodel->CopyConstantObject("md.smb.isprecipscaled",SmbIsprecipscaledEnum));
 				iomodel->FetchData(&temp,&N,&M,"md.smb.delta18o"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbDelta18oEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.delta18o");
 
@@ -371,12 +382,13 @@
 			/*Nothing to add to parameters*/
 			break;
+		case SMBautoregressionEnum:
+         /*Nothing to add to parameters*/
+         break;
 		case SMBhenningEnum:
 			/*Nothing to add to parameters*/
 			break;
 		case SMBcomponentsEnum:
-			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
 			break;
 		case SMBmeltcomponentsEnum:
-			parameters->AddObject(iomodel->CopyConstantObject("md.smb.isclimatology",SmbIsclimatologyEnum));
 			break;
 		case SMBgradientscomponentsEnum:
@@ -385,15 +397,15 @@
 
 				iomodel->FetchData(&temp,&N,&M,"md.smb.accugrad"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbAccugradEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbAccugradEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.accugrad");
 				iomodel->FetchData(&temp,&N,&M,"md.smb.runoffgrad"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbRunoffgradEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbRunoffgradEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.runoffgrad");
 
 				iomodel->FetchData(&temp,&N,&M,"md.smb.accuref"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbAccurefEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbAccurefEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.accuref");
 				iomodel->FetchData(&temp,&N,&M,"md.smb.runoffref"); _assert_(N==2);
-				parameters->AddObject(new TransientParam(SmbRunoffrefEnum,&temp[0],&temp[M],interp,M));
+				parameters->AddObject(new TransientParam(SmbRunoffrefEnum,&temp[0],&temp[M],interp,cycle,M));
 				iomodel->DeleteData(temp,"md.smb.runoffref");
 			break;
@@ -465,4 +477,8 @@
 			SmbGradientsElax(femmodel);
 			break;
+		case SMBautoregressionEnum:
+         if(VerboseSolution())_printf0_("    call smb autoregression module\n");
+         Smbautoregressionx(femmodel);
+         break;
 		case SMBhenningEnum:
 			if(VerboseSolution())_printf0_("  call smb Henning module\n");
@@ -497,4 +513,7 @@
 
 }/*}}}*/
+void           SmbAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* SmbAnalysis::CreateDVector(Element* element){/*{{{*/
 	_error_("not implemented");
Index: issm/trunk/src/c/analyses/SmbAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/SmbAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/SmbAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/SmoothAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/SmoothAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/SmoothAnalysis.cpp	(revision 26744)
@@ -35,4 +35,7 @@
 /*Finite Element Analysis*/
 void           SmoothAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           SmoothAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/SmoothAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/SmoothAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/SmoothAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp	(revision 26744)
@@ -188,7 +188,15 @@
 		}
 		else{
-			IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvx",StressbalanceAnalysisEnum,finiteelement,0);
-			if(iomodel->domaintype!=Domain2DverticalEnum){
-				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvy",StressbalanceAnalysisEnum,finiteelement,1);
+			if(!isMLHO){
+				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvx",StressbalanceAnalysisEnum,finiteelement,0);
+				if(iomodel->domaintype!=Domain2DverticalEnum){
+					IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvy",StressbalanceAnalysisEnum,finiteelement,1);
+				}
+			}
+			else{//MLHO 
+				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvx_base",StressbalanceAnalysisEnum,finiteelement,0);
+				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvx_shear",StressbalanceAnalysisEnum,finiteelement,1);
+				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvy_base",StressbalanceAnalysisEnum,finiteelement,2);
+				IoModelToConstraintsx(constraints,iomodel,"md.stressbalance.spcvy_shear",StressbalanceAnalysisEnum,finiteelement,3);
 			}
 		}
@@ -371,5 +379,5 @@
 				}
 				else if (IoCodeToEnumVertexEquation(reCast<int>(vertices_type[i]))==SIAApproximationEnum){
-					constraints->AddObject(new SpcDynamic(count+1,i+1,0,StressbalanceAnalysisEnum));
+					constraints->AddObject(new SpcDynamic(count+1,i+1,0,0.,StressbalanceAnalysisEnum));
 					count++;
 				}
@@ -394,5 +402,5 @@
 				}
 				else if (IoCodeToEnumVertexEquation(reCast<int>(vertices_type[i]))==SIAApproximationEnum){
-					constraints->AddObject(new SpcDynamic(count+1,i+1,1,StressbalanceAnalysisEnum));
+					constraints->AddObject(new SpcDynamic(count+1,i+1,1,0.,StressbalanceAnalysisEnum));
 					count++;
 				}
@@ -768,9 +776,25 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum,0.);
 	iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum,0.);
+	/*MLHO*/
+	if(isMLHO){
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxShearEnum,0.);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyShearEnum,0.);
+		/*3D MLHO also need to have VxBase and VyBase for reconstruting Vx and Vy*/
+		if (iomodel->domaintype==Domain3DEnum) {
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum,0.);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum,0.);
+		}
+	}
+   if(iomodel->domaintype==Domain2DhorizontalEnum){
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum,0.);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum,0.);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxSurfaceEnum,0.);
+		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VySurfaceEnum,0.);
+	}
 	iomodel->FetchDataToInput(inputs,elements,"md.stressbalance.loadingforcex",LoadingforceXEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.stressbalance.loadingforcey",LoadingforceYEnum);
@@ -792,9 +816,15 @@
 
 		/*Add basal forcings to compute melt rate*/
+		bool isstochastic;
 		int basalforcing_model;
 		iomodel->FindConstant(&basalforcing_model,"md.basalforcings.model");
+		iomodel->FindConstant(&isstochastic,"md.stochasticforcing.isstochasticforcing");
 		switch(basalforcing_model){
 			case FloatingMeltRateEnum:
 				iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BasalforcingsFloatingiceMeltingRateEnum);
+				if(isstochastic){
+					iomodel->FetchDataToInput(inputs,elements,"md.stochasticforcing.default_id",StochasticForcingDefaultIdEnum);
+					iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BaselineBasalforcingsFloatingiceMeltingRateEnum);
+				}
 				break;
 			case LinearFloatingMeltRateEnum:
@@ -907,7 +937,13 @@
 			break;
 		case 11:
+			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
 			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.friction.Cmax",FrictionCmaxEnum);
+			if(FrictionCoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(FrictionCoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
 			break;
 		case 12:
@@ -915,4 +951,14 @@
 			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
 			iomodel->FetchDataToInput(inputs,elements,"md.friction.f",FrictionfEnum);
+			break;
+		case 13:
+			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			if(FrictionCoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(FrictionCoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
 			break;
 		default:
@@ -1011,4 +1057,5 @@
 			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
 			break;
 		case 10:
@@ -1021,9 +1068,13 @@
 			break;
 		case 11:
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,2));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
 			break;
 		case 12:
 			parameters->AddObject(new IntParam(FrictionCouplingEnum,2));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 13:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
 			break;
@@ -1061,5 +1112,4 @@
 		if(solver_type==FSSolverEnum) is_schur_cg_solver = true;
 		#endif
-
 
 		if(is_schur_cg_solver)
@@ -1096,4 +1146,7 @@
 	}
 
+}/*}}}*/
+void           StressbalanceAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreateDVector(Element* element){/*{{{*/
@@ -1192,6 +1245,9 @@
 			GetSolutionFromInputsFS(solution,element);
 			return;
-		case SSAApproximationEnum: case HOApproximationEnum: case L1L2ApproximationEnum: case MLHOApproximationEnum: case SIAApproximationEnum:
+		case SSAApproximationEnum: case HOApproximationEnum: case L1L2ApproximationEnum: case SIAApproximationEnum:
 			GetSolutionFromInputsHoriz(solution,element);
+			return;
+		case MLHOApproximationEnum:
+			GetSolutionFromInputsMLHO(solution,element);
 			return;
 		case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum:
@@ -1373,5 +1429,5 @@
 
 	/*clean-up and return*/
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 
@@ -1411,5 +1467,5 @@
 
 	/*clean-up and return*/
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete Ke1;
 	delete Ke2;
@@ -1419,5 +1475,5 @@
 
 	/*Return if element is inactive*/
-	if(element->IsFloating() || !element->IsIceInElement()) return NULL;
+	if(element->IsAllFloating() || !element->IsIceInElement()) return NULL;
 
 	/*Intermediaries*/
@@ -1688,5 +1744,5 @@
 
 	/*clean-up and return*/
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete pe1;
 	delete pe2;
@@ -2071,6 +2127,13 @@
 
 	/*Add vx and vy as inputs to the tria element: */
+	/*Also add surface vx and vy for the misfit, and base vx and vy for friction*/
 	element->AddBasalInput(VxEnum,vx,element->GetElementType());
-	if(dim==2)element->AddBasalInput(VyEnum,vy,element->GetElementType());
+	element->AddBasalInput(VxSurfaceEnum,vx,element->GetElementType());
+	element->AddBasalInput(VxBaseEnum,vx,element->GetElementType());
+	if(dim==2) {
+		element->AddBasalInput(VyEnum,vy,element->GetElementType());
+		element->AddBasalInput(VySurfaceEnum,vy,element->GetElementType());
+		element->AddBasalInput(VyBaseEnum,vy,element->GetElementType());
+	}
 	element->AddBasalInput(VelEnum,vel,element->GetElementType());
 
@@ -2083,5 +2146,5 @@
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 #ifdef DISCSLOPE
@@ -2384,10 +2447,10 @@
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2Friction(Element* element){/*{{{*/
 
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || element->IsAllFloating()) return NULL;
 	Element* basalelement = element->SpawnBasalElement();
 	ElementMatrix* Ke = CreateKMatrixSSAFriction(basalelement);
 
 	/*clean-up and return*/
-	basalelement->DeleteMaterials(); delete basalelement;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	return Ke;
 }/*}}}*/
@@ -2449,5 +2512,5 @@
 	delete gauss;
 	delete gauss_base;
-	basalelement->DeleteMaterials(); delete basalelement;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<IssmDouble>(dbasis);
@@ -2482,5 +2545,5 @@
 
 	/*clean-up and return*/
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete pe1;
 	delete pe2;
@@ -2536,5 +2599,5 @@
 
 	/*Intermediaries*/
-	IssmDouble  Jdet,thickness,bed,sealevel,water_pressure,ice_pressure;
+	IssmDouble  Jdet,thickness,base,sealevel,water_pressure,ice_pressure;
 	IssmDouble  surface_under_water,base_under_water,pressure;
 	IssmDouble *xyz_list = NULL;
@@ -2564,11 +2627,11 @@
 	while(gauss->next()){
 		thickness_input->GetInputValue(&thickness,gauss);
-		base_input->GetInputValue(&bed,gauss);
+		base_input->GetInputValue(&base,gauss);
 		sealevel_input->GetInputValue(&sealevel,gauss);
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 		element->NodalFunctions(basis,gauss);
 
-		surface_under_water = min(0.,thickness+bed-sealevel); // 0 if the top of the glacier is above water level
-		base_under_water    = min(0.,bed-sealevel);           // 0 if the bottom of the glacier is above water level
+		surface_under_water = min(0.,thickness+base-sealevel); // 0 if the top of the glacier is above water level
+		base_under_water    = min(0.,base-sealevel);           // 0 if the bottom of the glacier is above water level
 		water_pressure = 1.0/2.0*gravity*rho_water*(surface_under_water*surface_under_water - base_under_water*base_under_water);
 		ice_pressure   = 1.0/2.0*gravity*rho_ice*thickness*thickness;
@@ -2675,4 +2738,10 @@
 	element->AddBasalInput(VelEnum,vel,element->GetElementType());
 
+	/*Also add surface vx and vy for the misfit, and base vx and vy for friction*/
+	element->AddBasalInput(VxSurfaceEnum,vx,element->GetElementType());
+	element->AddBasalInput(VySurfaceEnum,vy,element->GetElementType());
+	element->AddBasalInput(VxBaseEnum,vx,element->GetElementType());
+	element->AddBasalInput(VyBaseEnum,vy,element->GetElementType());
+
 	/*Free ressources:*/
 	xDelete<IssmDouble>(vel);
@@ -2683,20 +2752,37 @@
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 
 /*MLHO*/
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHO(Element* element){/*{{{*/
-	_error_("not implemented yet");
 
 	/* Check if ice in element */
 	if(!element->IsIceInElement()) return NULL;
 
+	/*Intermediaries*/
+	int      domaintype;
+	Element* basalelement;
+
+	/*Get basal element*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			basalelement = element;
+			break;
+		case Domain3DEnum: 
+			if(!element->IsOnBase()) return NULL;
+			basalelement = element->SpawnBasalElement(true);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
 	/*compute all stiffness matrices for this element*/
-	ElementMatrix* Ke1=CreateKMatrixMLHOViscous(element);
-	ElementMatrix* Ke2=CreateKMatrixMLHOFriction(element);
+	ElementMatrix* Ke1=CreateKMatrixMLHOViscous(basalelement);
+	ElementMatrix* Ke2=CreateKMatrixMLHOFriction(basalelement);
 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
 
 	/*clean-up and return*/
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete Ke1;
 	delete Ke2;
@@ -2704,79 +2790,200 @@
 }/*}}}*/
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOFriction(Element* element){/*{{{*/
-	_error_("not implemented yet");
-
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
-	Element* basalelement = element->SpawnBasalElement();
-	ElementMatrix* Ke = CreateKMatrixSSAFriction(basalelement);
-
-	/*clean-up and return*/
-	basalelement->DeleteMaterials(); delete basalelement;
-	return Ke;
-}/*}}}*/
-ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOViscous(Element* element){/*{{{*/
-	_error_("not implemented yet");
+
+	if(element->IsAllFloating()) return NULL;
 
 	/*Intermediaries*/
-	IssmDouble  viscosity,Jdet;
-	IssmDouble *xyz_list = NULL;
-
-	/*Get element on base*/
-	Element* basalelement = element->GetBasalElement()->SpawnBasalElement(true);
+	int         dim,domaintype;
+	bool        mainlyfloating;
+	int         friction_style,point1;
+	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+	IssmDouble  gllevelset,phi=1.;
+	IssmDouble *xyz_list  = NULL;
+	Gauss*      gauss     = NULL;
+
+	/*Get problem dimension*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DverticalEnum:   dim = 1;break;
+		case Domain2DhorizontalEnum: dim = 2;break;
+		case Domain3DEnum:           dim = 2;break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
 
 	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = basalelement->GetNumberOfNodes();
+	int numnodes = element->GetNumberOfNodes();
+	int numdof   = numnodes*dim;
 
 	/*Initialize Element matrix and vectors*/
-	ElementMatrix* Ke     = basalelement->NewElementMatrix(MLHOApproximationEnum);
-	IssmDouble*    dbasis = xNew<IssmDouble>(3*numnodes);
+	ElementMatrix* Ke = element->NewElementMatrix(MLHOApproximationEnum);
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
 
 	/*Retrieve all inputs and parameters*/
 	element->GetVerticesCoordinates(&xyz_list);
-	Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
-	Input* vx_input      = element->GetInput(VxEnum);      _assert_(vx_input);
-	Input* vy_input      = element->GetInput(VyEnum);      _assert_(vy_input);
+	element->FindParam(&friction_style,GroundinglineFrictionInterpolationEnum);
+	Input* surface_input    = element->GetInput(SurfaceEnum); _assert_(surface_input);
+	Input* gllevelset_input = NULL;
+
+	/*build friction object, used later on: */
+	Friction* friction=new Friction(element, dim);
+
+	/*Recover portion of element that is grounded*/
+	if(!(friction_style==SubelementFriction2Enum)) phi=element->GetGroundedPortion(xyz_list);
+	if(friction_style==SubelementFriction2Enum){
+		gllevelset_input=element->GetInput(MaskOceanLevelsetEnum); _assert_(gllevelset_input);
+		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+	   gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+	}
+	else{
+		gauss = element->NewGauss(2);
+	}
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss      = element->NewGauss(5);
-	Gauss* gauss_base = basalelement->NewGauss();
 	while(gauss->next()){
-		gauss->SynchronizeGaussBase(gauss_base);
-
-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss_base);
-
-		element->material->ViscosityL1L2(&viscosity,xyz_list,gauss,vx_input,vy_input,surface_input);
+
+		friction->GetAlpha2(&alpha2,gauss);
+		if(friction_style==SubelementFriction1Enum) alpha2=phi*alpha2;
+		else if(friction_style==SubelementFriction2Enum){
+			gllevelset_input->GetInputValue(&gllevelset, gauss);
+			if(gllevelset<0.) alpha2=0.;
+		}
+		else if(friction_style==NoFrictionOnPartiallyFloatingEnum){
+			if (phi<0.99999999) alpha2=0.;
+		}
+		else  _error_("friction interpolation "<<EnumToStringx(friction_style)<<" not implemented yet");
+
+		element->NodalFunctions(basis,gauss);
+		element->JacobianDeterminant(&Jdet, xyz_list,gauss);
 
 		for(int i=0;i<numnodes;i++){
 			for(int j=0;j<numnodes;j++){
-				Ke->values[2*i*2*numnodes+2*j] += gauss->weight*Jdet*viscosity*(
-							4.*dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
-							);
-				Ke->values[2*i*2*numnodes+2*j+1] += gauss->weight*Jdet*viscosity*(
-							2.*dbasis[1*numnodes+j]*dbasis[0*numnodes+i] + dbasis[0*numnodes+j]*dbasis[1*numnodes+i]
-							);
-				Ke->values[(2*i+1)*2*numnodes+2*j] += gauss->weight*Jdet*viscosity*(
-							2.*dbasis[0*numnodes+j]*dbasis[1*numnodes+i] + dbasis[1*numnodes+j]*dbasis[0*numnodes+i]
-							);
-				Ke->values[(2*i+1)*2*numnodes+2*j+1] += gauss->weight*Jdet*viscosity*(
-							dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + 4.*dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
-							);
+				Ke->values[(4*i+0)*2*2*numnodes+4*j+0] += alpha2*gauss->weight*Jdet*basis[i]*basis[j];
+				Ke->values[(4*i+2)*2*2*numnodes+4*j+2] += alpha2*gauss->weight*Jdet*basis[i]*basis[j];
 			}
 		}
 	}
-
-	/*Transform Coordinate System*/
-	basalelement->TransformStiffnessMatrixCoord(Ke,XYEnum);
 
 	/*Clean up and return*/
 	delete gauss;
-	delete gauss_base;
-	basalelement->DeleteMaterials(); delete basalelement;
+	delete friction;
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	return Ke;
+}/*}}}*/
+ElementMatrix* StressbalanceAnalysis::CreateKMatrixMLHOViscous(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries*/
+	IssmDouble  viscosity[4],Jdet,thickness,n;
+	IssmDouble *xyz_list = NULL;
+	int      domaintype;
+	int dim=2;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element matrix and vectors*/
+	ElementMatrix* Ke     = element->NewElementMatrix(MLHOApproximationEnum);
+	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes); // like SSA
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes); // like SSA
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	Input* thickness_input= element->GetInput(ThicknessEnum); _assert_(thickness_input);
+	Input* surface_input  = element->GetInput(SurfaceEnum);   _assert_(surface_input);
+	Input* vxbase_input   = element->GetInput(VxBaseEnum);    _assert_(vxbase_input); 
+	Input* vybase_input   = element->GetInput(VyBaseEnum);    _assert_(vybase_input);
+	Input* vxshear_input  = element->GetInput(VxShearEnum);   _assert_(vxshear_input); //shear vx at the surface 
+	Input* vyshear_input  = element->GetInput(VyShearEnum);   _assert_(vyshear_input); //shear vy at the surface
+	Input* n_input			 = element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss      = element->NewGauss(2);
+	while(gauss->next()){
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+		element->NodalFunctions(basis, gauss);
+
+		thickness_input->GetInputValue(&thickness, gauss);
+		n_input->GetInputValue(&n,gauss);
+		element->material->ViscosityMLHO(&viscosity[0],dim,xyz_list,gauss,vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input);
+
+		for(int i=0;i<numnodes;i++){//shape functions on tria element
+			for(int j=0;j<numnodes;j++){
+				Ke->values[(4*i+0)*2*2*numnodes+4*j+0] += gauss->weight*Jdet*viscosity[0]*thickness*(
+							4.*dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
+							);//K11
+				Ke->values[(4*i+0)*2*2*numnodes+4*j+1] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							4.*dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
+							)*(n+1)/(n+2);//K12
+				Ke->values[(4*i+0)*2*2*numnodes+4*j+2] += gauss->weight*Jdet*viscosity[0]*thickness*(
+							2.*dbasis[1*numnodes+j]*dbasis[0*numnodes+i] + dbasis[0*numnodes+j]*dbasis[1*numnodes+i]
+							);//K13
+				Ke->values[ (4*i+0)*2*2*numnodes+4*j+3] += gauss->weight*Jdet*viscosity[1]*thickness*(
+                     2.*dbasis[1*numnodes+j]*dbasis[0*numnodes+i] + dbasis[0*numnodes+j]*dbasis[1*numnodes+i]
+                     )*(n+1)/(n+2);//K14
+
+				Ke->values[(4*i+1)*2*2*numnodes+4*j+0] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							4.*dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
+							)*(n+1)/(n+2);//K21
+				Ke->values[(4*i+1)*2*2*numnodes+4*j+1] += gauss->weight*Jdet*viscosity[2]*thickness*(
+							4.*dbasis[0*numnodes+j]*dbasis[0*numnodes+i] + dbasis[1*numnodes+j]*dbasis[1*numnodes+i]
+							)*2*pow(n+1,2)/((2*n+3)*(n+2)) 
+							+ 
+							gauss->weight*Jdet*viscosity[3]*basis[j]*basis[i]*pow(n+1,2)/(thickness*(2*n+1))
+							;//K22
+				Ke->values[(4*i+1)*2*2*numnodes+4*j+2] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							2.*dbasis[1*numnodes+j]*dbasis[0*numnodes+i] + dbasis[0*numnodes+j]*dbasis[1*numnodes+i]
+							)*(n+1)/(n+2);//K23
+				Ke->values[(4*i+1)*2*2*numnodes+4*j+3] += gauss->weight*Jdet*viscosity[2]*thickness*(
+							2.*dbasis[1*numnodes+j]*dbasis[0*numnodes+i] + dbasis[0*numnodes+j]*dbasis[1*numnodes+i]
+							)*2*pow(n+1,2)/((2*n+3)*(n+2));//K24
+
+				Ke->values[(4*i+2)*2*2*numnodes+4*j+0] += gauss->weight*Jdet*viscosity[0]*thickness*(
+							2.*dbasis[0*numnodes+j]*dbasis[1*numnodes+i] + dbasis[1*numnodes+j]*dbasis[0*numnodes+i]
+							);//K31
+				Ke->values[(4*i+2)*2*2*numnodes+4*j+1] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							2.*dbasis[0*numnodes+j]*dbasis[1*numnodes+i] + dbasis[1*numnodes+j]*dbasis[0*numnodes+i]
+							)*(n+1)/(n+2);//K32
+				Ke->values[(4*i+2)*2*2*numnodes+4*j+2] += gauss->weight*Jdet*viscosity[0]*thickness*(
+							4.*dbasis[1*numnodes+j]*dbasis[1*numnodes+i] + dbasis[0*numnodes+j]*dbasis[0*numnodes+i]
+							);//K33
+				Ke->values[(4*i+2)*2*2*numnodes+4*j+3] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							4.*dbasis[1*numnodes+j]*dbasis[1*numnodes+i] + dbasis[0*numnodes+j]*dbasis[0*numnodes+i]
+							)*(n+1)/(n+2);//K34
+
+				Ke->values[(4*i+3)*2*2*numnodes+4*j+0] += gauss->weight*Jdet*viscosity[1]*thickness*(
+                     2.*dbasis[0*numnodes+j]*dbasis[1*numnodes+i] + dbasis[1*numnodes+j]*dbasis[0*numnodes+i]
+                     )*(n+1)/(n+2);//K41
+				Ke->values[(4*i+3)*2*2*numnodes+4*j+1] += gauss->weight*Jdet*viscosity[2]*thickness*(
+                     2.*dbasis[0*numnodes+j]*dbasis[1*numnodes+i] + dbasis[1*numnodes+j]*dbasis[0*numnodes+i]
+                     )*2*pow(n+1,2)/((2*n+3)*(n+2));//K42
+				Ke->values[(4*i+3)*2*2*numnodes+4*j+2] += gauss->weight*Jdet*viscosity[1]*thickness*(
+							4.*dbasis[1*numnodes+j]*dbasis[1*numnodes+i] + dbasis[0*numnodes+j]*dbasis[0*numnodes+i]
+							)*(n+1)/(n+2);//K43
+				Ke->values[(4*i+3)*2*2*numnodes+4*j+3] += gauss->weight*Jdet*viscosity[2]*thickness*(
+							4.*dbasis[1*numnodes+j]*dbasis[1*numnodes+i] + dbasis[0*numnodes+j]*dbasis[0*numnodes+i]
+							)*2*pow(n+1,2)/((2*n+3)*(n+2))
+							+ 
+							gauss->weight*Jdet*viscosity[3]*basis[j]*basis[i]*pow(n+1,2)/(thickness*(2*n+1))
+							;//K44
+			}
+		}
+	}
+
+	/*Transform Coordinate System*/
+	//basalelement->TransformStiffnessMatrixCoord(Ke,XYMLHOEnum);
+
+	/*Clean up and return*/
+	delete gauss;
 	xDelete<IssmDouble>(xyz_list);
 	xDelete<IssmDouble>(dbasis);
+	xDelete<IssmDouble>(basis);
 	return Ke;
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorMLHO(Element* element){/*{{{*/
-	_error_("not implemented yet");
 
 	/* Check if ice in element */
@@ -2806,5 +3013,5 @@
 
 	/*clean-up and return*/
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	delete pe1;
 	delete pe2;
@@ -2812,8 +3019,7 @@
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorMLHODrivingStress(Element* element){/*{{{*/
-	_error_("not implemented yet");
 
 	/*Intermediaries */
-	IssmDouble  thickness,Jdet,slope[2];
+	IssmDouble  thickness,Jdet,slope[2],n;
 	IssmDouble* xyz_list = NULL;
 
@@ -2829,4 +3035,5 @@
 	Input*     thickness_input=element->GetInput(ThicknessEnum); _assert_(thickness_input);
 	Input*     surface_input  =element->GetInput(SurfaceEnum);   _assert_(surface_input);
+	Input*     n_input        =element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
 	IssmDouble rhog = element->FindParam(MaterialsRhoIceEnum)*element->FindParam(ConstantsGEnum);
 
@@ -2839,13 +3046,16 @@
 		thickness_input->GetInputValue(&thickness,gauss);
 		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
-
-		for(int i=0;i<numnodes;i++){
-			pe->values[i*2+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i];
-			pe->values[i*2+1]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i];
+		n_input->GetInputValue(&n,gauss);
+
+		for(int i=0;i<numnodes;i++){// per node: vx (basal vx), vshx, vy (basal vy), vshy
+			pe->values[i*4+0]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i]; //F1
+			pe->values[i*4+1]+=-rhog*thickness*slope[0]*Jdet*gauss->weight*basis[i]*(n+1)/(n+2); //F2
+			pe->values[i*4+2]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i]; //F3
+			pe->values[i*4+3]+=-rhog*thickness*slope[1]*Jdet*gauss->weight*basis[i]*(n+1)/(n+2); //F4
 		}
 	}
 
 	/*Transform coordinate system*/
-	element->TransformLoadVectorCoord(pe,XYEnum);
+	//element->TransformLoadVectorCoord(pe,XYMLHOEnum);
 
 	/*Clean up and return*/
@@ -2856,5 +3066,4 @@
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorMLHOFront(Element* element){/*{{{*/
-	_error_("not implemented yet");
 
 	/*If no front, return NULL*/
@@ -2862,6 +3071,6 @@
 
 	/*Intermediaries*/
-	IssmDouble  Jdet,thickness,bed,sealevel,water_pressure,ice_pressure;
-	IssmDouble  surface_under_water,base_under_water,pressure;
+	IssmDouble  Jdet,thickness,base,sealevel,water_pressure,ice_pressure;
+	IssmDouble  water_pressure_sh,ice_pressure_sh,pressure_sh,pressure,n,s,b;
 	IssmDouble *xyz_list = NULL;
 	IssmDouble *xyz_list_front = NULL;
@@ -2877,6 +3086,7 @@
 	/*Retrieve all inputs and parameters*/
 	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
-	Input* base_input       = element->GetInput(BaseEnum);       _assert_(base_input);
-	Input* sealevel_input       = element->GetInput(SealevelEnum);       _assert_(sealevel_input);
+	Input* base_input      = element->GetInput(BaseEnum);       _assert_(base_input);
+	Input* sealevel_input  = element->GetInput(SealevelEnum);       _assert_(sealevel_input);
+	Input* n_input         = element->GetInput(MaterialsRheologyNEnum); _assert_(n_input);
 	IssmDouble rho_water   = element->FindParam(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->FindParam(MaterialsRhoIceEnum);
@@ -2890,23 +3100,35 @@
 	while(gauss->next()){
 		thickness_input->GetInputValue(&thickness,gauss);
-		base_input->GetInputValue(&bed,gauss);
+		base_input->GetInputValue(&base,gauss);
+		n_input->GetInputValue(&n,gauss);
 		sealevel_input->GetInputValue(&sealevel,gauss);
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 		element->NodalFunctions(basis,gauss);
 
-		surface_under_water = min(0.,thickness+bed-sealevel); // 0 if the top of the glacier is above water level
-		base_under_water    = min(0.,bed-sealevel);           // 0 if the bottom of the glacier is above water level
-		water_pressure = 1.0/2.0*gravity*rho_water*(surface_under_water*surface_under_water - base_under_water*base_under_water);
-		ice_pressure   = 1.0/2.0*gravity*rho_ice*thickness*thickness;
+		b = base-sealevel; // ice base shifted by the sea level
+		s = thickness+b;   // ice surface shifted by the sea level
+		/*Vertically integrated pressure - SSA type*/
+		water_pressure = -(1.0/2.0)*gravity*rho_water*(b*b);
+		ice_pressure   =  (1.0/2.0)*gravity*rho_ice*thickness*thickness;
 		pressure = ice_pressure + water_pressure;
+		/*Vertically integrated pressure - HO type*/
+		water_pressure_sh = gravity*rho_water*( -b*b/2 - (s*thickness/(n+2))*(1-pow(s/thickness,n+2)) + (thickness*thickness/(n+3))*(1-pow(s/thickness,n+3)) );
+		ice_pressure_sh   = gravity*rho_ice*thickness*thickness*(n+1)/(2*(n+3));
+		pressure_sh = ice_pressure_sh + water_pressure_sh;
+		if (b>0) {
+			pressure = ice_pressure;
+			pressure_sh = ice_pressure_sh;
+		}
 
 		for (int i=0;i<numnodes;i++){
-			pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i];
-			pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i];
+			pe->values[i*4+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i]; // F1
+			pe->values[i*4+1]+= pressure_sh*Jdet*gauss->weight*normal[0]*basis[i]; // F2
+			pe->values[i*4+2]+= pressure*Jdet*gauss->weight*normal[1]*basis[i]; // F3
+			pe->values[i*4+3]+= pressure_sh*Jdet*gauss->weight*normal[1]*basis[i]; // F4
 		}
 	}
 
 	/*Transform coordinate system*/
-	element->TransformLoadVectorCoord(pe,XYEnum);
+	//element->TransformLoadVectorCoord(pe,XYMLHOEnum);
 
 	/*Clean up and return*/
@@ -2919,6 +3141,4 @@
 void           StressbalanceAnalysis::InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element){/*{{{*/
 
-	_error_("not implemented yet");
-
 	int         i,dim,domaintype;
 	IssmDouble  rho_ice,g;
@@ -2933,16 +3153,20 @@
 	IssmDouble* surface   = xNew<IssmDouble>(numvertices);
 
-	element->FindParam(&dim,DomainDimensionEnum);
 	element->FindParam(&domaintype,DomainTypeEnum);
 	rho_ice =element->FindParam(MaterialsRhoIceEnum);
 	g       =element->FindParam(ConstantsGEnum);
-	if(dim==2){
-		element->GetInputListOnVertices(thickness,ThicknessEnum);
-		for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
-	}
-	else{
-		element->GetVerticesCoordinates(&xyz_list);
-		element->GetInputListOnVertices(surface,SurfaceEnum);
-		for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			element->GetInputListOnVertices(thickness,ThicknessEnum);
+			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i];
+			dim=2;
+			break;
+		case Domain3DEnum:
+			element->GetVerticesCoordinates(&xyz_list);
+			element->GetInputListOnVertices(surface,SurfaceEnum);
+			for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]);
+			dim=2;
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
 	}
 	element->AddInput(PressureEnum,pressure,P1Enum);
@@ -2965,13 +3189,22 @@
 	/*Fetch number of nodes and dof for this finite element*/
 	int numnodes = basalelement->GetNumberOfNodes();
-	int numdof   = numnodes*2;
+	int numdof   = numnodes*dim*2; //2xdim DOFs per node
 
 	/*Fetch dof list and allocate solution vectors*/
-	basalelement->GetDofListLocal(&doflist,NoneApproximationEnum,GsetEnum);
+	basalelement->GetDofListLocal(&doflist,MLHOApproximationEnum,GsetEnum); 
 	IssmDouble* values    = xNew<IssmDouble>(numdof);
+	IssmDouble* vbx       = xNew<IssmDouble>(numnodes);
+	IssmDouble* vby       = xNew<IssmDouble>(numnodes);
+   IssmDouble* vshx      = xNew<IssmDouble>(numnodes); 
+   IssmDouble* vshy      = xNew<IssmDouble>(numnodes);
+	IssmDouble* vsx       = xNew<IssmDouble>(numnodes);
+	IssmDouble* vsy       = xNew<IssmDouble>(numnodes);
 	IssmDouble* vx        = xNew<IssmDouble>(numnodes);
 	IssmDouble* vy        = xNew<IssmDouble>(numnodes);
 	IssmDouble* vz        = xNew<IssmDouble>(numnodes);
 	IssmDouble* vel       = xNew<IssmDouble>(numnodes);
+	IssmDouble* n			 = xNew<IssmDouble>(numnodes);
+	IssmDouble* H			 = xNew<IssmDouble>(numnodes);
+	IssmDouble* s			 = xNew<IssmDouble>(numnodes);
 
 	/*Use the dof list to index into the solution vector: */
@@ -2979,37 +3212,134 @@
 
 	/*Transform solution in Cartesian Space*/
-	basalelement->TransformSolutionCoord(&values[0],XYEnum);
-	basalelement->FindParam(&domaintype,DomainTypeEnum);
-
-	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
-	for(i=0;i<numnodes;i++){
-		vx[i]=values[i*2+0];
-		vy[i]=values[i*2+1];
-
-		/*Check solution*/
-		if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector");
-		if(xIsInf<IssmDouble>(vx[i])) _error_("Inf found in solution vector");
-		if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector");
-		if(xIsInf<IssmDouble>(vy[i])) _error_("Inf found in solution vector");
-	}
-
-	/*Get Vz and compute vel*/
-	basalelement->GetInputListOnNodes(&vz[0],VzEnum,0.);
-	for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
-
-	/*Add vx and vy as inputs to the tria element: */
-	element->AddBasalInput(VxEnum,vx,element->GetElementType());
-	element->AddBasalInput(VyEnum,vy,element->GetElementType());
-	element->AddBasalInput(VelEnum,vel,element->GetElementType());
+	if(dim==2) basalelement->TransformSolutionCoord(&values[0],XYEnum);
+
+   /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+   for(i=0;i<numnodes;i++){ //numnodes of the 2D mesh in which the MLHO is written
+      vbx[i] =values[i*4+0]; //base vx
+      vshx[i]=values[i*4+1]; //shear vx
+		vsx[i] =vbx[i]+vshx[i]; //surface vx
+		if(xIsNan<IssmDouble>(vbx[i]))	_error_("NaN found in solution vector");
+      if(xIsInf<IssmDouble>(vbx[i]))	_error_("Inf found in solution vector");
+		if(xIsNan<IssmDouble>(vshx[i]))	_error_("NaN found in solution vector");
+      if(xIsInf<IssmDouble>(vshx[i]))	_error_("Inf found in solution vector");
+		vby[i] =values[i*4+2]; //base vy
+		vshy[i]=values[i*4+3]; //shear vy
+		vsy[i] =vby[i]+vshy[i]; //surface vy
+		if(xIsNan<IssmDouble>(vby[i]))	_error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(vby[i]))	_error_("Inf found in solution vector");
+		if(xIsNan<IssmDouble>(vshy[i]))	_error_("NaN found in solution vector");
+		if(xIsInf<IssmDouble>(vshy[i]))	_error_("Inf found in solution vector");
+	}
+
+	/*Add vx and vy as inputs to the tria element (shear velocities): */
+	element->AddBasalInput(VxShearEnum,vshx,element->GetElementType());
+	element->AddBasalInput(VyShearEnum,vshy,element->GetElementType());
+
+	/*Add vx and vy as inputs to the tria element (base velocities): */
+	element->AddBasalInput(VxBaseEnum,vbx,element->GetElementType());
+	element->AddBasalInput(VyBaseEnum,vby,element->GetElementType());
+
+	/*Add vx and vy as inputs to the tria element (surface velocities): */
+	element->AddBasalInput(VxSurfaceEnum,vsx,element->GetElementType());
+	element->AddBasalInput(VySurfaceEnum,vsy,element->GetElementType());
+
+	/*Compute the vertically averaged velocities on each node*/
+	basalelement->GetInputListOnNodes(&n[0],MaterialsRheologyNEnum,0.); 
+
+	/* Reconstruct vx, vy and vz solutions for 3D problem
+	 * Add vx and vy as inputs to the tria element (vertically averaged velocities): */
+
+   switch(domaintype){
+      case Domain2DhorizontalEnum:
+			for(i=0;i<numnodes;i++){ //numnodes of the 2D mesh in which the MLHO is written
+				vx[i]=vbx[i]+vshx[i]*(n[i]+1)/(n[i]+2);
+				vy[i]=vby[i]+vshy[i]*(n[i]+1)/(n[i]+2);
+				vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i]); 
+			}
+			element->AddBasalInput(VxEnum,vx,element->GetElementType());
+			element->AddBasalInput(VyEnum,vy,element->GetElementType());
+			element->AddBasalInput(VelEnum,vel,element->GetElementType()); 
+         break;
+      case Domain3DEnum:
+		   basalelement->GetInputListOnNodes(&H[0],ThicknessEnum,0.);
+		   basalelement->GetInputListOnNodes(&s[0],SurfaceEnum,0.);
+			element->Recover3DMLHOInput(VxEnum, numnodes, vbx, vshx, n, H, s);
+			element->Recover3DMLHOInput(VyEnum, numnodes, vby, vshy, n, H, s);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
 
 	/*Free ressources:*/
 	xDelete<IssmDouble>(vel);
+	xDelete<IssmDouble>(vx);
+	xDelete<IssmDouble>(vy);
 	xDelete<IssmDouble>(vz);
-	xDelete<IssmDouble>(vy);
-	xDelete<IssmDouble>(vx);
+	xDelete<IssmDouble>(vby);
+	xDelete<IssmDouble>(vbx);
+	xDelete<IssmDouble>(vsy);
+	xDelete<IssmDouble>(vsx);
+	xDelete<IssmDouble>(vshy);
+	xDelete<IssmDouble>(vshx);
 	xDelete<IssmDouble>(values);
 	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(n);
+	xDelete<IssmDouble>(s);
+	xDelete<IssmDouble>(H);
 	xDelete<int>(doflist);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+}/*}}}*/
+void           StressbalanceAnalysis::GetSolutionFromInputsMLHO(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+
+	IssmDouble   vbx,vby,vshx,vshy;
+	int          domaintype,dim,approximation,dofpernode;
+	int*         doflist = NULL;
+
+	/*Get some parameters*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum: dim = 2; dofpernode = 4; break;
+		case Domain3DEnum: dim = 2; dofpernode = 4; break;
+		case Domain2DverticalEnum: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+	int numdof   = numnodes*dofpernode;
+	element->GetInputValue(&approximation,ApproximationEnum);
+	if(approximation!=MLHOApproximationEnum) _error_("mesh "<<EnumToStringx(approximation)<<" not supported here");
+
+	/*Fetch dof list and allocate solution vector*/
+	element->GetDofList(&doflist,approximation,GsetEnum); 
+	IssmDouble* values = xNew<IssmDouble>(numdof);
+
+	/*Get inputs*/
+	Input* vxbase_input	=element->GetInput(VxBaseEnum);	_assert_(vxbase_input);
+	Input* vxshear_input	=element->GetInput(VxShearEnum);	_assert_(vxshear_input);
+	Input* vybase_input	=element->GetInput(VyBaseEnum);	_assert_(vybase_input);
+	Input* vyshear_input	=element->GetInput(VyShearEnum);	_assert_(vyshear_input);
+
+	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+	Gauss* gauss=element->NewGauss();
+	for(int i=0;i<numnodes;i++){
+		gauss->GaussNode(element->FiniteElement(),i);
+
+		/*Recover vx and vy*/
+		vxbase_input->GetInputValue(&vbx,gauss);	//base vx
+		vxshear_input->GetInputValue(&vshx,gauss);//shear vx
+		values[i*dofpernode+0]=vbx;  //base vx
+		values[i*dofpernode+1]=vshx; //shear vx
+		vybase_input->GetInputValue(&vby,gauss);	//base vy
+		vyshear_input->GetInputValue(&vshy,gauss);//shear vy
+		values[i*dofpernode+2]=vby; //base vy
+		values[i*dofpernode+3]=vshy;//shear vy  
+	}
+
+	solution->SetValues(numdof,doflist,values,INS_VAL);
+
+	/*Free ressources:*/
+	delete gauss;
+	xDelete<IssmDouble>(values);
+	xDelete<int>(doflist);
 }/*}}}*/
 
@@ -3095,5 +3425,5 @@
 	if(!element->IsIceInElement()) return NULL;
 
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*Intermediaries*/
@@ -3123,5 +3453,6 @@
 
 	/*build friction object, used later on: */
-	Friction* friction=new Friction(element,dim==3?2:1);
+	/*dim=4 is special for HO, which is actually 2.5D*/
+	Friction* friction=new Friction(element,dim==3?2.5:1);
 
 	/*Recover portion of element that is grounded*/
@@ -3816,5 +4147,5 @@
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSShelf(Element* element){/*{{{*/
 
-	if(!element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(!element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*If on not water or not FS, skip stiffness: */
@@ -4040,5 +4371,4 @@
 	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
 
-
 	/* Start  looping on the number of gaussian points: */
 	Gauss* gauss = element->NewGauss(5);
@@ -4048,5 +4378,4 @@
 		element->NodalFunctionsPressure(pbasis,gauss);
 		element->material->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
-
 
 		if(dim==3 || dim==2){
@@ -4139,8 +4468,7 @@
 		mk = 1.0 /3.0;
 		element->ElementSizes(&hx,&hy,&hz);
-		hk = max(max(hx, hy), hz);
-		// if(!element->IsOnDirichletBoundary()) {
-			Tau = - mk * hk * hk * 0.125 / viscosity;
-
+		// hk = max(max(hx, hy), hz);
+		hk = max(hx, hy);
+		Tau = - mk * hk * hk * 0.125 / viscosity;
 
 		for (int q=0;q<dim;q++){
@@ -4148,5 +4476,5 @@
 			for (int p=0;p<dim;p++){
 				for(int i=0;i<vnumnodes;i++){
-					SU[q*vnumnodes*(dim+1)+i*dim+p] = (-gradViscos[p])*vdbasis[q*vnumnodes+i];
+					SU[q*numdof+i*dim+p] = (-gradViscos[p])*vdbasis[q*vnumnodes+i];
 				}
 			}
@@ -4154,10 +4482,10 @@
 			for(int i=0;i<vnumnodes;i++){
 				for (int p=0;p<dim;p++){
-					SU[q*vnumnodes*(dim+1)+i*dim+q] += (-gradViscos[p])*vdbasis[p*vnumnodes+i];
+					SU[q*numdof+i*dim+q] += (-gradViscos[p])*vdbasis[p*vnumnodes+i];
 				}
 			}
 			/* column 4 for the pressure */
-			for(int i=0;i<vnumnodes;i++){
-					SU[q*vnumnodes*(dim+1)+dim*vnumnodes+i] = FSreconditioning*vdbasis[q*vnumnodes+i];
+			for(int i=0;i<pnumnodes;i++){
+					SU[q*numdof+dim*vnumnodes+i] = FSreconditioning*vdbasis[q*vnumnodes+i];
 			}
 		}
@@ -4225,4 +4553,5 @@
 	int vnumnodes = element->NumberofNodesVelocity();
 	int pnumnodes = element->NumberofNodesPressure();
+	int numdof    = vnumnodes*dim + pnumnodes;
 
 	/*Prepare coordinate system list*/
@@ -4290,11 +4619,7 @@
 		mk = 1.0 /3.0;
 		element->ElementSizes(&hx,&hy,&hz);
-		hk = max(max(hx, hy), hz);
-		// if(!element->IsOnDirichletBoundary()) {
-			Tau = - mk * hk * hk * 0.125 / viscosity;
-		// }
-		// else {
-		// 	Tau = 0.0;
-		// }
+		// hk = max(max(hx, hy), hz);
+		hk = max(hx, hy);
+		Tau = - mk * hk * hk * 0.125 / viscosity;
 
 		for (int q=0;q<dim;q++){
@@ -4302,5 +4627,5 @@
 			for (int p=0;p<dim;p++){
 				for(int i=0;i<vnumnodes;i++){
-					SU[q*vnumnodes*(dim+1)+i*dim+p] = (-gradViscos[p])*vdbasis[q*vnumnodes+i];
+					SU[q*numdof+i*dim+p] = (-gradViscos[p])*vdbasis[q*vnumnodes+i];
 				}
 			}
@@ -4308,13 +4633,12 @@
 			for(int i=0;i<vnumnodes;i++){
 				for (int p=0;p<dim;p++){
-					SU[q*vnumnodes*(dim+1)+i*dim+q] += (-gradViscos[p])*vdbasis[p*vnumnodes+i];
+					SU[q*numdof+i*dim+q] += (-gradViscos[p])*vdbasis[p*vnumnodes+i];
 				}
 			}
 			/* column 4 for the pressure */
-			for(int i=0;i<vnumnodes;i++){
-					SU[q*vnumnodes*(dim+1)+dim*vnumnodes+i] = FSreconditioning*vdbasis[q*vnumnodes+i];
+			for(int i=0;i<pnumnodes;i++){
+					SU[q*numdof+dim*vnumnodes+i] = FSreconditioning*vdbasis[q*vnumnodes+i];
 			}
 		}
-
 		for(i=0;i<vnumnodes;i++){
 			pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
@@ -4325,6 +4649,6 @@
 		}
 
-		for(int i=0;i<vnumnodes*(dim+1);i++){
-			pe->values[i] += Tau*Jdet*gauss->weight*rho_ice*(-gravity)*SU[(dim-1)*(dim+1)*vnumnodes+i];
+		for(int i=0;i<numdof;i++){
+			pe->values[i] += Tau*Jdet*gauss->weight*rho_ice*(-gravity)*SU[(dim-1)*numdof+i];
 		}
 	}
@@ -4541,5 +4865,5 @@
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
 
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*If on water or not FS, skip stiffness: */
@@ -4813,5 +5137,5 @@
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFriction(Element* element){/*{{{*/
 
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*If on water or not FS, skip stiffness: */
@@ -5033,5 +5357,5 @@
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixFSFrictionNitsche(Element* element){/*{{{*/
 
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*If on water or not FS, skip stiffness: */
@@ -5052,5 +5376,4 @@
 	/*coefficient of Nitsche's method*/
 	IssmDouble gamma, hx, hy, hz;
-	IssmDouble pnu, qnv;
 
 	/*Get problem dimension*/
@@ -5069,7 +5392,4 @@
 	IssmDouble* vdbasis = xNew<IssmDouble>(dim*vnumnodes);
 	IssmDouble* pbasis  = xNew<IssmDouble>(pnumnodes);
-	IssmDouble* vdbasisn = xNew<IssmDouble>(vnumnodes);
-	IssmDouble* nsigma = xNew<IssmDouble>(numdof);
-	IssmDouble  bed_normal[3], bed_tangent[6];
 
 	/*Prepare coordinate system list*/
@@ -5104,6 +5424,4 @@
 	}
 
-	element->NormalBase(&bed_normal[0],xyz_list_base);
-	element->TangentBase(&bed_tangent[0], &bed_normal[0]);
 	element->ElementSizes(&hx,&hy,&hz);
 	element->FindParam(&gamma,FeFSNitscheGammaEnum);
@@ -5131,24 +5449,12 @@
 		element->material->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
 
-		/*Frictions*/
 		for(int i=0;i<vnumnodes;i++){
 			for(int j=0;j<vnumnodes;j++){
-				for (int d=0; d<2; d++) {
-					for (int p=0; p<dim; p++) {
-						for (int q=0; q<dim; q++) {
-							Ke->values[(dim*i+p)*numdof+dim*j+q] += alpha2*gauss->weight*Jdet*vbasis[i]*vbasis[j]*bed_tangent[d*3+p]*bed_tangent[d*3+q];
-						}
-					}
+				for (int d=0; d<dim; d++) {
+						Ke->values[(dim*i+d)*numdof+dim*j+d] += alpha2*gauss->weight*Jdet*vbasis[i]*vbasis[j];
 				}
 			}
 		}
 		/* -------- Nitsche terms -------- */
-		/* n\cdot\nabla\phi*/
-		for(int i=0;i<vnumnodes;i++){
-			vdbasisn[i] = 0.0;
-			for (int d=0; d<dim; d++) {
-				vdbasisn[i] += bed_normal[d]*vdbasis[d*vnumnodes+i];
-			}
-		}
 		/* Boundary terms for integration by parts.
 			The coefficient matrix of n*sigma*n-gamma*n*u is stored in the following order:
@@ -5157,50 +5463,26 @@
 		*/
 		for(int i=0;i<vnumnodes;i++){
-			for(int d=0;d<dim;d++){
-				nsigma[d*vnumnodes+i] = 2.0 * viscosity * bed_normal[d]*vdbasisn[i];
+			for(int j=0;j<vnumnodes;j++){
+				/* gamma*(n*u)*(n*v) */
+				Ke->values[(dim*i+(dim-1))*numdof+dim*j+(dim-1)] += gauss->weight*Jdet * (gamma*viscosity) * vbasis[j] * vbasis[i];
+				/* -sigma(v)*(n*u) */
+				Ke->values[(dim*i+(dim-1))*numdof+dim*j+(dim-1)] += (- gauss->weight*Jdet) * 2.0 * viscosity * (-vbasis[j]) * vdbasis[(dim-1)*vnumnodes+i];
+				/* -sigma(u)*(n*v) */
+				Ke->values[(dim*i+(dim-1))*numdof+dim*j+(dim-1)] += (- gauss->weight*Jdet) * 2.0 * viscosity * vdbasis[(dim-1)*vnumnodes+j] * (-vbasis[i]);
 			}
 		}
-		for(int i=0;i<pnumnodes;i++){
-			nsigma[dim*vnumnodes+i] = -FSreconditioning*pbasis[i];
-		}
-
-		/*velocity components A11 */
-		for(int i=0;i<vnumnodes;i++){
-			for (int p=0; p<dim; p++) {
-				for(int j=0;j<vnumnodes;j++){
-					for (int q=0; q<dim; q++) {
-						/* gamma*(n*u)*(n*v) */
-						Ke->values[(dim*i+p)*numdof+dim*j+q] += gauss->weight*Jdet * (-gamma) * bed_normal[q] * vbasis[j]*bed_normal[p] * vbasis[i];
-						/* sigma(u)*(n*v) */
-						Ke->values[(dim*i+p)*numdof+dim*j+q] += (- gauss->weight*Jdet)* nsigma[p*vnumnodes+i] * bed_normal[q] * vbasis[j];
-						/* sigma(v)*(n*u) */
-						Ke->values[(dim*i+p)*numdof+dim*j+q] += (- gauss->weight*Jdet)* bed_normal[p] * vbasis[i] * nsigma[q*vnumnodes+j];
-					}
-				}
+		/* pressure x velocity  component A12, +p*(n*v) */
+		for(int k=0;k<pnumnodes;k++){
+			for(int i=0;i<vnumnodes;i++){
+				Ke->values[(dim*i+dim-1)*numdof+dim*vnumnodes+k] += gauss->weight*Jdet * FSreconditioning*pbasis[k] * (-vbasis[i]);
 			}
 		}
-
-		/* pressure x velocity  component A12 */
+		/* velocity x pressure component A21, +(n*u)*q */
 		for(int k=0;k<pnumnodes;k++){
-			pnu = nsigma[dim*vnumnodes+k];
-			for(int i=0;i<vnumnodes;i++){
-				for (int p=0;p<dim;p++) {
-					Ke->values[(dim*i+p)*numdof+dim*vnumnodes+k] += gauss->weight*Jdet * pnu * (- bed_normal[p] * vbasis[i]);
-				}
+			for(int j=0;j<vnumnodes;j++){
+				Ke->values[(dim*vnumnodes+k)*numdof+dim*j+dim-1] += gauss->weight*Jdet * (-vbasis[j]) * FSreconditioning*pbasis[k];
 			}
 		}
-		/* velocity x pressure component A21 */
-		for(int k=0;k<pnumnodes;k++){
-			qnv = nsigma[dim*vnumnodes+k];
-			for(int j=0;j<vnumnodes;j++){
-				for (int q=0;q<dim;q++) {
-					Ke->values[(dim*vnumnodes+k)*numdof+dim*j+q] += gauss->weight*Jdet * ( - bed_normal[q] * vbasis[j]) * qnv;
-				}
-			}
-		}
-	}
-
-	/*Transform Coordinate System*/
-	element->TransformStiffnessMatrixCoord(Ke,cs_list);
+	}
 
 	/*Clean up and return*/
@@ -5212,7 +5494,4 @@
 	xDelete<IssmDouble>(vdbasis);
 	xDelete<IssmDouble>(pbasis);
-	xDelete<IssmDouble>(vdbasisn);
-	xDelete<IssmDouble>(nsigma);
-	xDelete<int>(cs_list);
 	return Ke;
 }/*}}}*/
@@ -5300,5 +5579,5 @@
 
 	/*Get basal element*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	/*Get problem dimension*/
@@ -6854,5 +7133,5 @@
 	/*If on water or not FS, skip stiffness: */
 	element->GetInputValue(&approximation,ApproximationEnum);
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	int vnumnodes = element->NumberofNodesVelocity();
@@ -7071,5 +7350,5 @@
 	if(!element->IsIceInElement()) return NULL;
 
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*Constants*/
@@ -7299,5 +7578,5 @@
 
 	/*Initialize Element matrix and return if necessary*/
-	if(element->IsFloating() || !element->IsOnBase()) return NULL;
+	if(element->IsAllFloating() || !element->IsOnBase()) return NULL;
 
 	/*Build a tria element using the 3 nodes of the base of the penta. Then use
@@ -7306,5 +7585,5 @@
 	Element* basalelement = element->SpawnBasalElement();
 	ElementMatrix* Ke=CreateKMatrixSSAFriction(basalelement);
-	basalelement->DeleteMaterials(); delete basalelement;
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 
 	/*clean-up and return*/
@@ -7416,5 +7695,5 @@
 
 	/*Initialize Element vector and return if necessary*/
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || element->IsAllFloating()) return NULL;
 	element->GetInputValue(&approximation,ApproximationEnum);
 	if(approximation!=HOFSApproximationEnum) return NULL;
@@ -7582,5 +7861,5 @@
 
 	/*Initialize Element vector and return if necessary*/
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || element->IsAllFloating()) return NULL;
 	element->GetInputValue(&approximation,ApproximationEnum);
 	if(approximation!=SSAFSApproximationEnum) return NULL;
Index: issm/trunk/src/c/analyses/StressbalanceAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
@@ -64,4 +65,5 @@
 		ElementVector* CreatePVectorMLHODrivingStress(Element* element);
 		void           InputUpdateFromSolutionMLHO(IssmDouble* solution,Element* element);
+		void           GetSolutionFromInputsMLHO(Vector<IssmDouble>* solution,Element* element);
 		/*HO*/
 		ElementMatrix* CreateJacobianMatrixHO(Element* element);
Index: issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 26744)
@@ -181,4 +181,7 @@
 		femmodel->SetCurrentConfiguration(StressbalanceSIAAnalysisEnum);
 		solutionsequence_linear(femmodel);
+}/*}}}*/
+void           StressbalanceSIAAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+_error_("not implemented");
 }/*}}}*/
 ElementVector* StressbalanceSIAAnalysis::CreateDVector(Element* element){/*{{{*/
Index: issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 26744)
@@ -5,4 +5,6 @@
 #include "../modules/modules.h"
 #include "../solutionsequences/solutionsequences.h"
+
+//#define INWOOVZ 1 //For Inwoo Park 0: incompressible assumption(IA), 1: internal deformation(ID), 2: IA+ID
 
 /*Model processing*/
@@ -105,5 +107,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -112,13 +114,20 @@
 	}
 	iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.groundedice_melting_rate",BasalforcingsGroundediceMeltingRateEnum);
-	//iomodel->FetchDataToInput(inputs,elements,"md.smb.mass_balance",SmbMassBalanceEnum);
-
+	#ifdef INWOOVZ
+	iomodel->FetchDataToInput(inputs,elements,"md.smb.mass_balance",SmbMassBalanceEnum);
+	#endif
 
 	/*Add basal forcings to compute melt rate*/
+	bool isstochastic;
 	int basalforcing_model;
 	iomodel->FindConstant(&basalforcing_model,"md.basalforcings.model");
+	iomodel->FindConstant(&isstochastic,"md.stochasticforcing.isstochasticforcing");
 	switch(basalforcing_model){
 		case FloatingMeltRateEnum:
 			iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BasalforcingsFloatingiceMeltingRateEnum);
+			if(isstochastic){
+            iomodel->FetchDataToInput(inputs,elements,"md.stochasticforcing.default_id",StochasticForcingDefaultIdEnum);
+            iomodel->FetchDataToInput(inputs,elements,"md.basalforcings.floatingice_melting_rate",BaselineBasalforcingsFloatingiceMeltingRateEnum);
+         }
 			break;
 		case LinearFloatingMeltRateEnum:
@@ -153,5 +162,5 @@
 void StressbalanceVerticalAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 
-	/*No specific parameters*/
+	/* specific parameters*/
 
 }/*}}}*/
@@ -163,4 +172,7 @@
 		femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);
 		solutionsequence_linear(femmodel);
+}/*}}}*/
+void           StressbalanceVerticalAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
 }/*}}}*/
 ElementVector* StressbalanceVerticalAnalysis::CreateDVector(Element* element){/*{{{*/
@@ -576,4 +588,45 @@
 	}
 
+	#ifdef INWOOVZ
+	IssmDouble*  thickness = xNew<IssmDouble>(numnodes);
+	IssmDouble*  base	     = xNew<IssmDouble>(numnodes);
+	IssmDouble*  smb       = xNew<IssmDouble>(numnodes);
+
+	IssmDouble rheology_n=element->material->GetN();
+	IssmDouble isvelbc   = 10./(365.25*24*3600); /*10 m/yr*/
+	/*Set analytical vertical velocity field at slow flow region.*/
+	if(INWOOVZ == 1){
+		element->GetInputListOnNodes(&thickness[0],ThicknessEnum,0.);
+		element->GetInputListOnNodes(&base[0],BaseEnum,0.);
+		element->GetInputListOnNodes(&smb[0],SmbMassBalanceEnum,0.);
+		for(i=0;i<numnodes;i++){
+			IssmDouble eta = (base[i]+thickness[i]-xyz_list[i*3+2])/thickness[i];
+			vz[i] = -(pow(eta,rheology_n+2.0)-1-(rheology_n+2.0)*(eta-1.))/(rheology_n+1.)*smb[i];
+		}	
+	}
+	else if(INWOOVZ== 2) {
+		element->GetInputListOnNodes(&thickness[0],ThicknessEnum,0.);
+		element->GetInputListOnNodes(&base[0],BaseEnum,0.);
+		element->GetInputListOnNodes(&smb[0],SmbMassBalanceEnum,0.);
+		for(i=0;i<numnodes;i++){
+			if ( vx[i]*vx[i]+vy[i]*vy[i] < isvelbc*isvelbc ){
+				IssmDouble eta = (base[i]+thickness[i]-xyz_list[i*3+2])/thickness[i];
+				vz[i] = -(pow(eta,rheology_n+2.0)-1-(rheology_n+2.0)*(eta-1.))/(rheology_n+1.)*smb[i];
+			}
+		}	
+	}
+	else if(INWOOVZ==0){
+		/*nothing to add*/
+	}
+	else{
+		_error_("not supported yet");
+	}
+
+	/*Cleanup*/
+	xDelete<IssmDouble>(smb);
+	xDelete<IssmDouble>(base);
+	xDelete<IssmDouble>(thickness);
+	#endif
+
 	/*Now Compute vel*/
 	for(i=0;i<numnodes;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
Index: issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/ThermalAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ThermalAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/ThermalAnalysis.cpp	(revision 26744)
@@ -133,5 +133,5 @@
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.surface",SurfaceEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.base",BaseEnum);
-	iomodel->FetchDataToInput(inputs,elements,"md.solidearth.initialsealevel",SealevelEnum,0);
+	iomodel->FetchDataToInput(inputs,elements,"md.initialization.sealevel",SealevelEnum,0);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
@@ -299,4 +299,7 @@
 	_error_("not implemented");
 }/*}}}*/
+void           ThermalAnalysis::PreCore(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
 ElementVector* ThermalAnalysis::CreateDVector(Element* element){/*{{{*/
 	/*Default, return NULL*/
@@ -327,5 +330,5 @@
 
 	/*Initialize Element matrix and return if necessary*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	IssmDouble  dt,Jdet,D;
@@ -333,5 +336,5 @@
 
 	/*Get basal element*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	/*Fetch number of nodes for this finite element*/
@@ -534,5 +537,5 @@
 
 	/* Geothermal flux on ice sheet base and basal friction */
-	if(!element->IsOnBase() || element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || element->IsAllFloating()) return NULL;
 
 	IssmDouble  dt,Jdet,geothermalflux,vx,vy,vz;
@@ -598,5 +601,5 @@
 
 	/*Get basal element*/
-	if(!element->IsOnBase() || !element->IsFloating()) return NULL;
+	if(!element->IsOnBase() || !element->IsAllFloating()) return NULL;
 
 	/*Fetch number of nodes for this finite element*/
Index: issm/trunk/src/c/analyses/ThermalAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/ThermalAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/ThermalAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/UzawaPressureAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/UzawaPressureAnalysis.cpp	(revision 25994)
+++ issm/trunk/src/c/analyses/UzawaPressureAnalysis.cpp	(revision 26744)
@@ -61,4 +61,7 @@
 /*Finite Element Analysis*/
 void           UzawaPressureAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+void           UzawaPressureAnalysis::PreCore(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
Index: issm/trunk/src/c/analyses/UzawaPressureAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/UzawaPressureAnalysis.h	(revision 25994)
+++ issm/trunk/src/c/analyses/UzawaPressureAnalysis.h	(revision 26744)
@@ -22,4 +22,5 @@
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           PreCore(FemModel* femmodel);
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
Index: issm/trunk/src/c/analyses/analyses.h
===================================================================
--- issm/trunk/src/c/analyses/analyses.h	(revision 25994)
+++ issm/trunk/src/c/analyses/analyses.h	(revision 26744)
@@ -1,4 +1,4 @@
 /*
- * analyses.h: 
+ * analyses.h:
  */
 
@@ -23,5 +23,4 @@
 #include "./FreeSurfaceBaseAnalysis.h"
 #include "./FreeSurfaceTopAnalysis.h"
-#include "./GiaAnalysis.h"
 #include "./GLheightadvectionAnalysis.h"
 #include "./LoveAnalysis.h"
@@ -30,4 +29,5 @@
 #include "./HydrologyDCInefficientAnalysis.h"
 #include "./HydrologyShreveAnalysis.h"
+#include "./HydrologyTwsAnalysis.h"
 #include "./HydrologyGlaDSAnalysis.h"
 #include "./HydrologyShaktiAnalysis.h"
@@ -35,6 +35,8 @@
 #include "./LevelsetAnalysis.h"
 #include "./MasstransportAnalysis.h"
+#include "./OceantransportAnalysis.h"
+#include "./SamplingAnalysis.h"
 #include "./SmbAnalysis.h"
-#include "./SealevelriseAnalysis.h"
+#include "./SealevelchangeAnalysis.h"
 #include "./MeltingAnalysis.h"
 #include "./SmoothAnalysis.h"
Index: issm/trunk/src/c/classes/AmrBamg.cpp
===================================================================
--- issm/trunk/src/c/classes/AmrBamg.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/AmrBamg.cpp	(revision 26744)
@@ -86,5 +86,5 @@
 /*Methods*/
 void AmrBamg::SetMesh(int** elementslist_in,IssmDouble** x_in,IssmDouble** y_in,int* numberofvertices_in,int* numberofelements_in){/*{{{*/
-	
+
 	/*Delete previous mesh and keep the entire mesh*/
 	if(this->elementslist) xDelete<int>(this->elementslist);
@@ -99,5 +99,5 @@
 }/*}}}*/
 void AmrBamg::GetMesh(int** elementslist_out,IssmDouble** x_out,IssmDouble** y_out,int* numberofvertices_out,int* numberofelements_out){/*{{{*/
-	
+
 	/*Get the entire mesh*/
 	*elementslist_out		= this->elementslist;
@@ -128,5 +128,5 @@
 }/*}}}*/
 void AmrBamg::ExecuteRefinementBamg(IssmDouble* field,IssmDouble* hmaxVertices,int** pdatalist,IssmDouble** pxylist,int** pelementslist){/*{{{*/
-	
+
 	/*Intermediaries*/
 	BamgGeom* geomout=new BamgGeom();
@@ -142,5 +142,5 @@
 	this->options->field			 = field;
 	this->options->hmaxVertices = hmaxVertices;
-	
+
 	/*remesh*/
 	if(this->previousmesh){
Index: issm/trunk/src/c/classes/AmrBamg.h
===================================================================
--- issm/trunk/src/c/classes/AmrBamg.h	(revision 25994)
+++ issm/trunk/src/c/classes/AmrBamg.h	(revision 26744)
@@ -28,8 +28,7 @@
 		IssmDouble deviatoricerror_maximum;
 
-
 		/* Constructor, destructor etc*/
 		AmrBamg();
-		
+
 		~AmrBamg();
 
@@ -40,8 +39,8 @@
 		void ExecuteRefinementBamg(IssmDouble* field,IssmDouble* hmaxVertices,int** pdatalist,IssmDouble** pxylist,int** pelementslist);
 		void SetBamgOpts(IssmDouble hmin_in,IssmDouble hmax_in,IssmDouble err_in,IssmDouble gradation_in);
-		
+
 		/*Access Method*/
 		BamgOpts* GetBamgOpts(){return this->options;}
-		
+
 	private:
 		BamgGeom* geometry;
Index: issm/trunk/src/c/classes/AmrNeopz.cpp
===================================================================
--- issm/trunk/src/c/classes/AmrNeopz.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/AmrNeopz.cpp	(revision 26744)
@@ -137,5 +137,5 @@
 /*Mesh refinement methods*/
 void AmrNeopz::SetMesh(int** elementslist_in,IssmDouble** x_in,IssmDouble** y_in,int* numberofvertices_in,int* numberofelements_in){/*{{{*/
-   
+
    /*Delete previous mesh and keep the entire mesh*/
    if(this->elementslist) xDelete<int>(this->elementslist);
@@ -150,5 +150,5 @@
 }/*}}}*/
 void AmrNeopz::GetMesh(int** elementslist_out,IssmDouble** x_out,IssmDouble** y_out,int* numberofvertices_out,int* numberofelements_out){/*{{{*/
-   
+
    /*Get the entire mesh*/
    *elementslist_out    = this->elementslist;
@@ -394,5 +394,5 @@
 		if(type>1) break;
 	}
-	
+
 	/*Verify and return*/
 	if(type>1) type=2;
@@ -416,5 +416,5 @@
 
 	count=1;
-	
+
 	while(count>0){
 		count=0;
@@ -438,5 +438,5 @@
 				}
 			}
-			
+
 			/*refine the element if requested*/
 			if(type==2){gmesh->Element(i)->Divide(sons);	count++;}
@@ -926,5 +926,5 @@
 	this->fathermesh = dynamic_cast<TPZGeoMesh *>(TPZPersistenceManager::ReadFromFile());
 	TPZPersistenceManager::CloseRead();
-	
+
 	TPZPersistenceManager::OpenRead(previousmeshfile);
 	this->previousmesh = dynamic_cast<TPZGeoMesh *>(TPZPersistenceManager::ReadFromFile());
@@ -933,9 +933,9 @@
 	if(!amrifstream.is_open()) _error_("amr ifstream is not open!");
 	amrifstream.seekg(0);
-	
+
 	this->sid2index.clear();
 	this->index2sid.clear();
 	this->specialelementsindex.clear();
-	
+
 	amrifstream>>size;
 	for(int i=0;i<size;i++){
@@ -943,5 +943,5 @@
 		this->sid2index.push_back(value);
 	}
-	
+
 	amrifstream>>size;
 	for(int i=0;i<size;i++){
@@ -949,5 +949,5 @@
 		this->index2sid.push_back(value);
 	}
-	
+
 	amrifstream>>size;
 	for(int i=0;i<size;i++){
@@ -982,5 +982,5 @@
 		}
 	}
-	
+
 	if(this->index2sid.size()>0){
 		amrofstream << this->index2sid.size() << std::endl;
Index: issm/trunk/src/c/classes/BarystaticContributions.cpp
===================================================================
--- issm/trunk/src/c/classes/BarystaticContributions.cpp	(revision 26744)
+++ issm/trunk/src/c/classes/BarystaticContributions.cpp	(revision 26744)
@@ -0,0 +1,185 @@
+/*!\file BarystaticContributions.c
+ * \brief: implementation of the BarystaticContributions object
+ */
+
+/*Include files: {{{*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./BarystaticContributions.h" 
+#include "../toolkits/toolkits.h"
+#include "./classes.h"
+/*}}}*/
+
+/*Constructors and destructors:*/
+BarystaticContributions::BarystaticContributions(IoModel* iomodel ){ /*{{{*/
+
+	int nel;
+
+	iomodel->FetchData(&nice,"md.solidearth.npartice");
+	if(nice){
+		iomodel->FetchData(&pice,&nel,NULL,"md.solidearth.partitionice");
+		ice=new Vector<IssmDouble>(nice);
+		cumice=new Vector<IssmDouble>(nice); cumice->Set(0); cumice->Assemble();
+	}
+	else{
+		ice=new Vector<IssmDouble>(1);
+		cumice=new Vector<IssmDouble>(1);
+	}
+
+	iomodel->FetchData(&nhydro,"md.solidearth.nparthydro");
+	if(nhydro){
+		iomodel->FetchData(&phydro,&nel,NULL,"md.solidearth.partitionhydro");
+		hydro=new Vector<IssmDouble>(nhydro);
+		cumhydro=new Vector<IssmDouble>(nhydro); cumhydro->Set(0); cumhydro->Assemble();
+	}
+	else{
+		hydro=new Vector<IssmDouble>(1);
+		cumhydro=new Vector<IssmDouble>(1);
+	}
+	iomodel->FetchData(&nocean,"md.solidearth.npartocean");
+	if(nocean){
+		iomodel->FetchData(&pocean,&nel,NULL,"md.solidearth.partitionocean");
+		ocean=new Vector<IssmDouble>(nocean);
+		cumocean=new Vector<IssmDouble>(nocean); cumocean->Set(0); cumocean->Assemble();
+	}
+	else{
+		ocean=new Vector<IssmDouble>(1);
+		cumocean=new Vector<IssmDouble>(1);
+	}
+
+} /*}}}*/
+BarystaticContributions::~BarystaticContributions(){ /*{{{*/
+	delete ice;   delete cumice;
+	delete hydro; delete cumhydro;
+	delete ocean; delete cumocean;
+	if(nice)xDelete<IssmDouble>(pice);
+	if(nhydro)xDelete<IssmDouble>(phydro);
+	if(nocean)xDelete<IssmDouble>(pocean);
+}; /*}}}*/
+
+/*Support routines:*/
+IssmDouble BarystaticContributions::Total(){ /*{{{*/
+
+	IssmDouble  sumice,sumhydro,sumocean;
+
+	ice->Assemble();
+	hydro->Assemble();
+	ocean->Assemble();
+
+	ice->Sum(&sumice);
+	hydro->Sum(&sumhydro);
+	ocean->Sum(&sumocean);
+
+	return sumice+sumhydro+sumocean;
+
+} /*}}}*/
+IssmDouble BarystaticContributions::CumTotal(){ /*{{{*/
+
+	IssmDouble sumice,sumhydro,sumocean;
+
+	cumice->Assemble();
+	cumhydro->Assemble();
+	cumocean->Assemble();
+
+	cumice->Sum(&sumice);
+	cumhydro->Sum(&sumhydro);
+	cumocean->Sum(&sumocean);
+
+	return sumice+sumhydro+sumocean;
+
+} /*}}}*/
+void BarystaticContributions::Cumulate(Parameters* parameters){ /*{{{*/
+
+	cumice->AXPY(ice,1);
+	cumocean->AXPY(ocean,1);
+	cumhydro->AXPY(hydro,1);
+
+} /*}}}*/
+void BarystaticContributions::Set(int eid, IssmDouble icevalue, IssmDouble hydrovalue, IssmDouble oceanvalue){ /*{{{*/
+
+	int id;
+	if(nice){
+		id=reCast<int>(pice[eid]);
+		ice->SetValue(id,icevalue,ADD_VAL);
+	}
+	else{
+		ice->SetValue(0,icevalue,ADD_VAL);
+	}
+
+	if(nhydro){
+		id=reCast<int>(phydro[eid]);
+		hydro->SetValue(id,hydrovalue,ADD_VAL);
+	}
+	else{
+		hydro->SetValue(0,hydrovalue,ADD_VAL);
+	}
+
+	if(nocean){
+		id=reCast<int>(pocean[eid]);
+		ocean->SetValue(id,oceanvalue,ADD_VAL);
+	}
+	else{
+		ocean->SetValue(0,oceanvalue,ADD_VAL);
+	}
+
+} /*}}}*/
+void BarystaticContributions::Reset(){ /*{{{*/
+
+	ice->Set(0.);
+	hydro->Set(0.);
+	ocean->Set(0.);
+
+} /*}}}*/
+void BarystaticContributions::Save(Results* results, Parameters* parameters, IssmDouble oceanarea){ /*{{{*/
+
+	int        step;
+	IssmDouble time;
+	IssmDouble rho_water;
+
+	IssmDouble* cumice_serial=NULL;
+	IssmDouble* cumhydro_serial=NULL;
+	IssmDouble* cumocean_serial=NULL;
+
+	IssmDouble sumice,sumhydro,sumocean;
+
+	parameters->FindParam(&step,StepEnum);
+	parameters->FindParam(&time,TimeEnum);
+	parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum);
+
+	ice->Sum(&sumice); hydro->Sum(&sumhydro); ocean->Sum(&sumocean);
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,BslcEnum,this->Total()/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,BslcIceEnum,sumice/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,BslcHydroEnum,sumice/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,BslcOceanEnum,sumocean/oceanarea/rho_water,step,time));
+
+	cumice->Sum(&sumice); cumhydro->Sum(&sumhydro); cumocean->Sum(&sumocean);
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,CumBslcEnum,this->CumTotal()/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,CumBslcIceEnum,sumice/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,CumBslcHydroEnum,sumhydro/oceanarea/rho_water,step,time));
+	results->AddResult(new GenericExternalResult<IssmDouble>(results->Size()+1,CumBslcOceanEnum,sumocean/oceanarea/rho_water,step,time));
+
+	if(nice){
+		cumice_serial=this->cumice->ToMPISerial0(); for (int i=0;i<nice;i++)cumice_serial[i]=cumice_serial[i]/oceanarea/rho_water;
+		results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,CumBslcIcePartitionEnum,cumice_serial,nice,1,step,time));
+	}
+	if(nhydro){
+		cumhydro_serial=this->cumhydro->ToMPISerial0(); for (int i=0;i<nhydro;i++)cumhydro_serial[i]=cumhydro_serial[i]/oceanarea/rho_water;
+		results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,CumBslcHydroPartitionEnum,cumhydro_serial,nhydro,1,step,time));
+	}
+	if(nocean){
+		cumocean_serial=this->cumocean->ToMPISerial0(); for (int i=0;i<nocean;i++)cumocean_serial[i]=cumocean_serial[i]/oceanarea/rho_water;
+		results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,CumBslcOceanPartitionEnum,cumocean_serial,nocean,1,step,time));
+	}
+
+	if(IssmComm::GetRank()==0){
+		if(nice)xDelete<IssmDouble>(cumice_serial);
+		if(nhydro)xDelete<IssmDouble>(cumhydro_serial);
+		if(nocean)xDelete<IssmDouble>(cumocean_serial);
+	}
+	return;
+
+} /*}}}*/
Index: issm/trunk/src/c/classes/BarystaticContributions.h
===================================================================
--- issm/trunk/src/c/classes/BarystaticContributions.h	(revision 26744)
+++ issm/trunk/src/c/classes/BarystaticContributions.h	(revision 26744)
@@ -0,0 +1,47 @@
+/*!\file BarystaticContributions.h
+ * \brief: header file for barystatic contribution object
+ */
+
+#ifndef _BARYSTATICCONTRIBUTIONS_H_
+#define _BARYSTATICCONTRIBUTIONS_H_
+
+/*Headers:*/
+class IoModel;
+class Parameters;
+class Results;
+template <class doubletype> class Vector;
+#include "../shared/shared.h"
+
+class BarystaticContributions {
+
+	public: 
+
+		Vector<IssmDouble>* ice;  //contributions to every ice partition (size nice x 1)
+		Vector<IssmDouble>* cumice;  //cumulated contributions to every ice partition
+		int                 nice; //number of ice partitions 
+		IssmDouble*         pice; //ice partition (nel)
+
+		Vector<IssmDouble>* hydro;  //contributions to every hydro partition (size nhydro x 1)
+		Vector<IssmDouble>* cumhydro;  //cumulated contributions to every hydro partition
+		int                 nhydro; //number of hydro partitions 
+		IssmDouble*         phydro; //hydro partition (nel)
+
+		Vector<IssmDouble>* ocean;  //contributions to every ocean partition (size nocean x 1)
+		Vector<IssmDouble>* cumocean;  //cumulated contributions to every ocean partition
+		int                 nocean; //number of ocean partitions 
+		IssmDouble*         pocean; //ocean partition (nel)
+
+		/*BarystaticContributions constructors, destructors :*/
+		BarystaticContributions(IoModel* iomodel );
+		~BarystaticContributions();
+
+		/*routines:*/
+		IssmDouble Total();
+		IssmDouble CumTotal();
+		void Cumulate(Parameters* parameters);
+		void Save(Results* results, Parameters* parameters, IssmDouble oceanarea);
+		void Set(int eid, IssmDouble icevalue, IssmDouble hydrovalue, IssmDouble oceanvalue);
+		void Reset();
+
+};
+#endif  /* _BARYSTATICCONTRIBUTIONS_H_ */
Index: issm/trunk/src/c/classes/Cfdragcoeffabsgrad.cpp
===================================================================
--- issm/trunk/src/c/classes/Cfdragcoeffabsgrad.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Cfdragcoeffabsgrad.cpp	(revision 26744)
@@ -161,5 +161,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/classes/Cfdragcoeffabsgrad.h
===================================================================
--- issm/trunk/src/c/classes/Cfdragcoeffabsgrad.h	(revision 25994)
+++ issm/trunk/src/c/classes/Cfdragcoeffabsgrad.h	(revision 26744)
@@ -21,12 +21,12 @@
 		int         weights_enum;
 		bool			timepassedflag;
-		
+
 		IssmDouble  misfit; //value carried over in time.
-		
+
 		/*Cfdragcoeffabsgrad constructors, destructors :*/
 		Cfdragcoeffabsgrad();
 		Cfdragcoeffabsgrad(char* in_name, int in_definitionenum, int in_weights_enum,  bool timepassedflag);
 		~Cfdragcoeffabsgrad();
-		
+
 		/*Object virtual function resolutoin: */
 		Object* copy();
@@ -36,5 +36,5 @@
 		void Marshall(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
-		
+
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum();
Index: issm/trunk/src/c/classes/Cflevelsetmisfit.cpp
===================================================================
--- issm/trunk/src/c/classes/Cflevelsetmisfit.cpp	(revision 26744)
+++ issm/trunk/src/c/classes/Cflevelsetmisfit.cpp	(revision 26744)
@@ -0,0 +1,215 @@
+/*!\file Cflevelsetmisfit.cpp
+ * \brief: Cflevelsetmisfit Object
+ */
+
+/*Headers:*/
+/*{{{*/
+#ifdef HAVE_CONFIG_H
+   #include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./classes.h"
+#include "./ExternalResults/ExternalResult.h"
+#include "./ExternalResults/Results.h"
+#include "../datastructures/datastructures.h"
+#include "./Elements/Element.h"
+#include "./Elements/Elements.h"
+#include "./FemModel.h"
+#include "../modules/SurfaceAreax/SurfaceAreax.h"
+#include "../classes/Params/Parameters.h"
+#include "../classes/gauss/Gauss.h"
+#include "./Inputs/DatasetInput.h"
+/*}}}*/
+
+/*Cflevelsetmisfit constructors, destructors :*/
+Cflevelsetmisfit::Cflevelsetmisfit(){/*{{{*/
+
+	this->definitionenum = -1;
+	this->name = NULL;
+	this->model_enum = UNDEF;
+	this->observation_enum = UNDEF;
+	this->weights_enum = UNDEF;
+	this->misfit=0;
+	this->datatime=0.;
+	this->timepassedflag = false;
+}
+/*}}}*/
+Cflevelsetmisfit::Cflevelsetmisfit(char* in_name, int in_definitionenum, int in_model_enum, int in_observation_enum, int in_weights_enum, IssmDouble in_datatime, bool in_timepassedflag){/*{{{*/
+
+	this->definitionenum=in_definitionenum;
+
+	this->name		= xNew<char>(strlen(in_name)+1);
+	xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
+
+	this->model_enum=in_model_enum;
+	this->observation_enum=in_observation_enum;
+	this->weights_enum=in_weights_enum;
+	this->datatime=in_datatime;
+	this->timepassedflag=in_timepassedflag;
+
+	this->misfit=0;
+}
+/*}}}*/
+Cflevelsetmisfit::~Cflevelsetmisfit(){/*{{{*/
+	if(this->name)xDelete(this->name);
+	this->misfit=0;
+}
+/*}}}*/
+/*Object virtual function resolutoin: */
+Object* Cflevelsetmisfit::copy() {/*{{{*/
+	Cflevelsetmisfit* mf = new Cflevelsetmisfit(this->name,this->definitionenum, this->model_enum,this->observation_enum,this->weights_enum,this->datatime,this->timepassedflag);
+	mf->misfit=this->misfit;
+	return (Object*) mf;
+}
+/*}}}*/
+void Cflevelsetmisfit::DeepEcho(void){/*{{{*/
+	this->Echo();
+}
+/*}}}*/
+void Cflevelsetmisfit::Echo(void){/*{{{*/
+	_printf_(" Cflevelsetmisfit: " << name << " " << this->definitionenum << "\n");
+	_printf_("    model_enum: " << model_enum << " " << EnumToStringx(model_enum) << "\n");
+	_printf_("    observation_enum: " << observation_enum << " " << EnumToStringx(observation_enum) << "\n");
+	_printf_("    weights_enum: " << weights_enum << " " << EnumToStringx(weights_enum) << "\n");
+	_printf_("    datatime: " << datatime << "\n");
+	_printf_("	  timepassedflag: "<<timepassedflag<<"\n");
+}
+/*}}}*/
+int Cflevelsetmisfit::Id(void){/*{{{*/
+	return -1;
+}
+/*}}}*/
+void Cflevelsetmisfit::Marshall(MarshallHandle* marshallhandle){/*{{{*/
+
+	/*ok, marshall operations: */
+   int object_enum=CflevelsetmisfitEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->definitionenum);
+	marshallhandle->call(this->model_enum);
+	marshallhandle->call(this->name);
+	marshallhandle->call(this->observation_enum);
+	marshallhandle->call(this->weights_enum);
+	marshallhandle->call(this->datatime);
+	marshallhandle->call(this->timepassedflag);
+	marshallhandle->call(this->misfit);
+} 
+/*}}}*/
+int Cflevelsetmisfit::ObjectEnum(void){/*{{{*/
+	return CflevelsetmisfitEnum;
+}
+/*}}}*/
+/*Definition virtual function resolutoin: */
+int Cflevelsetmisfit::DefinitionEnum(){/*{{{*/
+	return this->definitionenum;
+}
+/*}}}*/
+char* Cflevelsetmisfit::Name(){/*{{{*/
+	char* name2=xNew<char>(strlen(this->name)+1);
+	xMemCpy(name2,this->name,strlen(this->name)+1);
+
+	return name2;
+}
+/*}}}*/
+IssmDouble Cflevelsetmisfit::Response(FemModel* femmodel){/*{{{*/
+	 /*diverse: */
+	 IssmDouble time;
+
+	 /*recover time parameters: */
+	 femmodel->parameters->FindParam(&time,TimeEnum);
+
+	 IssmDouble J=0.;
+	 IssmDouble J_sum=0.;
+
+	 if(datatime<=time && !timepassedflag){
+		 for(Object* & object : femmodel->elements->objects){
+			 Element* element=xDynamicCast<Element*>(object);
+			 J+=this->Cflevelsetmisfit_Calculation(element,model_enum,observation_enum,weights_enum);
+		 }
+
+		 ISSM_MPI_Allreduce ( (void*)&J,(void*)&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+		 ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+		 J=J_sum;
+
+		 timepassedflag = true;
+		 return J;
+	 }
+	 else return J;
+ }
+	/*}}}*/
+IssmDouble Cflevelsetmisfit::Cflevelsetmisfit_Calculation(Element* element, int model_enum, int observation_enum, int weights_enum){/*{{{*/
+
+	int        domaintype,numcomponents;
+	IssmDouble Jelem=0.;
+	IssmDouble misfit,Jdet;
+	IssmDouble model,obs,weight;
+	IssmDouble modelLevel,obsLevel;
+	IssmDouble* xyz_list = NULL;
+
+	/*Get basal element*/
+	if(!element->IsOnSurface()) return 0.;
+
+	/*If on water, return 0: */
+//	if(!element->IsIceInElement()) return 0.;
+
+	/*Get problem dimension*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DverticalEnum:   numcomponents   = 1; break;
+		case Domain3DEnum:           numcomponents   = 2; break;
+		case Domain2DhorizontalEnum: numcomponents   = 2; break;
+		default: _error_("not supported yet");
+	}
+
+	/*Spawn surface element*/
+	Element* topelement = element->SpawnTopElement();
+
+	/* Get node coordinates*/
+	topelement->GetVerticesCoordinates(&xyz_list);
+
+	/*Retrieve all inputs we will be needing: */
+	DatasetInput *datasetinput = topelement->GetDatasetInput(definitionenum); _assert_(datasetinput);
+	Input        *model_input  = topelement->GetInput(model_enum);            _assert_(model_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=topelement->NewGauss(2);
+	while(gauss->next()){
+
+		/* Get Jacobian determinant: */
+		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+
+		/*Get all parameters at gaussian point*/
+		datasetinput->GetInputValue(&weight,gauss,WeightsLevelsetObservationEnum);
+		model_input->GetInputValue(&model,gauss);
+		datasetinput->GetInputValue(&obs,gauss,LevelsetObservationEnum);
+
+		/*Compute Levelset misfit:
+		 *  J = || H(\phi) - H(\phi_obs)||^2
+		 *                                           */
+//		modelLevel = this->Heaviside(model);
+//		obsLevel = this->Heaviside(obs);
+		modelLevel = model;
+		obsLevel = obs;
+
+		misfit=0.5*(modelLevel-obsLevel)*(modelLevel-obsLevel);
+
+//		if (modelLevel*obsLevel<0.0) {
+		/*Add to cost function*/
+			Jelem+=misfit*weight*Jdet*gauss->weight;
+//		}
+	}
+
+	/*clean up and Return: */
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
+	xDelete<IssmDouble>(xyz_list);
+	delete gauss;
+	return Jelem;
+}/*}}}*/
+IssmDouble Cflevelsetmisfit::Heaviside(IssmDouble x){/*{{{*/
+	if (x>0) return 1.;
+	else if (x<0) return -1.;
+	else return 0.;
+}
+	/*}}}*/
Index: issm/trunk/src/c/classes/Cflevelsetmisfit.h
===================================================================
--- issm/trunk/src/c/classes/Cflevelsetmisfit.h	(revision 26744)
+++ issm/trunk/src/c/classes/Cflevelsetmisfit.h	(revision 26744)
@@ -0,0 +1,49 @@
+/*!\file Cflevelsetmisfit.h
+ * \brief: header file for Cflevelsetmisfit object
+ */
+
+#ifndef _CFLEVELSETMISFIT_H_
+#define _CFLEVELSETMISFIT_H_
+
+/*Headers:*/
+#include "./Definition.h"
+#include "./FemModel.h"
+
+IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,int output_enum);
+void  GetVectorFromInputsx( IssmDouble** pvector, int* pvector_size, FemModel* femmodel,int name);
+
+class Cflevelsetmisfit: public Object, public Definition{
+
+	public: 
+
+		int         definitionenum;
+		int         model_enum;
+		char*       name;
+		int         observation_enum;
+		int         weights_enum;
+		IssmDouble	datatime;
+		bool			timepassedflag;
+
+		IssmDouble  misfit; //value carried over in time.
+
+		/*Cflevelsetmisfit constructors, destructors :*/
+		Cflevelsetmisfit();
+		Cflevelsetmisfit(char* in_name, int in_definitionenum, int in_model_enum, int in_observation_enum, int in_weights_enum, IssmDouble in_datatime, bool timepassedflag);
+		~Cflevelsetmisfit();
+
+		/*Object virtual function resolutoin: */
+		Object* copy();
+		void DeepEcho(void);
+		void Echo(void);
+		int Id(void);
+		void Marshall(MarshallHandle* marshallhandle);
+		int ObjectEnum(void);
+
+		/*Definition virtual function resolutoin: */
+		int DefinitionEnum();
+		char* Name();
+		IssmDouble Response(FemModel* femmodel);
+		IssmDouble Cflevelsetmisfit_Calculation(Element* element, int model_enum, int observation_enum, int weights_enum);
+		IssmDouble Heaviside(IssmDouble x);
+};
+#endif  /* _CFLEVELSETMISFIT_H_ */
Index: issm/trunk/src/c/classes/Cfsurfacelogvel.cpp
===================================================================
--- issm/trunk/src/c/classes/Cfsurfacelogvel.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Cfsurfacelogvel.cpp	(revision 26744)
@@ -96,5 +96,4 @@
 IssmDouble Cfsurfacelogvel::Response(FemModel* femmodel){/*{{{*/
 
-
 	/*recover time parameters: */
 	IssmDouble time;
@@ -198,5 +197,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/classes/Cfsurfacelogvel.h
===================================================================
--- issm/trunk/src/c/classes/Cfsurfacelogvel.h	(revision 25994)
+++ issm/trunk/src/c/classes/Cfsurfacelogvel.h	(revision 26744)
@@ -21,12 +21,12 @@
 		IssmDouble	datatime;
 		bool			timepassedflag;
-		
+
 		IssmDouble  misfit; //value carried over in time.
-		
+
 		/*Cfsurfacelogvel constructors, destructors :*/
 		Cfsurfacelogvel();
 		Cfsurfacelogvel(char* in_name, int in_definitionenum, IssmDouble in_datatime, bool timepassedflag);
 		~Cfsurfacelogvel();
-		
+
 		/*Object virtual function resolutoin: */
 		Object* copy();
@@ -36,5 +36,5 @@
 		void Marshall(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
-		
+
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum();
Index: issm/trunk/src/c/classes/Cfsurfacesquare.cpp
===================================================================
--- issm/trunk/src/c/classes/Cfsurfacesquare.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Cfsurfacesquare.cpp	(revision 26744)
@@ -83,5 +83,17 @@
 /*}}}*/
 void Cfsurfacesquare::Marshall(MarshallHandle* marshallhandle){/*{{{*/
-	_error_("not implemented yet!"); 
+
+	int object_enum=CfsurfacesquareEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->definitionenum);
+	marshallhandle->call(this->local);
+	marshallhandle->call(this->model_enum);
+	marshallhandle->call(this->name);
+	marshallhandle->call(this->observation_enum);
+	marshallhandle->call(this->weights_enum);
+	marshallhandle->call(this->datatime);
+	marshallhandle->call(this->timepassedflag);
+	marshallhandle->call(this->misfit);
 } 
 /*}}}*/
@@ -187,5 +199,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/classes/Cfsurfacesquare.h
===================================================================
--- issm/trunk/src/c/classes/Cfsurfacesquare.h	(revision 25994)
+++ issm/trunk/src/c/classes/Cfsurfacesquare.h	(revision 26744)
@@ -22,16 +22,15 @@
 		char*       name;
 		int         observation_enum;
-		char*       timeinterpolation;
 		int         weights_enum;
 		IssmDouble	datatime;
 		bool			timepassedflag;
-		
+
 		IssmDouble  misfit; //value carried over in time.
-		
+
 		/*Cfsurfacesquare constructors, destructors :*/
 		Cfsurfacesquare();
 		Cfsurfacesquare(char* in_name, int in_definitionenum, int in_model_enum, int in_observation_enum, int in_weights_enum, IssmDouble in_datatime, bool timepassedflag);
 		~Cfsurfacesquare();
-		
+
 		/*Object virtual function resolutoin: */
 		Object* copy();
@@ -41,5 +40,5 @@
 		void Marshall(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
-		
+
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum();
Index: issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp	(revision 26744)
@@ -18,10 +18,10 @@
 }
 /*}}}*/
-SpcDynamic::SpcDynamic(int spc_id,int spc_nodeid, int spc_dof,int spc_analysis_type){/*{{{*/
+SpcDynamic::SpcDynamic(int spc_id,int spc_nodeid, int spc_dof,IssmDouble value_in,int spc_analysis_type){/*{{{*/
 
 	id           = spc_id;
 	nodeid        = spc_nodeid;
 	dof           = spc_dof;
-	value         = 0;
+	value         = value_in;
 	analysis_type = spc_analysis_type;
 	isset         = false;
Index: issm/trunk/src/c/classes/Constraints/SpcDynamic.h
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcDynamic.h	(revision 25994)
+++ issm/trunk/src/c/classes/Constraints/SpcDynamic.h	(revision 26744)
@@ -26,5 +26,5 @@
 		/*SpcDynamic constructors, destructors*/
 		SpcDynamic();
-		SpcDynamic(int id_in,int nodeid, int dof,int analysis_type);
+		SpcDynamic(int id_in,int nodeid, int dof,IssmDouble value_in,int analysis_type);
 		~SpcDynamic();
 
Index: issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp
===================================================================
--- issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp	(revision 26744)
@@ -55,4 +55,5 @@
 		bool       control_analysis         = false;
 		void     (*solutioncore)(FemModel*) = NULL;
+		void     (*solutionprecore)(FemModel*) = NULL;
 		bool       nodakotacore             = true;
 
@@ -94,6 +95,7 @@
 		responses=xNewZeroInit<IssmDouble>(numFns);
 
-		/*Hack:*/
-		for(int i=0;i<femmodel_init->nummodels;i++) if(femmodel_init->analysis_type_list[i]==SealevelriseAnalysisEnum) sealevelrise_core_geometry(femmodel_init);
+		/*Launch cores that are not used during the uncertainty quantification: */
+		WrapperPreCorePointerFromSolutionEnum(&solutionprecore,femmodel_init->parameters,solution_type);
+		if(solutionprecore)solutionprecore(femmodel_init);
 
 		/*Make a copy of femmodel, so we start this new evaluation run for this specific sample with a brand 
@@ -122,5 +124,5 @@
 		if(VerboseQmu()) _printf0_("compute dakota responses:\n");
 		femmodel->DakotaResponsesx(responses,responses_descriptors,numresponsedescriptors,numFns);
-		
+
 		/*Output results for this iteration: */
 		if(VerboseQmu()) _printf0_("output results for this iteration: \n");
Index: issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h
===================================================================
--- issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h	(revision 25994)
+++ issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h	(revision 26744)
@@ -29,5 +29,4 @@
 /*}}}*/
 
-
 #if !defined(_WRAPPERS_) && defined(_HAVE_DAKOTA_) && _DAKOTA_MAJOR_ >= 6
 
@@ -37,5 +36,5 @@
 namespace SIM {
 	class IssmParallelDirectApplicInterface: public Dakota::DirectApplicInterface{
-      
+
 		private: 
 			FemModel* femmodel_init;
Index: issm/trunk/src/c/classes/Elements/Element.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Element.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Element.cpp	(revision 26744)
@@ -56,7 +56,120 @@
 
 	for(int i=0;i<numnodes;i++){
-		if(nodes[i]->fsize) return true;
+		if(nodes[i]->FSize()) return true;
 	}
 	return false;
+}/*}}}*/
+void       Element::AutoregressionInit(int numbasins,int arorder,int nspin,IssmDouble starttime,IssmDouble tstep_ar,IssmDouble tinit_ar,IssmDouble* beta0,IssmDouble* beta1,IssmDouble* phi,int enum_type){/*{{{*/
+
+const int numvertices = this->GetNumberOfVertices();
+   int         basinid;
+   IssmDouble  tspin,beta0_basin,beta1_basin,noisespin_basin;
+   IssmDouble* phi_basin   = xNew<IssmDouble>(arorder);
+   IssmDouble* varspin     = xNewZeroInit<IssmDouble>(numvertices*arorder);
+
+   /*Get Basin ID and Basin coefficients*/
+   if(enum_type==SMBautoregressionEnum)                   this->GetInputValue(&basinid,SmbBasinsIdEnum);
+   if(enum_type==FrontalForcingsRignotAutoregressionEnum) this->GetInputValue(&basinid,FrontalForcingsBasinIdEnum);
+   for(int i=0;i<arorder;i++) phi_basin[i] = phi[basinid*arorder+i];
+   beta0_basin   = beta0[basinid];
+   beta1_basin   = beta1[basinid];
+
+   /*Loop over number of spin-up steps for all vertices*/
+   for(int j=0;j<nspin;j++){
+      tspin = starttime-((nspin-j)*tstep_ar);
+      IssmDouble* oldvarspin = xNew<IssmDouble>(numvertices*arorder);
+      for(int i=0;i<numvertices*arorder;i++) oldvarspin[i]=varspin[i];
+
+      for(int v=0;v<numvertices;v++){
+         IssmDouble autoregressionterm = 0.;
+         for(int i=0;i<arorder;i++) autoregressionterm += phi_basin[i]*varspin[v+i*numvertices];
+         varspin[v] = beta0_basin+beta1_basin*(tspin-tinit_ar)+autoregressionterm;
+      }
+
+      /*Adjust older values in varspin*/
+      for(int i=0;i<(arorder-1)*numvertices;i++) varspin[i+numvertices]=oldvarspin[i];
+
+      xDelete<IssmDouble>(oldvarspin);
+   }
+   if(enum_type==SMBautoregressionEnum)                   this->inputs->SetArrayInput(SmbValuesAutoregressionEnum,this->lid,varspin,numvertices*arorder);
+   if(enum_type==FrontalForcingsRignotAutoregressionEnum) this->inputs->SetArrayInput(ThermalforcingValuesAutoregressionEnum,this->lid,varspin,numvertices*arorder);
+
+   /*Cleanup and return*/
+   xDelete<IssmDouble>(varspin);
+   xDelete<IssmDouble>(phi_basin);	
+}/*}}}*/
+void       Element::Autoregression(bool isstepforar,int arorder,IssmDouble telapsed_ar,IssmDouble* beta0,IssmDouble* beta1,IssmDouble* phi,bool isfieldstochastic,int enum_type){/*{{{*/
+
+   const int numvertices = this->GetNumberOfVertices();
+   int         basinid,M,N,arenum_type,basinenum_type,noiseenum_type,outenum_type;
+   IssmDouble  beta0_basin,beta1_basin,noiseterm;
+   IssmDouble* phi_basin  = xNew<IssmDouble>(arorder);
+   IssmDouble* varlist     = xNew<IssmDouble>(numvertices);
+   IssmDouble* valuesautoregression = NULL;
+   Input*      noiseterm_input      = NULL;
+
+   /*Get field-specific enums*/
+   switch(enum_type){
+      case(SMBautoregressionEnum):
+         arenum_type    = SmbValuesAutoregressionEnum;
+         basinenum_type = SmbBasinsIdEnum;
+         noiseenum_type = SmbAutoregressionNoiseEnum;
+         outenum_type   = SmbMassBalanceEnum;
+         break;
+      case(FrontalForcingsRignotAutoregressionEnum):
+         arenum_type    = ThermalforcingValuesAutoregressionEnum;
+         basinenum_type = FrontalForcingsBasinIdEnum;
+         noiseenum_type = ThermalforcingAutoregressionNoiseEnum;
+         outenum_type   = FrontalForcingsThermalForcingEnum;
+         break;
+   }
+
+   /*Get noise and autoregressive terms*/
+   this->GetInputValue(&basinid,basinenum_type);
+   if(isfieldstochastic){
+      noiseterm_input = this->GetInput(noiseenum_type);
+      Gauss* gauss = this->NewGauss();
+      noiseterm_input->GetInputValue(&noiseterm,gauss);
+      delete gauss;
+   }
+   else noiseterm = 0.0;
+   this->inputs->GetArray(arenum_type,this->lid,&valuesautoregression,&M);
+
+   /*Get basin coefficients*/
+   for(int ii=0;ii<arorder;ii++) phi_basin[ii] = phi[basinid*arorder+ii];
+   beta0_basin   = beta0[basinid];
+   beta1_basin   = beta1[basinid];
+
+	/*If not AR model timestep: take the old values of variable*/
+   if(isstepforar==false){
+      for(int i=0;i<numvertices;i++) varlist[i]=valuesautoregression[i];
+   }
+   /*If AR model timestep: compute variable values on vertices from AR*/
+   else{
+      for(int v=0;v<numvertices;v++){
+
+         /*Compute autoregressive term*/
+         IssmDouble autoregressionterm=0.;
+         for(int ii=0;ii<arorder;ii++) autoregressionterm += phi_basin[ii]*valuesautoregression[v+ii*numvertices];
+
+         /*Stochastic variable value*/
+         varlist[v] = beta0_basin+beta1_basin*telapsed_ar+autoregressionterm+noiseterm;
+      }
+      /*Update autoregression values*/
+      IssmDouble* temparray = xNew<IssmDouble>(numvertices*arorder);
+      /*Assign newest values and shift older values*/
+      for(int i=0;i<numvertices;i++) temparray[i] = varlist[i];
+      for(int i=0;i<(arorder-1)*numvertices;i++) temparray[i+numvertices] = valuesautoregression[i];
+      this->inputs->SetArrayInput(arenum_type,this->lid,temparray,numvertices*arorder);
+      xDelete<IssmDouble>(temparray);
+   }
+
+   /*Add input to element*/
+   this->AddInput(outenum_type,varlist,P1Enum);
+
+   /*Cleanup*/
+   xDelete<IssmDouble>(phi_basin);
+   xDelete<IssmDouble>(varlist);
+   xDelete<IssmDouble>(valuesautoregression);
 }/*}}}*/
 void       Element::ComputeLambdaS(){/*{{{*/
@@ -651,24 +764,20 @@
 	const int NUM_VERTICES = this->GetNumberOfVertices();
 
-	int        i;
-	IssmDouble accuref, runoffref; //reference values at given altitude
-	IssmDouble accualti, runoffalti; //reference altitudes
+	IssmDouble accuref, runoffref;  //reference values at given altitude
 	IssmDouble accugrad, runoffgrad; //gradients from reference altitude
-	IssmDouble rho_water, rho_ice;
-	IssmDouble time;
-
-	IssmDouble*		smb	 = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble*		surf	 = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble*		accu	 = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble*		runoff = xNew<IssmDouble>(NUM_VERTICES);
+
+	IssmDouble smb[MAXVERTICES];
+	IssmDouble surf[MAXVERTICES];
+	IssmDouble accu[MAXVERTICES];
+	IssmDouble runoff[MAXVERTICES];
 
 	/*Get material parameters :*/
-	rho_water=this->FindParam(MaterialsRhoSeawaterEnum);
-	rho_ice=this->FindParam(MaterialsRhoIceEnum);
+	IssmDouble rho_water = this->FindParam(MaterialsRhoSeawaterEnum);
+	IssmDouble rho_ice   = this->FindParam(MaterialsRhoIceEnum);
 
 	/*Recover parameters*/
-	parameters->FindParam(&time,TimeEnum);
-	parameters->FindParam(&accualti,SmbAccualtiEnum);
-	parameters->FindParam(&runoffalti,SmbRunoffaltiEnum);
+	IssmDouble time       = this->FindParam(TimeEnum);
+	IssmDouble accualti   = this->FindParam(SmbAccualtiEnum);
+	IssmDouble runoffalti = this->FindParam(SmbRunoffaltiEnum);
 
 	/*Recover reference values at current time*/
@@ -683,7 +792,7 @@
 	/*Compute the temperature and precipitation*/
 	for(int iv=0;iv<NUM_VERTICES;iv++){
-		accu[iv]=max(0.,(accuref+(surf[iv]-accualti)*accugrad));
-		runoff[iv]=max(0.,(runoffref+(surf[iv]-runoffalti)*runoffgrad));
-		smb[iv]=(accu[iv]-runoff[iv])*rho_ice/rho_water;
+		accu[iv]   = max(0.,(accuref+(surf[iv]-accualti)*accugrad));
+		runoff[iv] = max(0.,(runoffref+(surf[iv]-runoffalti)*runoffgrad));
+		smb[iv]    = (accu[iv]-runoff[iv])*rho_ice/rho_water;
 	}
 
@@ -701,9 +810,4 @@
 	default: _error_("Not implemented yet");
 	}
-	/*clean-up*/
-	xDelete<IssmDouble>(surf);
-	xDelete<IssmDouble>(accu);
-	xDelete<IssmDouble>(runoff);
-	xDelete<IssmDouble>(smb);
 }
 /*}}}*/
@@ -825,4 +929,33 @@
 }
 /*}}}*/
+void       Element::dViscositydBMLHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vxbase_input,Input* vybase_input, Input* vxshear_input ,Input* vyshear_input,Input* thickness_input,Input* n_input, IssmDouble zeta){/*{{{*/
+
+	/*Intermediaries*/
+	int materialstype;
+	IssmDouble dmudB;
+	IssmDouble epsilon[5];/* epsilon=[exx,eyy,exy,exy,exz,eyz];    */
+	IssmDouble eps_eff;
+	IssmDouble eps0=1.e-27;
+
+	/* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy */
+   this->StrainRateMLHO(&epsilon[0],xyz_list,gauss,
+				vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+   eps_eff=sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2]
+				+ epsilon[3]*epsilon[3] + epsilon[4]*epsilon[4] + epsilon[0]*epsilon[1] + eps0*eps0);
+
+	/*Get viscosity*/
+	materialstype=this->material->ObjectEnum();
+	switch(materialstype){
+		case MaticeEnum:
+			material->GetViscosity_B(&dmudB,eps_eff,gauss);
+			break;
+		default: _error_("not supported");
+	}
+
+	/*Assign output pointer*/
+	*pdmudB=dmudB;
+
+}
+/*}}}*/
 void       Element::dViscositydBSSA(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
 
@@ -956,5 +1089,5 @@
 	/*First, figure out size of doflist and create it: */
 	int numberofdofs=0;
-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum);
 
 	/*Allocate output*/
@@ -964,6 +1097,6 @@
 	int count=0;
 	for(int i=0;i<numnodes;i++){
-		nodes[i]->GetDofList(doflist+count,approximation_enum,setenum);
-		count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+		nodes[i]->GetDofList(&doflist[count],approximation_enum,setenum);
+		count+=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum);
 	}
 
@@ -979,5 +1112,5 @@
 	/*First, figure out size of doflist and create it: */
 	int numberofdofs=0;
-	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+	for(int i=0;i<numnodes;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
 
 	/*Allocate output*/
@@ -987,6 +1120,7 @@
 	int count=0;
 	for(int i=0;i<numnodes;i++){
+		_assert_(count<numberofdofs);
 		nodes[i]->GetDofListLocal(doflist+count,approximation_enum,setenum);
-		count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
+		count+=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum);
 	}
 
@@ -1293,70 +1427,57 @@
 }
 /*}}}*/
-/* void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/\*{{{*\/ */
-
-/* 	/\*Fetch number vertices for this element and allocate arrays*\/ */
-/* 	const int NUM_VERTICES = this->GetNumberOfVertices(); */
-/* 	int*        vertexpidlist = xNew<int>(NUM_VERTICES); */
-/* 	IssmDouble* values        = xNew<IssmDouble>(NUM_VERTICES); */
-
-/* 	/\*Fill in values*\/ */
-/* 	this->GetVerticesPidList(vertexpidlist); */
-/* 	this->GetInputListOnVertices(values,input_enum); */
-/* 	vector->SetValues(NUM_VERTICES,vertexpidlist,values,INS_VAL); */
-
-/* 	/\*Clean up*\/ */
-/* 	xDelete<int>(vertexpidlist); */
-/* 	xDelete<IssmDouble>(values); */
-
-/* } */
-/* /\*}}}*\/ */
 void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum,int type){/*{{{*/
 
-	/*Fetch number vertices for this element and allocate arrays*/
-	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	int         numnodes    = this->GetNumberOfNodes();
-	int*        doflist     = NULL;
-	IssmDouble  value;
-	IssmDouble* values      = NULL;
-	Input*     input       = NULL;
-
 	switch(type){
-		case ElementSIdEnum:
-			input=this->GetInput(input_enum); _assert_(input);
+		case ElementSIdEnum:{
+         IssmDouble  value;
+			Input* input=this->GetInput(input_enum); _assert_(input);
 			input->GetInputAverage(&value);
 			vector->SetValue(this->sid,value,INS_VAL);
+                          }
 			break;
-		case VertexPIdEnum:
-			doflist = xNew<int>(NUM_VERTICES);
-			values = xNew<IssmDouble>(NUM_VERTICES);
+		case VertexPIdEnum:{
+         int        doflist[MAXVERTICES];
+         IssmDouble values[MAXVERTICES];
+			const int  NUM_VERTICES = this->GetNumberOfVertices();
 			/*Fill in values*/
-			this->GetVerticesPidList(doflist);
-			this->GetInputListOnVertices(values,input_enum);
+			this->GetVerticesPidList(&doflist[0]);
+			this->GetInputListOnVertices(&values[0],input_enum);
 			vector->SetValues(NUM_VERTICES,doflist,values,INS_VAL);
+                         }
 			break;
-		case VertexSIdEnum:
-			doflist = xNew<int>(NUM_VERTICES);
-			values = xNew<IssmDouble>(NUM_VERTICES);
+		case VertexSIdEnum:{
+         int        doflist[MAXVERTICES];
+         IssmDouble values[MAXVERTICES];
+			const int  NUM_VERTICES = this->GetNumberOfVertices();
 			/*Fill in values*/
 			this->GetVerticesSidList(doflist);
 			this->GetInputListOnVertices(values,input_enum);
 			vector->SetValues(NUM_VERTICES,doflist,values,INS_VAL);
+                         }
 			break;
-		case NodesEnum:
-			doflist = xNew<int>(numnodes);
-			values = xNew<IssmDouble>(numnodes);
+		case NodesEnum:{
+         int         numnodes = this->GetNumberOfNodes();
+         int        *doflist  = xNew<int>(numnodes);
+         IssmDouble *values   = xNew<IssmDouble>(numnodes);
 			/*Fill in values*/
 			this->GetInputListOnNodes(values,input_enum);
 			this->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
 			vector->SetValues(numnodes,doflist,values,INS_VAL);
+         xDelete<int>(doflist);
+         xDelete<IssmDouble>(values);
+                     }
 			break;
-		case NodeSIdEnum:
-			doflist = xNew<int>(numnodes);
-			values = xNew<IssmDouble>(numnodes);
+		case NodeSIdEnum:{
+         int         numnodes = this->GetNumberOfNodes();
+         int        *doflist  = xNew<int>(numnodes);
+         IssmDouble *values   = xNew<IssmDouble>(numnodes);
 			/*Fill in values*/
 			this->GetNodesSidList(doflist);
 			this->GetInputListOnNodes(values,input_enum);
 			vector->SetValues(numnodes,doflist,values,INS_VAL);
+         xDelete<int>(doflist);
+         xDelete<IssmDouble>(values);
+                       }
 			break;
 		default:
@@ -1364,44 +1485,31 @@
 	}
 
-	/*Clean up*/
-	xDelete<int>(doflist);
-	xDelete<IssmDouble>(values);
-
-}
-/*}}}*/
+}/*}}}*/
 void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum,int type, IssmDouble time){/*{{{*/
 
-	/*Fetch number vertices for this element and allocate arrays*/
-	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	int         numnodes    = this->GetNumberOfNodes();
-	int*        doflist     = NULL;
-	IssmDouble* values      = NULL;
-
 	switch(type){
-		case VertexPIdEnum:
-			doflist = xNew<int>(NUM_VERTICES);
-			values = xNew<IssmDouble>(NUM_VERTICES);
+		case VertexPIdEnum:{
+			int        doflist[MAXVERTICES];
+			IssmDouble values[MAXVERTICES];
+			const int  NUM_VERTICES = this->GetNumberOfVertices();
 			/*Fill in values*/
 			this->GetVerticesPidList(doflist);
 			this->GetInputListOnVerticesAtTime(values,input_enum,time);
-			vector->SetValues(NUM_VERTICES,doflist,values,INS_VAL);
+			vector->SetValues(NUM_VERTICES,doflist,&values[0],INS_VAL);
+								 }
 			break;
-		case VertexSIdEnum:
-			doflist = xNew<int>(NUM_VERTICES);
-			values = xNew<IssmDouble>(NUM_VERTICES);
+		case VertexSIdEnum:{
+			int        doflist[MAXVERTICES];
+			IssmDouble values[MAXVERTICES];
+			const int  NUM_VERTICES = this->GetNumberOfVertices();
 			/*Fill in values*/
 			this->GetVerticesSidList(doflist);
 			this->GetInputListOnVerticesAtTime(values,input_enum,time);
-			vector->SetValues(NUM_VERTICES,doflist,values,INS_VAL);
+			vector->SetValues(NUM_VERTICES,doflist,&values[0],INS_VAL);
+								 }
 			break;
 		default:
 			_error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
 	}
-
-	/*Clean up*/
-	xDelete<int>(doflist);
-	xDelete<IssmDouble>(values);
-
 }
 /*}}}*/
@@ -1449,11 +1557,9 @@
 	/*Create list of x*/
 	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	IssmDouble* x_list = xNew<IssmDouble>(NUM_VERTICES);
-
+	IssmDouble x_list[MAXVERTICES];
 	for(int i=0;i<NUM_VERTICES;i++) x_list[i]=xyz_list[i*3+0];
-	ValueP1OnGauss(&x,x_list,gauss);
-
-	xDelete<IssmDouble>(x_list);
+
+	/*Get value at gauss point*/
+	ValueP1OnGauss(&x,&x_list[0],gauss);
 	return x;
 }/*}}}*/
@@ -1465,11 +1571,9 @@
 	/*Create list of y*/
 	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	IssmDouble* y_list      = xNew<IssmDouble>(NUM_VERTICES);
-
+	IssmDouble y_list[MAXVERTICES];
 	for(int i=0;i<NUM_VERTICES;i++) y_list[i]=xyz_list[i*3+1];
-	ValueP1OnGauss(&y,y_list,gauss);
-
-	xDelete<IssmDouble>(y_list);
+
+	/*Get value at gauss point*/
+	ValueP1OnGauss(&y,&y_list[0],gauss);
 	return y;
 }/*}}}*/
@@ -1481,11 +1585,9 @@
 	/*Create list of z*/
 	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	IssmDouble* z_list      = xNew<IssmDouble>(NUM_VERTICES);
-
+	IssmDouble z_list[MAXVERTICES];
 	for(int i=0;i<NUM_VERTICES;i++) z_list[i]=xyz_list[i*3+2];
-	ValueP1OnGauss(&z,z_list,gauss);
-
-	xDelete<IssmDouble>(z_list);
+
+	/*Get value at gauss point*/
+	ValueP1OnGauss(&z,&z_list[0],gauss);
 	return z;
 }/*}}}*/
@@ -1612,7 +1714,4 @@
 void       Element::InputCreate(IssmDouble* vector,Inputs* inputs,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
 
-	/*Intermediaries*/
-	int i,t;
-
 	/*Branch on type of vector: nodal or elementary: */
 	if(vector_type==1){ //nodal vector
@@ -1620,11 +1719,11 @@
 		const int NUM_VERTICES = this->GetNumberOfVertices();
 
-		int        *vertexids  = xNew<int>(NUM_VERTICES);
-		int        *vertexlids = xNew<int>(NUM_VERTICES);
-		IssmDouble *values     = xNew<IssmDouble>(NUM_VERTICES);
+		int        vertexids[MAXVERTICES];
+		int        vertexlids[MAXVERTICES];
+		IssmDouble values[MAXVERTICES];
 
 		/*Recover vertices ids needed to initialize inputs*/
 		_assert_(iomodel->elements);
-		for(i=0;i<NUM_VERTICES;i++){
+		for(int i=0;i<NUM_VERTICES;i++){
 			vertexids[i] =reCast<int>(iomodel->elements[NUM_VERTICES*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
 			vertexlids[i]=iomodel->my_vertices_lids[vertexids[i]-1];
@@ -1637,5 +1736,5 @@
 		}
 		else if(M==iomodel->numberofvertices){
-			for(i=0;i<NUM_VERTICES;i++) values[i]=vector[vertexids[i]-1];
+			for(int i=0;i<NUM_VERTICES;i++) values[i]=vector[vertexids[i]-1];
 			this->SetElementInput(inputs,NUM_VERTICES,vertexlids,values,vector_enum);
 		}
@@ -1643,12 +1742,12 @@
 			/*create transient input: */
 			IssmDouble* times = xNew<IssmDouble>(N);
-			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+			for(int t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
 			inputs->SetTransientInput(vector_enum,times,N);
 			TransientInput* transientinput = inputs->GetTransientInput(vector_enum);
-			for(t=0;t<N;t++){
-				for(i=0;i<NUM_VERTICES;i++) values[i]=vector[N*(vertexids[i]-1)+t];
+			for(int t=0;t<N;t++){
+				for(int i=0;i<NUM_VERTICES;i++) values[i]=vector[N*(vertexids[i]-1)+t];
 				switch(this->ObjectEnum()){
-					case TriaEnum:  transientinput->AddTriaTimeInput( t,NUM_VERTICES,vertexlids,values,P1Enum); break;
-					case PentaEnum: transientinput->AddPentaTimeInput(t,NUM_VERTICES,vertexlids,values,P1Enum); break;
+					case TriaEnum:  transientinput->AddTriaTimeInput( t,NUM_VERTICES,vertexlids,&values[0],P1Enum); break;
+					case PentaEnum: transientinput->AddPentaTimeInput(t,NUM_VERTICES,vertexlids,&values[0],P1Enum); break;
 					default: _error_("Not implemented yet");
 				}
@@ -1659,23 +1758,23 @@
 
 			/*This is a Patch!*/
-			xDelete<IssmDouble>(values);
-			values = xNew<IssmDouble>(N);
-			for(int j=0;j<N;j++) values[j]=vector[this->Sid()*N+j];
+			IssmDouble* evalues = xNew<IssmDouble>(N);
+			for(int j=0;j<N;j++) evalues[j]=vector[this->Sid()*N+j];
 
 			if (N==this->GetNumberOfNodes(P1Enum)){
-				this->SetElementInput(inputs,NUM_VERTICES,vertexlids,values,vector_enum);
+				this->SetElementInput(inputs,NUM_VERTICES,vertexlids,evalues,vector_enum);
 			}
 			else if(N==this->GetNumberOfNodes(P0Enum)){
-				this->SetElementInput(inputs,vector_enum,values[0]);
+				this->SetElementInput(inputs,vector_enum,evalues[0]);
 			}
 			else if(N==this->GetNumberOfNodes(P1xP2Enum)){ _assert_(this->ObjectEnum()==PentaEnum);
-				inputs->SetPentaInput(vector_enum,P1xP2Enum,this->lid,N,values);
+				inputs->SetPentaInput(vector_enum,P1xP2Enum,this->lid,N,evalues);
 			}
 			else if(N==this->GetNumberOfNodes(P1xP3Enum)){ _assert_(this->ObjectEnum()==PentaEnum);
-				inputs->SetPentaInput(vector_enum,P1xP3Enum,this->lid,N,values);
+				inputs->SetPentaInput(vector_enum,P1xP3Enum,this->lid,N,evalues);
 			}
 			else{
 				_error_("Patch interpolation not supported yet");
 			}
+			xDelete<IssmDouble>(evalues);
 
 		}
@@ -1683,8 +1782,4 @@
 			_error_("nodal vector is either numberofvertices or numberofvertices+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
 		}
-
-		xDelete<IssmDouble>(values);
-		xDelete<int>(vertexids);
-		xDelete<int>(vertexlids);
 	}
 	else if(vector_type==2){ //element vector
@@ -1708,8 +1803,8 @@
 			/*create transient input: */
 			IssmDouble* times = xNew<IssmDouble>(N);
-			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+			for(int t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
 			inputs->SetTransientInput(vector_enum,times,N);
 			TransientInput* transientinput = inputs->GetTransientInput(vector_enum);
-			for(t=0;t<N;t++){
+			for(int t=0;t<N;t++){
 				value=vector[N*this->Sid()+t];
 				switch(this->ObjectEnum()){
@@ -1721,4 +1816,23 @@
 			xDelete<IssmDouble>(times);
 		}
+		else if(M==1 || M==2){
+			/*create transient input: */
+			IssmDouble* times = xNew<IssmDouble>(N);
+			if(M==1)times[0]=0;
+			if(M==2)for(int t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+
+			inputs->SetTransientInput(vector_enum,times,N);
+			TransientInput* transientinput = inputs->GetTransientInput(vector_enum);
+
+			for(int t=0;t<N;t++){
+				value=vector[t]; //values are on the first line, times are on the second line
+				switch(this->ObjectEnum()){
+					case TriaEnum:  transientinput->AddTriaTimeInput( t,1,&(this->lid),&value,P0Enum); break;
+					case PentaEnum: transientinput->AddPentaTimeInput(t,1,&(this->lid),&value,P0Enum); break;
+					default: _error_("Not implemented yet");
+				}
+			}
+			xDelete<IssmDouble>(times);
+		}
 		else _error_("element vector is either numberofelements or numberofelements+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
 	}
@@ -1728,5 +1842,5 @@
 		if(M==iomodel->numberofelements){
 			IssmDouble* layers = xNewZeroInit<IssmDouble>(N);
-			for(t=0;t<N;t++) layers[t] = vector[N*this->Sid()+t];
+			for(int t=0;t<N;t++) layers[t] = vector[N*this->Sid()+t];
 			inputs->SetArrayInput(vector_enum,this->lid,layers,N);
 			xDelete<IssmDouble>(layers);
@@ -1735,4 +1849,24 @@
 	}
 	else _error_("Cannot add input for vector type " << vector_type << " (not supported)");
+}
+/*}}}*/
+void       Element::InputCreateP1FromConstant(Inputs* inputs,IoModel* iomodel,IssmDouble value_in,int vector_enum){/*{{{*/
+
+	const int NUM_VERTICES = this->GetNumberOfVertices();
+
+	int        vertexids[MAXVERTICES];
+	int        vertexlids[MAXVERTICES];
+	IssmDouble values[MAXVERTICES];
+
+	/*Recover vertices ids needed to initialize inputs*/
+	_assert_(iomodel->elements);
+	for(int i=0;i<NUM_VERTICES;i++){
+		vertexids[i] =reCast<int>(iomodel->elements[NUM_VERTICES*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
+		vertexlids[i]=iomodel->my_vertices_lids[vertexids[i]-1];
+	}
+
+	for(int i=0;i<NUM_VERTICES;i++) values[i]=value_in;
+	this->SetElementInput(inputs,NUM_VERTICES,vertexlids,values,vector_enum);
+
 }
 /*}}}*/
@@ -1850,7 +1984,4 @@
 	 */
 
-	/*Intermediaries*/
-	int i,t;
-
 	/*Branch on type of vector: nodal or elementary: */
 	if(vector_type==1){ //nodal vector
@@ -1858,11 +1989,11 @@
 		const int NUM_VERTICES = this->GetNumberOfVertices();
 
-		int        *vertexids  = xNew<int>(NUM_VERTICES);
-		int        *vertexlids = xNew<int>(NUM_VERTICES);
-		IssmDouble *values     = xNew<IssmDouble>(NUM_VERTICES);
+		int        vertexids[MAXVERTICES];
+		int        vertexlids[MAXVERTICES];
+		IssmDouble values[MAXVERTICES];
 
 		/*Recover vertices ids needed to initialize inputs*/
 		_assert_(iomodel->elements);
-		for(i=0;i<NUM_VERTICES;i++){
+		for(int i=0;i<NUM_VERTICES;i++){
 			vertexids[i] =reCast<int>(iomodel->elements[NUM_VERTICES*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
 			vertexlids[i]=iomodel->my_vertices_lids[vertexids[i]-1];
@@ -1876,5 +2007,5 @@
 		}
 		else if(M==iomodel->numberofvertices){
-			for(i=0;i<NUM_VERTICES;i++) values[i]=vector[vertexids[i]-1];
+			for(int i=0;i<NUM_VERTICES;i++) values[i]=vector[vertexids[i]-1];
 			switch(this->ObjectEnum()){
 				case TriaEnum:  inputs->SetTriaDatasetInput(enum_type,input_id,P1Enum,NUM_VERTICES,vertexlids,values); break;
@@ -1886,8 +2017,8 @@
 			/*create transient input: */
 			IssmDouble* times = xNew<IssmDouble>(N);
-			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+			for(int t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
 			TransientInput* transientinput = inputs->SetDatasetTransientInput(enum_type,input_id,times,N);
-			for(t=0;t<N;t++){
-				for(i=0;i<NUM_VERTICES;i++) values[i]=vector[N*(vertexids[i]-1)+t];
+			for(int t=0;t<N;t++){
+				for(int i=0;i<NUM_VERTICES;i++) values[i]=vector[N*(vertexids[i]-1)+t];
 				switch(this->ObjectEnum()){
 					case TriaEnum:  transientinput->AddTriaTimeInput( t,NUM_VERTICES,vertexlids,values,P1Enum); break;
@@ -1901,8 +2032,4 @@
 			_error_("not implemented yet (M="<<M<<")");
 		}
-
-		xDelete<IssmDouble>(values);
-		xDelete<int>(vertexids);
-		xDelete<int>(vertexlids);
 	}
 	else if(vector_type==2){ //element vector
@@ -1983,5 +2110,5 @@
 }
 /*}}}*/
-void       Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
+void       Element::InputUpdateFromConstant(IssmDouble constant, int name, int type){/*{{{*/
 
 	/*Check that name is an element input*/
@@ -1989,4 +2116,13 @@
 
 	/*update input*/
+	this->SetElementInput(name,constant,type);
+}
+/*}}}*/
+void       Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
+
+	/*Check that name is an element input*/
+	if(!IsInputEnum(name)) return;
+
+	/*update input*/
 	this->SetBoolInput(this->inputs,name,constant);
 }
@@ -1998,5 +2134,5 @@
 	return this->isonbase;
 }/*}}}*/
-bool       Element::IsFloating(){/*{{{*/
+bool       Element::IsAllFloating(){/*{{{*/
 
 	bool shelf;
@@ -2039,5 +2175,5 @@
 bool       Element::IsIceOnlyInElement(){/*{{{*/
 	Input* input=this->GetInput(MaskIceLevelsetEnum); _assert_(input);
-	return (input->GetInputMax()<0.);
+	return (input->GetInputMax()<=0.);
 }
 /*}}}*/
@@ -2052,7 +2188,12 @@
 }
 /*}}}*/
+bool       Element::IsOceanOnlyInElement(){/*{{{*/
+	Input* input=this->GetInput(MaskOceanLevelsetEnum); _assert_(input);
+	return (input->GetInputMax()<=0.);
+}
+/*}}}*/
 void       Element::Ismip6FloatingiceMeltingRate(){/*{{{*/
 
-	if(!this->IsIceInElement() || !this->IsFloating() || !this->IsOnBase()) return;
+	if(!this->IsIceInElement() || !this->IsAllFloating() || !this->IsOnBase()) return;
 
 	int         basinid,num_basins,M,N;
@@ -2065,5 +2206,5 @@
 	/*Allocate some arrays*/
 	const int numvertices = this->GetNumberOfVertices();
-	IssmDouble* basalmeltrate = xNew<IssmDouble>(numvertices);
+	IssmDouble basalmeltrate[MAXVERTICES];
 
 	/*Get variables*/
@@ -2114,5 +2255,4 @@
 	xDelete<IssmDouble>(mean_tf);
 	xDelete<IssmDouble>(depths);
-	xDelete<IssmDouble>(basalmeltrate);
 
 }/*}}}*/
@@ -2121,9 +2261,9 @@
 	const int NUM_VERTICES = this->GetNumberOfVertices();
 
-	IssmDouble  deepwaterel,upperwaterel,deepwatermelt,upperwatermelt;
-	IssmDouble *base         = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *values       = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *perturbation = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble 	time;
+	IssmDouble deepwaterel,upperwaterel,deepwatermelt,upperwatermelt;
+	IssmDouble base[MAXVERTICES];
+	IssmDouble values[MAXVERTICES];
+	IssmDouble perturbation[MAXVERTICES];
+	IssmDouble time;
 
 	parameters->FindParam(&time,TimeEnum);
@@ -2134,6 +2274,6 @@
 	_assert_(upperwaterel>deepwaterel);
 
-	this->GetInputListOnVertices(base,BaseEnum);
-   this->GetInputListOnVertices(perturbation,BasalforcingsPerturbationMeltingRateEnum);
+	this->GetInputListOnVertices(&base[0],BaseEnum);
+   this->GetInputListOnVertices(&perturbation[0],BasalforcingsPerturbationMeltingRateEnum);
 	for(int i=0;i<NUM_VERTICES;i++){
 		if(base[i]>=upperwaterel){
@@ -2152,7 +2292,4 @@
 
 	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,values,P1Enum);
-	xDelete<IssmDouble>(base);
-   xDelete<IssmDouble>(perturbation);
-	xDelete<IssmDouble>(values);
 
 }/*}}}*/
@@ -2161,14 +2298,14 @@
 	const int NUM_VERTICES = this->GetNumberOfVertices();
 
-	IssmDouble *deepwatermelt = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *deepwaterel   = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *upperwaterel  = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *base          = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble *values        = xNew<IssmDouble>(NUM_VERTICES);
-
-	this->GetInputListOnVertices(base,BaseEnum);
-	this->GetInputListOnVertices(deepwatermelt,BasalforcingsDeepwaterMeltingRateEnum);
-	this->GetInputListOnVertices(deepwaterel,BasalforcingsDeepwaterElevationEnum);
-	this->GetInputListOnVertices(upperwaterel,BasalforcingsUpperwaterElevationEnum);
+	IssmDouble deepwatermelt[MAXVERTICES];
+	IssmDouble deepwaterel[MAXVERTICES];;
+	IssmDouble upperwaterel[MAXVERTICES];
+	IssmDouble base[MAXVERTICES];
+	IssmDouble values[MAXVERTICES];
+
+	this->GetInputListOnVertices(&base[0],BaseEnum);
+	this->GetInputListOnVertices(&deepwatermelt[0],BasalforcingsDeepwaterMeltingRateEnum);
+	this->GetInputListOnVertices(&deepwaterel[0],BasalforcingsDeepwaterElevationEnum);
+	this->GetInputListOnVertices(&upperwaterel[0],BasalforcingsUpperwaterElevationEnum);
 
 	for(int i=0;i<NUM_VERTICES;i++){
@@ -2178,11 +2315,5 @@
 	}
 
-	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,values,P1Enum);
-	xDelete<IssmDouble>(base);
-	xDelete<IssmDouble>(deepwaterel);
-	xDelete<IssmDouble>(deepwatermelt);
-	xDelete<IssmDouble>(upperwaterel);
-	xDelete<IssmDouble>(values);
-
+	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,&values[0],P1Enum);
 }/*}}}*/
 void       Element::MantlePlumeGeothermalFlux(){/*{{{*/
@@ -2193,5 +2324,5 @@
 	IssmDouble  crustheat,plumeheat,dt,middleplumedepth,a,e,eprime,A0,lambda,Alambda,dAlambda;
 	IssmDouble  x,y,z,c;
-	IssmDouble* values   = xNew<IssmDouble>(NUM_VERTICES);
+	IssmDouble  values[MAXVERTICES];
 	IssmDouble *xyz_list = NULL;
 
@@ -2228,7 +2359,6 @@
 	}
 
-	this->AddInput(BasalforcingsGeothermalfluxEnum,values,P1Enum);
+	this->AddInput(BasalforcingsGeothermalfluxEnum,&values[0],P1Enum);
 	xDelete<IssmDouble>(xyz_list);
-	xDelete<IssmDouble>(values);
 
 }/*}}}*/
@@ -2253,14 +2383,13 @@
 
 	const int  NUM_VERTICES = this->GetNumberOfVertices();
-	int        i,migration_style;
+	int        migration_style;
 	IssmDouble bed_hydro,yts;
-	IssmDouble rho_water,rho_ice,density;
-	IssmDouble* melting = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* phi     = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* h       = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* s       = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* b       = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* r       = xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* sl      = xNew<IssmDouble>(NUM_VERTICES);
+	IssmDouble melting[MAXVERTICES];
+	IssmDouble phi[MAXVERTICES];
+	IssmDouble h[MAXVERTICES];
+	IssmDouble s[MAXVERTICES];
+	IssmDouble b[MAXVERTICES];
+	IssmDouble r[MAXVERTICES];
+	IssmDouble sl[MAXVERTICES];
 
 	/*Recover info at the vertices: */
@@ -2273,10 +2402,10 @@
 	GetInputListOnVertices(&sl[0],SealevelEnum);
 	GetInputListOnVertices(&phi[0],MaskOceanLevelsetEnum);
-	rho_water   = FindParam(MaterialsRhoSeawaterEnum);
-	rho_ice     = FindParam(MaterialsRhoIceEnum);
-	density     = rho_ice/rho_water;
+	IssmDouble rho_water   = FindParam(MaterialsRhoSeawaterEnum);
+	IssmDouble rho_ice     = FindParam(MaterialsRhoIceEnum);
+	IssmDouble density     = rho_ice/rho_water;
 
 	/*go through vertices, and update inputs, considering them to be TriaVertex type: */
-	for(i=0;i<NUM_VERTICES;i++){
+	for(int i=0;i<NUM_VERTICES;i++){
 		/* Contact FS*/
 		if(migration_style == ContactEnum){
@@ -2284,6 +2413,8 @@
 			if(phi[i]>=0.) b[i]=r[i];
 		}
-		else if(migration_style == GroundingOnlyEnum && b[i]<r[i]) b[i]=r[i];
-		/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
+		else if(migration_style == GroundingOnlyEnum && b[i]<r[i]){
+			/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
+			b[i]=r[i];
+		}
 		else if(phi[i]<=0.){
 			if(b[i]<=r[i]){
@@ -2299,10 +2430,10 @@
 				/*Unground only if the element is connected to the ice shelf*/
 				if(migration_style==AggressiveMigrationEnum || migration_style==SubelementMigrationEnum){
-					s[i]        = (1-density)*h[i]+sl[i];
-					b[i]        = -density*h[i]+sl[i];
+					s[i] = (1.-density)*h[i]+sl[i];
+					b[i] = -density*h[i]+sl[i];
 				}
 				else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Pid()]<0.){
-					s[i]        = (1-density)*h[i]+sl[i];
-					b[i]        = -density*h[i]+sl[i];
+					s[i] = (1.-density)*h[i]+sl[i];
+					b[i] = -density*h[i]+sl[i];
 				}
 				else{
@@ -2314,5 +2445,5 @@
 
 	/*Recalculate phi*/
-	for(i=0;i<NUM_VERTICES;i++){
+	for(int i=0;i<NUM_VERTICES;i++){
 		if(migration_style==SoftMigrationEnum){
 			bed_hydro=-density*h[i]+sl[i];
@@ -2321,5 +2452,7 @@
 			}
 		}
-		else if(migration_style!=ContactEnum) phi[i]=h[i]+(r[i]-sl[i])/density;
+		else if(migration_style!=ContactEnum){
+			phi[i]=h[i]+(r[i]-sl[i])/density;
+		}
 		else{
 			/*do nothing*/
@@ -2332,15 +2465,5 @@
 	this->AddInput(BaseEnum,&b[0],P1Enum);
 
-	/*Delete*/
-	xDelete<IssmDouble>(melting);
-	xDelete<IssmDouble>(phi);
-	xDelete<IssmDouble>(r);
-	xDelete<IssmDouble>(b);
-	xDelete<IssmDouble>(s);
-	xDelete<IssmDouble>(sl);
-	xDelete<IssmDouble>(h);
-
-}
-/*}}}*/
+}/*}}}*/
 void       Element::MismipFloatingiceMeltingRate(){/*{{{*/
 
@@ -2518,5 +2641,5 @@
 void       Element::PicoUpdateBoxid(int* max_boxid_basin_list){/*{{{*/
 
-	if(!this->IsIceInElement() || !this->IsFloating()) return;
+	if(!this->IsIceInElement() || !this->IsAllFloating()) return;
 
 	int        basin_id;
@@ -2559,5 +2682,5 @@
 void       Element::PicoUpdateBox(int loopboxid){/*{{{*/
 
-	if(!this->IsIceInElement() || !this->IsFloating()) return;
+	if(!this->IsIceInElement() || !this->IsAllFloating()) return;
 
 	int boxid;
@@ -2566,5 +2689,4 @@
 
 	const int NUM_VERTICES = this->GetNumberOfVertices();
-
 	int        basinid, maxbox, num_basins, numnodes, M;
 	IssmDouble gamma_T, overturning_coeff, thickness;
@@ -2593,6 +2715,7 @@
 	this->GetInputValue(&basinid,BasalforcingsPicoBasinIdEnum);
 	this->parameters->FindParam(&isplume, BasalforcingsPicoIsplumeEnum);
-	Input *thickness_input    = this->GetInput(ThicknessEnum);                         _assert_(thickness_input);
-	_assert_(basinid<=num_basins);
+	Input *thickness_input = this->GetInput(ThicknessEnum); 
+   _assert_(basinid<=num_basins);
+   _assert_(thickness_input);
 
 	IssmDouble* boxareas = NULL;
@@ -2603,8 +2726,8 @@
 	IssmDouble g1               = area_boxi*gamma_T;
 
-	IssmDouble* basalmeltrates_shelf 				= xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* potential_pressure_melting_point	= xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* Tocs 								= xNew<IssmDouble>(NUM_VERTICES);
-	IssmDouble* Socs								= xNew<IssmDouble>(NUM_VERTICES);
+	IssmDouble basalmeltrates_shelf[MAXVERTICES];
+	IssmDouble potential_pressure_melting_point[MAXVERTICES];
+	IssmDouble Tocs[MAXVERTICES];
+	IssmDouble Socs[MAXVERTICES];
 
 	/* First box calculations */
@@ -2612,9 +2735,9 @@
 		/* Get box1 parameters and inputs */
 		IssmDouble time, toc_farocean, soc_farocean;
+      IssmDouble overturnings[MAXVERTICES];
 		this->parameters->FindParam(&time,TimeEnum);
 		this->parameters->FindParam(&toc_farocean, basinid, time, BasalforcingsPicoFarOceantemperatureEnum);
 		this->parameters->FindParam(&soc_farocean, basinid, time, BasalforcingsPicoFarOceansalinityEnum);
-		IssmDouble 	s1 				= soc_farocean/(nu*lambda);
-		IssmDouble* overturnings 	= xNew<IssmDouble>(NUM_VERTICES);
+		IssmDouble s1 = soc_farocean/(nu*lambda);
 		Input *overturningC_input = this->GetInput(BasalforcingsPicoOverturningCoeffEnum); _assert_(overturningC_input);
 
@@ -2640,8 +2763,8 @@
 		}
 
-		if(!isplume) this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,basalmeltrates_shelf,P1DGEnum);
-		this->AddInput(BasalforcingsPicoSubShelfOceanTempEnum,Tocs,P1DGEnum);
-		this->AddInput(BasalforcingsPicoSubShelfOceanSalinityEnum,Socs,P1DGEnum);
-		this->AddInput(BasalforcingsPicoSubShelfOceanOverturningEnum,overturnings,P1DGEnum);
+		if(!isplume) this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,&basalmeltrates_shelf[0],P1DGEnum);
+		this->AddInput(BasalforcingsPicoSubShelfOceanTempEnum,&Tocs[0],P1DGEnum);
+		this->AddInput(BasalforcingsPicoSubShelfOceanSalinityEnum,&Socs[0],P1DGEnum);
+		this->AddInput(BasalforcingsPicoSubShelfOceanOverturningEnum,&overturnings[0],P1DGEnum);
 
 		/*Cleanup and return*/
@@ -2693,5 +2816,5 @@
 void       Element::PicoComputeBasalMelt(){/*{{{*/
 
-	if(!this->IsIceInElement() || !this->IsFloating()) return;
+	if(!this->IsIceInElement() || !this->IsAllFloating()) return;
 
 	const int NUM_VERTICES = this->GetNumberOfVertices();
@@ -2716,5 +2839,5 @@
 
 	/*Define arrays*/
-	IssmDouble* basalmeltrates_shelf = xNew<IssmDouble>(NUM_VERTICES); //Basal melt-rate
+	IssmDouble basalmeltrates_shelf[MAXVERTICES];
 
 	/*Polynomial coefficients*/
@@ -2789,9 +2912,8 @@
 
 	/*Save computed melt-rate*/
-	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,basalmeltrates_shelf,P1DGEnum);
+	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,&basalmeltrates_shelf[0],P1DGEnum);
 
 	/*Cleanup and return*/
 	delete gauss;
-
 }/*}}}*/
 void       Element::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm,bool issetpddfac){/*{{{*/
@@ -3281,5 +3403,4 @@
 	}
 
-
 	/*Assign output pointer*/
 
@@ -3342,6 +3463,4 @@
 				case P1Enum:{
 					const int NUM_VERTICES = this->GetNumberOfVertices();
-
-
 
 					this->GetVerticesSidList(&sidlist[0]);
@@ -3372,4 +3491,59 @@
 
 } /*}}}*/
+void       Element::RignotMeltParameterization(){/*{{{*/
+
+	const int numvertices = this->GetNumberOfVertices();
+   IssmDouble A, B, alpha, beta;
+   IssmDouble bed,qsg,qsg_basin,TF,yts;
+   int numbasins,basinid;
+   IssmDouble* basin_icefront_area=NULL;
+
+   /* Coefficients */
+   A    = 3e-4;
+   B    = 0.15;
+   alpha = 0.39;
+   beta = 1.18;
+
+   /*Get inputs*/
+	this->GetInputValue(&basinid,FrontalForcingsBasinIdEnum);
+	Input* bed_input = this->GetInput(BedEnum);                     _assert_(bed_input);
+   Input* qsg_input = this->GetInput(FrontalForcingsSubglacialDischargeEnum);     _assert_(qsg_input);
+   Input* TF_input  = this->GetInput(FrontalForcingsThermalForcingEnum);          _assert_(TF_input);
+
+	this->FindParam(&yts, ConstantsYtsEnum);
+   this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
+   this->parameters->FindParam(&basin_icefront_area,&numbasins,FrontalForcingsBasinIcefrontAreaEnum);
+   IssmDouble meltrates[numvertices];  
+
+   /* Start looping on the number of vertices: */
+   GaussTria gauss;
+   for(int iv=0;iv<numvertices;iv++){
+      gauss.GaussVertex(iv);
+
+      /* Get variables */
+      bed_input->GetInputValue(&bed,&gauss);
+      qsg_input->GetInputValue(&qsg,&gauss);
+      TF_input->GetInputValue(&TF,&gauss);
+
+      if(basin_icefront_area[basinid]==0.) meltrates[iv]=0.;
+      else{
+         /* change the unit of qsg (m^3/d -> m/d) with ice front area */
+         qsg_basin=qsg/basin_icefront_area[basinid];
+
+         /* calculate melt rates */
+         meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
+      }
+
+      if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
+      if(xIsInf<IssmDouble>(meltrates[iv])) _error_("Inf found in vector");
+   }
+
+   /*Add input*/
+   this->AddInput(CalvingMeltingrateEnum,&meltrates[0],P1Enum);
+
+   /*Cleanup and return*/
+   xDelete<IssmDouble>(basin_icefront_area);
+}
+/*}}}*/
 void       Element::SetBoolInput(Inputs* inputs,int enum_in,bool value){/*{{{*/
 
@@ -3407,5 +3581,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -3423,5 +3597,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -3619,4 +3793,5 @@
 	IssmDouble dlw=0.0;
 	IssmDouble dsw=0.0;
+	IssmDouble dswdiff=0.0;
 	IssmDouble P=0.0;
 	IssmDouble eAir=0.0;
@@ -3624,6 +3799,12 @@
 	IssmDouble teValue=1.0;
 	IssmDouble aValue=0.0;
+	IssmDouble dulwrfValue=0.0;
+	IssmDouble szaValue=0.0;
+	IssmDouble cotValue=0.0;
+	IssmDouble ccsnowValue=0.0;
+	IssmDouble cciceValue=0.0;
 	IssmDouble dt,time,smb_dt;
 	int        aIdx=0;
+	int        eIdx=0;
 	int        denIdx=0;
 	int        dsnowIdx=0;
@@ -3635,24 +3816,29 @@
 	IssmDouble initMass=0.0;
    IssmDouble sumR=0.0;
-   IssmDouble sumM=0.0;
+	IssmDouble sumF=0.0;
+	IssmDouble sumM=0.0;
 	IssmDouble sumMsurf=0.0;
-   IssmDouble sumEC=0.0;
-   IssmDouble sumP=0.0;
-   IssmDouble sumW=0.0;
-   IssmDouble sumMassAdd=0.0;
+	IssmDouble sumEC=0.0;
+	IssmDouble sumP=0.0;
+	IssmDouble sumRa=0.0;
+	IssmDouble sumW=0.0;
+	IssmDouble sumMassAdd=0.0;
 	IssmDouble fac=0.0;
 	IssmDouble sumMass=0.0;
 	IssmDouble dMass=0.0;
 	IssmDouble accsumR=0.0;
+	IssmDouble accsumF=0.0;
 	IssmDouble accsumM=0.0;
 	IssmDouble accsumSMB=0.0;
 	IssmDouble accsumEC=0.0;
 	IssmDouble accsumP=0.0;
+	IssmDouble accsumRa=0.0;
 	bool isgraingrowth,isalbedo,isshortwave,isthermal,isaccumulation,ismelt,isdensification,isturbulentflux;
-	bool isclimatology=false;
 	bool isconstrainsurfaceT=false;
+	bool isdeltaLWup=false;
 	IssmDouble init_scaling=0.0;
 	IssmDouble thermo_scaling=1.0;
 	IssmDouble adThresh=1023.0;
+	IssmDouble teThresh=10;
 	/*}}}*/
 	/*Output variables:{{{ */
@@ -3671,4 +3857,5 @@
 	IssmDouble* W = NULL;
 	IssmDouble* a = NULL;
+	IssmDouble* adiff = NULL;
 	IssmDouble* swf=NULL;
 	IssmDouble* T = NULL;
@@ -3677,4 +3864,6 @@
 	IssmDouble  Msurf = 0.0;
 	IssmDouble  R = 0.0;
+	IssmDouble  F = 0.0;
+	IssmDouble  Ra = 0.0;
 	IssmDouble  mAdd = 0.0;
 	IssmDouble  dz_add = 0.0;
@@ -3686,4 +3875,5 @@
 	IssmDouble* Wini = NULL;
 	IssmDouble* aini = NULL;
+	IssmDouble* adiffini = NULL;
 	IssmDouble* Tini = NULL;
 	int         m=0;
@@ -3700,4 +3890,5 @@
 	parameters->FindParam(&smb_dt,SmbDtEnum);                     /*time period for the smb solution,  usually smaller than the glaciological dt*/
 	parameters->FindParam(&aIdx,SmbAIdxEnum);
+	parameters->FindParam(&eIdx,SmbEIdxEnum);
 	parameters->FindParam(&denIdx,SmbDenIdxEnum);
 	parameters->FindParam(&swIdx,SmbSwIdxEnum);
@@ -3716,7 +3907,9 @@
 	parameters->FindParam(&isturbulentflux,SmbIsturbulentfluxEnum);
 	parameters->FindParam(&isconstrainsurfaceT,SmbIsconstrainsurfaceTEnum);
+	parameters->FindParam(&isdeltaLWup,SmbIsdeltaLWupEnum);
 	parameters->FindParam(&init_scaling,SmbInitDensityScalingEnum);
 	parameters->FindParam(&thermo_scaling,SmbThermoDeltaTScalingEnum);
 	parameters->FindParam(&adThresh,SmbAdThreshEnum);
+	parameters->FindParam(&teThresh,SmbTeThreshEnum);
 	/*}}}*/
 	/*Retrieve inputs: {{{*/
@@ -3764,4 +3957,5 @@
 		this->inputs->GetArray(SmbWiniEnum,this->lid,&Wini,&m);
 		this->inputs->GetArray(SmbAiniEnum,this->lid,&aini,&m);
+		this->inputs->GetArray(SmbAdiffiniEnum,this->lid,&adiffini,&m);
 		this->inputs->GetArray(SmbTiniEnum,this->lid,&Tini,&m);
 		EC_input = this->GetInput(SmbECiniEnum);  _assert_(EC_input);
@@ -3783,4 +3977,5 @@
 			W = xNew<IssmDouble>(m); for(int i=0;i<m;i++)W[i]=Wini[0];             //set water content to zero [kg m-2]
 			a = xNew<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aini[0];         //set albedo equal to fresh snow [fraction]
+			adiff = xNew<IssmDouble>(m); for(int i=0;i<m;i++)adiff[i]=adiffini[0];         //set diffusive albedo equal to 1 [fraction]
 			T = xNew<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean;         //set initial grid cell temperature to the annual mean temperature [K]
 			/*/!\ Default value of T can not be retrived from SMBgemb.m (like other snow properties)
@@ -3801,4 +3996,5 @@
 			W = xNew<IssmDouble>(m);for(int i=0;i<m;i++)W[i]=Wini[i];
 			a = xNew<IssmDouble>(m);for(int i=0;i<m;i++)a[i]=aini[i];
+			adiff = xNew<IssmDouble>(m);for(int i=0;i<m;i++)adiff[i]=adiffini[i];
 			T = xNew<IssmDouble>(m);for(int i=0;i<m;i++)T[i]=Tini[i];
 
@@ -3812,4 +4008,6 @@
 		this->SetElementInput(SmbAccumulatedMeltEnum,0.0);
 		this->SetElementInput(SmbAccumulatedRunoffEnum,0.0);
+		this->SetElementInput(SmbAccumulatedRefreezeEnum,0.0);
+		this->SetElementInput(SmbAccumulatedRainEnum,0.0);
 		this->SetElementInput(SmbAccumulatedPrecipitationEnum,0.0);
 
@@ -3826,4 +4024,5 @@
 		this->inputs->GetArray(SmbWEnum,this->lid,&W,&m);
 		this->inputs->GetArray(SmbAEnum,this->lid,&a,&m);
+		this->inputs->GetArray(SmbAdiffEnum,this->lid,&adiff,&m);
 		this->inputs->GetArray(SmbTEnum,this->lid,&T,&m);
 		EC_input = this->GetInput(SmbECDtEnum);  _assert_(EC_input);
@@ -3839,5 +4038,5 @@
 
 	// initialize cumulative variables
-	sumR = 0; sumM = 0; sumEC = 0; sumP = 0; sumMassAdd = 0; sumMsurf = 0;
+	sumR = 0; sumF=0; sumM = 0; sumEC = 0; sumP = 0; sumMassAdd = 0; sumMsurf = 0; sumRa = 0;
 
 	//before starting loop, realize that the transient core runs this smb_core at time = time +deltaT.
@@ -3852,4 +4051,6 @@
 		Input *sumM_input          = this->GetInput(SmbMeltEnum);  _assert_(sumM_input);
 		Input *sumR_input          = this->GetInput(SmbRunoffEnum);  _assert_(sumR_input);
+		Input *sumF_input          = this->GetInput(SmbRefreezeEnum);  _assert_(sumF_input);
+		Input *sumRa_input         = this->GetInput(SmbRainEnum);  _assert_(sumRa_input);
 		Input *sumP_input          = this->GetInput(SmbPrecipitationEnum);  _assert_(sumP_input);
 		Input *ULW_input           = this->GetInput(SmbMeanULWEnum);  _assert_(ULW_input);
@@ -3880,4 +4081,8 @@
 		sumR_input->GetInputAverage(&sumR);
 		sumR=sumR*dt*rho_ice;
+		sumF_input->GetInputAverage(&sumF);
+		sumF=sumF*dt*rho_ice;
+		sumRa_input->GetInputAverage(&sumRa);
+		sumRa=sumRa*dt*rho_ice;
 		sumP_input->GetInputAverage(&sumP);
 		sumP=sumP*dt*rho_ice;
@@ -3890,4 +4095,5 @@
 	Input *Dlwr_input= this->GetInput(SmbDlwrfEnum,timeinputs); _assert_(Dlwr_input);
 	Input *Dswr_input= this->GetInput(SmbDswrfEnum,timeinputs); _assert_(Dswr_input);
+	Input *Dswrdiff_input= this->GetInput(SmbDswdiffrfEnum,timeinputs); _assert_(Dswrdiff_input);
 	Input *P_input   = this->GetInput(SmbPEnum,timeinputs);     _assert_(P_input);
 	Input *eAir_input= this->GetInput(SmbEAirEnum,timeinputs);  _assert_(eAir_input);
@@ -3895,4 +4101,9 @@
 	Input *teValue_input= this->GetInput(SmbTeValueEnum,timeinputs); _assert_(teValue_input);
 	Input *aValue_input= this->GetInput(SmbAValueEnum,timeinputs); _assert_(aValue_input);
+	Input *dulwrfValue_input= this->GetInput(SmbDulwrfValueEnum,timeinputs); _assert_(dulwrfValue_input);
+	Input *szaValue_input= this->GetInput(SmbSzaValueEnum,timeinputs); _assert_(szaValue_input);
+	Input *cotValue_input= this->GetInput(SmbCotValueEnum,timeinputs); _assert_(cotValue_input);
+	Input *ccsnowValue_input= this->GetInput(SmbCcsnowValueEnum,timeinputs); _assert_(ccsnowValue_input);
+	Input *cciceValue_input= this->GetInput(SmbCciceValueEnum,timeinputs); _assert_(cciceValue_input);
 
 	/*extract daily data:{{{*/
@@ -3901,9 +4112,15 @@
 	Dlwr_input->GetInputValue(&dlw,gauss);   //downward longwave radiation flux [W m-2]
 	Dswr_input->GetInputValue(&dsw,gauss);   //downward shortwave radiation flux [W m-2]
+	Dswrdiff_input->GetInputValue(&dswdiff,gauss);   //downward shortwave diffuse radiation flux [W m-2]
 	P_input->GetInputValue(&P,gauss);        //precipitation [kg m-2]
 	eAir_input->GetInputValue(&eAir,gauss);  //screen level vapor pressure [Pa]
 	pAir_input->GetInputValue(&pAir,gauss);  // screen level air pressure [Pa]
 	teValue_input->GetInputValue(&teValue,gauss);  // Emissivity [0-1]
+	dulwrfValue_input->GetInputValue(&dulwrfValue,gauss);  // LWup perturbation [W m-2]
 	aValue_input->GetInputValue(&aValue,gauss);  // Albedo [0 1]
+	szaValue_input->GetInputValue(&szaValue,gauss);  // Solar Zenith Angle [degree]
+	cotValue_input->GetInputValue(&cotValue,gauss);  // Cloud Optical Thickness
+	ccsnowValue_input->GetInputValue(&ccsnowValue,gauss); //concentration of light absorbing carbon for snow [ppm1]
+	cciceValue_input->GetInputValue(&cciceValue,gauss); //concentration of light absorbing carbon for ice [ppm1]
 	//_printf_("Time: " << t << " Ta: " << Ta << " V: " << V << " dlw: " << dlw << " dsw: " << dsw << " P: " << P << " eAir: " << eAir << " pAir: " << pAir << "\n");
 	/*}}}*/
@@ -3913,8 +4130,8 @@
 
 	/*Snow, firn and ice albedo:*/
-	if(isalbedo)albedo(&a,aIdx,re,dz,d,cldFrac,aIce,aSnow,aValue,adThresh,T,W,P,EC,Msurf,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid());
+	if(isalbedo)albedo(&a,&adiff,aIdx,re,dz,d,cldFrac,aIce,aSnow,aValue,adThresh,T,W,P,EC,Msurf,ccsnowValue,cciceValue,szaValue,cotValue,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid());
 
 	/*Distribution of absorbed short wave radation with depth:*/
-	if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, a[0], d, dz, re,rho_ice,m,this->Sid());
+	if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, dswdiff, a[0], adiff[0], d, dz, re,rho_ice,m,this->Sid());
 
 	/*Calculate net shortwave [W m-2]*/
@@ -3926,5 +4143,5 @@
 	}
 	/*Thermal profile computation:*/
-	if(isthermal)thermo(&EC, &T, &ulw, dz, d, swf, dlw, Ta, V, eAir, pAir, teValue, W[0], smb_dt, m, Vz, Tz, thermo_scaling,rho_ice,this->Sid(),isconstrainsurfaceT);
+	if(isthermal)thermo(&EC, &T, &ulw, re, dz, d, swf, dlw, Ta, V, eAir, pAir, eIdx, teValue, dulwrfValue, teThresh, W[0], smb_dt, m, Vz, Tz, thermo_scaling,rho_ice,this->Sid(),isconstrainsurfaceT,isdeltaLWup);
 
 	/*Change in thickness of top cell due to evaporation/condensation  assuming same density as top cell.
@@ -3933,9 +4150,9 @@
 
 	/*Add snow/rain to top grid cell adjusting cell depth, temperature and density*/
-	if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, &re, &gdn, &gsp, &m, aIdx, dsnowIdx, Tmean, Ta, P, dzMin, aSnow, C, V, Vmean, rho_ice,this->Sid());
+	if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, &adiff, &re, &gdn, &gsp, &Ra, &m, aIdx, dsnowIdx, Tmean, Ta, P, dzMin, aSnow, C, V, Vmean, rho_ice,this->Sid());
 
 	/*Calculate water production, M [kg m-2] resulting from snow/ice temperature exceeding 273.15 deg K
 	 * (> 0 deg C), runoff R [kg m-2] and resulting changes in density and determine wet compaction [m]*/
-	if(ismelt)melt(&M, &Msurf, &R, &mAdd, &dz_add, &T, &d, &dz, &W, &a, &re, &gdn, &gsp, &m, dzMin, zMax, zMin, zTop, zY, rho_ice,this->Sid());
+	if(ismelt)melt(&M, &Msurf, &R, &F, &mAdd, &dz_add, &T, &d, &dz, &W, &a, &adiff, &re, &gdn, &gsp, &m, Ra, dzMin, zMax, zMin, zTop, zY, rho_ice,this->Sid());
 
 	/*Allow non-melt densification and determine compaction [m]*/
@@ -3967,4 +4184,5 @@
 					<< "lwf[" << netLW << "] "
 					<< "a[" << a << "] "
+					<< "adiff[" << adiff << "] "
 					<< "te[" << teValue << "] "
 					<< "\n");
@@ -3981,5 +4199,7 @@
 	sumW = cellsum(W,m);
 	sumP = P +  sumP;
-	sumEC = sumEC + EC;  // evap (-)/cond(+)
+	sumEC = EC + sumEC;  // evap (-)/cond(+)
+	sumRa = Ra + sumRa;
+	sumF = F + sumF;
 
 	/*Calculate total system mass:*/
@@ -4000,5 +4220,6 @@
 	/*Check mass conservation:*/
 	if (dMass != 0.0){
-		_printf_("total system mass not conserved in MB function \n");
+		_printf_("Time: " << setprecision(8) << timeinputs/365.0/24.0/3600.0 << ",total system mass not conserved in MB function \n");
+		_printf_("sumMass: " << sumMass << " sumR: " << sumR << " sumW: " << sumW << " sumP: " << sumP << " sumEC: " << sumEC << " initMass: " << initMass << " sumMassAdd: " << sumMassAdd << " \n");
 	}
 	#endif
@@ -4012,13 +4233,17 @@
    Input *accsumEC_input         = this->GetInput(SmbAccumulatedECEnum);  _assert_(accsumEC_input);
    Input *accsumM_input          = this->GetInput(SmbAccumulatedMeltEnum);  _assert_(accsumM_input);
-   Input *accsumR_input          = this->GetInput(SmbAccumulatedRunoffEnum);  _assert_(accsumR_input);
-   Input *accsumP_input          = this->GetInput(SmbAccumulatedPrecipitationEnum);  _assert_(accsumP_input);
-   Input *accsumSMB_input        = this->GetInput(SmbAccumulatedMassBalanceEnum);  _assert_(accsumP_input);
+	Input *accsumR_input          = this->GetInput(SmbAccumulatedRunoffEnum);  _assert_(accsumR_input);
+	Input *accsumF_input          = this->GetInput(SmbAccumulatedRefreezeEnum);  _assert_(accsumF_input);
+	Input *accsumRa_input         = this->GetInput(SmbAccumulatedRainEnum);  _assert_(accsumRa_input);
+	Input *accsumP_input          = this->GetInput(SmbAccumulatedPrecipitationEnum);  _assert_(accsumP_input);
+	Input *accsumSMB_input        = this->GetInput(SmbAccumulatedMassBalanceEnum);  _assert_(accsumSMB_input);
 
    accsumEC_input->GetInputAverage(&accsumEC);
-   accsumM_input->GetInputAverage(&accsumM);
-   accsumR_input->GetInputAverage(&accsumR);
-   accsumP_input->GetInputAverage(&accsumP);
-   accsumSMB_input->GetInputAverage(&accsumSMB);
+	accsumM_input->GetInputAverage(&accsumM);
+	accsumR_input->GetInputAverage(&accsumR);
+	accsumF_input->GetInputAverage(&accsumF);
+	accsumRa_input->GetInputAverage(&accsumRa);
+	accsumP_input->GetInputAverage(&accsumP);
+	accsumSMB_input->GetInputAverage(&accsumSMB);
 
 	this->SetElementInput(SmbAccumulatedECEnum,accsumEC+EC/rho_ice);
@@ -4026,4 +4251,6 @@
 	this->SetElementInput(SmbAccumulatedMeltEnum,accsumM+M/rho_ice);
 	this->SetElementInput(SmbAccumulatedRunoffEnum,accsumR+R/rho_ice);
+	this->SetElementInput(SmbAccumulatedRefreezeEnum,accsumF+F/rho_ice);
+	this->SetElementInput(SmbAccumulatedRainEnum,accsumRa+Ra/rho_ice);
 	this->SetElementInput(SmbAccumulatedPrecipitationEnum,accsumP+P/rho_ice);
    /*}}}*/
@@ -4038,8 +4265,11 @@
 	this->inputs->SetArrayInput(SmbWEnum,this->lid,W,m);
 	this->inputs->SetArrayInput(SmbAEnum,this->lid,a,m);
+	this->inputs->SetArrayInput(SmbAdiffEnum,this->lid,adiff,m);
 	this->SetElementInput(SmbECEnum,sumEC/dt/rho_ice);
 	this->SetElementInput(SmbMassBalanceEnum,(sumP + sumEC -sumR)/dt/rho_ice);
 	this->SetElementInput(SmbMeltEnum,sumM/dt/rho_ice);
 	this->SetElementInput(SmbRunoffEnum,sumR/dt/rho_ice);
+	this->SetElementInput(SmbRefreezeEnum,sumF/dt/rho_ice);
+	this->SetElementInput(SmbRainEnum,sumRa/dt/rho_ice);
 	this->SetElementInput(SmbPrecipitationEnum,sumP/dt/rho_ice);
 	this->SetElementInput(SmbMeanULWEnum,meanULW);
@@ -4064,4 +4294,5 @@
 	if(W) xDelete<IssmDouble>(W);
 	if(a) xDelete<IssmDouble>(a);
+	if(adiff) xDelete<IssmDouble>(adiff);
 	if(T) xDelete<IssmDouble>(T);
 	if(dzini) xDelete<IssmDouble>(dzini);
@@ -4072,4 +4303,5 @@
 	if(Wini) xDelete<IssmDouble>(Wini);
 	if(aini) xDelete<IssmDouble>(aini);
+	if(adiffini) xDelete<IssmDouble>(adiffini);
 	if(Tini) xDelete<IssmDouble>(Tini);
 	if(swf) xDelete<IssmDouble>(swf);
@@ -4182,4 +4414,49 @@
 
 }/*}}}*/
+void       Element::StrainRateMLHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vxbase_input,Input* vybase_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input,IssmDouble zeta){/*{{{*/
+	/*Compute the 2d Blatter/MLHO Strain Rate (5 components) for a given vertical coordinate (zeta):
+	 *
+	 * epsilon=[exx eyy exy exz eyz]
+	 *
+	 * with exz=1/2 du/dz
+	 *      eyz=1/2 dv/dz
+	 *
+	 * the contribution of vz is neglected
+	 *
+	 * zeta = (surface - z)/thickness 
+	 * i.e., zeta=0 <=> ice surface
+	 * i.e., zeta=1 <=> ice base
+	 */
+
+	/*Intermediaries*/
+	IssmDouble dvxb[2];  // [dvx/dx, dvx/dy] at the base
+	IssmDouble dvyb[2];  // [dvy/dx, dvy/dy] at the base
+	IssmDouble dvxsh[2]; // [dvx/dx, dvx/dy] at the surface (only the shear)
+	IssmDouble dvysh[2]; // [dvy/dx, dvy/dy] at the surface (only the shear)
+	IssmDouble vxsh,vysh; // shear vx and shear at the surface
+	IssmDouble thickness,n;
+
+	/*Check that both inputs have been found*/
+	if (!vxbase_input || !vybase_input || !vxshear_input || !vyshear_input || !thickness_input || !n_input){
+		_error_("Input missing. Here are the input pointers we have for vxb: " << vxbase_input << ", vyb: " << vybase_input << ", vxshear: " << vxshear_input << ", vyshear: " << vyshear_input << ", thickness: " << thickness_input << ", n: " << n_input<< "\n");
+	}
+
+	/*Get strain rate assuming that epsilon has been allocated*/
+	vxbase_input->GetInputDerivativeValue(&dvxb[0],xyz_list,gauss);
+	vybase_input->GetInputDerivativeValue(&dvyb[0],xyz_list,gauss);
+	vxshear_input->GetInputDerivativeValue(&dvxsh[0],xyz_list,gauss);
+	vyshear_input->GetInputDerivativeValue(&dvysh[0],xyz_list,gauss);
+	thickness_input->GetInputValue(&thickness,gauss); _assert_(thickness>0);
+   vxshear_input->GetInputValue(&vxsh,gauss);
+   vyshear_input->GetInputValue(&vysh,gauss);
+   n_input->GetInputValue(&n,gauss);
+
+	epsilon[0] = dvxb[0] + dvxsh[0]*( 1 - pow(zeta,n+1) );
+	epsilon[1] = dvyb[1] + dvysh[1]*( 1 - pow(zeta,n+1) );
+	epsilon[2] = 0.5*( dvxb[1] + dvxsh[1]*( 1 - pow(zeta,n+1) ) + dvyb[0] + dvysh[0]*( 1 - pow(zeta,n+1) ) ); 
+	epsilon[3] = 0.5*(vxsh/thickness)*(n+1)*pow(zeta,n);
+	epsilon[4] = 0.5*(vysh/thickness)*(n+1)*pow(zeta,n);
+
+}/*}}}*/
 void       Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
 
@@ -4232,6 +4509,5 @@
 	/*Fetch number vertices and allocate memory*/
 	const int NUM_VERTICES  = this->GetNumberOfVertices();
-
-	IssmDouble* maxprincipal = xNew<IssmDouble>(NUM_VERTICES);
+	IssmDouble maxprincipal[MAXVERTICES];
 
 	/*Retrieve all inputs and parameters*/
@@ -4251,5 +4527,5 @@
 	/*loop over vertices: */
 	Gauss* gauss=this->NewGauss();
-	for (int iv=0;iv<NUM_VERTICES;iv++){
+	for(int iv=0;iv<NUM_VERTICES;iv++){
 		gauss->GaussVertex(iv);
 
@@ -4296,8 +4572,7 @@
 
 	/*Create input*/
-	this->AddInput(StressMaxPrincipalEnum,maxprincipal,P1Enum);
+	this->AddInput(StressMaxPrincipalEnum,&maxprincipal[0],P1Enum);
 
 	/*Clean up and return*/
-	xDelete<IssmDouble>(maxprincipal);
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
@@ -4374,6 +4649,6 @@
 
 	/*Copy current stiffness matrix*/
-	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
-	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
+	values=xNew<IssmDouble>(Ke->nrows*Ke->nrows);
+	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->nrows;j++) values[i*Ke->nrows+j]=Ke->values[i*Ke->nrows+j];
 
 	/*Get Coordinate Systems transform matrix*/
@@ -4382,5 +4657,5 @@
 	/*Transform matrix: R*Ke*R^T */
 	TripleMultiply(transform,numdofs,numdofs,0,
-				values,Ke->nrows,Ke->ncols,0,
+				values,Ke->nrows,Ke->nrows,0,
 				transform,numdofs,numdofs,1,
 				&Ke->values[0],0);
@@ -4550,6 +4825,6 @@
 
 	/*Copy current stiffness matrix*/
-	values=xNew<IssmDouble>(Ke->nrows*Ke->ncols);
-	for(int i=0;i<Ke->nrows*Ke->ncols;i++) values[i]=Ke->values[i];
+	values=xNew<IssmDouble>(Ke->nrows*Ke->nrows);
+	for(int i=0;i<Ke->nrows*Ke->nrows;i++) values[i]=Ke->values[i];
 
 	/*Get Coordinate Systems transform matrix*/
@@ -4558,5 +4833,5 @@
 	/*Transform matrix: R^T*Ke*R */
 	TripleMultiply(transform,numdofs,numdofs,1,
-				values,Ke->nrows,Ke->ncols,0,
+				values,Ke->nrows,Ke->nrows,0,
 				transform,numdofs,numdofs,0,
 				&Ke->values[0],0);
@@ -4575,6 +4850,5 @@
 	/*Fetch number vertices and allocate memory*/
 	const int NUM_VERTICES = this->GetNumberOfVertices();
-
-	IssmDouble* viscousheating = xNew<IssmDouble>(NUM_VERTICES);
+	IssmDouble viscousheating[MAXVERTICES];
 
 	/*Retrieve all inputs and parameters*/
@@ -4595,8 +4869,7 @@
 
 	/*Create PentaVertex input, which will hold the basal friction:*/
-	this->AddInput(ViscousHeatingEnum,viscousheating,P1Enum);
+	this->AddInput(ViscousHeatingEnum,&viscousheating[0],P1Enum);
 
 	/*Clean up and return*/
-	xDelete<IssmDouble>(viscousheating);
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
@@ -4683,6 +4956,6 @@
 	IssmDouble  kappa,kappa_c,kappa_t;  //enthalpy conductivities
 	IssmDouble  Hc,Ht;
-	IssmDouble* PIE   = xNew<IssmDouble>(numvertices);
-	IssmDouble* dHpmp = xNew<IssmDouble>(numvertices);
+	IssmDouble PIE[MAXVERTICES];
+	IssmDouble dHpmp[MAXVERTICES];
 
 	for(int iv=0; iv<numvertices; iv++){
@@ -4720,6 +4993,4 @@
 
 	/*Clean up and return*/
-	xDelete<IssmDouble>(PIE);
-	xDelete<IssmDouble>(dHpmp);
 	return kappa;
 }
Index: issm/trunk/src/c/classes/Elements/Element.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Element.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Element.h	(revision 26744)
@@ -23,4 +23,5 @@
 class Materials;
 class Material;
+class Matlitho;
 class Inputs;
 class Inputs;
@@ -30,6 +31,7 @@
 class DatasetInput;
 class IoModel;
-class SealevelMasks;
+class SealevelGeometry;
 class Gauss;
+class GrdLoads;
 class ElementVector;
 template <class doublematrix> class Matrix;
@@ -37,4 +39,5 @@
 class ElementMatrix;
 class ElementVector;
+class BarystaticContributions;
 /*}}}*/
 
@@ -65,4 +68,6 @@
 		/*bool               AnyActive(void);*/
 		bool               AnyFSet(void);
+		void					 AutoregressionInit(int numbasins,int arorder,int nspin,IssmDouble starttime,IssmDouble tstep_ar,IssmDouble tinit_ar,IssmDouble* beta0,IssmDouble* beta1,IssmDouble* phi,int enum_type);
+      void               Autoregression(bool isstepforar,int arorder,IssmDouble telapsed_ar,IssmDouble* beta0,IssmDouble* beta1,IssmDouble* phi,bool isfieldstochastic,int enum_type);
 		void               ComputeLambdaS(void);
 		void               ComputeNewDamage();
@@ -78,4 +83,5 @@
 		void               dViscositydBHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
 		void               dViscositydBSSA(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+		void               dViscositydBMLHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vxbase_input,Input* vybase_input, Input* vxshear_input ,Input* vyshear_input,Input* thickness_input,Input* n_input, IssmDouble zeta);
 		void               dViscositydDSSA(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
 		void               Echo();
@@ -129,4 +135,5 @@
 		int                Id();
 		void               InputCreate(IssmDouble* vector,Inputs* inputs,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
+		void               InputCreateP1FromConstant(Inputs* inputs,IoModel* iomodel,IssmDouble value,int vector_enum);
 		void               ControlInputCreate(IssmDouble* doublearray,IssmDouble* independents_min,IssmDouble* independents_max,Inputs*inputs,IoModel* iomodel,int M,int N,IssmDouble scale,int input_enum,int id);
 		void					 DatasetInputAdd(int enum_type,IssmDouble* vector,Inputs* inputs,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code,int input_enum);
@@ -134,6 +141,7 @@
 		void               InputUpdateFromConstant(int constant, int name);
 		void               InputUpdateFromConstant(bool constant, int name);
-
-		bool               IsFloating();
+		void               InputUpdateFromConstant(IssmDouble constant, int name, int type);
+
+		bool               IsAllFloating();
 		bool               IsGrounded();
 		bool               IsOnBase();
@@ -142,4 +150,5 @@
 		bool               IsIceOnlyInElement();
 		bool               IsOceanInElement();
+		bool               IsOceanOnlyInElement();
 		bool               IsLandInElement();
 		void               Ismip6FloatingiceMeltingRate();
@@ -160,4 +169,5 @@
 		void               PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm,bool issetpddfac);
 		void               PositiveDegreeDaySicopolis(bool isfirnwarming);
+		void               RignotMeltParameterization();
 		void               ResultInterpolation(int* pinterpolation,int*nodesperelement,int* parray_size, int output_enum);
 		void               ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
@@ -175,4 +185,5 @@
 		void               StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
 		void               StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+		void               StrainRateMLHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input,IssmDouble zeta);
 		void               StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
 		void               StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input);
@@ -209,5 +220,4 @@
 		IssmDouble         PureIceEnthalpy(IssmDouble pressure);
 
-
 		/*Virtual functions*/
 		virtual void       AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented");};
@@ -235,4 +245,6 @@
 		virtual void       ElementResponse(IssmDouble* presponse,int response_enum)=0;
 		virtual void       ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
+		virtual void       ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze, Vector<IssmDouble>* vareae, bool spherical=false)=0;
+		virtual void       ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae)=0;
 		virtual int        FiniteElement(void)=0;
 		virtual IssmDouble FloatingArea(bool scaled)=0;
@@ -243,4 +255,9 @@
 		virtual void       GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
+		virtual void        GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl)=0;
+		virtual void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum)=0;
+		virtual void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area, int levelset1enum, int levelset2enum)=0;
+		virtual void        GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius)=0;
+
 		virtual IssmDouble GetIcefrontArea(){_error_("not implemented");};
 		virtual void       GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
@@ -297,4 +314,5 @@
 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
 		virtual IssmDouble MisfitArea(int weightsenum)=0;
+		virtual void	   MovingFrontalVelocity(void){_error_("not implemented yet");};
 		virtual Gauss*     NewGauss(void)=0;
 		virtual Gauss*     NewGauss(int order)=0;
@@ -325,9 +343,10 @@
 		virtual void       PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
 		virtual int        PressureInterpolation()=0;
+      virtual void       Recover3DMLHOInput(int targetVel_enum, int numnodes, IssmDouble* vb,  IssmDouble* vsh, IssmDouble* n, IssmDouble* H, IssmDouble* s){_error_("not implemented yet");};
 		virtual void       ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
 		virtual void       ResetFSBasalBoundaryCondition()=0;
 		virtual void       ResetHooks()=0;
-		virtual void       RignotMeltParameterization(void){_error_("not implemented yet");};
-		virtual void       SetElementInput(int enum_in,IssmDouble values){_error_("not implemented yet");};
+		virtual void       SetElementInput(int enum_in,IssmDouble value){_error_("not implemented yet");};
+		virtual void       SetElementInput(int enum_in,IssmDouble value, int type)=0;
 		virtual void       SetElementInput(Inputs* inputs,int enum_in,IssmDouble values){_error_("not implemented yet");};
 		virtual void       SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in){_error_("not implemented yet");};
@@ -337,4 +356,5 @@
 	   virtual Element*   SpawnBasalElement(bool depthaverage_materials=false)=0;
 		virtual Element*   SpawnTopElement(void)=0;
+		virtual bool       IsSpawnedElement(void)=0;
 		virtual IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)=0;
 		virtual void       StabilizationParameterAnisotropic(IssmDouble* tau_parameter_anisotropic, IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble hx, IssmDouble hy, IssmDouble hz, IssmDouble kappa)=0;
@@ -364,23 +384,26 @@
 		virtual void       WriteFieldIsovalueSegment(DataSet* segments,int fieldenum,IssmDouble fieldvalue){_error_("not implemented yet");};
 
-		#ifdef _HAVE_GIA_
-		virtual void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y)=0;
-		#endif
 		#ifdef _HAVE_ESA_
 		virtual void          EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast, Vector<IssmDouble>* pX, Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy)=0;
 		virtual void          EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz)=0;
 		#endif
-		#ifdef _HAVE_SEALEVELRISE_
-		virtual void          SetSealevelMasks(SealevelMasks* masks)=0;
+		#ifdef _HAVE_SEALEVELCHANGE_
 		virtual IssmDouble    GetArea3D(void)=0;
 		virtual IssmDouble    GetAreaSpherical(void)=0;
-		virtual IssmDouble    OceanAverage(IssmDouble* Sg, SealevelMasks* masks)=0;
-		virtual void          SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks)=0;
-		virtual IssmDouble    SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks,Vector<IssmDouble>* barystatic_contribution,IssmDouble* partition,IssmDouble oceanarea)=0;
-		virtual IssmDouble    SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks,Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea)=0;
-		virtual void          SealevelriseEustaticBottomPressure(IssmDouble* Sgi, SealevelMasks* masks)=0;
-		virtual void          SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx, IssmDouble* yy, IssmDouble* zz)=0;
-		virtual void          SealevelriseNonEustatic(IssmDouble* Sgo, IssmDouble* Sg_old,SealevelMasks* mask)=0;
-		virtual void          SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg,SealevelMasks* masks)=0;
+		virtual IssmDouble    GetTriangleAreaSpherical(IssmDouble xyz_list[3][3])=0;
+		virtual void          GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y)=0;
+
+		virtual void       SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae)=0;
+		virtual void       SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae)=0;
+		virtual void       SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae)=0;
+		virtual void       SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom)=0;
+		virtual void       SealevelchangeUpdateViscousFields()=0;
 		#endif
 
Index: issm/trunk/src/c/classes/Elements/ElementHook.h
===================================================================
--- issm/trunk/src/c/classes/Elements/ElementHook.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/ElementHook.h	(revision 26744)
@@ -23,5 +23,5 @@
 		~ElementHook();
 		void Marshall(MarshallHandle* marshallhandle);
-		
+
 		void DeepEcho();
 		void Echo();
Index: issm/trunk/src/c/classes/Elements/Penta.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Penta.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Penta.cpp	(revision 26744)
@@ -220,4 +220,7 @@
 	/*Call inputs method*/
 	switch(interpolation_enum){
+		case P0Enum:
+			control_input->SetControl(interpolation_enum,1,&this->lid,values,values_min,values_max);
+			break;
 		case P1Enum:
 			control_input->SetControl(interpolation_enum,NUMVERTICES,&vertexlids[0],values,values_min,values_max);
@@ -299,22 +302,22 @@
 
 	/* Start looping on the number of vertices: */
-	GaussPenta* gauss=new GaussPenta();
+	GaussPenta gauss;
 	for(int iv=0;iv<3;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Get velocity components and thickness*/
-		B_input->GetInputValue(&B,gauss);
-		n_input->GetInputValue(&n,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
-		gr_input->GetInputValue(&groundedice,gauss);
-		bs_input->GetInputValue(&bed,gauss);
-		smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
-		smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
+		B_input->GetInputValue(&B,&gauss);
+		n_input->GetInputValue(&n,&gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
+		gr_input->GetInputValue(&groundedice,&gauss);
+		bs_input->GetInputValue(&bed,&gauss);
+		smax_fl_input->GetInputValue(&sigma_max_floating,&gauss);
+		smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss);
 		vel=sqrt(vx*vx+vy*vy)+1.e-14;
-		sl_input->GetInputValue(&sealevel,gauss);
+		sl_input->GetInputValue(&sealevel,&gauss);
 
 		/*Compute strain rate and viscosity: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 
 		/*Get Eigen values*/
@@ -359,7 +362,4 @@
 	this->InputExtrude(CalvingCalvingrateEnum,-1);
 	this->InputExtrude(SigmaVMEnum,-1);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -382,15 +382,15 @@
 
 	/* Start looping on the number of vertices: */
-	GaussPenta* gauss=new GaussPenta();
-	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+	GaussPenta gauss;
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss.GaussVertex(iv);
 
 		/* Get the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
-		strainparallel_input->GetInputValue(&strainparallel,gauss);
-		strainperpendicular_input->GetInputValue(&strainperpendicular,gauss);
-		levermanncoeff_input->GetInputValue(&propcoeff,gauss);
+		strainparallel_input->GetInputValue(&strainparallel,&gauss);
+		strainperpendicular_input->GetInputValue(&strainperpendicular,&gauss);
+		levermanncoeff_input->GetInputValue(&propcoeff,&gauss);
 
 		/*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
@@ -407,7 +407,4 @@
 	this->AddBasalInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
 	this->AddBasalInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }/*}}}*/
 void       Penta::CalvingFluxLevelset(){/*{{{*/
@@ -761,5 +758,4 @@
 	IssmDouble	tau_yz[NUMVERTICES];
 	IssmDouble	tau_eff[NUMVERTICES];
-	GaussPenta* gauss=NULL;
 
 	/* Get node coordinates and dof list: */
@@ -772,11 +768,11 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussPenta();
+	GaussPenta gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
-		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
+		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
 
 		/*Compute Stress*/
@@ -802,7 +798,4 @@
 	this->AddInput(DeviatoricStresszzEnum,&tau_zz[0],P1DGEnum);
 	this->AddInput(DeviatoricStresseffectiveEnum,&tau_eff[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -818,5 +811,4 @@
 	IssmDouble	sigma_xz[NUMVERTICES];
 	IssmDouble	sigma_yz[NUMVERTICES];
-	GaussPenta* gauss=NULL;
 
 	/* Get node coordinates and dof list: */
@@ -830,12 +822,12 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussPenta();
-	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+	GaussPenta gauss;
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
-		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
-		pressure_input->GetInputValue(&pressure,gauss);
+		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
+		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
+		pressure_input->GetInputValue(&pressure,&gauss);
 
 		/*Compute Stress*/
@@ -855,7 +847,4 @@
 	this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
 	this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -952,15 +941,14 @@
 		control_gradient->Serve(NUMVERTICES,&lidlist[0]);
 
-		GaussPenta* gauss=new GaussPenta();
+		GaussPenta gauss;
 		for (int iv=0;iv<NUMVERTICES;iv++){
-			gauss->GaussVertex(iv);
-
-			control_value->GetInputValue(&value,gauss);
-			control_gradient->GetInputValue(&gradient,gauss);
+			gauss.GaussVertex(iv);
+
+			control_value->GetInputValue(&value,&gauss);
+			control_gradient->GetInputValue(&gradient,&gauss);
 
 			values[iv]    = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
 			gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
 		}
-		delete gauss;
 
 		vector_control->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
@@ -1139,11 +1127,11 @@
 
 	/*1. Recover stresses at the base*/
-	GaussPenta* gauss=new GaussPenta();
+	GaussPenta gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
-		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
+		this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
 		/*FIXME: this is for Hongju only*/
 		//pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
@@ -1180,7 +1168,4 @@
 		}
 	}
-
-	/*clean up*/
-	delete gauss;
 }
 /*}}}*/
@@ -1251,4 +1236,84 @@
 	/*return PentaRef field*/
 	return this->element_type;
+}
+/*}}}*/
+void       Penta::GetFractionGeometry2D(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl){/*{{{*/
+
+  /*Compute portion of element that is grounded based on levelset at the 3 lower vertices of the Penta element*/
+   bool               trapezeisnegative=true;
+   int                point;
+   const IssmPDouble  epsilon= 1.e-15;
+   IssmDouble         f1,f2,phi;
+
+   /*Weights*/
+   IssmDouble loadweights_g[NUMVERTICES];
+   IssmDouble total_weight = 0;
+
+   _assert_(!xIsNan<IssmDouble>(gl[0]));
+   _assert_(!xIsNan<IssmDouble>(gl[1]));
+   _assert_(!xIsNan<IssmDouble>(gl[2]));
+
+   /*Be sure that values are not zero*/
+   if(gl[0]==0.) gl[0] = gl[0]+epsilon;
+   if(gl[1]==0.) gl[1] = gl[1]+epsilon;
+   if(gl[2]==0.) gl[2] = gl[2]+epsilon;
+
+   /*Check that not all nodes are positive or negative: */
+   if(gl[0]>0 && gl[1]>0 && gl[2]>0){
+      point = 0;
+      f1    = 1.;
+      f2    = 1.;
+   }
+   else if(gl[0]<0 && gl[1]<0 && gl[2]<0){
+      point = 0;
+      f1    = 0.;
+      f2    = 0.;
+   }
+	else{
+		if(gl[0]*gl[1]*gl[2]<0) trapezeisnegative = false;
+
+		/*Find the similar nodes*/
+		if(gl[0]*gl[1]>0){ 
+			point = 2;
+			f1    = gl[2]/(gl[2]-gl[0]);
+			f2    = gl[2]/(gl[2]-gl[1]);
+		}
+		else if(gl[1]*gl[2]>0){ 
+			point = 0;
+			f1    = gl[0]/(gl[0]-gl[1]);
+			f2    = gl[0]/(gl[0]-gl[2]);
+		}
+		else if(gl[0]*gl[2]>0){ 
+			point = 1;
+			f1    = gl[1]/(gl[1]-gl[2]);
+			f2    = gl[1]/(gl[1]-gl[0]);
+		}
+		else _error_("case not possible");
+	}
+	if(trapezeisnegative) phi = 1.-f1*f2;
+	else                  phi = f1*f2;
+	
+	/*Compute weights*/
+	Gauss* gauss = this->NewGauss(point,f1,f2,1-trapezeisnegative,2);
+
+	total_weight = 0.0;
+	for(int i=0;i<NUMVERTICES2D;i++)weights[i] = 0;
+	while(gauss->next()){
+		GetNodalFunctions(&loadweights_g[0],gauss,P1Enum);
+		for(int i=0;i<NUMVERTICES2D;i++)weights[i] += loadweights_g[i]*gauss->weight;
+		total_weight += gauss->weight;
+	}
+	delete gauss;
+
+	/*Normalizing to phi such that weights provide coefficients for integration over subelement (for averaging:phi*weights)*/
+   if(total_weight>0.) for(int i=0;i<NUMVERTICES2D;i++) weights[i] = weights[i]*phi/total_weight;
+	else for(int i=0;i<NUMVERTICES2D;i++) weights[i] = 0.0;
+	
+	/*Assign output pointers*/
+	*pphi               = phi;
+	*ppoint1            = point;
+	*pfraction1         = f1;
+	*pfraction2         = f2;
+	*ptrapezeisnegative = trapezeisnegative;
 }
 /*}}}*/
@@ -1631,9 +1696,7 @@
 	int index = this->GetNodeIndex(node);
 
-	GaussPenta* gauss=new GaussPenta();
-	gauss->GaussNode(this->element_type,index);
-
-	input->GetInputValue(pvalue,gauss);
-	delete gauss;
+	GaussPenta gauss;
+	gauss.GaussNode(this->element_type,index);
+	input->GetInputValue(pvalue,&gauss);
 }
 /*}}}*/
@@ -1645,9 +1708,7 @@
 	int index = this->GetVertexIndex(vertex);
 
-	GaussPenta* gauss=new GaussPenta();
-	gauss->GaussVertex(index);
-
-	input->GetInputValue(pvalue,gauss);
-	delete gauss;
+	GaussPenta gauss;
+	gauss.GaussVertex(index);
+	input->GetInputValue(pvalue,&gauss);
 }
 /*}}}*/
@@ -1959,5 +2020,4 @@
 	}
 
-
 	/*Some checks in debugging mode*/
 	_assert_(s1>=0 && s1<=1.);
@@ -2074,5 +2134,4 @@
 		_error_("case not possible");
 	}
-
 
 	/*Some checks in debugging mode*/
@@ -2120,22 +2179,57 @@
 	IssmDouble base,height,scalefactor;
 	IssmDouble xyz_list[NUMVERTICES][3];
-
-	if(!IsIceInElement())return 0;
+	IssmDouble lsf[NUMVERTICES];
+
+	if(!IsIceInElement()) return 0;
 
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
 
-	/*First calculate the area of the base (cross section triangle)
-	 * http://en.wikipedia.org/wiki/Pentangle
-	 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
-	base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
-
-	if(scaled==true){ //scale for area projection correction
-		Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
-		scalefactor_input->GetInputAverage(&scalefactor);
-		base=base*scalefactor;
-	}
-
-	/*Now get the average height*/
-	height = 1./3.*((xyz_list[3][2]-xyz_list[0][2])+(xyz_list[4][2]-xyz_list[1][2])+(xyz_list[5][2]-xyz_list[2][2]));
+	Element::GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum);
+	/*Deal with partially ice-covered elements*/
+	if(lsf[0]*lsf[1]<=0 || lsf[0]*lsf[2]<=0 || lsf[1]*lsf[2]<=0){
+		bool        istrapneg;
+		int         point;
+		IssmDouble  f1,f2,phi;
+		IssmDouble  heights[NUMVERTICES2D];
+		IssmDouble  weights[NUMVERTICES2D];
+		IssmDouble  lsf2d[NUMVERTICES2D];
+		for(int i=0;i<NUMVERTICES2D;i++){
+			heights[i] = xyz_list[i+NUMVERTICES2D][2]-xyz_list[i][2];
+			lsf2d[i]   = lsf[i];
+		}
+		GetFractionGeometry2D(&weights[0],&phi,&point,&f1,&f2,&istrapneg,lsf2d);
+		
+		IssmDouble basetot;
+		height = 0.0;
+		for(int i=0;i<NUMVERTICES2D;i++) height += weights[i]/phi*heights[i];
+		basetot = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
+		base    = basetot*phi;	
+	
+		/*Account for scaling factor averaged over subelement 2D area*/
+		if(scaled==true){
+			IssmDouble scalefactor_vertices[NUMVERTICES];
+			Element::GetInputListOnVertices(&scalefactor_vertices[0],MeshScaleFactorEnum);
+			/*Compute loop only over lower vertices: i<NUMVERTICES2D*/
+			scalefactor = 0.0;
+			for(int i=0;i<NUMVERTICES2D;i++) scalefactor += weights[i]/phi*scalefactor_vertices[i];
+			base = base*scalefactor;
+		}
+	}
+
+	else{ 
+		/*First calculate the area of the base (cross section triangle)
+		 * http://en.wikipedia.org/wiki/Pentangle
+		 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
+		base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
+	
+		if(scaled==true){ //scale for area projection correction
+			Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
+			scalefactor_input->GetInputAverage(&scalefactor);
+			base=base*scalefactor;
+		}
+	
+		/*Now get the average height*/
+		height = 1./3.*((xyz_list[3][2]-xyz_list[0][2])+(xyz_list[4][2]-xyz_list[1][2])+(xyz_list[5][2]-xyz_list[2][2]));
+	}
 
 	/*Return: */
@@ -2150,5 +2244,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(!IsIceInElement() || IsFloating() || !IsOnBase())return 0;
+	if(!IsIceInElement() || IsAllFloating() || !IsOnBase())return 0;
 
 	rho_ice=FindParam(MaterialsRhoIceEnum);
@@ -2396,5 +2490,4 @@
 	if(start==+1 && !IsOnSurface()) return;
 
-
 	/*Get original input*/
 	Input* input = this->GetInput(enum_type);
@@ -2747,4 +2840,280 @@
 }
 /*}}}*/
+void	   Penta::MovingFrontalVelocity(void){/*{{{*/
+	if(!this->IsOnBase()) return;
+	int  dim, domaintype, calvinglaw, i;
+	IssmDouble v[3],w[3],c[3],m[3],dlsf[3];
+	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
+	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	IssmDouble  movingfrontvx[NUMVERTICES];
+	IssmDouble  movingfrontvy[NUMVERTICES];
+	IssmDouble  vel;
+
+	/* Get node coordinates and dof list: */
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	Input* vx_input           = NULL;
+	Input* vy_input           = NULL;
+	Input* calvingratex_input = NULL;
+	Input* calvingratey_input = NULL;
+	Input* lsf_slopex_input   = NULL;
+	Input* lsf_slopey_input   = NULL;
+	Input* calvingrate_input  = NULL;
+	Input* meltingrate_input  = NULL;
+	Input* gr_input           = NULL;
+
+	/*Get problem dimension and whether there is moving front or not*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	this->FindParam(&calvinglaw,CalvingLawEnum);
+
+	switch(domaintype){
+		case Domain2DverticalEnum:   dim = 1; break;
+		case Domain2DhorizontalEnum: dim = 2; break;
+		case Domain3DEnum:           dim = 2; break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+	/*Load velocities*/
+	switch(domaintype){
+		case Domain2DverticalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			break;
+		case Domain2DhorizontalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		case Domain3DEnum:
+			vx_input=this->GetInput(VxAverageEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyAverageEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+		case CalvingVonmisesEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingLevermannEnum:
+			switch(domaintype){
+				case Domain2DverticalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					break;
+				case Domain2DhorizontalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+					break;
+				case Domain3DEnum:
+					calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+					break;
+				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+			}
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingMinthicknessEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingHabEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingCrevasseDepthEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingDev2Enum:
+			this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+	}
+
+	/* Start looping on the number of vertices: */
+	GaussPenta gauss;
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss.GaussVertex(iv);
+
+		/* Advection */
+		vx_input->GetInputValue(&v[0],&gauss);
+		vy_input->GetInputValue(&v[1],&gauss);
+		gr_input->GetInputValue(&groundedice,&gauss);
+
+		/*Get calving speed*/
+		switch(calvinglaw){
+			case DefaultCalvingEnum:
+			case CalvingVonmisesEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				calvingrate_input->GetInputValue(&calvingrate,&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.; m[i]=0.;
+				 }
+				break;
+
+			case CalvingLevermannEnum:
+				calvingratex_input->GetInputValue(&c[0],&gauss);
+				if(dim==2) calvingratey_input->GetInputValue(&c[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+				norm_calving=0.;
+				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
+				norm_calving=sqrt(norm_calving)+1.e-14;
+				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
+				break;
+
+			case CalvingMinthicknessEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingHabEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingCrevasseDepthEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingDev2Enum:
+				  {
+					lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+					calvingrate_input->GetInputValue(&calvingrate,&gauss);
+					meltingrate_input->GetInputValue(&meltingrate,&gauss);
+					gr_input->GetInputValue(&groundedice,&gauss);
+
+					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
+					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
+					haf_eps=10.;
+					if(groundedice-calvinghaf<=-haf_eps){
+						// ice floats freely below calvinghaf: calve freely
+						// undercutting has no effect:
+						meltingrate=0.;
+					}
+					else if(groundedice-calvinghaf>=haf_eps){
+						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
+						calvingrate=min(calvingrate,vel);
+						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
+					}
+					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
+						//heaviside: 0 for floating, 1 for grounded
+						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(M_PI*(groundedice-calvinghaf)/haf_eps)/(2.*M_PI);
+						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
+						meltingrate=heaviside*meltingrate+0.;
+					}
+
+					norm_dlsf=0.;
+					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+					norm_dlsf=sqrt(norm_dlsf);
+
+					if(norm_dlsf>1.e-10)
+					 for(i=0;i<dim;i++){
+						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
+						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+					 }
+					else
+					 for(i=0;i<dim;i++){
+						 c[i]=0.;
+						 m[i]=0.;
+					 }
+					break;
+				  }
+
+			default:
+				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+		}
+
+		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+
+		movingfrontvx[iv] = w[0];
+		movingfrontvy[iv] = w[1];		
+	}
+
+	/*Add input*/
+	this->AddInput(MovingFrontalVxEnum,&movingfrontvx[0],P1DGEnum);
+	this->AddInput(MovingFrontalVyEnum,&movingfrontvy[0],P1DGEnum);
+
+	this->InputExtrude(MovingFrontalVxEnum,-1);
+	this->InputExtrude(MovingFrontalVyEnum,-1);
+}
+/*}}}*/
 Gauss*     Penta::NewGauss(void){/*{{{*/
 	return new GaussPenta();
@@ -2864,5 +3233,5 @@
 	int found=0;
 	IssmDouble value;
-	GaussPenta* gauss=NULL;
+	GaussPenta gauss;
 
 	/*First, serarch the input: */
@@ -2876,6 +3245,6 @@
 			if(data){
 				/*ok, we are good. retrieve value of input at vertex :*/
-				gauss=new GaussPenta(); gauss->GaussVertex(i);
-				data->GetInputValue(&value,gauss);
+				gauss.GaussVertex(i);
+				data->GetInputValue(&value,&gauss);
 				found=1;
 				break;
@@ -2884,5 +3253,4 @@
 	}
 
-	delete gauss;
 	if(found)*pvalue=value;
 	return found;
@@ -3011,4 +3379,45 @@
 int        Penta::PressureInterpolation(void){/*{{{*/
 	return PentaRef::PressureInterpolation(this->element_type);
+}
+/*}}}*/
+void       Penta::Recover3DMLHOInput(int targetVel_enum, int numnodes, IssmDouble* vb,  IssmDouble* vsh, IssmDouble* n, IssmDouble* H, IssmDouble* s){/*{{{*/
+   /* Recover the velocity acording to v=vb+(1-\zeta^{n+1})vsh, where \zeta=(s-z)/H
+    * The variables vb, vsh, n, H and s are all from the 2D horizontal mesh(Tria), with "numnodes" DOFs
+    * To project to penta the DOFs are doubled in size
+    *
+    */
+   _assert_(this->inputs);
+   if(!IsOnBase()) return;
+   else{
+      if(targetVel_enum==VxEnum || targetVel_enum==VyEnum){
+         IssmDouble vel[NUMVERTICES2D*5];
+         IssmDouble* xyz_list = NULL;
+			IssmDouble zi;
+         Penta* penta = this;
+			numnodes = penta->NumberofNodes(P1xP4Enum);
+         _assert_(NUMVERTICES2D*5-numnodes==0);
+			GaussPenta gauss;
+
+         for(;;){
+            penta->GetVerticesCoordinates(&xyz_list);
+            for(int i=0;i<NUMVERTICES2D;i++) {
+					for (int j=0;j<5;j++){
+						/* Get z-coordinate of the current node */
+						gauss.GaussNode(P1xP4Enum, i+j*NUMVERTICES2D);
+						zi = this->GetZcoord(xyz_list, &gauss);
+	               vel[i+j*NUMVERTICES2D] = vb[i] + vsh[i]*(1.0-pow((s[i]-zi)/H[i], (n[i]+1)));
+					}
+            }
+				xDelete<IssmDouble>(xyz_list);
+
+            /*Add to the bottom side of the element*/
+            penta->AddInput(targetVel_enum,&vel[0],P1xP4Enum);
+            if (penta->IsOnSurface()) break;
+            penta=penta->GetUpperPenta(); _assert_(penta->Id()!=this->id);
+         }
+      }
+      else _error_("not implemented yet");
+   }
+
 }
 /*}}}*/
@@ -3074,4 +3483,5 @@
 	int          numindices;
 	int         *indices = NULL;
+	bool		isNitsche;
 	IssmDouble   slopex,slopey,groundedice;
 	IssmDouble   xz_plane[6];
@@ -3080,4 +3490,6 @@
 	/*For FS only: we want the CS to be tangential to the bedrock*/
 	this->Element::GetInputValue(&approximation,ApproximationEnum);
+	this->FindParam(&isNitsche,FlowequationIsNitscheEnum);
+
 	if(!IsOnBase() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
 
@@ -3091,11 +3503,11 @@
 
 	/*Loop over basal nodes and update their CS*/
-	GaussPenta* gauss = new GaussPenta();
+	GaussPenta gauss;
 	for(int i=0;i<numindices;i++){//FIXME
-		gauss->GaussNode(this->VelocityInterpolation(),indices[i]);
-
-		slopex_input->GetInputValue(&slopex,gauss);
-		slopey_input->GetInputValue(&slopey,gauss);
-		groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+		gauss.GaussNode(this->VelocityInterpolation(),indices[i]);
+
+		slopex_input->GetInputValue(&slopex,&gauss);
+		slopey_input->GetInputValue(&slopey,&gauss);
+		groundedicelevelset_input->GetInputValue(&groundedice,&gauss);
 
 		/*New X axis          New Z axis*/
@@ -3104,23 +3516,24 @@
 		xz_plane[2]=slopex;   xz_plane[5]=1.;
 
-		if(groundedice>=0){
-			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
-				this->nodes[indices[i]]->DofInSSet(2); //vz
+		if (!isNitsche) {
+			if(groundedice>=0){
+				if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+					this->nodes[indices[i]]->DofInSSet(2); //vz
+				}
+				else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
+					this->nodes[indices[i]]->DofInSSet(4); //vz
+				}
+				else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
 			}
-			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
-				this->nodes[indices[i]]->DofInSSet(4); //vz
+			else{
+				if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
+					this->nodes[indices[i]]->DofInFSet(2); //vz
+				}
+				else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
+					this->nodes[indices[i]]->DofInFSet(4); //vz
+				}
+				else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
 			}
-			else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
-		}
-		else{
-			if(this->nodes[indices[i]]->GetApproximation()==FSvelocityEnum){
-				this->nodes[indices[i]]->DofInFSet(2); //vz
-			}
-			else if(this->nodes[indices[i]]->GetApproximation()==SSAFSApproximationEnum || this->nodes[indices[i]]->GetApproximation()==HOFSApproximationEnum){
-				this->nodes[indices[i]]->DofInFSet(4); //vz
-			}
-			else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[indices[i]]->GetApproximation())<<" not supported yet");
-		}
-
+		}
 		XZvectorsToCoordinateSystem(&this->nodes[indices[i]]->coord_system[0][0],&xz_plane[0]);
 	}
@@ -3128,5 +3541,4 @@
 	/*cleanup*/
 	xDelete<int>(indices);
-	delete gauss;
 }
 /*}}}*/
@@ -3146,65 +3558,4 @@
 	if(this->hneighbors) this->hneighbors->reset();
 
-}
-/*}}}*/
-void       Penta::RignotMeltParameterization(){/*{{{*/
-
-	if(!this->IsOnBase()) return;
-
-	IssmDouble A, B, alpha, beta;
-	IssmDouble bed,qsg,qsg_basin,TF,yts;
-	int numbasins;
-	IssmDouble basinid[NUMVERTICES];
-	IssmDouble* basin_icefront_area=NULL;
-
-	/* Coefficients */
-	A    = 3e-4;
-	B    = 0.15;
-	alpha = 0.39;
-	beta = 1.18;
-
-	/*Get inputs*/
-	Input* bed_input = this->GetInput(BedEnum);                     _assert_(bed_input);
-	Input* qsg_input = this->GetInput(FrontalForcingsSubglacialDischargeEnum);		 _assert_(qsg_input);
-	Input* TF_input  = this->GetInput(FrontalForcingsThermalForcingEnum);          _assert_(TF_input);
-	Element::GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum);
-
-	this->FindParam(&yts, ConstantsYtsEnum);
-	this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
-	this->parameters->FindParam(&basin_icefront_area,&numbasins,FrontalForcingsBasinIcefrontAreaEnum);
-
-	IssmDouble meltrates[NUMVERTICES2D];  //frontal melt-rate
-
-	/* Start looping on the number of vertices: */
-	GaussPenta* gauss=new GaussPenta();
-	for(int iv=0;iv<NUMVERTICES2D;iv++){
-		gauss->GaussVertex(iv);
-
-		/* Get variables */
-		bed_input->GetInputValue(&bed,gauss);
-		qsg_input->GetInputValue(&qsg,gauss);
-		TF_input->GetInputValue(&TF,gauss);
-
-		if(basinid[iv]==0 || basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
-		else{
-			/* change the unit of qsg (m^3/d -> m/d) with ice front area */
-			qsg_basin=qsg/basin_icefront_area[reCast<int>(basinid[iv])-1];
-
-			/* calculate melt rates */
-			meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
-		}
-
-		if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
-		if(xIsInf<IssmDouble>(meltrates[iv])) _error_("Inf found in vector");
-	}
-
-	/*Add input*/
-	this->AddInput(CalvingMeltingrateEnum,&meltrates[0],P1Enum);
-
-	this->InputExtrude(CalvingMeltingrateEnum,-1);
-
-	/*Cleanup and return*/
-	xDelete<IssmDouble>(basin_icefront_area);
-	delete gauss;
 }
 /*}}}*/
@@ -3368,4 +3719,10 @@
 }
 /*}}}*/
+bool       Penta::IsSpawnedElement(void){/*{{{*/
+
+	/*Penta cannot be collapsed elements*/
+	return false;
+
+}/*}}}*/
 IssmDouble Penta::StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){/*{{{*/
 	/*Compute stabilization parameter*/
@@ -3414,5 +3771,4 @@
 
 	IssmDouble  epsilon[6];
-	GaussPenta* gauss=NULL;
 	IssmDouble  vx,vy,vel;
 	IssmDouble  strainxx;
@@ -3431,15 +3787,15 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussPenta();
+	GaussPenta gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/* Get the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
 
 		/*Compute strain rate and viscosity: */
-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
 		strainxx=epsilon[0];
 		strainyy=epsilon[1];
@@ -3452,7 +3808,4 @@
 	/*Add input*/
 	this->AddInput(StrainRateparallelEnum,&strainparallel[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -3460,5 +3813,4 @@
 
 	IssmDouble  epsilon[6];
-	GaussPenta* gauss=NULL;
 	IssmDouble  vx,vy,vel;
 	IssmDouble  strainxx;
@@ -3477,15 +3829,15 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussPenta();
+	GaussPenta gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/* Get the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
 
 		/*Compute strain rate and viscosity: */
-		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
+		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
 		strainxx=epsilon[0];
 		strainyy=epsilon[1];
@@ -3498,7 +3850,4 @@
 	/*Add input*/
 	this->AddInput(StrainRateperpendicularEnum,&strainperpendicular[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -3695,5 +4044,5 @@
 
 	/*CFL criterion: */
-	IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy+maxabsvz/dz);
+	IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy+maxabsvz/dz + 1.e-18);
 
 	return dt;
@@ -3776,5 +4125,4 @@
 		_error_("case not possible");
 	}
-
 
 	/*Some checks in debugging mode*/
@@ -3891,5 +4239,4 @@
 		_error_("case not possible");
 	}
-
 
 	/*Some checks in debugging mode*/
@@ -4035,4 +4382,5 @@
 	IssmDouble base,smb,rho_ice,scalefactor;
 	IssmDouble Total_Smb=0;
+	IssmDouble lsf[NUMVERTICES];
 	IssmDouble xyz_list[NUMVERTICES][3];
 
@@ -4050,14 +4398,45 @@
 
 	/*Now get the average SMB over the element*/
-	Input* smb_input = this->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
-
-	smb_input->GetInputAverage(&smb);
-	if(scaled==true){
-		Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
-		scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
-	}
+	Element::GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum);
+   if(lsf[0]*lsf[1]<=0 || lsf[0]*lsf[2]<=0 || lsf[1]*lsf[2]<=0){
+		/*Partially ice-covered element*/
+		bool mainlyice;
+      int point;
+      IssmDouble* smb_vertices = xNew<IssmDouble>(NUMVERTICES);
+		IssmDouble  weights[NUMVERTICES2D];
+		IssmDouble  lsf2d[NUMVERTICES2D];
+      IssmDouble f1,f2,phi;
+      Element::GetInputListOnVertices(&smb_vertices[0],SmbMassBalanceEnum);
+		for(int i=0;i<NUMVERTICES2D;i++) lsf2d[i] = lsf[i];
+		GetFractionGeometry2D(weights,&phi,&point,&f1,&f2,&mainlyice,lsf2d);
+		smb = 0.0;
+		for(int i=0;i<NUMVERTICES2D;i++) smb += weights[i]*smb_vertices[i];
+
+		if(scaled==true){
+         IssmDouble* scalefactor_vertices   = xNew<IssmDouble>(NUMVERTICES);
+         Element::GetInputListOnVertices(&scalefactor_vertices[0],MeshScaleFactorEnum);
+         /*Compute loop only over lower vertices: i<NUMVERTICES2D*/
+         scalefactor = 0.0;
+         for(int i=0;i<NUMVERTICES2D;i++) scalefactor += weights[i]/phi*scalefactor_vertices[i];
+         xDelete<IssmDouble>(scalefactor_vertices);
+		}
+		else scalefactor = 1.0;
+
+		/*Cleanup*/
+      xDelete<IssmDouble>(smb_vertices);
+	}
+
 	else{
-		scalefactor=1.;
-	}
+		/*Fully ice-covered element*/
+		Input* smb_input = this->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
+		smb_input->GetInputAverage(&smb);
+
+		if(scaled==true){
+			Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
+			scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
+		}
+		else scalefactor=1.0;
+	}
+
 	Total_Smb=rho_ice*base*smb*scalefactor;// smb on element in kg s-1
 
@@ -4501,17 +4880,14 @@
 	Input* onbase = this->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
 
-	GaussPenta* gauss=new GaussPenta();
+	GaussPenta gauss;
 	for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
-		gauss->GaussNode(this->element_type,iv);
-		onbase->GetInputValue(&isonbase,gauss);
+		gauss.GaussNode(this->element_type,iv);
+		onbase->GetInputValue(&isonbase,&gauss);
 		if(isonbase==1.){
-			input->GetInputValue(&value,gauss);
+			input->GetInputValue(&value,&gauss);
 			this->nodes[iv]->ApplyConstraint(0,value);
 		}
 	}
-	delete gauss;
-
-}
-/*}}}*/
+}/*}}}*/
 void       Penta::UpdateConstraintsExtrudeFromTop(void){/*{{{*/
 
@@ -4525,11 +4901,10 @@
 	Input* input = this->GetInput(extrusioninput); _assert_(extrusioninput);
 
-	GaussPenta* gauss=new GaussPenta();
+	GaussPenta gauss;
 	for(int i=0;i<3;i++){
-		gauss->GaussNode(P1Enum,indices[i]);
-		input->GetInputValue(&value,gauss);
+		gauss.GaussNode(P1Enum,indices[i]);
+		input->GetInputValue(&value,&gauss);
 		this->nodes[indices[i]]->ApplyConstraint(0,value);
 	}
-	delete gauss;
 
 }
@@ -4607,11 +4982,4 @@
 }
 /*}}}*/
-
-#ifdef _HAVE_GIA_
-void       Penta::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){/*{{{*/
-	_error_("GIA deflection not implemented yet!");
-}
-/*}}}*/
-#endif
 
 #ifdef _HAVE_DAKOTA_
@@ -4653,5 +5021,4 @@
 	}
 	else if(type==TransientInputEnum){
-
 
 		IssmDouble* steps=NULL;
@@ -4796,5 +5163,5 @@
 
 					/*build new bed and surface: */
-					if (this->IsFloating()){
+					if (this->IsAllFloating()){
 						/*hydrostatic equilibrium: */
 						IssmDouble rho_ice,rho_water,di;
Index: issm/trunk/src/c/classes/Elements/Penta.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Penta.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Penta.h	(revision 26744)
@@ -19,4 +19,5 @@
 class Node;
 class Material;
+class Matlitho;
 class Tria;
 class ElementMatrix;
@@ -69,4 +70,6 @@
 		void           CreateInputTimeAverage(int transientinput_enum,int averagedinput_enum,IssmDouble start_time,IssmDouble end_time,int averaging_method);
 		void           ElementResponse(IssmDouble* presponse,int response_enum);
+		void           ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze,Vector<IssmDouble>* vareae,bool spherical=false){_error_("not implemented yet");};
+		void           ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae){_error_("not implemented yet");};
 		void           ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
 		int            FiniteElement(void);
@@ -76,4 +79,5 @@
 		IssmDouble     GetAreaSpherical(void){_error_("not implemented yet!");};
 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+		IssmDouble     GetTriangleAreaSpherical(IssmDouble xyz_list[3][3]){_error_("not implemented yet");};
 		Element*       GetBasalElement(void);
 		Penta*         GetBasalPenta(void);
@@ -81,4 +85,9 @@
 		void           GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
 		IssmDouble     GetGroundedPortion(IssmDouble* xyz_list);
+		void           GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl){_error_("not implemented yet");};
+		void           GetFractionGeometry2D(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl);
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum){_error_("not implemented yet");};
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area, int levelset1enum, int levelset2enum){_error_("not implemented yet");};
+		void        GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius){_error_("not implemented yet");};
 		IssmDouble		GetIcefrontArea();
 		void           GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
@@ -129,4 +138,5 @@
 		IssmDouble     Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
 		IssmDouble     MisfitArea(int weightsenum){_error_("not implemented yet");};
+		void           MovingFrontalVelocity(void);
 		Gauss*         NewGauss(void);
 		Gauss*         NewGauss(int order);
@@ -159,10 +169,12 @@
 		void           PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
 		int            PressureInterpolation();
+      void           Recover3DMLHOInput(int targetVel_enum, int numnodes, IssmDouble* vb,  IssmDouble* vsh, IssmDouble* n, IssmDouble* H, IssmDouble* s);
 		void           ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
 		void           ResetFSBasalBoundaryCondition(void);
 		void           ResetHooks();
-		void				RignotMeltParameterization();
-		void           SetElementInput(int enum_in,IssmDouble values);
-		void           SetElementInput(Inputs* inputs,int enum_in,IssmDouble values);
+		void           SetElementInput(int enum_in,IssmDouble value);
+		void           SetElementInput(int enum_in,IssmDouble value,int type){_error_("not implemented yet");};
+		void           SetElementInput(Inputs* inputs,int enum_in,IssmDouble value);
+		void           SetElementInput(Inputs* inputs,int enum_in,IssmDouble value,int type){_error_("not implemented yet");};
 		void           SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in);
 		void           SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset, int M,int N);
@@ -171,4 +183,5 @@
 	   Element*       SpawnBasalElement(bool depthaverage_materials);
 		Element*       SpawnTopElement(void);
+		bool           IsSpawnedElement(void);
 		Tria*	         SpawnTria(int index1,int index2,int index3);
 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
@@ -205,21 +218,22 @@
 		#endif
 
-		#ifdef _HAVE_GIA_
-		void           GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
-		#endif
 		#ifdef _HAVE_ESA_
 		void    EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy){_error_("not implemented yet!");};
 		void    EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz){_error_("not implemented yet!");};
 		#endif
-		#ifdef _HAVE_SEALEVELRISE_
-		IssmDouble    OceanAverage(IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SetSealevelMasks(SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx, IssmDouble* yy, IssmDouble* zz){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition,IssmDouble oceanarea){_error_("not implemented yet!");};
-		void    SealevelriseEustaticBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseNonEustatic(IssmDouble* Sgo, IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
+		#ifdef _HAVE_SEALEVELCHANGE_
+		void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads,  SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeShift(GrdLoads* loads,  IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeBarystaticLoads(GrdLoads* loads,  BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads,  IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeUpdateViscousFields(){_error_("not implemented yet");};
 		#endif
 
Index: issm/trunk/src/c/classes/Elements/Seg.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Seg.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Seg.cpp	(revision 26744)
@@ -362,4 +362,13 @@
 	return isicefront;
 }/*}}}*/
+bool       Seg::IsSpawnedElement(void){/*{{{*/
+
+	if(this->iscollapsed!=0){
+		return true;
+	}
+
+	return false;
+
+}/*}}}*/
 void       Seg::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
 
Index: issm/trunk/src/c/classes/Elements/Seg.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Seg.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Seg.h	(revision 26744)
@@ -17,4 +17,5 @@
 class Node;
 class Material;
+class Matlitho;
 class ElementMatrix;
 class ElementVector;
@@ -53,4 +54,6 @@
 		void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum,int control_interp){_error_("not implemented yet");};
 		void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
+		void        ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze,Vector<IssmDouble>* vareae,bool spherical=false){_error_("not implemented yet");};
+		void        ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae){_error_("not implemented yet");};
 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
 		int         FiniteElement(void);
@@ -61,5 +64,9 @@
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
-		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+		void        GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl){_error_("not implemented yet");};
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum){_error_("not implemented yet");};
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelset1enum, int levelset2enum){_error_("not implemented yet");};
+		void        GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius){_error_("not implemented yet");};
+		void		GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
 		Input*     GetInput(int enumtype);
 		Input*     GetInput(int enumtype,IssmDouble time);
@@ -138,4 +145,6 @@
 	   Element*    SpawnBasalElement(bool depthaverage_materials){_error_("not implemented yet");};
 		Element*    SpawnTopElement(void){_error_("not implemented yet");};
+		bool        IsSpawnedElement(void);
+		void       SetElementInput(int enum_in,IssmDouble value, int type){_error_("not implemented yet");};
 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
 		void        StabilizationParameterAnisotropic(IssmDouble* tau_parameter_anisotropic, IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble hx, IssmDouble hy,  IssmDouble hz, IssmDouble kappa){_error_("not implemented yet");};
@@ -161,22 +170,24 @@
 		IssmDouble     GetArea3D(void){_error_("not implemented yet!");};
 		IssmDouble     GetAreaSpherical(void){_error_("not implemented yet!");};
-
-#ifdef _HAVE_GIA_
-		void        GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
-#endif
+		IssmDouble GetTriangleAreaSpherical(IssmDouble xyz_list[3][3]){_error_("not implemented yet");};
+
 #ifdef _HAVE_ESA_
 		void    EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy){_error_("not implemented yet!");};
 		void    EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz){_error_("not implemented yet!");};
 #endif
-#ifdef _HAVE_SEALEVELRISE_
-		void    SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SetSealevelMasks(SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx, IssmDouble* yy, IssmDouble* zz){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition,IssmDouble oceanarea){_error_("not implemented yet!");};
-		void    SealevelriseEustaticBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseNonEustatic(IssmDouble* Sgo,IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
-		IssmDouble    OceanAverage(IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
+#ifdef _HAVE_SEALEVELCHANGE_
+		void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads,  SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeShift(GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeBarystaticLoads(GrdLoads* loads,  BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeUpdateViscousFields(){_error_("not implemented yet");};
 #endif
 
Index: issm/trunk/src/c/classes/Elements/Tetra.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Tetra.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Tetra.cpp	(revision 26744)
@@ -786,4 +786,10 @@
 	this->FaceOnSurfaceIndices(&index1,&index2,&index3);
 	return SpawnTria(index1,index2,index3);
+}/*}}}*/
+bool       Tetra::IsSpawnedElement(void){/*{{{*/
+
+   /*Tetras cannot be collapsed elements*/
+   return false;
+
 }/*}}}*/
 Tria*    Tetra::SpawnTria(int index1,int index2,int index3){/*{{{*/
Index: issm/trunk/src/c/classes/Elements/Tetra.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Tetra.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Tetra.h	(revision 26744)
@@ -17,4 +17,5 @@
 class Node;
 class Material;
+class Matlitho;
 class ElementMatrix;
 class ElementVector;
@@ -52,4 +53,6 @@
 		IssmDouble  DragCoefficientAbsGradient(void){_error_("not implemented yet");};
 		void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
+		void        ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze,Vector<IssmDouble>* vareae,bool spherical=false){_error_("not implemented yet");};
+		void        ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae){_error_("not implemented yet");};
 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
 		void        FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3);
@@ -61,8 +64,13 @@
 		IssmDouble  GetArea3D(void){_error_("not implemented yet!");};
 		IssmDouble  GetAreaSpherical(void){_error_("not implemented yet!");};
+		IssmDouble  GetTriangleAreaSpherical(IssmDouble xyz_list[3][3]){_error_("not implemented yet");};
 		Element*    GetBasalElement(void){_error_("not implemented yet");};
 		int         GetElementType(void);
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+		void        GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl){_error_("not implemented yet");};
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum){_error_("not implemented yet");};
+		void       GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelset1enum, int levelset2enum){_error_("not implemented yet");};
+		void        GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius){_error_("not implemented yet");};
 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
 		Input*     GetInput(int enumtype);
@@ -142,6 +150,9 @@
 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
 		void        SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
+		void        SetElementInput(Inputs* inputs,int enum_in,IssmDouble value,int type){_error_("not implemented yet");};
+		void        SetElementInput(int enum_in, IssmDouble value, int type){_error_("not implemented yet");};
 	   Element*    SpawnBasalElement(bool depthaverage_materials);
 		Element*    SpawnTopElement(void);
+		bool        IsSpawnedElement(void);
 		Tria*       SpawnTria(int index1,int index2,int index3);
 		IssmDouble  StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
@@ -168,21 +179,22 @@
 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 
-#ifdef _HAVE_GIA_
-		void        GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
-#endif
 #ifdef _HAVE_ESA_
 		void    EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy){_error_("not implemented yet!");};
 		void    EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz){_error_("not implemented yet!");};
 #endif
-#ifdef _HAVE_SEALEVELRISE_
-		void    SetSealevelMasks(SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx, IssmDouble* yy, IssmDouble* zz){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea){_error_("not implemented yet!");};
-		IssmDouble    SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition,IssmDouble oceanarea){_error_("not implemented yet!");};
-		void    SealevelriseEustaticBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseNonEustatic(IssmDouble* Sgo, IssmDouble* Sg_old, SealevelMasks* masks){_error_("not implemented yet!");};
-		void    SealevelriseGeodetic(IssmDouble* Up ,IssmDouble* North, IssmDouble* East, IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
-		IssmDouble    OceanAverage(IssmDouble* Sg, SealevelMasks* masks){_error_("not implemented yet!");};
+#ifdef _HAVE_SEALEVELCHANGE_
+		void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, Matlitho* litho, IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads,  SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeShift(GrdLoads* loads,  IssmDouble offset, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){_error_("not implemented yet");};
+		void       SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads,  IssmDouble* rotationvector,SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){_error_("not implemented yet");};
+		void       SealevelchangeUpdateViscousFields(){_error_("not implemented yet");};
 #endif
 
Index: issm/trunk/src/c/classes/Elements/Tria.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Tria.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Tria.cpp	(revision 26744)
@@ -21,5 +21,5 @@
 #include "../Inputs/TransientInput.h"
 #include "../../shared/shared.h"
-#ifdef _HAVE_GIA_
+#ifdef _HAVE_SEALEVELCHANGE_
 #include "../../modules/GiaDeflectionCorex/GiaDeflectionCorex.h"
 #endif
@@ -29,4 +29,5 @@
 #define NUMVERTICES   3
 #define NUMVERTICES1D 2
+//#define ISMICI        1
 
 /*Constructors/destructor/copy*/
@@ -174,4 +175,5 @@
 	switch(domaintype){
 		case Domain2DhorizontalEnum:
+		case Domain3DsurfaceEnum:
 			this->AddInput(input_enum,values,interpolation_enum);
 			break;
@@ -321,5 +323,4 @@
 	IssmDouble  epse_2,groundedice,bed,sealevel;		// added sealevel
 
-
 	/* Get node coordinates and dof list: */
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -336,25 +337,23 @@
 	Input* sl_input  = this->GetInput(SealevelEnum); _assert_(sl_input);
 
-
-
 	/* 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 and thickness*/
-		B_input->GetInputValue(&B,gauss);
-		n_input->GetInputValue(&n,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
-		gr_input->GetInputValue(&groundedice,gauss);
-		bs_input->GetInputValue(&bed,gauss);
-		smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
-		smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
+		B_input->GetInputValue(&B,&gauss);
+		n_input->GetInputValue(&n,&gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
+		gr_input->GetInputValue(&groundedice,&gauss);
+		bs_input->GetInputValue(&bed,&gauss);
+		smax_fl_input->GetInputValue(&sigma_max_floating,&gauss);
+		smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss);
 		vel=sqrt(vx*vx+vy*vy)+1.e-14;
-		sl_input->GetInputValue(&sealevel,gauss);
+		sl_input->GetInputValue(&sealevel,&gauss);
 
 		/*Compute strain rate and viscosity: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 
 		/*Get Eigen values*/
@@ -399,7 +398,4 @@
 	this->AddInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
 	this->AddInput(SigmaVMEnum,&sigma_vm[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -407,10 +403,23 @@
 
 	IssmDouble  calvingrate[NUMVERTICES];
-	IssmDouble  vx,vy,vel;
-	IssmDouble  water_height, bed,Ho,thickness,surface;
+	IssmDouble  vx,vy;
+	IssmDouble  water_height, bed,Hab,thickness,surface;
 	IssmDouble  surface_crevasse[NUMVERTICES], basal_crevasse[NUMVERTICES], crevasse_depth[NUMVERTICES], H_surf, H_surfbasal;
-	IssmDouble  B, strainparallel, straineffective,n;
+	IssmDouble  strainparallel, straineffective,B,n;
 	IssmDouble  s_xx,s_xy,s_yy,s1,s2,stmp;
-	int crevasse_opening_stress;
+	int         crevasse_opening_stress;
+
+	/*reset if no ice in element*/
+	if(!this->IsIceInElement()){
+		for(int i=0;i<NUMVERTICES;i++){
+			surface_crevasse[i] = 0.;
+			basal_crevasse[i] = 0.;
+			crevasse_depth[i] = 0.;
+		}
+		this->AddInput(SurfaceCrevasseEnum,&surface_crevasse[0],P1DGEnum);
+		this->AddInput(BasalCrevasseEnum,&basal_crevasse[0],P1DGEnum);
+		this->AddInput(CrevasseDepthEnum,&crevasse_depth[0],P1DGEnum);
+		return;
+	}
 
 	/*retrieve the type of crevasse_opening_stress*/
@@ -437,56 +446,57 @@
 
 	/*Loop over all elements of this partition*/
-	GaussTria* gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
-
-		H_input->GetInputValue(&thickness,gauss);
-		bed_input->GetInputValue(&bed,gauss);
-		surface_input->GetInputValue(&surface,gauss);
-		strainrateparallel_input->GetInputValue(&strainparallel,gauss);
-		strainrateeffective_input->GetInputValue(&straineffective,gauss);
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
-		waterheight_input->GetInputValue(&water_height,gauss);
-		s_xx_input->GetInputValue(&s_xx,gauss);
-		s_xy_input->GetInputValue(&s_xy,gauss);
-		s_yy_input->GetInputValue(&s_yy,gauss);
-		B_input->GetInputValue(&B,gauss);
-		n_input->GetInputValue(&n,gauss);
-
-		vel=sqrt(vx*vx+vy*vy)+1.e-14;
-
-		s1=(s_xx+s_yy)/2.+sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
-		s2=(s_xx+s_yy)/2.-sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
-		if(fabs(s2)>fabs(s1)){stmp=s2; s2=s1; s1=stmp;}
-
-		Ho = thickness - (rho_seawater/rho_ice) * (-bed);
-		if(Ho<0.)  Ho=0.;
-
-		if(crevasse_opening_stress==0){		/*Otero2010: balance between the tensile deviatoric stress and ice overburden pressure*/
-			surface_crevasse[iv] = B * strainparallel * pow(straineffective, ((1 / n)-1)) / (rho_ice * constant_g);
-			basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice)) * (B * strainparallel * pow(straineffective,((1/n)-1)) / (rho_ice*constant_g) - Ho);
-		}
-		else if(crevasse_opening_stress==1){	 /*Benn2017,Todd2018: maximum principal stress */
-			surface_crevasse[iv] = s1 / (rho_ice*constant_g);
-			basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice))* (s1/ (rho_ice*constant_g)-Ho);
-		}
-
-		/* some constraints */
-		if (surface_crevasse[iv]<0.) {
+		gauss.GaussVertex(iv);
+
+		H_input->GetInputValue(&thickness,&gauss);
+		bed_input->GetInputValue(&bed,&gauss);
+		surface_input->GetInputValue(&surface,&gauss);
+
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
+		waterheight_input->GetInputValue(&water_height,&gauss);
+		s_xx_input->GetInputValue(&s_xx,&gauss);
+		s_xy_input->GetInputValue(&s_xy,&gauss);
+		s_yy_input->GetInputValue(&s_yy,&gauss);
+
+      /*Get longitudinal or maximum Eigen stress*/
+		if(crevasse_opening_stress==0){
+         /*Otero2010: balance between the tensile deviatoric stress and ice overburden pressure*/
+			strainrateparallel_input->GetInputValue(&strainparallel,&gauss);
+			strainrateeffective_input->GetInputValue(&straineffective,&gauss);
+			B_input->GetInputValue(&B,&gauss);
+			n_input->GetInputValue(&n,&gauss);
+         s1 =  B * strainparallel * pow(straineffective, (1./n)-1);
+		}
+		else if(crevasse_opening_stress==1){
+         /*Benn2017,Todd2018: maximum principal stress */
+			Matrix2x2Eigen(&s1,&s2,NULL,NULL,s_xx,s_xy,s_yy);
+			s1 = max(0.,max(s1,s2));
+		}
+      else{
+         _error_("not supported");
+      }
+
+      /*Surface crevasse: sigma'_xx - rho_i g d + rho_fw g d_w = 0*/
+      surface_crevasse[iv] = 2*s1 / (rho_ice*constant_g) + (rho_freshwater/rho_ice)*water_height;
+		if(surface_crevasse[iv]<0.){
 			surface_crevasse[iv]=0.;
 			water_height = 0.;
 		}
-		if (basal_crevasse[iv]<0.) basal_crevasse[iv]=0.;
-		if (bed>0.) basal_crevasse[iv] = 0.;
-
-		//if (surface_crevasse[iv]<water_height){
-		//	water_height = surface_crevasse[iv];
-		//}
-
-		/* add water in surface crevasse */
-		surface_crevasse[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height; /* surface crevasse + water */
-		crevasse_depth[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height + basal_crevasse[iv]; /* surface crevasse + basal crevasse + water */
-
+
+      /*Basal crevasse: sigma'_xx - rho_i g (H-d) - rho_w g (b+d) = 0*/
+      if(bed>0.){
+         basal_crevasse[iv] = 0.;
+      }
+      else{
+         Hab = thickness - (rho_seawater/rho_ice) * (-bed);
+         if(Hab<0.)  Hab=0.;
+         basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice))* (2*s1/ (rho_ice*constant_g)-Hab);
+         if(basal_crevasse[iv]<0.) basal_crevasse[iv]=0.;
+      }
+
+      /*Total crevasse depth (surface + basal)*/
+		crevasse_depth[iv]   = surface_crevasse[iv] + basal_crevasse[iv];
 	}
 
@@ -494,6 +504,4 @@
 	this->AddInput(BasalCrevasseEnum,&basal_crevasse[0],P1DGEnum);
 	this->AddInput(CrevasseDepthEnum,&crevasse_depth[0],P1DGEnum);
-
-	delete gauss;
 }
 /*}}}*/
@@ -517,16 +525,16 @@
 
 	/* 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 the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
-		strainparallel_input->GetInputValue(&strainparallel,gauss);
-		strainperpendicular_input->GetInputValue(&strainperpendicular,gauss);
-		levermanncoeff_input->GetInputValue(&propcoeff,gauss);
-		bs_input->GetInputValue(&bed,gauss);
+		strainparallel_input->GetInputValue(&strainparallel,&gauss);
+		strainperpendicular_input->GetInputValue(&strainperpendicular,&gauss);
+		levermanncoeff_input->GetInputValue(&propcoeff,&gauss);
+		bs_input->GetInputValue(&bed,&gauss);
 
 		/*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
@@ -545,7 +553,4 @@
 	this->AddInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
 	this->AddInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }/*}}}*/
 void       Tria::CalvingFluxLevelset(){/*{{{*/
@@ -852,5 +857,4 @@
 	IssmDouble  tau_1[NUMVERTICES];
 	IssmDouble  tau_2[NUMVERTICES];
-	GaussTria*  gauss=NULL;
 	int domaintype,dim=2;
 
@@ -868,19 +872,19 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate and viscosity: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 		switch(approximation){
 			case SSAApproximationEnum:
-				this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
+				this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
 				break;
 			case HOApproximationEnum:
-				this->material->ViscosityHO(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
+				this->material->ViscosityHO(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
 				break;
 			case FSApproximationEnum:
-				this->material->ViscosityFS(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input,NULL);
+				this->material->ViscosityFS(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input,NULL);
 				break;
 			default:
@@ -908,7 +912,4 @@
 	this->AddInput(DeviatoricStress1Enum,&tau_1[0],P1DGEnum);
 	this->AddInput(DeviatoricStress2Enum,&tau_2[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -921,5 +922,4 @@
 	IssmDouble  strain_xy[NUMVERTICES];
 	IssmDouble  vorticity_xy[NUMVERTICES];
-	GaussTria*  gauss=NULL;
 
 	/* Get node coordinates and dof list: */
@@ -931,10 +931,10 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate and vorticity rate: */
-		this->StrainRateESA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateESA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 
 		/*Compute Stress*/
@@ -950,7 +950,4 @@
 	this->AddInput(EsaStrainratexyEnum,&strain_xy[0],P1DGEnum);
 	this->AddInput(EsaRotationrateEnum,&vorticity_xy[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -1026,5 +1023,4 @@
 	IssmDouble	sigma_xz[NUMVERTICES]={0,0,0};
 	IssmDouble	sigma_yz[NUMVERTICES]={0,0,0};
-	GaussTria*  gauss=NULL;
 	int domaintype,dim=2;
 
@@ -1040,12 +1036,12 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
-		this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
-		pressure_input->GetInputValue(&pressure,gauss);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
+		this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
+		pressure_input->GetInputValue(&pressure,&gauss);
 
 		/*Compute Stress*/
@@ -1062,7 +1058,4 @@
 	this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
 	this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -1176,15 +1169,14 @@
 		control_gradient->Serve(NUMVERTICES,&lidlist[0]);
 
-		GaussTria* gauss=new GaussTria();
+		GaussTria gauss;
 		for (int iv=0;iv<NUMVERTICES;iv++){
-			gauss->GaussVertex(iv);
-
-			control_value->GetInputValue(&value,gauss);
-			control_gradient->GetInputValue(&gradient,gauss);
+			gauss.GaussVertex(iv);
+
+			control_value->GetInputValue(&value,&gauss);
+			control_gradient->GetInputValue(&gradient,&gauss);
 
 			values[iv]    = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
 			gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
 		}
-		delete gauss;
 
 		vector_control->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
@@ -1304,4 +1296,55 @@
 	_printf_("list of vertices on surface: "<<values[0]<<" "<<values[1]<<" "<<values[2]);
 	_error_("Could not find 2 vertices on surface");
+}
+/*}}}*/
+void       Tria::ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze, Vector<IssmDouble>* vareae, bool spherical){/*{{{*/
+
+	/*Look for x,y,z coordinates:*/
+	IssmDouble xyz_list[NUMVERTICES][3];
+	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
+
+	/*Find centroid:*/
+	IssmDouble xe=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
+	IssmDouble ye=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
+	IssmDouble ze=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3.0;
+
+	if(!spherical){
+		IssmDouble area;
+		vxe->SetValue(this->sid,xe,INS_VAL);
+		vye->SetValue(this->sid,ye,INS_VAL);
+		vze->SetValue(this->sid,ze,INS_VAL);
+		area=this->GetAreaSpherical();
+		vareae->SetValue(this->sid,area,INS_VAL);
+
+		/*in addition, put in in the inputs:*/
+		this->inputs->SetDoubleInput(AreaEnum,this->lid,area);
+	}
+	else _error_("spherical coordinates not supported yet!");
+	return;
+}
+/*}}}*/
+void       Tria::ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae){ /*{{{*/
+
+	IssmDouble planetradius;
+
+	/*Look for x,y,z coordinates:*/
+	IssmDouble xyz_list[NUMVERTICES][3];
+	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
+	IssmDouble area,xe,ye,ze,late,longe;
+
+	/*Find centroid:*/
+	xe=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
+	ye=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
+	ze=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3.0;
+
+	late= asin(ze/sqrt(pow(xe,2.0)+pow(ye,2.0)+pow(ze,2.0)));
+	longe= atan2(ye,xe);
+	area=this->GetAreaSpherical();
+
+	vlonge->SetValue(this->sid,longe,INS_VAL);
+	vlate->SetValue(this->sid,late,INS_VAL);
+	vareae->SetValue(this->sid,area,INS_VAL);
+
+	return;
 }
 /*}}}*/
@@ -1414,14 +1457,14 @@
 
 	/*1. Recover stresses at the base*/
-	GaussTria* gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
-		this->material->ViscosityFS(&viscosity,2,&xyz_list[0][0],gauss,vx_input,vy_input,NULL);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
+		this->material->ViscosityFS(&viscosity,2,&xyz_list[0][0],&gauss,vx_input,vy_input,NULL);
 		/*FIXME: this is for Hongju only*/
-	//	pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
-	//	if (pressure[iv]/pressureice[iv]>1) pressure[iv]=pressureice[iv];
+		//	pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
+		//	if (pressure[iv]/pressureice[iv]>1) pressure[iv]=pressureice[iv];
 
 		/*Compute Stress*/
@@ -1450,7 +1493,4 @@
 		}
 	}
-
-	/*clean up*/
-	delete gauss;
 }
 /*}}}*/
@@ -1536,12 +1576,12 @@
 	/*retrieve coordinates: lat,long,radius */
 	::GetVerticesCoordinates(&llr_list[0][0],vertices,NUMVERTICES,spherical);
-	x1=llr_list[0][0]/180*PI; y1=llr_list[0][1]/180*PI; z1=llr_list[0][2];
-	x2=llr_list[1][0]/180*PI; y2=llr_list[1][1]/180*PI; z2=llr_list[1][2];
-	x3=llr_list[2][0]/180*PI; y3=llr_list[2][1]/180*PI; z3=llr_list[2][2];
+	x1=llr_list[0][0]/180.*M_PI; y1=llr_list[0][1]/180.*M_PI; z1=llr_list[0][2];
+	x2=llr_list[1][0]/180.*M_PI; y2=llr_list[1][1]/180.*M_PI; z2=llr_list[1][2];
+	x3=llr_list[2][0]/180.*M_PI; y3=llr_list[2][1]/180.*M_PI; z3=llr_list[2][2];
 
 	/*compute great circle distance between vertices */
-	arc12=2.*asin(sqrt(pow(sin((x2-x1)/2),2.0)+cos(x1)*cos(x2)*pow(sin((y2-y1)/2),2)));
-	arc23=2.*asin(sqrt(pow(sin((x3-x2)/2),2.0)+cos(x2)*cos(x3)*pow(sin((y3-y2)/2),2)));
-	arc31=2.*asin(sqrt(pow(sin((x1-x3)/2),2.0)+cos(x3)*cos(x1)*pow(sin((y1-y3)/2),2)));
+	arc12=2.*asin(sqrt(pow(sin(0.5*(x2-x1)),2)+cos(x1)*cos(x2)*pow(sin(0.5*(y2-y1)),2)));
+	arc23=2.*asin(sqrt(pow(sin(0.5*(x3-x2)),2)+cos(x2)*cos(x3)*pow(sin(0.5*(y3-y2)),2)));
+	arc31=2.*asin(sqrt(pow(sin(0.5*(x1-x3)),2)+cos(x3)*cos(x1)*pow(sin(0.5*(y1-y3)),2)));
 
 	/*semi parameter */
@@ -1597,5 +1637,5 @@
 }
 /*}}}*/
-void       Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
+void       Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* pmainlyfloating){/*{{{*/
 	/*Computeportion of the element that is grounded*/
 
@@ -1648,5 +1688,5 @@
 	*fraction1=f1;
 	*fraction2=f2;
-	*mainlyfloating=floating;
+	*pmainlyfloating=floating;
 }
 /*}}}*/
@@ -1720,4 +1760,592 @@
 }
 /*}}}*/
+void       Tria::GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl){/*{{{*/
+
+	/*Computeportion of the element that is grounded*/
+	bool               trapezeisnegative=true; //default value
+	int                point;
+	const IssmPDouble  epsilon= 1.e-15;
+	IssmDouble         f1,f2,phi;
+
+	/*Weights: */
+	Gauss* gauss=NULL;
+	IssmDouble loadweights_g[NUMVERTICES];
+	IssmDouble total_weight=0;
+
+	_assert_(!xIsNan<IssmDouble>(gl[0]));
+	_assert_(!xIsNan<IssmDouble>(gl[1]));
+	_assert_(!xIsNan<IssmDouble>(gl[2]));
+
+	/*Be sure that values are not zero*/
+	if(gl[0]==0.) gl[0]=gl[0]+epsilon;
+	if(gl[1]==0.) gl[1]=gl[1]+epsilon;
+	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+
+	/*Check that not all nodes are positive or negative: */
+	if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All positive
+		point=0;
+		f1=1.;
+		f2=1.;
+	}
+	else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All negative
+		point=0;
+		f1=0.;
+		f2=0.;
+	}
+	else{
+		if(gl[0]*gl[1]*gl[2]<0) trapezeisnegative=false; //no matter what configuration, there has to be two positive vertices, which means the trapeze is positive.
+
+		if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
+			point=2;
+			f1=gl[2]/(gl[2]-gl[0]);
+			f2=gl[2]/(gl[2]-gl[1]);
+		}
+		else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+			point=0;
+			f1=gl[0]/(gl[0]-gl[1]);
+			f2=gl[0]/(gl[0]-gl[2]);
+		}
+		else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+			point=1;
+			f1=gl[1]/(gl[1]-gl[2]);
+			f2=gl[1]/(gl[1]-gl[0]);
+		}
+		else _error_("case not possible");
+	}
+	if(trapezeisnegative) phi=1-f1*f2;
+	else phi=f1*f2;
+
+	/*Compute weights:*/
+	gauss = this->NewGauss(point,f1,f2,1-trapezeisnegative,2); //VV correction (16Nov2021)
+
+	total_weight=0;
+	for(int i=0;i<NUMVERTICES;i++)weights[i]=0;
+	while(gauss->next()){
+		TriaRef::GetNodalFunctions(&loadweights_g[0], gauss,P1Enum);
+		for(int i=0;i<NUMVERTICES;i++)weights[i]+=loadweights_g[i]*gauss->weight;
+		total_weight+=gauss->weight;
+	}
+	/*Normalizing to phi such that weights provide coefficients for integration over subelement (for averaging:phi*weights)*/  
+	if(total_weight>0.) for(int i=0;i<NUMVERTICES;i++)weights[i]/=total_weight/phi; 
+	else for(int i=0;i<NUMVERTICES;i++)weights[i]=0;
+
+	/*free ressources:*/
+	delete gauss;
+
+	/*Assign output pointers:*/
+	*pphi=phi;
+	*ppoint1=point;
+	*pfraction1=f1;
+	*pfraction2=f2;
+	*ptrapezeisnegative=trapezeisnegative;
+}
+/*}}}*/
+IssmDouble Tria::GetTriangleAreaSpherical(IssmDouble xyz_list[3][3]){/*{{{*/
+
+	IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
+	IssmDouble arc12,arc23,arc31,semi_peri,excess;
+	IssmDouble lat1,lat2,lat3;
+	IssmDouble long1,long2,long3;
+	IssmDouble r1,r2,r3;
+
+	/*retrieve x,y,z coordinates: */
+	x1=xyz_list[0][0]; y1=xyz_list[0][1]; z1=xyz_list[0][2];
+	x2=xyz_list[1][0]; y2=xyz_list[1][1]; z2=xyz_list[1][2];
+	x3=xyz_list[2][0]; y3=xyz_list[2][1]; z3=xyz_list[2][2];
+
+	/*Build lat,long, r:*/
+	r1=sqrt(pow(x1,2.0)+pow(y1,2.0)+pow(z1,2.0));
+	r2=sqrt(pow(x2,2.0)+pow(y2,2.0)+pow(z2,2.0));
+	r3=sqrt(pow(x3,2.0)+pow(y3,2.0)+pow(z3,2.0));
+
+	lat1=asin(z1/r1); long1=atan2(y1,x1);
+	lat2=asin(z2/r2); long2=atan2(y2,x2);
+	lat3=asin(z3/r3); long3=atan2(y3,x3);
+
+	/*compute great circle distance between vertices */
+	arc12=2.*asin(sqrt(pow(sin(0.5*(lat2-lat1)),2)+cos(lat1)*cos(lat2)*pow(sin(0.5*(long2-long1)),2)));
+	arc23=2.*asin(sqrt(pow(sin(0.5*(lat3-lat2)),2)+cos(lat2)*cos(lat3)*pow(sin(0.5*(long3-long2)),2)));
+	arc31=2.*asin(sqrt(pow(sin(0.5*(lat1-lat3)),2)+cos(lat3)*cos(lat1)*pow(sin(0.5*(long1-long3)),2)));
+
+	/*semi parameter */
+	semi_peri=(arc12+arc23+arc31)/2;
+
+	/*spherical excess */
+	excess=4.*atan(sqrt(tan(semi_peri/2)*tan((semi_peri-arc12)/2)*tan((semi_peri-arc23)/2)*tan((semi_peri-arc31)/2)));
+
+	/*area = excess*radius^2 */
+	return excess*pow((r1+r2+r3)/3,2);
+}
+/*}}}*/
+void       Tria:: GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius){ /*{{{*/
+
+	int i0,i1,i2;
+
+	IssmDouble xyz0[3][3];
+	IssmDouble barycenter[3]={0};
+	IssmDouble centroid[3]={0};
+
+	::GetVerticesCoordinates(&xyz0[0][0],vertices,NUMVERTICES); // initial triangle
+
+	i0=point1;
+	i1=(point1+1)%3;
+	i2=(point1+2)%3;
+
+	//Barycenter of the subelement triangle:
+	for (int i=0;i<3;i++) barycenter[i]=xyz0[i0][i]*(3.0-fraction1-fraction2)/3.0 + fraction1/3.0*xyz0[i1][i] + fraction2/3.0*xyz0[i2][i];
+
+	if (istrapeze1){
+		centroid[0]=planetradius*cos(late*M_PI/180.0) * cos(longe*M_PI/180.0); //x
+		centroid[1]=planetradius*cos(late*M_PI/180.0) * sin(longe*M_PI/180.0);  //y
+		centroid[2]=planetradius*sin(late*M_PI/180.0);					//z
+
+		// centroid_el *area_el= barycenter_triangle * area_triangle + barycenter_trapeze * area_trapeze
+		// and phi_trapeze = area_trapeze/area_el = (1 - area_triangle/area_el)
+		// => barycenter_trapeze = (centroid_el - barycenter_triangle * (1-phi_trapeze) )/phi_trapeze
+		for (int i=0;i<3;i++) barycenter[i] =(centroid[i] -barycenter[i]*(1.0-phi))/phi;
+
+	}
+
+	//recompute planetradius from the barycenter onwards:
+	planetradius=sqrt( pow(barycenter[0],2.0)+ pow(barycenter[1],2.0)+ pow(barycenter[2],2.0));
+
+	*platbar=asin(barycenter[2]/planetradius)*180.0/M_PI;
+	*plongbar=atan2(barycenter[1],barycenter[0])*180.0/M_PI;
+
+} /*}}}*/
+void       Tria::GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum){ /*{{{*/
+
+	IssmDouble phi;
+	IssmDouble fraction1,fraction2;
+	bool istrapeze1;  
+	bool flip1=false;
+	int  point1;
+	IssmDouble levelset[NUMVERTICES];
+	IssmDouble planetradius;
+
+	this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum);
+
+	//figure out if we are flipping the levelsets: 
+	if(levelsetenum<0){
+		levelsetenum=-levelsetenum;
+		flip1=true;
+	}
+	//figure out area where we have loads
+	Element::GetInputListOnVertices(&levelset[0],levelsetenum);
+	if(flip1)for(int i=0;i<NUMVERTICES;i++)levelset[i]=-levelset[i];
+
+	//compute sea level load weights
+	this->GetFractionGeometry(loadweights,&phi,&point1,&fraction1,&fraction2,&istrapeze1,levelset);
+
+	this->GetBarycenterFromLevelset(platbar,plongbar, phi, fraction1, fraction2, late, longe, point1,istrapeze1,planetradius);
+
+	/*assign output pointers:*/
+	*ploadarea=phi*area;
+
+} /*}}}*/
+void       Tria::GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelset1enum, int levelset2enum){ /*{{{*/
+
+	bool istrapeze1, istrapeze2;
+	IssmDouble phi1,phi2, d,e,f,g,h1,h2;
+	int point1, point2,  i0,i1,i2,j0,j1,j2;
+	IssmDouble weights1[3],weights2[3];
+	IssmDouble levelset1[3];
+	IssmDouble levelset2[3];
+
+	bool flip1=false;
+	bool flip2=false;
+
+	IssmDouble xyz0[3][3];
+	IssmDouble xyz1[3][3]={0};
+	IssmDouble xyz2[3][3]={0};
+	IssmDouble xyz3[3][3]={0};
+	IssmDouble xyz[8][3]={0};
+	IssmDouble w[8][NUMVERTICES]={0};
+	IssmDouble areasub=0;
+	IssmDouble area1=0;
+	IssmDouble area2=0;
+	IssmDouble area3=0;
+
+	int tria0[3]={0,1,2};
+	int tria1[3]={-1};
+	int tria2[3]={-1};
+	int tria3[3]={-1};
+
+	IssmDouble w1[3][3]={0};
+	IssmDouble w2[3][3]={0};
+	IssmDouble w3[3][3]={0};
+
+	IssmDouble barycenter[3]={0};
+	IssmDouble planetradius;
+
+	//figure out if we are flipping the levelsets: 
+	if(levelset1enum<0){
+		levelset1enum=-levelset1enum;
+		flip1=true;
+	}
+	if(levelset2enum<0){
+		levelset2enum=-levelset2enum;
+		flip2=true;
+	}
+
+	//recover levelsets: 
+	Element::GetInputListOnVertices(&levelset1[0],levelset1enum);
+	if(flip1)for(int i=0;i<NUMVERTICES;i++)levelset1[i]=-levelset1[i];
+	Element::GetInputListOnVertices(&levelset2[0],levelset2enum);
+	if(flip2)for(int i=0;i<NUMVERTICES;i++)levelset2[i]=-levelset2[i];
+
+	//We want the fraction of the element where both levelsets are negative.
+	//Early return if either of them is >=0 on all vertices
+	if (levelset1[0]>=0 && levelset1[1]>=0 && levelset1[2]>=0) {
+		for (int i=0;i<NUMVERTICES;i++) loadweights[i]=0.0;
+		*ploadarea= 0.0;
+		*platbar=late; //just default to centroid of triangle
+		*plongbar=longe; 
+		return;
+	}
+	if (levelset2[0]>=0 && levelset2[1]>=0 && levelset2[2]>=0) {
+		for (int i=0;i<NUMVERTICES;i++) loadweights[i]=0.0;
+		*ploadarea= 0.0;
+		*platbar=late; //just default to centroid of triangle
+		*plongbar=longe; 
+		return;
+	}
+
+	//If everyone is negative, no need to calculate any fraction
+	if (levelset1[0]<=0 && levelset1[1]<=0 && levelset1[2]<=0 && levelset2[0]<=0 && levelset2[1]<=0 && levelset2[2]<=0) {
+		for (int i=0;i<NUMVERTICES;i++) loadweights[i]=1.0/NUMVERTICES;
+		*ploadarea= area;
+		*platbar=late;
+		*plongbar=longe;
+		return;
+	}
+
+	/*recover planet radius:*/
+	this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum);
+
+	//If just one levelset is all negative, just take the partitioning of the other, no interaction between them
+	if (levelset1[0]<=0 && levelset1[1]<=0 && levelset1[2]<=0) {
+		this->GetFractionGeometry(loadweights,&phi2,&point2,&f,&g,&istrapeze2,levelset2);
+		this->GetBarycenterFromLevelset(platbar,plongbar, phi2, f, g, late, longe, point2,istrapeze2,planetradius);
+		*ploadarea=area*phi2;
+		return;
+	}
+	if (levelset2[0]<=0 && levelset2[1]<=0 && levelset2[2]<=0) {
+		this->GetFractionGeometry(loadweights,&phi1,&point1,&d,&e,&istrapeze1,levelset1);
+		this->GetBarycenterFromLevelset(platbar,plongbar, phi1, d, e, late, longe, point1,istrapeze1,planetradius);
+		*ploadarea=area*phi1;
+		return;
+	}
+
+	this->GetFractionGeometry(&weights1[0],&phi1,&point1,&d,&e,&istrapeze1,levelset1);
+	this->GetFractionGeometry(&weights2[0],&phi2,&point2,&f,&g,&istrapeze2,levelset2);
+
+	//Early return if levelsets are not independent
+	if (istrapeze1==istrapeze2 && point1==point2 && phi1==phi2){
+		//the two levelsets are redundant: levelset1 = positivescalar * levelset2
+		this->GetBarycenterFromLevelset(platbar,plongbar, phi1, d, e, late, longe, point1,istrapeze1,planetradius);
+		*ploadarea=area*phi1;
+		for (int i=0;i<NUMVERTICES;i++) loadweights[i]=weights1[i];
+		return;
+	}
+	if (istrapeze1!=istrapeze2 && point1==point2 && phi1==(1.0-phi2)){
+		//the two levelsets are incompatible: levelset1 = negativescalar * levelset2
+		*plongbar=longe;
+		*platbar=late;
+		*ploadarea=0.0;
+		for (int i=0;i<NUMVERTICES;i++) loadweights[i]=0.0;
+		return;
+	}
+
+	::GetVerticesCoordinates(&xyz0[0][0],vertices,NUMVERTICES); // initial triangle
+
+	//Let our element be triangle ABC with:
+	i0=point1; //A
+	i1=(point1+1)%3; //B
+	i2=(point1+2)%3; //C
+
+	j0=point2; //Can be A, B or C
+	j1=(point2+1)%3; //anticlockwise point from j0
+	j2=(point2+2)%3; //clockwise point from j0
+
+	/* Below we define the relative fractional lengths of ABC where the zero-level contours of the two level sets intersect with ABC and each other. For example D is the intersection of level set 1 with side AB with fractional length d=[AD]/[AB].
+
+	   levelset1 intersects ABC on D and E:
+	   A------D---B
+	   <--d--->		
+
+	   A-----E----C
+	   <--e-->
+
+	   levelset2 intersects ABC on F and G:
+	   j0---F------j1
+	   <--f->
+
+	   j0-------G--j2
+	   <---g---->
+
+	   levelset1 and 2 intersect on H (when that intersection exists inside the element)
+	   D----H------E
+	   <-h1->
+
+	   F-----H----G
+	   <--h2->
+	*/
+
+	if (point2==i0){
+		h1= g*(d-f)/(d*g-e*f);
+		h2= e/g * h1;
+	}
+        else if (point2==i1){
+		h1=f*(1.0-g-d)/(f*(e-d)-e*g);
+		h2= 1.0-e/f * h1;
+	}
+	else if (point2==i2){
+		h1= (g*(1.0-f-d)+f*d)/(g*(e-d) +f*d); 
+		h2= (d*(f+e-1))/(g*(e-d) +f*d);
+	}
+
+	//interpolant weights of each point. Any field F[0,1,2] provided at the original vertices [0,1,2] will be equal on point k to sum_i (F[i] * w[k][i])
+	w[0][0]=1; //A
+	w[1][1]=1; //B
+	w[2][2]=1; //C
+	w[3][i0]=1.0-d; w[3][i1]=d; //D
+	w[4][i0]=1.0-e; w[4][i2]=e; //E
+	w[5][j0]=1.0-f; w[5][j1]=f; //F
+	w[6][j0]=1.0-g; w[6][j2]=g; //G
+	for (int j=0;j<3;j++) w[7][j]=w[3][j]*(1.0-h1) + w[4][j]*h1; //H: we interpolate the intersection point H between D and E at fraction h1
+
+	for (int k=0;k<8;k++){
+		for (int i=0;i<NUMVERTICES;i++) {
+			for (int j=0;j<3;j++) xyz[k][j]+=xyz0[i][j]*w[k][i];
+		}
+	}
+
+		//point2 can be either i0,i1 or i2. We start the search with i1 and i2 as they have less computational cost in ifs
+		if(point2==i2){ /*{{{*/
+			if (e>1.0-f){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=5; tria1[1]= 7; tria1[2]= 4; // FHE
+					area1=h2*(e+f-1.0)*g;
+				}
+				else if (!istrapeze1 && istrapeze2){
+					tria1[0]=i0; tria1[1]= 3; tria1[2]= 5; //ADF
+					area1=d*(1.0-f);
+					tria2[0]=3; tria2[1]= 7; tria2[2]= 5; //DHF
+					area2=d*h1*(e+f-1.0);
+				}
+				else if (istrapeze1 && !istrapeze2){
+					tria1[0]=7; tria1[1]= 6; tria1[2]= 4; //HGE
+					area1=g*(1.0-h2)*(e+f-1.0);
+					tria2[0]=4; tria2[1]= 6; tria2[2]= i2; //EGC
+					area2=g*(1.0-e);
+				}
+				else { //istrapeze1 && istrapeze2
+					tria1[0]=3; tria1[1]= i1; tria1[2]= 6; //DBG
+					area1=(1.0-d)*(1.0-g);
+					tria2[0]=3; tria2[1]= 6; tria2[2]= 7; //DGH
+					area2=g*((1.0-f)*(1.0-h2)+h2*e)+d*(1.0-e-g);
+				}  /*}}}*/
+			}
+			else if (e<=1.0-f){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+				}
+				else if (!istrapeze1 && istrapeze2){
+					tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; //ADE
+					area1=d*e;
+				}
+				else if (istrapeze1 && !istrapeze2){
+					tria1[0]=5; tria1[1]= 6; tria1[2]= i2; //FGC
+					area1=f*g;
+				}
+				else { //istrapeze1 && istrapeze2
+					tria1[0]=3; tria1[1]= i1; tria1[2]= 5; //DBF
+			                area1=(1.0-d)*(1.0-f);
+					tria2[0]=4; tria2[1]= 3; tria2[2]= 5;  //EDF
+			                area2=d*(1.0-e-f);
+					tria3[0]=5; tria3[1]= i1; tria3[2]= 6; //FBG
+			                area3=f*(1.0-g);
+				} /*}}}*/
+			} 
+		}/*}}}*/    
+		else if(point2==i1){ /*{{{*/
+			if (d>1.0-g){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=6; tria1[1]= 3; tria1[2]= 7; //GDH
+					area1=(1.0-h2)*(d+g-1.0)*f;
+				}
+				else if (!istrapeze1 && istrapeze2){
+					tria1[0]=i0; tria1[1]= 6; tria1[2]= 4; //AGE
+			                area1=(1.0-g)*e;
+					tria2[0]=6; tria2[1]= 7; tria2[2]= 4; //GHE
+			                area2=e*(1.0-h1)*(g+d-1.0);
+				}
+				else if (istrapeze1 && !istrapeze2){
+					tria1[0]=i1; tria1[1]= 5; tria1[2]= 3; //BFD
+			                area1=(1.0-d)*f;
+					tria2[0]=3; tria2[1]= 5; tria2[2]= 7; //DFH
+					area2=f*h2*(d+g-1.0);
+				}
+				else { //istrapeze1 && istrapeze2
+					tria1[0]=7; tria1[1]= 5; tria1[2]= 4; //HFE
+			                area1=e*((1.0-d)*(1.0-h1)+h1*g)+f*(1.0-g-e);
+					tria2[0]=4; tria2[1]= 5; tria2[2]= i2;//EFC
+			                area2=(1.0-e)*(1.0-f);
+				}  /*}}}*/
+			}
+			else if (d<=1.0-g){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+				}
+				else if (!istrapeze1 && istrapeze2){
+					tria1[0]=i0; tria1[1]= 3; tria1[2]= 4; //ADE
+			                area1=d*e;
+				}
+				else if (istrapeze1 && !istrapeze2){
+					tria1[0]=6; tria1[1]= i1; tria1[2]= 5; //GBF
+			                area1=f*g;
+				}
+				else { //istrapeze1 && istrapeze2
+					tria1[0]=3; tria1[1]= 6; tria1[2]= 4; //DGE
+					area1=e*(1.0-d-g);
+					tria2[0]=6; tria2[1]= i2; tria2[2]= 4; //GCE
+					area2=(1.0-g)*(1.0-e);
+					tria3[0]=6; tria3[1]= 5; tria3[2]= i2; //GFC
+					area3=g*(1.0-f);
+				} /*}}}*/
+			}
+
+		}/*}}}*/
+		else{ /*{{{*/
+			if (d<=f && e>=g){  /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=i0; tria1[1]= 3; tria1[2]= 7; //ADH
+			                area1=h1*d*e;
+					tria2[0]=i0; tria2[1]= 7; tria2[2]= 6; //AHG
+			                area2=(1.0-h2)*f*g;
+				}
+				else if (!istrapeze1 && istrapeze2){
+					tria1[0]=6; tria1[1]= 7; tria1[2]= 4; //GHE
+			                area1=(e-g)*d*(1.0-h1);
+				}
+				else if (istrapeze1 && !istrapeze2){
+					tria1[0]=3; tria1[1]= 5; tria1[2]= 7; //DFH
+					area1=(f-d)*g*h2;
+				}
+				else { //istrapeze1 && istrapeze2
+					tria1[0]=5; tria1[1]= i1; tria1[2]= 7; //FBH
+			                area1=g*h2*(1.0-f);
+					tria2[0]=7; tria2[1]= i1; tria2[2]= i2;//HBC
+			                area2=1.0+d*(h1-e*h1-1.0)+g*h2*(d-1.0);
+					tria3[0]=7; tria3[1]= i2; tria3[2]= 4; //HCE
+			                area3=d*(1.0-h1)*(1.0-e);
+				} /*}}}*/
+			}
+			else if (d>=f && e<=g){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=i0; tria1[1]= 5; tria1[2]= 7; //AFH
+			                area1=h2*f*g;
+					tria2[0]=i0; tria2[1]= 7; tria2[2]= 4; //AHE
+			                area2=(1.0-h1)*d*e;
+				}else if (!istrapeze1 && istrapeze2){
+					tria1[0]=5; tria1[1]= 3; tria1[2]= 7; //FDH
+			                area1=(d-f)*e*h1;
+				}else if (istrapeze1 && !istrapeze2){
+					tria1[0]=4; tria1[1]= 7; tria1[2]= 6; //EHG
+			                area1=(g-e)*f*(1.0-h2);
+				}else { //istrapeze1 && istrapeze2
+					tria1[0]=3; tria1[1]= i1; tria1[2]= 7; //DBH
+			                area1=e*h1*(1.0-d);
+					tria2[0]=7; tria2[1]= i1; tria2[2]= 6; //HCG
+			                area2=f*(1.0-h2)*(1.0-g);
+					tria3[0]=6; tria3[1]= i1; tria3[2]= i2; //HBC
+			                area3=1.0+f*(h2-g*h2-1.0)+e*h1*(f-1.0);
+				}  /*}}}*/
+			}
+			else if (d<=f && e<=g){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=i0; tria1[1]= 3; tria1[2]= 4;//ADE
+					area1=d*e;
+				}else if (!istrapeze1 && istrapeze2){
+				}else if (istrapeze1 && !istrapeze2){
+					tria1[0]=3; tria1[1]= 5; tria1[2]= 6; //DFG
+			                area1=g*(f-d);
+					tria2[0]=3; tria2[1]= 6; tria2[2]= 4; //DGE
+			                area2=d*(g-e);
+				}else { //istrapeze1 && istrapeze2
+					tria1[0]=5; tria1[1]= i2; tria1[2]= 6; //FCG
+			                area1=f*(1.0-g);
+					tria2[0]=5; tria2[1]= i1; tria2[2]= i2;//FBC
+			                area2=1.0-f;
+				}  /*}}}*/
+			}
+			else if (d>=f && e>=g){ /*{{{*/
+				if (!istrapeze1 && !istrapeze2){
+					tria1[0]=i0; tria1[1]= 5; tria1[2]= 6; //AFG
+			                area1=f*g;
+				}else if (!istrapeze1 && istrapeze2){
+					tria1[0]=5; tria1[1]= 4; tria1[2]= 6; //FEG
+			                area1=f*(e-g);
+					tria2[0]=5; tria2[1]= 3; tria2[2]= 4; //FDE
+			                area2=e*(d-f);
+				}else if (istrapeze1 && !istrapeze2){
+				}else { //istrapeze1 && istrapeze2
+					tria1[0]=3; tria1[1]= i1; tria1[2]= i2; //DBC
+			                area1=1.0-d;
+					tria2[0]=3; tria2[1]= i2; tria2[2]= 4;//DCE
+			                area2=d*(1.0-e);
+				}  /*}}}*/
+			} 
+		} /*}}}*/
+
+	if(tria1[0]>-1){ 
+		for (int i=0;i<NUMVERTICES;i++){
+			for (int j=0;j<3;j++) {
+				xyz1[i][j]=xyz[tria1[i]][j];
+				w1[i][j]=w[tria1[i]][j];
+			}
+		}
+		area1*=area; //dimensionalize the fractional area from [0:1] to [0:area]
+	}
+	if(tria2[0]>-1){ 
+		for (int i=0;i<NUMVERTICES;i++){
+			for (int j=0;j<3;j++) {
+				xyz2[i][j]=xyz[tria2[i]][j];
+				w2[i][j]=w[tria2[i]][j];
+			}
+		}
+		area2*=area;
+	}
+	if(tria3[0]>-1){ 
+		for (int i=0;i<NUMVERTICES;i++){
+			for (int j=0;j<3;j++) {
+				xyz3[i][j]=xyz[tria3[i]][j];
+				w3[i][j]=w[tria3[i]][j];
+			}
+		}
+		area3*=area;
+	}
+
+	areasub=area1+area2+area3;
+
+	if (areasub>0){
+		for (int j=0;j<3;j++){
+			for (int i=0;i<NUMVERTICES;i++) {
+				loadweights[j]=w1[i][j]*area1 + w2[i][j]*area2 + w3[i][j]*area3;
+				barycenter[j]+=xyz1[i][j]*area1+xyz2[i][j]*area2+xyz3[i][j]*area3;
+			}
+			loadweights[j]/=area;
+			barycenter[j]/=areasub *3.0;
+		}
+		*platbar=asin(barycenter[2]/sqrt(pow(barycenter[0],2.0)+pow(barycenter[1],2.0)+pow(barycenter[2],2.0)))*180.0/M_PI;
+		*plongbar=atan2(barycenter[1],barycenter[0])*180.0/M_PI;
+	} 
+	else {
+		for(int j=0;j<3;j++)loadweights[j]=0.0;
+		*platbar=late;
+		*plongbar=longe;
+	}
+	*ploadarea=areasub;
+
+} /*}}}*/
 IssmDouble Tria::GetIcefrontArea(){/*{{{*/
 
@@ -1869,5 +2497,4 @@
 		TriaInput* input = this->inputs->GetTriaInput(inputenum);
 		if(!input) return input;
-
 		this->InputServe(input);
 		return input;
@@ -1977,4 +2604,5 @@
 				input->Serve(numindices,&indices[0]);
 				break;
+			case P1xP4Enum:
 			case P1DGEnum:
 			case P1bubbleEnum:
@@ -2143,4 +2771,5 @@
 
 	/*Assign output pointers*/
+	xDelete<IssmDouble>(timesteps);
 	*pvalues=values;
 	*ptimes=times;
@@ -2155,9 +2784,7 @@
 	int index = this->GetNodeIndex(node);
 
-	GaussTria* gauss=new GaussTria();
-	gauss->GaussNode(this->element_type,index);
-
-	input->GetInputValue(pvalue,gauss);
-	delete gauss;
+	GaussTria gauss;
+	gauss.GaussNode(this->element_type,index);
+	input->GetInputValue(pvalue,&gauss);
 }
 /*}}}*/
@@ -2169,9 +2796,7 @@
 	int index = this->GetVertexIndex(vertex);
 
-	GaussTria* gauss=new GaussTria();
-	gauss->GaussVertex(index);
-
-	input->GetInputValue(pvalue,gauss);
-	delete gauss;
+	GaussTria gauss;
+	gauss.GaussVertex(index);
+	input->GetInputValue(pvalue,&gauss);
 }
 /*}}}*/
@@ -2222,5 +2847,5 @@
 
 	/*Intermediaries*/
-	int i, numiceverts, numnoiceverts;
+	int numiceverts, numnoiceverts;
 	int ind0, ind1, lastindex;
 	int indices_ice[NUMVERTICES],indices_noice[NUMVERTICES];
@@ -2234,5 +2859,5 @@
 	 * Exploit: ice/no-ice parts are connected, so find starting vertex of segment*/
 	lastindex=0;
-	for(i=0;i<NUMVERTICES;i++){ // go backwards along vertices, and check for sign change
+	for(int i=0;i<NUMVERTICES;i++){ // go backwards along vertices, and check for sign change
 		ind0=(NUMVERTICES-i)%NUMVERTICES;
 		ind1=(ind0-1+NUMVERTICES)%NUMVERTICES;
@@ -2248,5 +2873,5 @@
 	numiceverts=0;
 	numnoiceverts=0;
-	for(i=0;i<NUMVERTICES;i++){
+	for(int i=0;i<NUMVERTICES;i++){
 		ind0=(lastindex+i)%NUMVERTICES;
 		if(lsf[i]<=level){
@@ -2260,24 +2885,28 @@
 	}
 	//merge indices
-	for(i=0;i<numiceverts;i++){indices[i]=indices_ice[i];}
-	for(i=0;i<numnoiceverts;i++){indices[numiceverts+i]=indices_noice[i];}
-
-	switch (numiceverts){
+	for(int i=0;i<numiceverts;  i++){
+		indices[i]=indices_ice[i];
+	}
+	for(int i=0;i<numnoiceverts;i++){
+		indices[numiceverts+i]=indices_noice[i];
+	}
+
+	switch(numiceverts){
 		case 0: // no vertex has ice: element is ice free, no intersection
-			for(i=0;i<2;i++)
+			for(int i=0;i<2;i++)
 				fraction[i]=0.;
 			break;
 		case 1: // one vertex has ice:
-			for(i=0;i<2;i++){
+			for(int i=0;i<2;i++){
 				fraction[i]=(level-lsf[indices[0]])/(lsf[indices[numiceverts+i]]-lsf[indices[0]]);
 			}
 			break;
 		case 2: // two vertices have ice: fraction is computed from first ice vertex to last in CCW fashion
-			for(i=0;i<2;i++){
+			for(int i=0;i<2;i++){
 				fraction[i]=(level-lsf[indices[i]])/(lsf[indices[numiceverts]]-lsf[indices[i]]);
 			}
 			break;
 		case NUMVERTICES: // all vertices have ice: return triangle area
-			for(i=0;i<2;i++)
+			for(int i=0;i<2;i++)
 				fraction[i]=1.;
 			break;
@@ -2860,4 +3489,5 @@
 	parameters->FindParam(&domaintype,DomainTypeEnum);
 
+	/*Relict code
 	if(false && IsIcefront()){
 		//Assumption: linear ice thickness profile on element.
@@ -2914,5 +3544,39 @@
 		for(i=0;i<numthk;i++)	Haverage+=H[i];
 		Haverage/=IssmDouble(numthk);
-	}
+	}*/
+
+   IssmDouble lsf[NUMVERTICES];
+	Element::GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum);
+   /*Deal with partially ice-covered elements*/
+	if(lsf[0]*lsf[1]<=0 || lsf[0]*lsf[2]<=0 || lsf[1]*lsf[2]<=0){
+		bool istrapneg;
+      int point;
+      IssmDouble weights[NUMVERTICES];
+      IssmDouble surfaces[NUMVERTICES];
+      IssmDouble bases[NUMVERTICES];
+      IssmDouble Hice[NUMVERTICES];
+      IssmDouble area_basetot,f1,f2,phi;
+      /*Average thickness over subelement*/
+		Element::GetInputListOnVertices(&surfaces[0],SurfaceEnum);
+      Element::GetInputListOnVertices(&bases[0],BaseEnum);
+      GetFractionGeometry(weights,&phi,&point,&f1,&f2,&istrapneg,lsf);
+      for(int i=0;i<NUMVERTICES;i++) Hice[i] = surfaces[i]-bases[i];
+      Haverage = 0.0;
+		/*Use weights[i]/phi to get average thickness over subelement*/
+      for(int i=0;i<NUMVERTICES;i++) Haverage += weights[i]/phi*Hice[i];
+		/*Get back area of ice-covered base*/
+		area_basetot = this->GetArea();
+		area_base    = phi*area_basetot;
+
+		/*Account for scaling factor averaged over subelement*/
+		if(scaled==true){
+			IssmDouble* scalefactor_vertices = xNew<IssmDouble>(NUMVERTICES);
+			Element::GetInputListOnVertices(&scalefactor_vertices[0],MeshScaleFactorEnum);
+			scalefactor = 0.0;
+			for(int i=0;i<NUMVERTICES;i++) scalefactor += weights[i]/phi*scalefactor_vertices[i];
+			area_base = area_base*scalefactor;
+			xDelete<IssmDouble>(scalefactor_vertices);
+		}
+   }
 	else{
 		/*First get back the area of the base*/
@@ -2932,4 +3596,5 @@
 	}
 
+	
 	/*Cleanup & return: */
 	xDelete<int>(indices);
@@ -2952,5 +3617,5 @@
 	IssmDouble xyz_list[NUMVERTICES][3];
 
-	if(!IsIceInElement() || IsFloating())return 0;
+	if(!IsIceInElement() || IsAllFloating())return 0;
 
 	rho_ice=FindParam(MaterialsRhoIceEnum);
@@ -3257,18 +3922,10 @@
 
 	/*intermediary: */
-	IssmDouble* values=NULL;
-	Input*     thickness_input=NULL;
 	IssmDouble  thickness;
-	IssmDouble  weight;
 	IssmDouble  Jdet;
-	IssmDouble  volume;
-	IssmDouble  rho_ice;
 	int         point1;
 	IssmDouble  fraction1,fraction2;
 	bool        mainlynegative=true;
 
-	/*Output:*/
-	volume=0;
-
 	/* Get node coordinates and dof list: */
 	IssmDouble  xyz_list[NUMVERTICES][3];
@@ -3276,11 +3933,11 @@
 
 	/*Retrieve inputs required:*/
-	thickness_input=this->GetInput(ThicknessEnum); _assert_(thickness_input);
+	Input* thickness_input=this->GetInput(ThicknessEnum); _assert_(thickness_input);
 
 	/*Retrieve material parameters: */
-	rho_ice=FindParam(MaterialsRhoIceEnum);
+	IssmDouble rho_ice=FindParam(MaterialsRhoIceEnum);
 
 	/*Retrieve values of the levelset defining the masscon: */
-	values = xNew<IssmDouble>(NUMVERTICES);
+	IssmDouble values[NUMVERTICES];
 	for(int i=0;i<NUMVERTICES;i++){
 		values[i]=levelset[this->vertices[i]->Sid()];
@@ -3288,19 +3945,15 @@
 
 	/*Ok, use the level set values to figure out where we put our gaussian points:*/
-	this->GetLevelsetPositivePart(&point1,&fraction1,&fraction2,&mainlynegative,values);
+	this->GetLevelsetPositivePart(&point1,&fraction1,&fraction2,&mainlynegative,&values[0]);
 	Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlynegative,4);
 
-	volume=0;
-
+	IssmDouble volume=0.;
 	while(gauss->next()){
-
 		this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
 		thickness_input->GetInputValue(&thickness, gauss);
-
 		volume+=thickness*gauss->weight*Jdet;
 	}
 
 	/* clean up and Return: */
-	xDelete<IssmDouble>(values);
 	delete gauss;
 	return rho_ice*volume;
@@ -3324,8 +3977,8 @@
 
 	/*get area coordinates of 0 and 1 locations: */
-	GaussTria* gauss_1=new GaussTria();
-	gauss_1->GaussFromCoords(x1,y1,&xyz_list[0][0]);
-	GaussTria* gauss_2=new GaussTria();
-	gauss_2->GaussFromCoords(x2,y2,&xyz_list[0][0]);
+	GaussTria gauss_1;
+	gauss_1.GaussFromCoords(x1,y1,&xyz_list[0][0]);
+	GaussTria gauss_2;
+	gauss_2.GaussFromCoords(x2,y2,&xyz_list[0][0]);
 
 	/*Get segment length and normal (needs to be properly oriented)*/
@@ -3348,10 +4001,10 @@
 	}
 
-	thickness_input->GetInputValue(&h1, gauss_1);
-	thickness_input->GetInputValue(&h2, gauss_2);
-	vx_input->GetInputValue(&vx1,gauss_1);
-	vx_input->GetInputValue(&vx2,gauss_2);
-	vy_input->GetInputValue(&vy1,gauss_1);
-	vy_input->GetInputValue(&vy2,gauss_2);
+	thickness_input->GetInputValue(&h1, &gauss_1);
+	thickness_input->GetInputValue(&h2, &gauss_2);
+	vx_input->GetInputValue(&vx1,&gauss_1);
+	vx_input->GetInputValue(&vx2,&gauss_2);
+	vy_input->GetInputValue(&vy1,&gauss_1);
+	vy_input->GetInputValue(&vy2,&gauss_2);
 
 	mass_flux= rho_ice*length*(
@@ -3361,6 +4014,4 @@
 
 	/*clean up and return:*/
-	delete gauss_1;
-	delete gauss_2;
 	return mass_flux;
 }
@@ -3444,4 +4095,327 @@
 }
 /*}}}*/
+void	      Tria::MovingFrontalVelocity(void){/*{{{*/
+
+	int  dim, domaintype, calvinglaw, i;
+	IssmDouble v[3],w[3],c[3],m[3],dlsf[3];
+	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
+	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	IssmDouble  movingfrontvx[NUMVERTICES];
+	IssmDouble  movingfrontvy[NUMVERTICES];
+	IssmDouble  vel;
+
+	/* Get node coordinates and dof list: */
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	Input* vx_input           = NULL;
+	Input* vy_input           = NULL;
+	Input* calvingratex_input = NULL;
+	Input* calvingratey_input = NULL;
+	Input* lsf_slopex_input   = NULL;
+	Input* lsf_slopey_input   = NULL;
+	Input* calvingrate_input  = NULL;
+	Input* meltingrate_input  = NULL;
+	Input* gr_input           = NULL;
+
+	/*Get problem dimension and whether there is moving front or not*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	this->FindParam(&calvinglaw,CalvingLawEnum);
+
+	switch(domaintype){
+		case Domain2DverticalEnum:   dim = 1; break;
+		case Domain2DhorizontalEnum: dim = 2; break;
+		case Domain3DEnum:           dim = 2; break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+	/*Load velocities*/
+	switch(domaintype){
+		case Domain2DverticalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			break;
+		case Domain2DhorizontalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		case Domain3DEnum:
+			vx_input=this->GetInput(VxAverageEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyAverageEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+		case CalvingVonmisesEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingLevermannEnum:
+			switch(domaintype){
+				case Domain2DverticalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					break;
+				case Domain2DhorizontalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+					break;
+				case Domain3DEnum:
+					calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+					break;
+				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+			}
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingMinthicknessEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingHabEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingCrevasseDepthEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingDev2Enum:
+			this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+	}
+
+	/* Start looping on the number of vertices: */
+	GaussTria gauss;
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss.GaussVertex(iv);
+
+		/* Advection */
+		vx_input->GetInputValue(&v[0],&gauss);
+		vy_input->GetInputValue(&v[1],&gauss);
+		gr_input->GetInputValue(&groundedice,&gauss);
+
+		/*Get calving speed*/
+		switch(calvinglaw){
+			case DefaultCalvingEnum:
+			case CalvingVonmisesEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				calvingrate_input->GetInputValue(&calvingrate,&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.; m[i]=0.;
+				 }
+				break;
+
+			case CalvingLevermannEnum:
+				calvingratex_input->GetInputValue(&c[0],&gauss);
+				if(dim==2) calvingratey_input->GetInputValue(&c[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+				norm_calving=0.;
+				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
+				norm_calving=sqrt(norm_calving)+1.e-14;
+				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
+				break;
+
+			case CalvingMinthicknessEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingHabEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingCrevasseDepthEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+				meltingrate_input->GetInputValue(&meltingrate,&gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingDev2Enum:
+				  {
+					lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
+					calvingrate_input->GetInputValue(&calvingrate,&gauss);
+					meltingrate_input->GetInputValue(&meltingrate,&gauss);
+					gr_input->GetInputValue(&groundedice,&gauss);
+
+					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
+					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
+					haf_eps=10.;
+					if(groundedice-calvinghaf<=-haf_eps){
+						// ice floats freely below calvinghaf: calve freely
+						// undercutting has no effect:
+						meltingrate=0.;
+					}
+					else if(groundedice-calvinghaf>=haf_eps){
+						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
+						calvingrate=min(calvingrate,vel);
+						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
+					}
+					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
+						//heaviside: 0 for floating, 1 for grounded
+						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*M_PI);
+						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
+						meltingrate=heaviside*meltingrate+0.;
+					}
+
+					norm_dlsf=0.;
+					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+					norm_dlsf=sqrt(norm_dlsf);
+
+					if(norm_dlsf>1.e-10)
+					 for(i=0;i<dim;i++){
+						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
+						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+					 }
+					else
+					 for(i=0;i<dim;i++){
+						 c[i]=0.;
+						 m[i]=0.;
+					 }
+					break;
+				  }
+
+			default:
+				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+		}
+		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+
+		movingfrontvx[iv] = w[0];
+		movingfrontvy[iv] = w[1];		
+	}
+
+	#ifdef MICI
+	/**************************************  MICI  START ************************************/
+	/*MICI from Crawford et al. 2021:
+	 * Tice = 20C; Bf  ->  I = 3.7e-16; α = 6.9
+	 * Tice = 20C; Bn  ->  I = 5.1e-14; α = 6.0
+	 * Tice = 20C; Bh  ->  I = 3.2e-17; α = 7.2
+	 * Tice = 10C; Bn  ->  I = 6.9e-17; α = 7.3
+	 * Tice = 5C;  Bn  ->  I = 1.9e-16; α = 7.3
+	 */
+	Input* surface_input = this->GetInput(SurfaceEnum); _assert_(surface_input);
+	Input* bed_input     = this->GetInput(BedEnum);     _assert_(bed_input);
+	Input* ls_input      = this->GetInput(MaskIceLevelsetEnum);   _assert_(ls_input);
+	IssmDouble Hc,bed,ls;
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss.GaussVertex(iv);
+
+		surface_input->GetInputValue(&Hc,&gauss);
+		bed_input->GetInputValue(&bed,&gauss);
+		ls_input->GetInputValue(&ls,&gauss);
+
+		/*Do we assume that the calving front does not move?*/
+		//movingfrontvx[iv] = 0.;
+		//movingfrontvy[iv] = 0.;
+
+		//if(Hc>80. && bed<0. && fabs(ls)<100.e3){ //Pollard & De Conto
+		if(Hc>135. && bed<0. && fabs(ls)<100.e3){ // Crawford et all
+
+			lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
+			norm_dlsf=0.;
+			for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+			norm_dlsf=sqrt(norm_dlsf);
+
+			/*use vel direction instead of LSF*/
+			vx_input->GetInputValue(&v[0],&gauss);
+			vy_input->GetInputValue(&v[1],&gauss);
+			vel=sqrt(v[0]*v[0] + v[1]*v[1]);
+			norm_dlsf = max(vel,1.e-10);
+			dlsf[0] = v[0];
+			dlsf[1] = v[1];
+
+			/*5C Bn (worst case scenario)*/
+			IssmDouble I     = 1.9e-16;
+			IssmDouble alpha = 7.3;
+			IssmDouble C = min(2000.,I*pow(Hc,alpha))/(24*3600.); /*convert from m/day to m/s*/
+			//IssmDouble C = (min(max(Hc,80.),100.) - 80.)/20. * 10./(24*3600.); /*Original MICI! convert from m/day to m/s*/
+			movingfrontvx[iv] = -C*dlsf[0]/norm_dlsf;
+			movingfrontvy[iv] = -C*dlsf[1]/norm_dlsf;
+		}
+	}
+	#endif
+	/**************************************  END MICI  *************************************/
+
+	/*Add input*/
+	this->AddInput(MovingFrontalVxEnum,&movingfrontvx[0],P1DGEnum);
+	this->AddInput(MovingFrontalVyEnum,&movingfrontvy[0],P1DGEnum);
+}
+/*}}}*/
 Gauss*     Tria::NewGauss(void){/*{{{*/
 	return new GaussTria();
@@ -3562,5 +4536,5 @@
 	int         found = 0;
 	IssmDouble  value;
-	GaussTria  *gauss = NULL;
+	GaussTria   gauss;
 
 	/*First, serarch the input: */
@@ -3574,6 +4548,6 @@
 			if(data){
 				/*ok, we are good. retrieve value of input at vertex :*/
-				gauss=new GaussTria(); gauss->GaussVertex(i);
-				data->GetInputValue(&value,gauss);
+				gauss.GaussVertex(i);
+				data->GetInputValue(&value,&gauss);
 				found=1;
 				break;
@@ -3581,7 +4555,4 @@
 		}
 	}
-
-	/*clean-up*/
-	delete gauss;
 
 	if(found)*pvalue=value;
@@ -3740,11 +4711,11 @@
 
 	/*Loop over basal nodes and update their CS*/
-	GaussTria* gauss = new GaussTria();
+	GaussTria gauss;
 	for(int i=0;i<this->NumberofNodesVelocity();i++){
 
 		if(vertexonbase[i]==1){
-			gauss->GaussNode(this->VelocityInterpolation(),i);
-			slope_input->GetInputValue(&slope,gauss);
-			groundedicelevelset_input->GetInputValue(&groundedice,gauss);
+			gauss.GaussNode(this->VelocityInterpolation(),i);
+			slope_input->GetInputValue(&slope,&gauss);
+			groundedicelevelset_input->GetInputValue(&groundedice,&gauss);
 			IssmDouble theta = atan(slope);
 
@@ -3767,5 +4738,4 @@
 	/*cleanup*/
 	xDelete<IssmDouble>(vertexonbase);
-	delete gauss;
 }
 /*}}}*/
@@ -3784,61 +4754,4 @@
 	if(this->hneighbors) this->hneighbors->reset();
 
-}
-/*}}}*/
-void       Tria::RignotMeltParameterization(){/*{{{*/
-
-   IssmDouble A, B, alpha, beta;
-	IssmDouble bed,qsg,qsg_basin,TF,yts;
-	int numbasins;
-	IssmDouble basinid[NUMVERTICES];
-	IssmDouble* basin_icefront_area=NULL;
-
-	/* Coefficients */
-	A    = 3e-4;
-	B    = 0.15;
-	alpha = 0.39;
-	beta = 1.18;
-
-	/*Get inputs*/
-	Input* bed_input = this->GetInput(BedEnum);                     _assert_(bed_input);
-	Input* qsg_input = this->GetInput(FrontalForcingsSubglacialDischargeEnum);		 _assert_(qsg_input);
-	Input* TF_input  = this->GetInput(FrontalForcingsThermalForcingEnum);          _assert_(TF_input);
-	Element::GetInputListOnVertices(&basinid[0],FrontalForcingsBasinIdEnum);
-
-	this->FindParam(&yts, ConstantsYtsEnum);
-	this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
-	this->parameters->FindParam(&basin_icefront_area,&numbasins,FrontalForcingsBasinIcefrontAreaEnum);
-
-	IssmDouble meltrates[NUMVERTICES];  //frontal melt-rate
-
-	/* Start looping on the number of vertices: */
-	GaussTria* gauss=new GaussTria();
-	for(int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
-
-		/* Get variables */
-		bed_input->GetInputValue(&bed,gauss);
-		qsg_input->GetInputValue(&qsg,gauss);
-		TF_input->GetInputValue(&TF,gauss);
-
-		if(basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
-		else{
-			/* change the unit of qsg (m^3/d -> m/d) with ice front area */
-			qsg_basin=qsg/basin_icefront_area[reCast<int>(basinid[iv])-1];
-
-			/* calculate melt rates */
-			meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
-		}
-
-		if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
-		if(xIsInf<IssmDouble>(meltrates[iv])) _error_("Inf found in vector");
-	}
-
-	/*Add input*/
-	this->AddInput(CalvingMeltingrateEnum,&meltrates[0],P1Enum);
-
-	/*Cleanup and return*/
-	xDelete<IssmDouble>(basin_icefront_area);
-	delete gauss;
 }
 /*}}}*/
@@ -3950,4 +4863,19 @@
 }
 /*}}}*/
+void       Tria::SetElementInput(int enum_in,IssmDouble value,int type){/*{{{*/
+
+	if(type==P0Enum){
+		this->inputs->SetTriaInput(enum_in,P0Enum,this->lid,value);
+	}
+	else if(type==P1Enum){
+		IssmDouble values[3]; 
+		for(int i=0;i<3;i++)values[i]=value;
+		int lidlist[3];
+		this->GetVerticesLidList(&lidlist[0]);
+		this->inputs->SetTriaInput(enum_in,P1Enum,3,&lidlist[0],&values[0]);
+	}
+	else _error_("interpolation type not supported yet");
+}
+/*}}}*/
 void       Tria::SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in){/*{{{*/
 
@@ -3965,4 +4893,5 @@
 	switch(domaintype){
 		case Domain2DhorizontalEnum:
+		case Domain3DsurfaceEnum:
 			return this;
 		case Domain2DverticalEnum:
@@ -4025,8 +4954,16 @@
 }
 /*}}}*/
+bool       Tria::IsSpawnedElement(void){/*{{{*/
+
+	if(this->iscollapsed!=0){
+		return true;
+	}
+
+	return false;
+
+}/*}}}*/
 void       Tria::StrainRateparallel(){/*{{{*/
 
 	IssmDouble  epsilon[3];
-	GaussTria* gauss=NULL;
 	IssmDouble  vx,vy,vel;
 	IssmDouble  strainxx;
@@ -4044,15 +4981,15 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/* Get the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 		strainxx=epsilon[0];
 		strainyy=epsilon[1];
@@ -4065,12 +5002,8 @@
 	/*Add input*/
 	this->AddInput(StrainRateparallelEnum,&strainparallel[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
 void       Tria::StrainRateperpendicular(){/*{{{*/
 
-	GaussTria* gauss=NULL;
 	IssmDouble  epsilon[3];
 	IssmDouble  vx,vy,vel;
@@ -4089,15 +5022,15 @@
 
 	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
+	GaussTria gauss;
 	for (int iv=0;iv<NUMVERTICES;iv++){
-		gauss->GaussVertex(iv);
+		gauss.GaussVertex(iv);
 
 		/* Get the value we need*/
-		vx_input->GetInputValue(&vx,gauss);
-		vy_input->GetInputValue(&vy,gauss);
+		vx_input->GetInputValue(&vx,&gauss);
+		vy_input->GetInputValue(&vy,&gauss);
 		vel=vx*vx+vy*vy;
 
 		/*Compute strain rate viscosity and pressure: */
-		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
+		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
 		strainxx=epsilon[0];
 		strainyy=epsilon[1];
@@ -4110,7 +5043,4 @@
 	/*Add input*/
 	this->AddInput(StrainRateperpendicularEnum,&strainperpendicular[0],P1DGEnum);
-
-	/*Clean up and return*/
-	delete gauss;
 }
 /*}}}*/
@@ -4179,5 +5109,5 @@
 
 	/*CFL criterion: */
-	IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy);
+	IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy + 1.e-18);
 
 	return dt;
@@ -4543,4 +5473,5 @@
 	IssmDouble base,smb,rho_ice,scalefactor;
 	IssmDouble Total_Smb=0;
+	IssmDouble lsf[NUMVERTICES];
 	IssmDouble xyz_list[NUMVERTICES][3];
 
@@ -4556,15 +5487,45 @@
 	 * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
 	base = 1./2. * fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));	// area of element in m2
-
+	
 	/*Now get the average SMB over the element*/
-	Input* smb_input = this->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
-	smb_input->GetInputAverage(&smb);	// average smb on element in m ice s-1
-	if(scaled==true){
-		Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
-		scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
+	Element::GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum);
+	if(lsf[0]*lsf[1]<=0 || lsf[0]*lsf[2]<=0 || lsf[1]*lsf[2]<=0){
+		/*Partially ice-covered element*/
+		bool mainlyice;
+      int point;
+      IssmDouble* weights       = xNew<IssmDouble>(NUMVERTICES);
+      IssmDouble* smb_vertices  = xNew<IssmDouble>(NUMVERTICES);
+      IssmDouble f1,f2,phi;
+		
+		Element::GetInputListOnVertices(&smb_vertices[0],SmbMassBalanceEnum);
+		GetFractionGeometry(weights,&phi,&point,&f1,&f2,&mainlyice,lsf);
+		smb = 0.0;
+		for(int i=0;i<NUMVERTICES;i++) smb += weights[i]*smb_vertices[i];
+	
+		if(scaled==true){
+         IssmDouble* scalefactor_vertices = xNew<IssmDouble>(NUMVERTICES);
+         Element::GetInputListOnVertices(&scalefactor_vertices[0],MeshScaleFactorEnum);
+         scalefactor = 0.0;
+         for(int i=0;i<NUMVERTICES;i++) scalefactor += weights[i]/phi*scalefactor_vertices[i];
+         xDelete<IssmDouble>(scalefactor_vertices);
+      }
+		else scalefactor = 1.0;
+
+		/*Cleanup*/
+      xDelete<IssmDouble>(weights);
+      xDelete<IssmDouble>(smb_vertices);
 	}
 	else{
-		scalefactor=1.;
-	}
+		/*Fully ice-covered element*/
+		Input* smb_input = this->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
+		smb_input->GetInputAverage(&smb);   // average smb on element in m ice s-1
+
+		if(scaled==true){
+			Input* scalefactor_input = this->GetInput(MeshScaleFactorEnum); _assert_(scalefactor_input);
+			scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
+		}
+		else scalefactor=1.0;
+	}
+	
    Total_Smb=rho_ice*base*smb*scalefactor;	// smb on element in kg s-1
 
@@ -4730,14 +5691,13 @@
 	Input* onbase = this->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
 
-	GaussTria* gauss=new GaussTria();
+	GaussTria gauss;
 	for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
-		gauss->GaussNode(this->element_type,iv);
-		onbase->GetInputValue(&isonbase,gauss);
+		gauss.GaussNode(this->element_type,iv);
+		onbase->GetInputValue(&isonbase,&gauss);
 		if(isonbase==1.){
-			input->GetInputValue(&value,gauss);
+			input->GetInputValue(&value,&gauss);
 			this->nodes[iv]->ApplyConstraint(0,value);
 		}
 	}
-	delete gauss;
 
 }
@@ -4754,14 +5714,13 @@
 	Input* onsurf = this->GetInput(MeshVertexonsurfaceEnum); _assert_(onsurf);
 
-	GaussTria* gauss=new GaussTria();
+	GaussTria gauss;
 	for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
-		gauss->GaussNode(this->element_type,iv);
-		onsurf->GetInputValue(&isonsurface,gauss);
+		gauss.GaussNode(this->element_type,iv);
+		onsurf->GetInputValue(&isonsurface,&gauss);
 		if(isonsurface==1.){
-			input->GetInputValue(&value,gauss);
+			input->GetInputValue(&value,&gauss);
 			this->nodes[iv]->ApplyConstraint(0,value);
 		}
 	}
-	delete gauss;
 }
 /*}}}*/
@@ -4870,11 +5829,308 @@
 /*}}}*/
 
-#ifdef _HAVE_GIA_
-void       Tria::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x, IssmDouble* y){/*{{{*/
-
+#ifdef _HAVE_ESA_
+void    Tria::EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy){ /*{{{*/
+
+	/*diverse:*/
+	int gsize;
 	IssmDouble xyz_list[NUMVERTICES][3];
+	IssmDouble area;
+	IssmDouble earth_radius = 6371012.0;	// Earth's radius [m]
+	IssmDouble I;		//ice/water loading
+	IssmDouble rho_ice, rho_earth;
+
+	/*precomputed elastic green functions:*/
+	IssmDouble* U_elastic_precomputed = NULL;
+	IssmDouble* H_elastic_precomputed = NULL;
+	int         M, hemi;
+
+	/*computation of Green functions:*/
+	IssmDouble* U_elastic= NULL;
+	IssmDouble* N_elastic= NULL;
+	IssmDouble* E_elastic= NULL;
+	IssmDouble* X_elastic= NULL;
+	IssmDouble* Y_elastic= NULL;
+
+	/*optimization:*/
+	bool store_green_functions=false;
+
+	/*Compute ice thickness change: */
+	Input* deltathickness_input=this->GetInput(DeltaIceThicknessEnum);
+	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
+	deltathickness_input->GetInputAverage(&I);
+
+	/*early return if we are not on the (ice) loading point: */
+	if(I==0) return;
+
+	/*recover material parameters: */
+	rho_ice=FindParam(MaterialsRhoIceEnum);
+	rho_earth=FindParam(MaterialsEarthDensityEnum);
+
+	/*how many dofs are we working with here? */
+	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
+
+	/*which hemisphere? for north-south, east-west components*/
+	this->parameters->FindParam(&hemi,EsaHemisphereEnum);
+
+	/*compute area of element:*/
+	area=GetArea();
+
+	/*figure out gravity center of our element (Cartesian): */
+	IssmDouble x_element, y_element;
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
+	y_element=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
+
+	/*recover elastic Green's functions for displacement:*/
+	DoubleVecParam* U_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaUElasticEnum)); _assert_(U_parameter);
+	DoubleVecParam* H_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaHElasticEnum)); _assert_(H_parameter);
+	U_parameter->GetParameterValueByPointer(&U_elastic_precomputed,&M);
+	H_parameter->GetParameterValueByPointer(&H_elastic_precomputed,&M);
+
+	/*initialize: */
+	U_elastic=xNewZeroInit<IssmDouble>(gsize);
+	N_elastic=xNewZeroInit<IssmDouble>(gsize);
+	E_elastic=xNewZeroInit<IssmDouble>(gsize);
+	X_elastic=xNewZeroInit<IssmDouble>(gsize);
+	Y_elastic=xNewZeroInit<IssmDouble>(gsize);
+
+	int* indices=xNew<int>(gsize);
+	IssmDouble* U_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* N_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* E_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* X_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* Y_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble dx, dy, dist, alpha, ang, ang2;
+	IssmDouble N_azim, E_azim, X_azim, Y_azim;
+
+	for(int i=0;i<gsize;i++){
+
+		indices[i]=i;
+
+		IssmDouble N_azim=0;
+		IssmDouble E_azim=0;
+
+		/*Compute alpha angle between centroid and current vertex: */
+		dx = x_element - xx[i];		dy = y_element - yy[i];
+		dist = sqrt(pow(dx,2)+pow(dy,2));						// distance between vertex and elemental centroid [m]
+		alpha = dist*360.0/(2*M_PI*earth_radius) * M_PI/180.0;	// [in radians] 360 degree = 2*pi*earth_radius
+
+		/*Compute azimuths, both north and east components: */
+		ang = M_PI/2 - atan2(dy,dx);		// this is bearing angle!
+		Y_azim = cos(ang);
+		X_azim = sin(ang);
+
+		/*Elastic component  (from Eq 17 in Adhikari et al, GMD 2015): */
+		int index=reCast<int,IssmDouble>(alpha/M_PI*(M-1));
+		U_elastic[i] += U_elastic_precomputed[index];
+		Y_elastic[i] += H_elastic_precomputed[index]*Y_azim;
+		X_elastic[i] += H_elastic_precomputed[index]*X_azim;
+
+		/*Add all components to the pUp solution vectors:*/
+		U_values[i]+=3*rho_ice/rho_earth*area/(4*M_PI*pow(earth_radius,2))*I*U_elastic[i];
+		Y_values[i]+=3*rho_ice/rho_earth*area/(4*M_PI*pow(earth_radius,2))*I*Y_elastic[i];
+		X_values[i]+=3*rho_ice/rho_earth*area/(4*M_PI*pow(earth_radius,2))*I*X_elastic[i];
+
+		/*North-south, East-west components */
+		if (hemi == -1) {
+			ang2 = M_PI/2 - atan2(yy[i],xx[i]);
+		}
+		else if (hemi == 1) {
+			ang2 = M_PI/2 - atan2(-yy[i],-xx[i]);
+		}
+		if (hemi != 0){
+			N_azim = Y_azim*cos(ang2) + X_azim*sin(ang2);
+			E_azim = X_azim*cos(ang2) - Y_azim*sin(ang2);
+			N_elastic[i] += H_elastic_precomputed[index]*N_azim;
+			E_elastic[i] += H_elastic_precomputed[index]*E_azim;
+			N_values[i]+=3*rho_ice/rho_earth*area/(4*M_PI*pow(earth_radius,2))*I*N_elastic[i];
+			E_values[i]+=3*rho_ice/rho_earth*area/(4*M_PI*pow(earth_radius,2))*I*E_elastic[i];
+		}
+	}
+
+	pUp->SetValues(gsize,indices,U_values,ADD_VAL);
+	pNorth->SetValues(gsize,indices,N_values,ADD_VAL);
+	pEast->SetValues(gsize,indices,E_values,ADD_VAL);
+	pX->SetValues(gsize,indices,X_values,ADD_VAL);
+	pY->SetValues(gsize,indices,Y_values,ADD_VAL);
+
+	/*free ressources:*/
+	xDelete<int>(indices);
+	xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
+	xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
+	xDelete<IssmDouble>(X_values); xDelete<IssmDouble>(Y_values);
+	xDelete<IssmDouble>(X_elastic); xDelete<IssmDouble>(Y_elastic);
+
+	return;
+}
+/*}}}*/
+void    Tria::EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz){ /*{{{*/
+
+	/*diverse:*/
+	int gsize;
+	bool spherical=true;
+	IssmDouble llr_list[NUMVERTICES][3];
+	IssmDouble xyz_list[NUMVERTICES][3];
+	IssmDouble area,planetarea;
+	IssmDouble I;		//ice/water loading
+	IssmDouble late,longe,re;
+	IssmDouble lati,longi,ri;
+	IssmDouble rho_ice,rho_earth;
+	IssmDouble minlong=400;
+	IssmDouble maxlong=-20;
+
+	/*precomputed elastic green functions:*/
+	IssmDouble* U_elastic_precomputed = NULL;
+	IssmDouble* H_elastic_precomputed = NULL;
+	int         M;
+
+	/*computation of Green functions:*/
+	IssmDouble* U_elastic= NULL;
+	IssmDouble* N_elastic= NULL;
+	IssmDouble* E_elastic= NULL;
+
+	/*optimization:*/
+	bool store_green_functions=false;
+
+	/*Compute ice thickness change: */
+	Input* deltathickness_input=this->GetInput(DeltaIceThicknessEnum);
+	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
+	deltathickness_input->GetInputAverage(&I);
+
+	/*early return if we are not on the (ice) loading point: */
+	if(I==0) return;
+
+	/*recover material parameters: */
+	rho_ice=FindParam(MaterialsRhoIceEnum);
+	rho_earth=FindParam(MaterialsEarthDensityEnum);
+
+	/*recover earth area: */
+	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
+
+	/*how many dofs are we working with here? */
+	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
+
+	/*Get area of element: precomputed in the sealevelchange_geometry:*/
+	area=GetAreaSpherical();
+
+	/*element centroid (spherical): */
+	/* Where is the centroid of this element?:{{{*/
+	::GetVerticesCoordinates(&llr_list[0][0],this->vertices,NUMVERTICES,spherical);
+
+	minlong=400; maxlong=-20;
+	for (int i=0;i<NUMVERTICES;i++){
+		llr_list[i][0]=(90-llr_list[i][0]);
+		if(llr_list[i][1]<0)llr_list[i][1]=180+(180+llr_list[i][1]);
+		if(llr_list[i][1]>maxlong)maxlong=llr_list[i][1];
+		if(llr_list[i][1]<minlong)minlong=llr_list[i][1];
+	}
+	if(minlong==0 && maxlong>180){
+		if (llr_list[0][1]==0)llr_list[0][1]=360;
+		if (llr_list[1][1]==0)llr_list[1][1]=360;
+		if (llr_list[2][1]==0)llr_list[2][1]=360;
+	}
+
+	// correction at the north pole: given longitude of the North pole a definition
+	// closer to the other two vertices.
+	if(llr_list[0][0]==0)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
+	if(llr_list[1][0]==0)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
+	if(llr_list[2][0]==0)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
+
+	// correction at the north pole: given longitude of the North pole a definition
+	// closer to the other two vertices.
+	if(llr_list[0][0]==180)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
+	if(llr_list[1][0]==180)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
+	if(llr_list[2][0]==180)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
+
+	late=(llr_list[0][0]+llr_list[1][0]+llr_list[2][0])/3.0;
+	longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
+
+	late=90-late;
+	if(longe>180)longe=longe-360;
+
+	late=late/180.*M_PI;
+	longe=longe/180.*M_PI;
+	/*}}}*/
+
+	/*figure out gravity center of our element (Cartesian): */
+	IssmDouble x_element, y_element, z_element;
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
+	y_element=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
+	z_element=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3.0;
+
+	/*recover elastic Green's functions for displacement:*/
+	DoubleVecParam* U_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaUElasticEnum)); _assert_(U_parameter);
+	DoubleVecParam* H_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaHElasticEnum)); _assert_(H_parameter);
+	U_parameter->GetParameterValueByPointer(&U_elastic_precomputed,&M);
+	H_parameter->GetParameterValueByPointer(&H_elastic_precomputed,&M);
+
+	/*initialize: */
+	U_elastic=xNewZeroInit<IssmDouble>(gsize);
+	N_elastic=xNewZeroInit<IssmDouble>(gsize);
+	E_elastic=xNewZeroInit<IssmDouble>(gsize);
+
+	int* indices=xNew<int>(gsize);
+	IssmDouble* U_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* N_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble* E_values=xNewZeroInit<IssmDouble>(gsize);
+	IssmDouble alpha;
+	IssmDouble delPhi,delLambda;
+	IssmDouble dx, dy, dz, x, y, z;
+	IssmDouble N_azim, E_azim;
+
+	for(int i=0;i<gsize;i++){
+
+		indices[i]=i;
+
+		/*Compute alpha angle between centroid and current vertex: */
+		lati=latitude[i]/180.*M_PI; longi=longitude[i]/180.*M_PI;
+
+		delPhi=fabs(lati-late); delLambda=fabs(longi-longe);
+		alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
+
+		/*Compute azimuths, both north and east components: */
+		x = xx[i]; y = yy[i]; z = zz[i];
+		if(latitude[i]==90){
+			x=1e-12; y=1e-12;
+		}
+		if(latitude[i]==-90){
+			x=1e-12; y=1e-12;
+		}
+		dx = x_element-x; dy = y_element-y; dz = z_element-z;
+		N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
+		E_azim = (-y*dx+x*dy) /pow((pow(x,2)+pow(y,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
+
+		/*Elastic component  (from Eq 17 in Adhikari et al, GMD 2015): */
+		int index=reCast<int,IssmDouble>(alpha/M_PI*(M-1));
+		U_elastic[i] += U_elastic_precomputed[index];
+		N_elastic[i] += H_elastic_precomputed[index]*N_azim;
+		E_elastic[i] += H_elastic_precomputed[index]*E_azim;
+
+		/*Add all components to the pUp solution vectors:*/
+		U_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*U_elastic[i];
+		N_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*N_elastic[i];
+		E_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*E_elastic[i];
+	}
+	pUp->SetValues(gsize,indices,U_values,ADD_VAL);
+	pNorth->SetValues(gsize,indices,N_values,ADD_VAL);
+	pEast->SetValues(gsize,indices,E_values,ADD_VAL);
+
+	/*free ressources:*/
+	xDelete<int>(indices);
+	xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
+	xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
+
+	return;
+}
+/*}}}*/
+#endif
+#ifdef _HAVE_SEALEVELCHANGE_
+void       Tria::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, Matlitho* litho, IssmDouble* x, IssmDouble* y){/*{{{*/
+
+	IssmDouble xyz_list[NUMVERTICES][3];
 
 	/*gia solution parameters:*/
-	IssmDouble lithosphere_thickness,mantle_viscosity,ice_mask;
+	IssmDouble ice_mask;
 
 	/*output: */
@@ -4890,8 +6146,8 @@
 	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
 	this->parameters->FindParam(&yts,ConstantsYtsEnum);
-	
+
 	/*recover gia solution parameters: */
 	int cross_section_shape;
-	this->parameters->FindParam(&cross_section_shape,GiaCrossSectionShapeEnum);
+	this->parameters->FindParam(&cross_section_shape,SolidearthSettingsCrossSectionShapeEnum);
 
 	/*what time is it? :*/
@@ -4900,9 +6156,17 @@
 
 	/*recover material parameters: */
-	IssmDouble lithosphere_shear_modulus = FindParam(MaterialsLithosphereShearModulusEnum);
-	IssmDouble lithosphere_density       = FindParam(MaterialsLithosphereDensityEnum);
-	IssmDouble mantle_shear_modulus      = FindParam(MaterialsMantleShearModulusEnum);
-	IssmDouble mantle_density            = FindParam(MaterialsMantleDensityEnum);
 	IssmDouble rho_ice                   = FindParam(MaterialsRhoIceEnum);
+
+	/*recover mantle and lithosphere material properties:*/
+	int numlayers=litho->numlayers;
+
+	/*lithosphere is the last layer, mantle is the penultimate layer. Watch out, radius represents the layers 
+	 *from center to surface of the Earth:*/
+	IssmDouble lithosphere_thickness = litho->radius[numlayers] - litho->radius[numlayers-1];
+	IssmDouble lithosphere_shear_modulus = litho->lame_mu[numlayers-1];
+	IssmDouble lithosphere_density = litho->density[numlayers-1];
+	IssmDouble mantle_shear_modulus = litho->lame_mu[numlayers-2];
+	IssmDouble mantle_density = litho->density[numlayers-2];
+	IssmDouble mantle_viscosity = litho->viscosity[numlayers-2];
 
 	/*early return if we are NOT on an icy element:*/
@@ -4913,15 +6177,5 @@
 	IssmDouble *times    = NULL;
 	int         numtimes;
-	this->GetInputAveragesUpToCurrentTime(ThicknessEnum,&hes,&times,&numtimes,currenttime);
-
-	/*recover mantle viscosity: */
-	Input* mantle_viscosity_input=this->GetInput(GiaMantleViscosityEnum);
-	if (!mantle_viscosity_input)_error_("mantle viscosity input needed to compute gia deflection!");
-	mantle_viscosity_input->GetInputAverage(&mantle_viscosity);
-
-	/*recover lithosphere thickness: */
-	Input* lithosphere_thickness_input=this->GetInput(GiaLithosphereThicknessEnum);
-	if (!lithosphere_thickness_input)_error_("lithosphere thickness input needed to compute gia deflection!");
-	lithosphere_thickness_input->GetInputAverage(&lithosphere_thickness);
+	this->GetInputAveragesUpToCurrentTime(TransientAccumulatedDeltaIceThicknessEnum,&hes,&times,&numtimes,currenttime);
 
 	/*pull area of this Tria: */
@@ -4929,5 +6183,5 @@
 
 	/*element radius: */
-	IssmDouble re=sqrt(area/PI);
+	IssmDouble re=sqrt(area/M_PI);
 
 	/*figure out gravity center of our element: */
@@ -4977,445 +6231,25 @@
 }
 /*}}}*/
-#endif
-#ifdef _HAVE_ESA_
-void    Tria::EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
-	IssmDouble xyz_list[NUMVERTICES][3];
-	IssmDouble area;
-	IssmDouble earth_radius = 6371012.0;	// Earth's radius [m]
-	IssmDouble I;		//ice/water loading
-	IssmDouble rho_ice, rho_earth;
-
-	/*precomputed elastic green functions:*/
-	IssmDouble* U_elastic_precomputed = NULL;
-	IssmDouble* H_elastic_precomputed = NULL;
-	int         M, hemi;
-
-	/*computation of Green functions:*/
-	IssmDouble* U_elastic= NULL;
-	IssmDouble* N_elastic= NULL;
-	IssmDouble* E_elastic= NULL;
-	IssmDouble* X_elastic= NULL;
-	IssmDouble* Y_elastic= NULL;
-
-	/*optimization:*/
-	bool store_green_functions=false;
-
-	/*Compute ice thickness change: */
-	Input* deltathickness_input=this->GetInput(EsaDeltathicknessEnum);
-	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
-	deltathickness_input->GetInputAverage(&I);
-
-	/*early return if we are not on the (ice) loading point: */
-	if(I==0) return;
-
-	/*recover material parameters: */
-	rho_ice=FindParam(MaterialsRhoIceEnum);
-	rho_earth=FindParam(MaterialsEarthDensityEnum);
-
-	/*how many dofs are we working with here? */
-	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
-
-	/*which hemisphere? for north-south, east-west components*/
-	this->parameters->FindParam(&hemi,EsaHemisphereEnum);
-
-	/*compute area of element:*/
-	area=GetArea();
-
-	/*figure out gravity center of our element (Cartesian): */
-	IssmDouble x_element, y_element;
-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-	x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
-	y_element=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
-
-	/*recover elastic Green's functions for displacement:*/
-	DoubleVecParam* U_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaUElasticEnum)); _assert_(U_parameter);
-	DoubleVecParam* H_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaHElasticEnum)); _assert_(H_parameter);
-	U_parameter->GetParameterValueByPointer(&U_elastic_precomputed,&M);
-	H_parameter->GetParameterValueByPointer(&H_elastic_precomputed,&M);
-
-	/*initialize: */
-	U_elastic=xNewZeroInit<IssmDouble>(gsize);
-	N_elastic=xNewZeroInit<IssmDouble>(gsize);
-	E_elastic=xNewZeroInit<IssmDouble>(gsize);
-	X_elastic=xNewZeroInit<IssmDouble>(gsize);
-	Y_elastic=xNewZeroInit<IssmDouble>(gsize);
-
-	int* indices=xNew<int>(gsize);
-	IssmDouble* U_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* N_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* E_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* X_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* Y_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble dx, dy, dist, alpha, ang, ang2;
-	IssmDouble N_azim, E_azim, X_azim, Y_azim;
-
-	for(int i=0;i<gsize;i++){
-
-		indices[i]=i;
-
-		IssmDouble N_azim=0;
-		IssmDouble E_azim=0;
-
-		/*Compute alpha angle between centroid and current vertex: */
-		dx = x_element - xx[i];		dy = y_element - yy[i];
-		dist = sqrt(pow(dx,2)+pow(dy,2));						// distance between vertex and elemental centroid [m]
-		alpha = dist*360.0/(2*PI*earth_radius) * PI/180.0;	// [in radians] 360 degree = 2*pi*earth_radius
-
-		/*Compute azimuths, both north and east components: */
-		ang = PI/2 - atan2(dy,dx);		// this is bearing angle!
-		Y_azim = cos(ang);
-		X_azim = sin(ang);
-
-		/*Elastic component  (from Eq 17 in Adhikari et al, GMD 2015): */
-		int index=reCast<int,IssmDouble>(alpha/PI*(M-1));
-		U_elastic[i] += U_elastic_precomputed[index];
-		Y_elastic[i] += H_elastic_precomputed[index]*Y_azim;
-		X_elastic[i] += H_elastic_precomputed[index]*X_azim;
-
-		/*Add all components to the pUp solution vectors:*/
-		U_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*U_elastic[i];
-		Y_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*Y_elastic[i];
-		X_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*X_elastic[i];
-
-		/*North-south, East-west components */
-		if (hemi == -1) {
-			ang2 = PI/2 - atan2(yy[i],xx[i]);
-		}
-		else if (hemi == 1) {
-			ang2 = PI/2 - atan2(-yy[i],-xx[i]);
-		}
-		if (hemi != 0){
-			N_azim = Y_azim*cos(ang2) + X_azim*sin(ang2);
-			E_azim = X_azim*cos(ang2) - Y_azim*sin(ang2);
-			N_elastic[i] += H_elastic_precomputed[index]*N_azim;
-			E_elastic[i] += H_elastic_precomputed[index]*E_azim;
-			N_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*N_elastic[i];
-			E_values[i]+=3*rho_ice/rho_earth*area/(4*PI*pow(earth_radius,2))*I*E_elastic[i];
-		}
-	}
-
-	pUp->SetValues(gsize,indices,U_values,ADD_VAL);
-	pNorth->SetValues(gsize,indices,N_values,ADD_VAL);
-	pEast->SetValues(gsize,indices,E_values,ADD_VAL);
-	pX->SetValues(gsize,indices,X_values,ADD_VAL);
-	pY->SetValues(gsize,indices,Y_values,ADD_VAL);
-
-	/*free ressources:*/
-	xDelete<int>(indices);
-	xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
-	xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
-	xDelete<IssmDouble>(X_values); xDelete<IssmDouble>(Y_values);
-	xDelete<IssmDouble>(X_elastic); xDelete<IssmDouble>(Y_elastic);
-
-	return;
-}
-/*}}}*/
-void    Tria::EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
-	bool spherical=true;
-	IssmDouble llr_list[NUMVERTICES][3];
-	IssmDouble xyz_list[NUMVERTICES][3];
-	IssmDouble area,planetarea;
-	IssmDouble I;		//ice/water loading
-	IssmDouble late,longe,re;
-	IssmDouble lati,longi,ri;
-	IssmDouble rho_ice,rho_earth;
-	IssmDouble minlong=400;
-	IssmDouble maxlong=-20;
-
-	/*precomputed elastic green functions:*/
-	IssmDouble* U_elastic_precomputed = NULL;
-	IssmDouble* H_elastic_precomputed = NULL;
-	int         M;
-
-	/*computation of Green functions:*/
-	IssmDouble* U_elastic= NULL;
-	IssmDouble* N_elastic= NULL;
-	IssmDouble* E_elastic= NULL;
-
-	/*optimization:*/
-	bool store_green_functions=false;
-
-	/*Compute ice thickness change: */
-	Input* deltathickness_input=this->GetInput(EsaDeltathicknessEnum);
-	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
-	deltathickness_input->GetInputAverage(&I);
-
-	/*early return if we are not on the (ice) loading point: */
-	if(I==0) return;
-
-	/*recover material parameters: */
-	rho_ice=FindParam(MaterialsRhoIceEnum);
-	rho_earth=FindParam(MaterialsEarthDensityEnum);
-
-	/*recover earth area: */
-	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
-
-	/*how many dofs are we working with here? */
-	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
-
-	/*Get area of element: precomputed in the sealevelrise_core_geometry:*/
-	area=GetAreaSpherical();
-
-	/*element centroid (spherical): */
-	/* Where is the centroid of this element?:{{{*/
-	::GetVerticesCoordinates(&llr_list[0][0],this->vertices,NUMVERTICES,spherical);
-
-	minlong=400; maxlong=-20;
-	for (int i=0;i<NUMVERTICES;i++){
-		llr_list[i][0]=(90-llr_list[i][0]);
-		if(llr_list[i][1]<0)llr_list[i][1]=180+(180+llr_list[i][1]);
-		if(llr_list[i][1]>maxlong)maxlong=llr_list[i][1];
-		if(llr_list[i][1]<minlong)minlong=llr_list[i][1];
-	}
-	if(minlong==0 && maxlong>180){
-		if (llr_list[0][1]==0)llr_list[0][1]=360;
-		if (llr_list[1][1]==0)llr_list[1][1]=360;
-		if (llr_list[2][1]==0)llr_list[2][1]=360;
-	}
-
-	// correction at the north pole: given longitude of the North pole a definition
-	// closer to the other two vertices.
-	if(llr_list[0][0]==0)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
-	if(llr_list[1][0]==0)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
-	if(llr_list[2][0]==0)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
-
-	// correction at the north pole: given longitude of the North pole a definition
-	// closer to the other two vertices.
-	if(llr_list[0][0]==180)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
-	if(llr_list[1][0]==180)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
-	if(llr_list[2][0]==180)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
-
-	late=(llr_list[0][0]+llr_list[1][0]+llr_list[2][0])/3.0;
-	longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
-
-	late=90-late;
-	if(longe>180)longe=longe-360;
-
-	late=late/180*PI;
-	longe=longe/180*PI;
-	/*}}}*/
-
-	/*figure out gravity center of our element (Cartesian): */
-	IssmDouble x_element, y_element, z_element;
-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-	x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
-	y_element=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
-	z_element=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3.0;
-
-	/*recover elastic Green's functions for displacement:*/
-	DoubleVecParam* U_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaUElasticEnum)); _assert_(U_parameter);
-	DoubleVecParam* H_parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(EsaHElasticEnum)); _assert_(H_parameter);
-	U_parameter->GetParameterValueByPointer(&U_elastic_precomputed,&M);
-	H_parameter->GetParameterValueByPointer(&H_elastic_precomputed,&M);
-
-	/*initialize: */
-	U_elastic=xNewZeroInit<IssmDouble>(gsize);
-	N_elastic=xNewZeroInit<IssmDouble>(gsize);
-	E_elastic=xNewZeroInit<IssmDouble>(gsize);
-
-	int* indices=xNew<int>(gsize);
-	IssmDouble* U_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* N_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble* E_values=xNewZeroInit<IssmDouble>(gsize);
-	IssmDouble alpha;
-	IssmDouble delPhi,delLambda;
-	IssmDouble dx, dy, dz, x, y, z;
-	IssmDouble N_azim, E_azim;
-
-	for(int i=0;i<gsize;i++){
-
-		indices[i]=i;
-
-		/*Compute alpha angle between centroid and current vertex: */
-		lati=latitude[i]/180*PI; longi=longitude[i]/180*PI;
-
-		delPhi=fabs(lati-late); delLambda=fabs(longi-longe);
-		alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
-
-		/*Compute azimuths, both north and east components: */
-		x = xx[i]; y = yy[i]; z = zz[i];
-		if(latitude[i]==90){
-			x=1e-12; y=1e-12;
-		}
-		if(latitude[i]==-90){
-			x=1e-12; y=1e-12;
-		}
-		dx = x_element-x; dy = y_element-y; dz = z_element-z;
-		N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
-		E_azim = (-y*dx+x*dy) /pow((pow(x,2)+pow(y,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
-
-		/*Elastic component  (from Eq 17 in Adhikari et al, GMD 2015): */
-		int index=reCast<int,IssmDouble>(alpha/PI*(M-1));
-		U_elastic[i] += U_elastic_precomputed[index];
-		N_elastic[i] += H_elastic_precomputed[index]*N_azim;
-		E_elastic[i] += H_elastic_precomputed[index]*E_azim;
-
-		/*Add all components to the pUp solution vectors:*/
-		U_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*U_elastic[i];
-		N_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*N_elastic[i];
-		E_values[i]+=3*rho_ice/rho_earth*area/planetarea*I*E_elastic[i];
-	}
-	pUp->SetValues(gsize,indices,U_values,ADD_VAL);
-	pNorth->SetValues(gsize,indices,N_values,ADD_VAL);
-	pEast->SetValues(gsize,indices,E_values,ADD_VAL);
-
-	/*free ressources:*/
-	xDelete<int>(indices);
-	xDelete<IssmDouble>(U_values); xDelete<IssmDouble>(N_values); xDelete<IssmDouble>(E_values);
-	xDelete<IssmDouble>(U_elastic); xDelete<IssmDouble>(N_elastic); xDelete<IssmDouble>(E_elastic);
-
-	return;
-}
-/*}}}*/
-#endif
-#ifdef _HAVE_SEALEVELRISE_
-IssmDouble Tria::OceanAverage(IssmDouble* Sg, SealevelMasks* masks){ /*{{{*/
-
-	if(masks->isoceanin[this->lid]){
-
-		IssmDouble area;
-
-		/*Get area of element:*/
-		this->Element::GetInputValue(&area,AreaEnum);
-
-		/*Average Sg over vertices:*/
-		IssmDouble Sg_avg=0; for(int i=0;i<NUMVERTICES;i++) Sg_avg+=Sg[this->vertices[i]->Sid()]/NUMVERTICES;
-
-		/*return: */
-		return area*Sg_avg;
-	}
-	else return 0;
-
-}
-/*}}}*/
-void	Tria::SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old, SealevelMasks* masks){/*{{{*/
-	/*early return if we are not on an ice cap OR ocean:*/
-	if(!masks->isiceonly[this->lid] && !masks->isoceanin[this->lid]){
-		dI_list[0] = 0.0; // this is important!!!
-		dI_list[1] = 0.0; // this is important!!!
-		dI_list[2] = 0.0; // this is important!!!
-		return;
-	}
-
-	/*Compute area of element:*/
-	IssmDouble area,planetarea;
-	this->Element::GetInputValue(&area,AreaEnum);
-
-	/*recover earth area: */
-	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
-
-	/*Compute lat,long,radius of elemental centroid: */
-	bool spherical=true;
-	IssmDouble llr_list[NUMVERTICES][3];
-	IssmDouble late,longe,re;
-	/* Where is the centroid of this element?:{{{*/
-	::GetVerticesCoordinates(&llr_list[0][0],this->vertices,NUMVERTICES,spherical);
-
-	IssmDouble minlong=400;
-	IssmDouble maxlong=-20;
-	for (int i=0;i<NUMVERTICES;i++){
-		llr_list[i][0]=(90-llr_list[i][0]);
-		if(llr_list[i][1]<0)llr_list[i][1]=180+(180+llr_list[i][1]);
-		if(llr_list[i][1]>maxlong)maxlong=llr_list[i][1];
-		if(llr_list[i][1]<minlong)minlong=llr_list[i][1];
-	}
-	if(minlong==0 && maxlong>180){
-		if (llr_list[0][1]==0)llr_list[0][1]=360;
-		if (llr_list[1][1]==0)llr_list[1][1]=360;
-		if (llr_list[2][1]==0)llr_list[2][1]=360;
-	}
-
-	// correction at the north pole
-	if(llr_list[0][0]==0)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
-	if(llr_list[1][0]==0)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
-	if(llr_list[2][0]==0)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
-
-	//correction at the south pole
-	if(llr_list[0][0]==180)llr_list[0][1]=(llr_list[1][1]+llr_list[2][1])/2.0;
-	if(llr_list[1][0]==180)llr_list[1][1]=(llr_list[0][1]+llr_list[2][1])/2.0;
-	if(llr_list[2][0]==180)llr_list[2][1]=(llr_list[0][1]+llr_list[1][1])/2.0;
-
-	late=(llr_list[0][0]+llr_list[1][0]+llr_list[2][0])/3.0;
-	longe=(llr_list[0][1]+llr_list[1][1]+llr_list[2][1])/3.0;
-
-	late=90-late;
-	if(longe>180)longe=(longe-180)-180;
-
-	late=late/180*PI;
-	longe=longe/180*PI;
-	/*}}}*/
-	re=(llr_list[0][2]+llr_list[1][2]+llr_list[2][2])/3.0;
-
-	if(masks->isoceanin[this->lid]){
-		IssmDouble rho_water, S;
-
-		/*recover material parameters: */
-		rho_water=FindParam(MaterialsRhoSeawaterEnum);
-
-		/*From Sg_old, recover water sea level rise:*/
-		S=0; for(int i=0;i<NUMVERTICES;i++) S+=Sg_old[this->vertices[i]->Sid()]/NUMVERTICES;
-
-		/* Perturbation terms for moment of inertia (moi_list):
-		 * computed analytically (see Wu & Peltier, eqs 10 & 32)
-		 * also consistent with my GMD formulation!
-		 * ALL in geographic coordinates
-		 * */
-		dI_list[0] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea;
-		dI_list[1] = -4*PI*(rho_water*S*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea;
-		dI_list[2] = +4*PI*(rho_water*S*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea;
-	}
-	else if(masks->isiceonly[this->lid]){
-		IssmDouble rho_ice, I;
-
-		/*recover material parameters: */
-		rho_ice=FindParam(MaterialsRhoIceEnum);
-
-		/*Compute ice thickness change: */
-		Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessChangeEnum);
-		if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
-		deltathickness_input->GetInputAverage(&I);
-
-		dI_list[0] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea;
-		dI_list[1] = -4*PI*(rho_ice*I*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea;
-		dI_list[2] = +4*PI*(rho_ice*I*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea;
-	}
-
-	return;
-}/*}}}*/
-void    Tria::SetSealevelMasks(SealevelMasks* masks){ /*{{{*/
-
-	masks->isiceonly[this->lid]=this->IsIceOnlyInElement();
-	masks->isoceanin[this->lid]=this->IsOceanInElement();
-
-	/*are we fully floating:*/
-	Input* gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
-	if (gr_input->GetInputMax()<=0)masks->isfullyfloating[this->lid]=true;
-	else masks->isfullyfloating[this->lid]=false;
-
-	/*are we not fully grounded: */
-	if ((gr_input->GetInputMin())<0) masks->notfullygrounded[this->lid]=true;
-	else masks->notfullygrounded[this->lid]=false;
-
-}
-/*}}}*/
-void    Tria::SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz){ /*{{{*/
-	/*diverse:*/
-	int gsize;
-	bool spherical=true;
-	IssmDouble llr_list[NUMVERTICES][3];
-	IssmDouble xyz_list[NUMVERTICES][3];
+void       Tria::SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){ /*{{{*/
+
+	/*Declarations:{{{*/
+	int nel;
 	IssmDouble area,planetarea,planetradius;
+	IssmDouble constant,ratioe;
 	IssmDouble I;  //change in ice thickness or water level(Farrel and Clarke, Equ. 4)
 	IssmDouble rho_earth;
-	IssmDouble late,longe,re;
-	IssmDouble lati,longi,ri;
-	IssmDouble constant;
-	IssmDouble x_element,y_element,z_element,x,y,z,dx,dy,dz,N_azim,E_azim;
+	IssmDouble NewtonG;
+	IssmDouble g;
+	IssmDouble lati,longi;
+	IssmDouble latitude[NUMVERTICES];
+	IssmDouble longitude[NUMVERTICES];
+	IssmDouble x,y,z,dx,dy,dz,N_azim,E_azim;
+	IssmDouble xyz_list[NUMVERTICES][3];
+
+	/*viscous stacks:*/
+	IssmDouble* viscousRSL = NULL;
+	IssmDouble* viscousU = NULL;
+	IssmDouble* viscousN = NULL;
+	IssmDouble* viscousE = NULL;
 
 	#ifdef _HAVE_RESTRICT_
@@ -5424,9 +6258,8 @@
 	IssmDouble* __restrict__ GN=NULL;
 	IssmDouble* __restrict__ GE=NULL;
-	IssmDouble* __restrict__ G_elastic_precomputed=NULL;
-	IssmDouble* __restrict__ G_rigid_precomputed=NULL;
-	IssmDouble* __restrict__ U_elastic_precomputed=NULL;
-	IssmDouble* __restrict__ H_elastic_precomputed=NULL;
-	IssmDouble* __restrict__ indices=NULL;
+	IssmDouble* __restrict__ G_viscoelastic_precomputed=NULL;
+	IssmDouble* __restrict__ G_gravi_precomputed=NULL;
+	IssmDouble* __restrict__ U_viscoelastic_precomputed=NULL;
+	IssmDouble* __restrict__ H_viscoelastic_precomputed=NULL;
 	#else
 	IssmDouble* G=NULL;
@@ -5434,133 +6267,296 @@
 	IssmDouble* GN=NULL;
 	IssmDouble* GE=NULL;
-	IssmDouble* G_elastic_precomputed=NULL;
-	IssmDouble* G_rigid_precomputed=NULL;
-	IssmDouble* U_elastic_precomputed=NULL;
-	IssmDouble* H_elastic_precomputed=NULL;
-	IssmDouble* indices=NULL;
+	IssmDouble* G_viscoelastic_precomputed=NULL;
+	IssmDouble* G_gravi_precomputed=NULL;
+	IssmDouble* U_viscoelastic_precomputed=NULL;
+	IssmDouble* H_viscoelastic_precomputed=NULL;
 	#endif
 
-	/*elastic green function:*/
+	/*viscoelastic green function:*/
 	int index;
-	int         M;
+	int M;
+	IssmDouble doubleindex,lincoef;
 
 	/*Computational flags:*/
-	bool computerigid = false;
+	bool computeselfattraction = false;
 	bool computeelastic = false;
+	bool computerotation = false;
+	bool computeviscous = false;
 	int  horiz;
-
-	/*recover parameters: */
+	bool istime=true;
+	IssmDouble timeacc=0.;
+	IssmDouble start_time,final_time;
+	int  nt,precomputednt;
+	int grd, grdmodel;
+
+	/*Rotational:*/
+	IssmDouble* tide_love_h  = NULL;
+	IssmDouble* tide_love_k  = NULL;
+	IssmDouble* tide_love_l  = NULL;
+	IssmDouble  moi_e, moi_p, omega;
+	IssmDouble  Grotm1[3],GUrotm1[3],GNrotm1[3],GErotm1[3];
+	IssmDouble  Grotm2[3],GUrotm2[3],GNrotm2[3],GErotm2[3];
+	IssmDouble  Grotm3[3],GUrotm3[3],GNrotm3[3],GErotm3[3];
+	IssmDouble  Y21cos     , Y21sin     , Y20;
+	IssmDouble dY21cos_dlat,dY21sin_dlat,dY20_dlat;
+	IssmDouble dY21cos_dlon,dY21sin_dlon;
+	IssmDouble LoveRotRSL,LoveRotU,LoveRothoriz;
+	IssmDouble polenudge;
+	/*}}}*/
+
+	/*Recover parameters:{{{ */
 	rho_earth=FindParam(MaterialsEarthDensityEnum);
-	this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum);
+	this->parameters->FindParam(&computeselfattraction,SolidearthSettingsSelfAttractionEnum);
 	this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum);
-	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
+	this->parameters->FindParam(&computerotation,SolidearthSettingsRotationEnum);
+	this->parameters->FindParam(&computeviscous,SolidearthSettingsViscousEnum);
+	this->parameters->FindParam(&nel,MeshNumberofelementsEnum);
 	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
 	this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum);
+	this->parameters->FindParam(&NewtonG,ConstantsNewtonGravityEnum);
 	this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
-
-	/*compute area and add to inputs:*/
-	area=GetAreaSpherical();
-	this->inputs->SetDoubleInput(AreaEnum,this->lid,area);
-	this->AddInput(SealevelAreaEnum,&area,P0Enum);
-	if(!computerigid)return;
-
-	/*recover precomputed green function kernels:*/
-	DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGRigidEnum)); _assert_(parameter);
-	parameter->GetParameterValueByPointer((IssmDouble**)&G_rigid_precomputed,&M);
-
-	/*allocate indices:*/
-	indices=xNew<IssmDouble>(gsize);
-	G=xNewZeroInit<IssmDouble>(gsize);
+	this->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 
+	this->parameters->FindParam(&grdmodel,GrdModelEnum);
+
+	/*early return:*/
+	if (!grd || grdmodel!=ElasticEnum) return; //Love numbers won't be found in this case, return before loading them
+	if(!computeselfattraction)return;
+
+	if(computerotation){
+		parameters->FindParam(&tide_love_h,NULL,NULL,TidalLoveHEnum);
+		parameters->FindParam(&tide_love_k,NULL,NULL,TidalLoveKEnum);
+		parameters->FindParam(&tide_love_l,NULL,NULL,TidalLoveLEnum);
+		parameters->FindParam(&moi_e,RotationalEquatorialMoiEnum);
+		parameters->FindParam(&moi_p,RotationalPolarMoiEnum);
+		parameters->FindParam(&omega,RotationalAngularVelocityEnum);
+	}
+	/*}}}*/
+
+	/*Recover precomputed green function kernels:{{{*/
+	DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGSelfAttractionEnum)); _assert_(parameter);
+	parameter->GetParameterValueByPointer((IssmDouble**)&G_gravi_precomputed,&M);
 
 	if(computeelastic){
-		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); _assert_(parameter);
-		parameter->GetParameterValueByPointer((IssmDouble**)&G_elastic_precomputed,&M);
-
-		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseHElasticEnum)); _assert_(parameter);
-		parameter->GetParameterValueByPointer((IssmDouble**)&H_elastic_precomputed,&M);
-
-		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseUElasticEnum)); _assert_(parameter);
-		parameter->GetParameterValueByPointer((IssmDouble**)&U_elastic_precomputed,&M);
-
-		GU=xNewZeroInit<IssmDouble>(gsize);
+		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGViscoElasticEnum)); _assert_(parameter);
+		parameter->GetParameterValueByPointer((IssmDouble**)&G_viscoelastic_precomputed,NULL);
+
+		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeUViscoElasticEnum)); _assert_(parameter);
+		parameter->GetParameterValueByPointer((IssmDouble**)&U_viscoelastic_precomputed,NULL);
+
 		if(horiz){
-			GN=xNewZeroInit<IssmDouble>(gsize);
-			GE=xNewZeroInit<IssmDouble>(gsize);
-		}
-	}
-
-	/* Where is the centroid of this element:*/
-
-	/*retrieve coordinates: */
+			parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeHViscoElasticEnum)); _assert_(parameter);
+			parameter->GetParameterValueByPointer((IssmDouble**)&H_viscoelastic_precomputed,NULL);
+		}
+	}
+	/*}}}*/
+	/*Compute lat long of all vertices in the element:{{{*/
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-
-	/*figure out gravity center of our element (Cartesian): */
-	x_element=(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])/3.0;
-	y_element=(xyz_list[0][1]+xyz_list[1][1]+xyz_list[2][1])/3.0;
-	z_element=(xyz_list[0][2]+xyz_list[1][2]+xyz_list[2][2])/3.0;
-
-	/*compute gravity center in lat,long: */
-	late= asin(z_element/planetradius);
-	longe = atan2(y_element,x_element);
-
-	constant=3/rho_earth*area/planetarea;
-
-	for(int i=0;i<gsize;i++){
-		IssmDouble alpha;
-		IssmDouble delPhi,delLambda;
-
-		/*Compute alpha angle between centroid and current vertex and index into precomputed tables: */
-		lati=latitude[i]/180*PI; longi=longitude[i]/180*PI;
-		delPhi=fabs(lati-late); delLambda=fabs(longi-longe); if (delLambda>PI)delLambda=2*PI-delLambda;
-		alpha=2.*asin(sqrt(pow(sin(delPhi/2),2)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
-		indices[i]=alpha/PI*reCast<IssmDouble,int>(M-1);
-		index=reCast<int,IssmDouble>(indices[i]);
-
-		/*Rigid earth gravitational perturbation: */
-		G[i]+=G_rigid_precomputed[index];
-		
-		if(computeelastic){
-			G[i]+=G_elastic_precomputed[index];
-		}
-		G[i]=G[i]*constant;
-
-		/*Elastic components:*/
-		if(computeelastic){
-			GU[i] =  constant * U_elastic_precomputed[index];
+	for(int i=0;i<NUMVERTICES;i++){
+		latitude[i]= asin(xyz_list[i][2]/planetradius);
+		if((xyz_list[i][2]/planetradius)==1.0)latitude[i]=M_PI/2;
+		longitude[i]= atan2(xyz_list[i][1],xyz_list[i][0]);
+	}
+	/*}}}*/
+	/*Compute green functions:{{{ */
+	if(computeviscous){
+		this->parameters->FindParam(&istime,LoveIsTimeEnum);
+		if(!istime)_error_("Frequency love numbers not supported yet!");
+		this->parameters->FindParam(&timeacc,SolidearthSettingsTimeAccEnum);
+		this->parameters->FindParam(&start_time,TimesteppingStartTimeEnum);
+		this->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
+		nt=reCast<int,IssmDouble>((final_time-start_time)/timeacc)+1;
+	}
+	else{
+		nt=1; //in elastic, or if we run only selfattraction, we need only one step
+	}
+
+	constant=3/rho_earth/planetarea;
+
+	G=xNewZeroInit<IssmDouble>(3*nel*nt);
+	if(computeelastic){
+		GU=xNewZeroInit<IssmDouble>(3*nel*nt);
+		if(horiz){
+			GN=xNewZeroInit<IssmDouble>(3*nel*nt);
+			GE=xNewZeroInit<IssmDouble>(3*nel*nt);
+		}
+	}
+
+	for(int e=0;e<nel;e++){
+		ratioe=constant*areae[e];
+		for (int i=0;i<3;i++){
+			IssmDouble alpha;
+			IssmDouble delPhi,delLambda;
+			/*recover info for this element and vertex:*/
+			IssmDouble late= asin(zze[e]/sqrt( pow(xxe[e],2.0)+ pow(yye[e],2.0)+ pow(zze[e],2.0)));
+			IssmDouble longe= atan2(yye[e],xxe[e]);
+
+			lati=latitude[i];
+			longi=longitude[i];
+
+			/*Compute alpha angle between centroid and current vertex and index into precomputed tables: */
+			delPhi=fabs(lati-late); delLambda=fabs(longi-longe); if (delLambda>M_PI)delLambda=2*M_PI-delLambda;
+			alpha=2.*asin(sqrt(pow(sin(delPhi/2),2)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
+			doubleindex=alpha/M_PI*reCast<IssmDouble,int>(M-1); //maps 0<alpha<PI on [0:M-1]
+			index=reCast<int,IssmDouble>(doubleindex); //truncates doubleindex to integer part
+			_assert_(index>=0 && index<M);
+
+			lincoef=doubleindex-index; //where between index and index+1 is alpha
+			if (index==M-1){ //avoids out of bound case
+				index-=1;
+				lincoef=1;
+			}
+
 			if(horiz){
 				/*Compute azimuths, both north and east components: */
-				x = xx[i]; y = yy[i]; z = zz[i];
-				if(latitude[i]==90){
+				x = xyz_list[i][0]; y = xyz_list[i][1]; z = xyz_list[i][2];
+				if(lati==M_PI/2){
 					x=1e-12; y=1e-12;
 				}
-				if(latitude[i]==-90){
+				if(lati==-M_PI/2){
 					x=1e-12; y=1e-12;
 				}
-				dx = x_element-x; dy = y_element-y; dz = z_element-z;
+				dx = xxe[e]-x; dy = yye[e]-y; dz = zze[e]-z;
 				N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
 				E_azim = (-y*dx+x*dy) /pow((pow(x,2)+pow(y,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
-
-				GN[i] = constant*H_elastic_precomputed[index]*N_azim;
-				GE[i] = constant*H_elastic_precomputed[index]*E_azim;
-			}
-		}
-	}
+			}
+
+			for(int t=0;t<nt;t++){
+				int timeindex=i*nel*nt+e*nt+t; 
+
+				/*Rigid earth gravitational perturbation: */
+				G[timeindex]+=G_gravi_precomputed[index+0]*(1.-lincoef) 
+					     +G_gravi_precomputed[index+1]*lincoef; //linear interpolation
+
+				/*Find a way to interpolate precomputed Gkernels to our solution time stepping:*/
+				if(computeelastic){
+					G[timeindex]+=G_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+						     +G_viscoelastic_precomputed[(index+1)*nt+t]*lincoef; //linear interpolation
+				}
+				G[timeindex]=G[timeindex]*ratioe;
+
+				/*Elastic components:*/
+				if(computeelastic){
+					GU[timeindex] =  ratioe *(U_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								 +U_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+					if(horiz){
+						GN[timeindex] = N_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								 	       +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+						GE[timeindex] = E_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								 	       +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+					}
+				}
+			} //for(int t=0;t<nt;t++)
+		} //for (int i=0;i<3;i++)
+	} //for(int e=0;e<nel;e++)
 
 	/*Add in inputs:*/
-	this->inputs->SetArrayInput(SealevelriseIndicesEnum,this->lid,indices,gsize);
-	this->inputs->SetArrayInput(SealevelriseGEnum,this->lid,G,gsize);
+	this->inputs->SetArrayInput(SealevelchangeGEnum,this->lid,G,nel*3*nt);
 	if(computeelastic){
-		this->inputs->SetArrayInput(SealevelriseGUEnum,this->lid,GU,gsize);
+		this->inputs->SetArrayInput(SealevelchangeGUEnum,this->lid,GU,nel*3*nt);
 		if(horiz){
-			this->inputs->SetArrayInput(SealevelriseGNEnum,this->lid,GN,gsize);
-			this->inputs->SetArrayInput(SealevelriseGEEnum,this->lid,GE,gsize);
-		}
-	}
-	this->inputs->SetDoubleInput(AreaEnum,this->lid,area); 
-	this->AddInput(SealevelAreaEnum,&area,P0Enum);
-
-	/*Free allocations:*/
+			this->inputs->SetArrayInput(SealevelchangeGNEnum,this->lid,GN,nel*3*nt);
+			this->inputs->SetArrayInput(SealevelchangeGEEnum,this->lid,GE,nel*3*nt);
+		}
+	}
+	/*}}}*/
+	/*Compute rotation kernel:{{{*/
+	if(computerotation){
+
+		/*What is the gravity at planet's surface: */
+		g=4.0/3.0*M_PI*rho_earth*NewtonG*planetradius;
+
+		//Amplitude of the rotational feedback
+		LoveRotRSL=((1.0+tide_love_k[2]-tide_love_h[2])/g)*pow(omega*planetradius,2.0);
+		LoveRotU=(tide_love_h[2]/g)*pow(omega*planetradius,2.0);
+		LoveRothoriz=(tide_love_l[2]/g)*pow(omega*planetradius,2.0);
+
+		for(int i=0;i<3;i++){
+
+			//Avoid singularity of the poles
+			if (latitude[i]==M_PI/2.){
+				//North pole: nudge south
+				polenudge=-1.e-12;
+			}
+			else if (latitude[i]==-M_PI/2.){
+				//South pole: nudge north
+				polenudge=1.e-12;
+			}
+			else {
+				polenudge=0.0;
+			}
+
+			lati=latitude[i]+polenudge;
+			longi=longitude[i];
+
+			//Spherical harmonic functions of degree 2
+			Y21cos= -0.5*sin(2.*lati)*cos(longi);
+			Y21sin= -0.5*sin(2.*lati)*sin(longi);
+			Y20   = -(1.0/6.0 - 0.5*cos(2.0*lati));
+
+			Grotm1[i]= LoveRotRSL*Y21cos;
+			Grotm2[i]= LoveRotRSL*Y21sin;
+			Grotm3[i]= LoveRotRSL*Y20;
+
+			if (computeelastic){
+				GUrotm1[i]= LoveRotU*Y21cos;
+				GUrotm2[i]= LoveRotU*Y21sin;
+				GUrotm3[i]= LoveRotU*Y20;
+				if (horiz){
+				//bed_N = Love_l * d(Y)/dlat ;
+				dY21cos_dlat=-cos(2.*lati)*cos(longi);
+				dY21sin_dlat=-cos(2.*lati)*sin(longi);
+				dY20_dlat=   -sin(2.*lati);
+				GNrotm1[i]= LoveRothoriz*dY21cos_dlat;
+				GNrotm2[i]= LoveRothoriz*dY21sin_dlat;
+				GNrotm3[i]= LoveRothoriz*dY20_dlat;
+
+				//bed_E = Love_l * 1/cos(lat) * d(Y)/dlon ;
+				dY21cos_dlon=-Y21sin/cos(lati);
+				dY21sin_dlon=Y21cos/cos(lati);
+				//dY20_dlon=0.;
+
+				GErotm1[i]= LoveRothoriz*dY21cos_dlon;
+				GErotm2[i]= LoveRothoriz*dY21sin_dlon;
+				GErotm3[i]= 0.0;
+				}
+			}
+		}
+		this->AddInput(SealevelGrotm1Enum,&Grotm1[0],P1Enum);
+		this->AddInput(SealevelGrotm2Enum,&Grotm2[0],P1Enum);
+		this->AddInput(SealevelGrotm3Enum,&Grotm3[0],P1Enum);
+		if (computeelastic){
+			this->AddInput(SealevelGUrotm1Enum,&GUrotm1[0],P1Enum);
+			this->AddInput(SealevelGUrotm2Enum,&GUrotm2[0],P1Enum);
+			this->AddInput(SealevelGUrotm3Enum,&GUrotm3[0],P1Enum);
+			if(horiz){
+				this->AddInput(SealevelGNrotm1Enum,&GNrotm1[0],P1Enum);
+				this->AddInput(SealevelGNrotm2Enum,&GNrotm2[0],P1Enum);
+				this->AddInput(SealevelGNrotm3Enum,&GNrotm3[0],P1Enum);
+				this->AddInput(SealevelGErotm1Enum,&GErotm1[0],P1Enum);
+				this->AddInput(SealevelGErotm2Enum,&GErotm2[0],P1Enum);
+				this->AddInput(SealevelGErotm3Enum,&GErotm3[0],P1Enum);
+			}
+		}
+	}
+	/*}}}*/
+	/*Initialize viscous stacks: {{{*/
+	if(computeviscous){
+		viscousRSL=xNewZeroInit<IssmDouble>(3*nt);
+		viscousU=xNewZeroInit<IssmDouble>(3*nt);
+
+		this->inputs->SetArrayInput(SealevelchangeViscousRSLEnum,this->lid,viscousRSL,3*nt);
+		this->inputs->SetArrayInput(SealevelchangeViscousUEnum,this->lid,viscousU,3*nt);
+		this->parameters->SetParam(0,SealevelchangeViscousIndexEnum);
+		if(horiz){
+			viscousN=xNewZeroInit<IssmDouble>(3*nt);
+			viscousE=xNewZeroInit<IssmDouble>(3*nt);
+			this->inputs->SetArrayInput(SealevelchangeViscousNEnum,this->lid,viscousRSL,3*nt);
+			this->inputs->SetArrayInput(SealevelchangeViscousEEnum,this->lid,viscousU,3*nt);
+		}
+	}
+	/*}}}*/
+
+	/*Free allocations:{{{*/
 	#ifdef _HAVE_RESTRICT_
-	delete indices;
 	delete G;
 	if(computeelastic){
@@ -5572,5 +6568,4 @@
 	}
 	#else
-	xDelete(indices);
 	xDelete(G);
 	if(computeelastic){
@@ -5582,398 +6577,1147 @@
 	}
 	#endif
-
+	/*}}}*/
 	return;
-}
-/*}}}*/
-IssmDouble Tria::SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
+
+}
+/*}}}*/
+void       Tria::SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae){ /*{{{*/
+
+	/* Classic buildup of load weights, centroids and areas *for elements which are fully inside a mask. 
+	 * At the same time, we'll tag the elements that are fractionally only inside a mask*/
+
+	IssmDouble loadweights[3]={0};
 	IssmDouble area;
-	IssmDouble phi=1.0; //WARNING: do not touch this, default is entire elemnt contributes eustatic
-	IssmDouble I;  //change in ice thickness or water level(Farrel and Clarke, Equ. 4)
-	bool notfullygrounded=false;
-	bool scaleoceanarea= false;
-	bool computerigid= false;
-	int  glfraction=1;
-
-	/*output: */
-	IssmDouble bslrice=0;
-
-	/*elastic green function:*/
-	IssmDouble* G=NULL;
-
-	/*ice properties: */
-	IssmDouble rho_ice,rho_water;
+	IssmDouble loadweightsocean[3]; //to keep memory of these loads, no need to recompute for bottom pressure.
+	IssmDouble xyz_list[NUMVERTICES][3];
+	IssmDouble planetradius;
+	IssmDouble late,longe;
+
+	/*flags:*/
+	bool isocean=false;
+	bool isoceanonly=false;
+	bool isice=false;
+	bool isiceonly=false;
+	bool  computeice=false;
+	bool  computebp=false;
+	bool  computehydro=false;
 
 	/*constants:*/
 	IssmDouble constant=0;
 
-	/*early return if we are not on an ice cap:*/
-	if(!masks->isiceonly[this->lid]){
+	/*recover parameters:*/
+	this->parameters->FindParam(&computeice,TransientIsmasstransportEnum);
+	this->parameters->FindParam(&computebp,TransientIsoceantransportEnum);
+	this->parameters->FindParam(&computehydro,TransientIshydrologyEnum);
+	this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum);
+
+	/*get vertex information:*/
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	/*answer mask questions:*/
+	isiceonly=this->IsIceOnlyInElement();
+	isice=this->IsIceInElement();
+	isoceanonly=this->IsOceanOnlyInElement();
+	isocean=this->IsOceanInElement();
+	slgeom->isoceanin[this->lid]=isocean; //keep track for later.
+	area=areae[this->sid];
+
+	/*Compute element ids, used to speed up computations in convolution phase:{{{*/
+	for(int i=0;i<NUMVERTICES;i++){
+		slgeom->lids[this->vertices[i]->lid]=this->lid;
+	}
+	/*}}}*/
+
+	/*set barycentre for all elements, to be updated for fractional loads in the next routine: */
+	//late= asin(zze[this->sid]/planetradius)*180.0/M_PI;
+	late= asin(zze[this->sid]/sqrt( pow(xxe[this->sid],2.0)+ pow(yye[this->sid],2.0)+ pow(zze[this->sid],2.0)))*180.0/M_PI;
+	longe= atan2(yye[this->sid],xxe[this->sid])*180.0/M_PI;
+	slgeom->longe[this->lid]=longe;
+	slgeom->late[this->lid]=late;
+
+	/*compute areas and load weights for ocean and flag elements only partially in the ocean:*/
+	if(isoceanonly){ 
+		slgeom->LoadArea[SLGEOM_OCEAN][this->lid]=area;
+		for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid]=1.0/3.0;
+
+		#ifdef _ISSM_DEBUG_ /*{{{*/
+		/*Inform mask: */
+		constant=1.0;
+		for(int i=0;i<NUMVERTICES;i++) loadweightsocean[i]=1.0/3.0;
+		this->AddInput(SealevelBarystaticOceanMaskEnum,&constant,P0Enum); 
+		this->AddInput(SealevelBarystaticOceanWeightsEnum,loadweightsocean,P1DGEnum);
+		this->AddInput(SealevelBarystaticOceanAreaEnum,&area,P0Enum);
+		#endif /*}}}*/
+	}
+	else if(!isocean){
+		slgeom->LoadArea[SLGEOM_OCEAN][this->lid]=0;
+		for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid]=0.0;
+		#ifdef _ISSM_DEBUG_ /*{{{*/
+		/*Inform mask: */
+		constant=0.0;
+		for(int i=0;i<NUMVERTICES;i++) loadweightsocean[i]=0.0;
+		this->AddInput(SealevelBarystaticOceanMaskEnum,&constant,P0Enum); 
+		this->AddInput(SealevelBarystaticOceanWeightsEnum,loadweightsocean,P1DGEnum);
+		this->AddInput(SealevelBarystaticOceanAreaEnum,&constant,P0Enum);
+		#endif /*}}}*/
+	}
+	else{
+		slgeom->issubelement[SLGEOM_OCEAN][this->lid]=true;
+		slgeom->nsubel[SLGEOM_OCEAN]++;
+	}
+
+	/*early return if we are not on an ice sheet , and we are not requesting 
+	 *hydrology or bottom pressure loads :*/
+	if(!computebp && !computehydro){
+		if(!isice  || isoceanonly) {
+			#ifdef _ISSM_DEBUG_
+			constant=0; 
+			this->AddInput(SealevelBarystaticIceMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticIceAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticIceWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticHydroMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticHydroWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticHydroAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticBpAreaEnum,&constant,P0Enum);
+			#endif
+			for(int i=0;i<NUMVERTICES;i++){
+				slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=0;
+				slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid]=0;
+			}
+			slgeom->LoadArea[SLGEOM_ICE][this->lid]=0;
+			slgeom->LoadArea[SLGEOM_WATER][this->lid]=0;
+			return;
+		}
+	}
+
+	/*early return if we are fully floating and we are not doing bottom pressure loads:*/
+	if(!computebp){
+		if (isoceanonly){
+			#ifdef _ISSM_DEBUG_
+			constant=0;
+			this->AddInput(SealevelBarystaticIceMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticIceWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticIceAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticHydroMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticHydroWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticHydroAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticBpAreaEnum,&constant,P0Enum);
+			#endif
+			for(int i=0;i<NUMVERTICES;i++){
+				slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=0;
+				slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid]=0;
+			}
+			slgeom->LoadArea[SLGEOM_ICE][this->lid]=0;
+			slgeom->LoadArea[SLGEOM_WATER][this->lid]=0;
+			return;
+		}
+	}
+
+	/*early return if we are not on the ocean and we are not doing ice mass transport of 
+	 * hydrology:*/
+	if(!computeice  && !computehydro){
+		if(!isocean){
+			#ifdef _ISSM_DEBUG_
+			constant=0;
+			this->AddInput(SealevelBarystaticIceMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticIceWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticIceAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticHydroMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticHydroWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticHydroAreaEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpMaskEnum,&constant,P0Enum);
+			this->AddInput(SealevelBarystaticBpWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticBpAreaEnum,&constant,P0Enum);
+			#endif
+			for(int i=0;i<NUMVERTICES;i++){
+				slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=0;
+				slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid]=0;
+			}
+			slgeom->LoadArea[SLGEOM_ICE][this->lid]=0;
+			slgeom->LoadArea[SLGEOM_WATER][this->lid]=0;
+			return;
+		}
+	}
+
+	/*Deal with ice loads if we are on grounded ice:*/
+	if(isice && !isoceanonly && computeice){
+		if(isiceonly && !isocean){
+			slgeom->LoadArea[SLGEOM_ICE][this->lid]=area;
+			for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=1.0/3.0;
+
+			#ifdef _ISSM_DEBUG_ /*{{{*/
+			/*Inform mask: */
+			constant=1.0;
+			for(int i=0;i<NUMVERTICES;i++) loadweights[i]=1.0/3.0;
+			this->AddInput(SealevelBarystaticIceMaskEnum,&constant,P0Enum); 
+			this->AddInput(SealevelBarystaticIceWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticIceAreaEnum,&area,P0Enum);
+			#endif /*}}}*/
+		}
+		else{
+			slgeom->issubelement[SLGEOM_ICE][this->lid]=true;
+			slgeom->nsubel[SLGEOM_ICE]++;
+		}
+	} 
+
+	/*Deal with water loads if we are on ground:*/
+	if(!isoceanonly && computehydro){
+
+		if(!isocean){
+			slgeom->LoadArea[SLGEOM_WATER][this->lid]=area;
+			for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid]=1.0/3.0;
+
+			#ifdef _ISSM_DEBUG_ /*{{{*/
+			/*Inform mask: */
+			constant=1.0;
+			for(int i=0;i<NUMVERTICES;i++) loadweights[i]=1.0/3.0;
+			this->AddInput(SealevelBarystaticHydroMaskEnum,&constant,P0Enum); 
+			this->AddInput(SealevelBarystaticHydroWeightsEnum,loadweights,P1DGEnum);
+			this->AddInput(SealevelBarystaticHydroAreaEnum,&area,P0Enum);
+			#endif /*}}}*/
+		}
+		else{
+			slgeom->issubelement[SLGEOM_WATER][this->lid]=true;
+			slgeom->nsubel[SLGEOM_WATER]++;
+		}
+	}
+
+}
+/*}}}*/
+void       Tria::SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae){ /*{{{*/
+
+	/* Classic buildup of load weights, centroids and areas *for elements which are fully inside a mask. 
+	 * At the same time, we'll tag the elements that are fractionally only inside a mask*/
+
+	IssmDouble loadweights[3]={0};
+	IssmDouble area,loadarea;
+	IssmDouble loadareaocean;
+	IssmDouble loadweightsocean[3]; //to keep memory of these loads, no need to recompute for bottom pressure.
+	IssmDouble xyz_list[NUMVERTICES][3];
+	IssmDouble latbar=slgeom->late[this->lid];
+	IssmDouble longbar=slgeom->longe[this->lid];
+	IssmDouble constant;
+	IssmDouble nanconstant=NAN;
+
+	/*get vertex and area information:*/
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	area=areae[this->sid];
+
+	#ifdef _ISSM_DEBUG_
+	this->AddInput(SealevelBarystaticIceLatbarEnum,&latbar,P0Enum); 
+	this->AddInput(SealevelBarystaticIceLongbarEnum,&longbar,P0Enum); 
+	this->AddInput(SealevelBarystaticHydroLatbarEnum,&latbar,P0Enum); 
+	this->AddInput(SealevelBarystaticHydroLongbarEnum,&longbar,P0Enum); 
+	this->AddInput(SealevelBarystaticOceanLatbarEnum,&latbar,P0Enum); 
+	this->AddInput(SealevelBarystaticOceanLongbarEnum,&longbar,P0Enum); 
+	#endif
+
+	if(slgeom->issubelement[SLGEOM_OCEAN][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_OCEAN][this->lid];
+
+		this->GetNodalWeightsAndAreaAndCentroidsFromLeveset(&loadweightsocean[0],&loadareaocean,&latbar, &longbar, slgeom->late[this->lid], slgeom->longe[this->lid], area, MaskOceanLevelsetEnum);
+		slgeom->LoadArea[SLGEOM_OCEAN][this->lid]=loadareaocean;
+		slgeom->vareae_subel[SLGEOM_OCEAN]->SetValue(intj,loadareaocean,INS_VAL);
+		slgeom->vlatbarycentre[SLGEOM_OCEAN]->SetValue(intj,latbar,INS_VAL);
+		slgeom->vlongbarycentre[SLGEOM_OCEAN]->SetValue(intj,longbar,INS_VAL);
+
+		for(int i=0;i<NUMVERTICES;i++) slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid]=loadweightsocean[i];
+		#ifdef _ISSM_DEBUG_ /*{{{*/
+		/*Inform mask: */
+		constant=loadareaocean/area;
+		this->AddInput(SealevelBarystaticOceanMaskEnum,&constant,P0Enum); 
+		this->AddInput(SealevelBarystaticOceanWeightsEnum,loadweightsocean,P1DGEnum);
+		this->AddInput(SealevelBarystaticOceanAreaEnum,&loadareaocean,P0Enum);
+
+		this->AddInput(SealevelBarystaticOceanLatbarEnum,&latbar,P0Enum); 
+		this->AddInput(SealevelBarystaticOceanLongbarEnum,&longbar,P0Enum); 
+		#endif /*}}}*/
+	}
+	if(slgeom->issubelement[SLGEOM_ICE][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_ICE][this->lid];
+
+		this->GetNodalWeightsAndAreaAndCentroidsFromLeveset(&loadweights[0],&loadarea,&latbar, &longbar, slgeom->late[this->lid], slgeom->longe[this->lid], area, -MaskOceanLevelsetEnum,MaskIceLevelsetEnum);
+
+		slgeom->LoadArea[SLGEOM_ICE][this->lid]=loadarea;
+		slgeom->vareae_subel[SLGEOM_ICE]->SetValue(intj,loadarea,INS_VAL);
+		slgeom->vlatbarycentre[SLGEOM_ICE]->SetValue(intj,latbar,INS_VAL);
+		slgeom->vlongbarycentre[SLGEOM_ICE]->SetValue(intj,longbar,INS_VAL);
+
+		for(int i=0;i<NUMVERTICES;i++)slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid]=loadweights[i];
+
 		#ifdef _ISSM_DEBUG_
-		constant=0; this->AddInput(SealevelEustaticMaskEnum,&constant,P0Enum);
+		/*Inform mask: */
+		constant=loadarea/area; 
+		this->AddInput(SealevelBarystaticIceMaskEnum,&constant,P0Enum);
+		this->AddInput(SealevelBarystaticIceWeightsEnum,loadweights,P1DGEnum);
+		this->AddInput(SealevelBarystaticIceAreaEnum,&loadarea,P0Enum);
+
+		this->AddInput(SealevelBarystaticIceLatbarEnum,&latbar,P0Enum); 
+		this->AddInput(SealevelBarystaticIceLongbarEnum,&longbar,P0Enum); 
+
 		#endif
-		bslrice=0;
-		return bslrice;
-	}
-
-	/*early return if we are fully floating:*/
-	if (masks->isfullyfloating[this->lid]){
-		constant=0;
+	}
+	if(slgeom->issubelement[SLGEOM_WATER][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_WATER][this->lid];
+
+		this->GetNodalWeightsAndAreaAndCentroidsFromLeveset(&loadweights[0],&loadarea,&latbar, &longbar, slgeom->late[this->lid], slgeom->longe[this->lid], area, -MaskOceanLevelsetEnum);
+
+		slgeom->LoadArea[SLGEOM_WATER][this->lid]=loadarea;
+		slgeom->vareae_subel[SLGEOM_WATER]->SetValue(intj,loadarea,INS_VAL);
+		slgeom->vlatbarycentre[SLGEOM_WATER]->SetValue(intj,latbar,INS_VAL);
+		slgeom->vlongbarycentre[SLGEOM_WATER]->SetValue(intj,longbar,INS_VAL);
+
+		for(int i=0;i<NUMVERTICES;i++)slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid]=loadweights[i];
+
 		#ifdef _ISSM_DEBUG_
-		this->AddInput(SealevelEustaticMaskEnum,&constant,P0Enum);
+		/*Inform mask: */
+		constant=loadarea/area; 
+		this->AddInput(SealevelBarystaticHydroMaskEnum,&constant,P0Enum);
+		this->AddInput(SealevelBarystaticHydroWeightsEnum,loadweights,P1DGEnum);
+		this->AddInput(SealevelBarystaticHydroAreaEnum,&loadarea,P0Enum);
+
+		this->AddInput(SealevelBarystaticHydroLatbarEnum,&latbar,P0Enum); 
+		this->AddInput(SealevelBarystaticHydroLongbarEnum,&longbar,P0Enum); 
+
 		#endif
-		bslrice=0;
-		return bslrice;
-	}
-
-	/*If we are here, we are on ice that is fully grounded or half-way to floating:*/
-	if (masks->notfullygrounded[this->lid]) notfullygrounded=true; //used later on.
-
-	/*Inform mask: */
-	constant=1;
-	#ifdef _ISSM_DEBUG_
-	this->AddInput(SealevelEustaticMaskEnum,&constant,P0Enum);
+	}
+
+}
+/*}}}*/
+void       Tria::SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom){ /*{{{*/
+
+	/*Declarations:{{{*/
+	int nel;
+	IssmDouble planetarea,planetradius;
+	IssmDouble constant,ratioe;
+	IssmDouble rho_earth;
+	IssmDouble lati,longi;
+	IssmDouble latitude[NUMVERTICES];
+	IssmDouble longitude[NUMVERTICES];
+	IssmDouble x,y,z,dx,dy,dz,N_azim,E_azim;
+	IssmDouble xyz_list[NUMVERTICES][3];
+
+	#ifdef _HAVE_RESTRICT_
+	IssmDouble* __restrict__ G_viscoelastic_precomputed=NULL;
+	IssmDouble* __restrict__ G_gravi_precomputed=NULL;
+	IssmDouble* __restrict__ U_viscoelastic_precomputed=NULL;
+	IssmDouble* __restrict__ H_viscoelastic_precomputed=NULL;
+	IssmDouble** __restrict__ Gsubel=NULL;
+	IssmDouble** __restrict__ GUsubel=NULL;
+	IssmDouble** __restrict__ GNsubel=NULL;
+	IssmDouble** __restrict__ GEsubel=NULL;
+
+	#else
+	IssmDouble* G_viscoelastic_precomputed=NULL;
+	IssmDouble* G_gravi_precomputed=NULL;
+	IssmDouble* U_viscoelastic_precomputed=NULL;
+	IssmDouble* H_viscoelastic_precomputed=NULL;
+	IssmDouble** Gsubel=NULL;
+	IssmDouble** GUsubel=NULL;
+	IssmDouble** GNsubel=NULL;
+	IssmDouble** GEsubel=NULL;
 	#endif
 
+	/*viscoelastic green function:*/
+	int index;
+	int M;
+	IssmDouble doubleindex,lincoef;
+
+	/*Computational flags:*/
+	bool computeselfattraction = false;
+	bool computeelastic = false;
+	bool computeviscous = false;
+	int  horiz;
+	int grd, grdmodel;
+
+	bool istime=true;
+	IssmDouble timeacc=0;
+	IssmDouble start_time,final_time;
+	int  nt,precomputednt;
+
+	/*}}}*/
+	/*Recover parameters:{{{ */
+	rho_earth=FindParam(MaterialsEarthDensityEnum);
+	this->parameters->FindParam(&computeselfattraction,SolidearthSettingsSelfAttractionEnum);
+	this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum);
+	this->parameters->FindParam(&computeviscous,SolidearthSettingsViscousEnum);
+	this->parameters->FindParam(&nel,MeshNumberofelementsEnum);
+	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
+	this->parameters->FindParam(&planetradius,SolidearthPlanetRadiusEnum);
+	this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
+	this->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 
+	this->parameters->FindParam(&grdmodel,GrdModelEnum);
+	/*}}}*/
+
+	/*early return:*/
+	if (!grd || grdmodel!=ElasticEnum) return; //Love numbers won't be found in this case, return before loading them
+	if(!computeselfattraction)return;
+
+	/*Recover precomputed green function kernels:{{{*/
+	DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGSelfAttractionEnum)); _assert_(parameter);
+	parameter->GetParameterValueByPointer((IssmDouble**)&G_gravi_precomputed,&M);
+
+	if(computeelastic){
+		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeGViscoElasticEnum)); _assert_(parameter);
+		parameter->GetParameterValueByPointer((IssmDouble**)&G_viscoelastic_precomputed,NULL);
+
+		parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeUViscoElasticEnum)); _assert_(parameter);
+		parameter->GetParameterValueByPointer((IssmDouble**)&U_viscoelastic_precomputed,NULL);
+
+		if(horiz){
+			parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelchangeHViscoElasticEnum)); _assert_(parameter);
+			parameter->GetParameterValueByPointer((IssmDouble**)&H_viscoelastic_precomputed,NULL);
+
+		}
+	}
+	/*}}}*/
+	/*Compute lat long of all vertices in the element:{{{*/
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	for(int i=0;i<NUMVERTICES;i++){
+		latitude[i]= asin(xyz_list[i][2]/planetradius);
+		longitude[i]= atan2(xyz_list[i][1],xyz_list[i][0]);
+	}
+	/*}}}*/
+	/*Compute green functions:{{{ */
+	constant=3/rho_earth/planetarea;
+
+	if(computeviscous){
+		this->parameters->FindParam(&istime,LoveIsTimeEnum);
+		if(!istime)_error_("Frequency love numbers not supported yet!");
+		this->parameters->FindParam(&timeacc,SolidearthSettingsTimeAccEnum);
+		this->parameters->FindParam(&start_time,TimesteppingStartTimeEnum);
+		this->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
+		nt=reCast<int,IssmDouble>((final_time-start_time)/timeacc)+1;
+	}
+	else{
+		nt=1; //in elastic, or if we run only selfattraction, we need only one step
+	}
+	Gsubel=xNew<IssmDouble*>(SLGEOM_NUMLOADS);
+	if(computeelastic){
+		GUsubel=xNew<IssmDouble*>(SLGEOM_NUMLOADS);
+		if(horiz){
+			GNsubel=xNew<IssmDouble*>(SLGEOM_NUMLOADS);
+			GEsubel=xNew<IssmDouble*>(SLGEOM_NUMLOADS);
+		}
+	}
+
+	//Allocate: 
+	for(int l=0;l<SLGEOM_NUMLOADS;l++){
+		int nbar=slgeom->nbar[l];
+		Gsubel[l]=xNewZeroInit<IssmDouble>(3*nbar*nt);
+		if(computeelastic){
+			GUsubel[l]=xNewZeroInit<IssmDouble>(3*nbar*nt);
+			if(horiz){
+				GNsubel[l]=xNewZeroInit<IssmDouble>(3*nbar*nt);
+				GEsubel[l]=xNewZeroInit<IssmDouble>(3*nbar*nt);
+			}
+		}
+
+		for(int e=0;e<nbar;e++){
+			ratioe=constant*slgeom->area_subel[l][e];
+			for (int i=0;i<3;i++){
+				IssmDouble alpha;
+				IssmDouble delPhi,delLambda;
+				/*recover info for this element and vertex:*/
+				IssmDouble late= slgeom->latbarycentre[l][e]; 
+				IssmDouble longe= slgeom->longbarycentre[l][e]; 
+				late=late/180*M_PI;
+				longe=longe/180*M_PI;
+
+				lati=latitude[i];
+				longi=longitude[i];
+
+				if(horiz){
+					/*Compute azimuths, both north and east components: */
+					x = xyz_list[i][0]; y = xyz_list[i][1]; z = xyz_list[i][2];
+					if(lati==90){
+						x=1e-12; y=1e-12;
+					}
+					if(lati==-90){
+						x=1e-12; y=1e-12;
+					}
+					IssmDouble xbar=planetradius*cos(late)*cos(longe);
+					IssmDouble ybar=planetradius*cos(late)*sin(longe);
+					IssmDouble zbar=planetradius*sin(late);
+
+					dx = xbar-x; dy = ybar-y; dz = zbar-z;
+					N_azim = (-z*x*dx-z*y*dy+(pow(x,2)+pow(y,2))*dz) /pow((pow(x,2)+pow(y,2))*(pow(x,2)+pow(y,2)+pow(z,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
+					E_azim = (-y*dx+x*dy) /pow((pow(x,2)+pow(y,2))*(pow(dx,2)+pow(dy,2)+pow(dz,2)),0.5);
+				}
+
+				/*Compute alpha angle between centroid and current vertex and index into precomputed tables: */
+				delPhi=fabs(lati-late); delLambda=fabs(longi-longe); if (delLambda>M_PI)delLambda=2*M_PI-delLambda;
+				alpha=2.*asin(sqrt(pow(sin(delPhi/2.0),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2.0),2.0)));
+				doubleindex=alpha/M_PI*reCast<IssmDouble,int>(M-1); //maps 0<alpha<PI on [0:M-1]
+				index=reCast<int,IssmDouble>(doubleindex); //truncates doubleindex to integer part
+
+				lincoef=doubleindex-index; //where between index and index+1 is alpha
+				if (index==M-1){ //avoids out of bound case
+					index-=1;
+					lincoef=1;
+				}
+
+				for(int t=0;t<nt;t++){
+					int timeindex=i*nbar*nt+e*nt+t; 
+
+					/*Rigid earth gravitational perturbation: */
+					Gsubel[l][timeindex]+=G_gravi_precomputed[index+0]*(1.-lincoef) 
+					    		     +G_gravi_precomputed[index+1]*lincoef; //linear interpolation
+
+					if(computeelastic){
+						Gsubel[l][timeindex]+=G_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								     +G_viscoelastic_precomputed[(index+1)*nt+t]*lincoef; //linear interpolation
+					}
+					Gsubel[l][timeindex]*=ratioe;
+
+					/*Elastic components:*/
+					if(computeelastic){
+						GUsubel[l][timeindex] =  ratioe *(U_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+										 +U_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+						if(horiz){
+							GNsubel[l][timeindex] = N_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								 			      +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+							GEsubel[l][timeindex] = E_azim*ratioe *(H_viscoelastic_precomputed[(index+0)*nt+t]*(1.-lincoef)
+								 			      +H_viscoelastic_precomputed[(index+1)*nt+t]*lincoef);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/*Save all these arrayins for each element:*/
+	for (int l=0;l<SLGEOM_NUMLOADS;l++){
+		this->inputs->SetArrayInput(slgeom->GEnum(l),this->lid,Gsubel[l],slgeom->nbar[l]*3*nt);
+		if(computeelastic){
+			this->inputs->SetArrayInput(slgeom->GUEnum(l),this->lid,GUsubel[l],slgeom->nbar[l]*3*nt);
+			if(horiz){
+				this->inputs->SetArrayInput(slgeom->GNEnum(l),this->lid,GNsubel[l],slgeom->nbar[l]*3*nt);
+				this->inputs->SetArrayInput(slgeom->GEEnum(l),this->lid,GEsubel[l],slgeom->nbar[l]*3*nt);
+			}
+		}
+	}
+	/*}}}*/
+	/*Free memory:{{{*/
+	for (int l=0;l<SLGEOM_NUMLOADS;l++){
+		xDelete<IssmDouble>(Gsubel[l]);
+		if(computeelastic){
+			xDelete<IssmDouble>(GUsubel[l]);
+			if(horiz){
+				xDelete<IssmDouble>(GNsubel[l]);
+				xDelete<IssmDouble>(GEsubel[l]);
+			}
+		}
+	}
+	xDelete<IssmDouble*>(Gsubel);
+	if(computeelastic){
+		xDelete<IssmDouble*>(GUsubel);
+		if(horiz){
+			xDelete<IssmDouble*>(GNsubel); 
+			xDelete<IssmDouble*>(GEsubel);
+		}
+	}
+	/*}}}*/
+	return;
+
+}
+/*}}}*/
+void       Tria::SealevelchangeUpdateViscousFields(){ /*{{{*/
+
+	/*Inputs:*/
+	IssmDouble* viscousRSL=NULL;
+	IssmDouble* viscousU=NULL;
+	IssmDouble* viscousN=NULL;
+	IssmDouble* viscousE=NULL;
+	IssmDouble* viscoustimes=NULL;
+	int         viscousnumsteps;
+	int         viscousindex=0; 
+	int         newindex=0; 
+	int         dummy;
+	bool        viscous=false;
+	IssmDouble  currenttime;
+	IssmDouble  lincoeff=0;
+	int horiz;
+
+	this->parameters->FindParam(&viscous,SolidearthSettingsViscousEnum);
+
+	if(viscous){
+		this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
+
+		this->parameters->FindParam(&viscousnumsteps,SealevelchangeViscousNumStepsEnum);
+		this->parameters->FindParam(&viscoustimes,NULL,SealevelchangeViscousTimesEnum);
+		this->parameters->FindParam(&viscousindex,SealevelchangeViscousIndexEnum);
+		this->parameters->FindParam(&currenttime,TimeEnum);
+
+		this->inputs->GetArrayPtr(SealevelchangeViscousRSLEnum,this->lid,&viscousRSL,&dummy);
+		this->inputs->GetArrayPtr(SealevelchangeViscousUEnum,this->lid,&viscousU,&dummy);
+		if(horiz){
+			this->inputs->GetArrayPtr(SealevelchangeViscousNEnum,this->lid,&viscousN,&dummy);
+			this->inputs->GetArrayPtr(SealevelchangeViscousEEnum,this->lid,&viscousE,&dummy);
+		}
+
+		bool foundtime=false;
+		int offset=1;
+		lincoeff=0;
+		newindex=viscousnumsteps-2;
+
+		for(int t=viscousindex;t<viscousnumsteps;t++){
+			if (viscoustimes[t]>currenttime){
+				newindex=t-1;
+				lincoeff=(currenttime-viscoustimes[newindex])/(viscoustimes[t]-viscoustimes[newindex]);
+				foundtime=true;
+				offset=0;
+				break;
+			}
+		}
+
+		if(!foundtime) lincoeff=1;
+		viscoustimes[newindex]=currenttime;
+		for(int i=0;i<NUMVERTICES;i++){
+			viscousRSL[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousRSL[i*viscousnumsteps+newindex]+lincoeff*viscousRSL[i*viscousnumsteps+newindex+1];
+			viscousU[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousU[i*viscousnumsteps+newindex]+lincoeff*viscousU[i*viscousnumsteps+newindex+1];
+			if(horiz){
+				viscousN[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousN[i*viscousnumsteps+newindex]+lincoeff*viscousN[i*viscousnumsteps+newindex+1];
+				viscousE[i*viscousnumsteps+newindex+offset]=(1-lincoeff)*viscousE[i*viscousnumsteps+newindex]+lincoeff*viscousE[i*viscousnumsteps+newindex+1];
+			}
+		}
+		viscousindex=newindex+offset;
+
+		this->parameters->SetParam(viscousindex,SealevelchangeViscousIndexEnum);
+		this->parameters->SetParam(viscoustimes,viscousnumsteps,SealevelchangeViscousTimesEnum);
+
+		/*free allocations:*/
+		xDelete<IssmDouble>(viscoustimes);
+	}
+
+}
+/*}}}*/
+void       Tria::SealevelchangeBarystaticLoads(GrdLoads* loads,  BarystaticContributions* barycontrib, SealevelGeometry* slgeom){ /*{{{*/
+
+	/*Inputs:*/
+	IssmDouble I[NUMVERTICES]; 
+	IssmDouble W[NUMVERTICES];
+	IssmDouble BP[NUMVERTICES];
+
+	/*output: */
+	IssmDouble bslcice=0;
+	IssmDouble bslchydro=0;
+	IssmDouble bslcbp=0;
+	IssmDouble BPavg=0;
+	IssmDouble Iavg=0;
+	IssmDouble Wavg=0;
+
+	/*ice properties: */
+	IssmDouble rho_ice,rho_water,rho_freshwater;
+
 	/*recover some parameters:*/
-	rho_ice=FindParam(MaterialsRhoIceEnum);
-	rho_water=FindParam(MaterialsRhoSeawaterEnum);
-	this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum);
-	this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum);
-	this->parameters->FindParam(&glfraction,SolidearthSettingsGlfractionEnum);
-
-	/*retrieve precomputed G:*/
-	if(computerigid)this->inputs->GetArrayPtr(SealevelriseGEnum,this->lid,&G,&gsize);
-
-	/*Get area of element: precomputed in the sealevelrise_core_geometry:*/
+	this->parameters->FindParam(&rho_ice,MaterialsRhoIceEnum);
+	this->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum);
+	this->parameters->FindParam(&rho_freshwater,MaterialsRhoFreshwaterEnum);
+
+	/*Retrieve inputs:*/
+	Element::GetInputListOnVertices(&I[0],DeltaIceThicknessEnum);
+	Element::GetInputListOnVertices(&W[0],DeltaTwsEnum);
+	Element::GetInputListOnVertices(&BP[0],DeltaBottomPressureEnum);
+
+	for(int i=0;i<NUMVERTICES;i++){
+		Iavg+=I[i]*slgeom->LoadWeigths[SLGEOM_ICE][i][this->lid];
+		Wavg+=W[i]*slgeom->LoadWeigths[SLGEOM_WATER][i][this->lid];
+		BPavg+=BP[i]*slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid];
+	}
+
+	/*convert from m to kg/m^2:*/
+	Iavg*=rho_ice;
+	Wavg*=rho_freshwater;
+	BPavg*=rho_water;
+
+	#ifdef _ISSM_DEBUG_ 
+	this->AddInput(SealevelBarystaticIceLoadEnum,&Iavg,P0Enum);
+	this->AddInput(SealevelBarystaticHydroLoadEnum,&Wavg,P0Enum);
+	this->AddInput(SealevelBarystaticBpLoadEnum,&BPavg,P0Enum);
+	#endif
+
+	/*Compute barystatic component in kg:*/
+	bslcice =   -slgeom->LoadArea[SLGEOM_ICE][this->lid]*Iavg;
+	bslchydro = -slgeom->LoadArea[SLGEOM_WATER][this->lid]*Wavg;
+	bslcbp =    -slgeom->LoadArea[SLGEOM_OCEAN][this->lid]*BPavg;
+
+	_assert_(!xIsNan<IssmDouble>(bslcice));
+	_assert_(!xIsNan<IssmDouble>(bslchydro));
+	_assert_(!xIsNan<IssmDouble>(bslcbp));
+
+	/*Plug values into subelement load vector:*/
+	if(slgeom->issubelement[SLGEOM_ICE][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_ICE][this->lid];
+		loads->vsubloads[SLGEOM_ICE]->SetValue(intj,Iavg,INS_VAL);
+		Iavg=0; //avoid double counting centroid loads and subelement loads!
+	}
+	if(slgeom->issubelement[SLGEOM_WATER][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_WATER][this->lid];
+		loads->vsubloads[SLGEOM_WATER]->SetValue(intj,Wavg,INS_VAL);
+		Wavg=0;
+	}
+	if(slgeom->issubelement[SLGEOM_OCEAN][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_OCEAN][this->lid];
+		loads->vsubloads[SLGEOM_OCEAN]->SetValue(intj,BPavg,INS_VAL); 
+		BPavg=0;
+	}
+	/*Plug remaining values into centroi load vector:*/
+	loads->vloads->SetValue(this->sid,Iavg+Wavg+BPavg,INS_VAL);
+
+	/*Keep track of barystatic contributions:*/
+	barycontrib->Set(this->Sid(),bslcice,bslchydro,bslcbp);
+
+}
+/*}}}*/
+void       Tria::SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* polarmotionvector,SealevelGeometry* slgeom){ /*{{{*/
+
+	/*sal green function:*/
+	IssmDouble* G=NULL;
+	IssmDouble* Gsub[SLGEOM_NUMLOADS];
+	bool computefuture=false;
+
+	bool sal = false;
+	bool viscous = false;
+	bool rotation= false;
+	bool percpu= false;
+	int  size;
+	int  nel,nbar;
+	IssmDouble Grotm1[3];
+	IssmDouble Grotm2[3];
+	IssmDouble Grotm3[3];
+
+	this->parameters->FindParam(&sal,SolidearthSettingsSelfAttractionEnum);
+	this->parameters->FindParam(&viscous,SolidearthSettingsViscousEnum);
+	this->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum);
+	this->parameters->FindParam(&nel,MeshNumberofelementsEnum);
+
+	if(sal){
+		this->inputs->GetArrayPtr(SealevelchangeGEnum,this->lid,&G,&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelIceEnum,this->lid,&Gsub[SLGEOM_ICE],&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelHydroEnum,this->lid,&Gsub[SLGEOM_WATER],&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelOceanEnum,this->lid,&Gsub[SLGEOM_OCEAN],&size);
+
+		this->SealevelchangeGxL(sealevelpercpu, G, Gsub, loads, slgeom, nel,percpu=true,SealevelchangeViscousRSLEnum,computefuture=false);
+	}
+
+	if(rotation){
+		Element::GetInputListOnVertices(&Grotm1[0],SealevelGrotm1Enum);
+		Element::GetInputListOnVertices(&Grotm2[0],SealevelGrotm2Enum);
+		Element::GetInputListOnVertices(&Grotm3[0],SealevelGrotm3Enum);
+
+		for(int i=0;i<NUMVERTICES;i++){
+			if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+				sealevelpercpu[this->vertices[i]->lid]+=Grotm1[i]*polarmotionvector[0]+Grotm2[i]*polarmotionvector[1]+Grotm3[i]*polarmotionvector[2];
+			}
+		}
+	}
+	return;
+} /*}}}*/
+void       Tria::SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom){ /*{{{*/
+
+	/*sal green function:*/
+	IssmDouble oceanaverage=0;
+	IssmDouble oceanarea=0;
+	IssmDouble rho_water;
+
+	this->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum);
+
+	/*retrieve ocean average and area:*/
+	for(int i=0;i<NUMVERTICES;i++){
+		oceanaverage+=sealevelpercpu[this->vertices[i]->lid]*slgeom->LoadWeigths[SLGEOM_OCEAN][i][this->lid];
+	}
+	#ifdef _ISSM_DEBUG_ 
+	this->AddInput(SealevelBarystaticOceanLoadEnum,&oceanaverage,P0Enum);
+	#endif
+	oceanarea=slgeom->LoadArea[SLGEOM_OCEAN][this->lid];
+
+	/*add ocean average in the global sealevelloads vector:*/
+	if(slgeom->issubelement[SLGEOM_OCEAN][this->lid]){
+		int intj=slgeom->subelementmapping[SLGEOM_OCEAN][this->lid];
+		loads->vsubsealevelloads->SetValue(intj,oceanaverage*rho_water,INS_VAL);
+		loads->vsealevelloads->SetValue(this->sid,0.,INS_VAL);
+	}
+	else loads->vsealevelloads->SetValue(this->sid,oceanaverage*rho_water,INS_VAL);
+
+	/*add ocean area into a global oceanareas vector:*/
+	if(!loads->sealevelloads){
+		oceanareas->SetValue(this->sid,oceanarea,INS_VAL);
+		if(slgeom->issubelement[SLGEOM_OCEAN][this->lid]){
+			int intj=slgeom->subelementmapping[SLGEOM_OCEAN][this->lid];
+			subelementoceanareas->SetValue(intj,oceanarea,INS_VAL);
+		}
+	}
+
+	return;
+} /*}}}*/
+void       Tria::SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* polarmotionvector,SealevelGeometry* slgeom){ /*{{{*/
+
+	IssmDouble SealevelGrd[3]={0,0,0};
+	IssmDouble RSLGrd[3]={0,0,0};
+	IssmDouble UGrd[3]={0,0,0};
+	IssmDouble NGrd[3]={0,0,0};
+	IssmDouble EGrd[3]={0,0,0};
+	int nel,nbar;
+	bool sal = false;
+	IssmDouble* G=NULL;
+	IssmDouble* GU=NULL;
+	IssmDouble* GE=NULL;
+	IssmDouble* GN=NULL;
+	IssmDouble* Gsub[SLGEOM_NUMLOADS];
+	IssmDouble* GUsub[SLGEOM_NUMLOADS];
+	IssmDouble* GNsub[SLGEOM_NUMLOADS];
+	IssmDouble* GEsub[SLGEOM_NUMLOADS];
+	bool computefuture=false;
+
+	int horiz;
+	int size;
+	IssmDouble Grotm1[3];
+	IssmDouble Grotm2[3];
+	IssmDouble Grotm3[3];
+	IssmDouble GUrotm1[3];
+	IssmDouble GUrotm2[3];
+	IssmDouble GUrotm3[3];
+	IssmDouble GNrotm1[3];
+	IssmDouble GNrotm2[3];
+	IssmDouble GNrotm3[3];
+	IssmDouble GErotm1[3];
+	IssmDouble GErotm2[3];
+	IssmDouble GErotm3[3];
+	bool rotation= false;
+	bool elastic=false;
+	bool percpu=false;
+	bool planethasocean=false;
+
+	this->parameters->FindParam(&nel,MeshNumberofelementsEnum);
+	this->parameters->FindParam(&sal,SolidearthSettingsSelfAttractionEnum);
+	this->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum);
+	this->parameters->FindParam(&elastic,SolidearthSettingsElasticEnum);
+	this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
+	this->parameters->FindParam(&planethasocean,SolidearthSettingsGrdOceanEnum);
+
+	if(sal){
+
+		this->inputs->GetArrayPtr(SealevelchangeGEnum,this->lid,&G,&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelIceEnum,this->lid,&Gsub[SLGEOM_ICE],&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelHydroEnum,this->lid,&Gsub[SLGEOM_WATER],&size);
+		this->inputs->GetArrayPtr(SealevelchangeGsubelOceanEnum,this->lid,&Gsub[SLGEOM_OCEAN],&size);
+
+		if(elastic){
+			this->inputs->GetArrayPtr(SealevelchangeGUEnum,this->lid,&GU,&size);
+			this->inputs->GetArrayPtr(SealevelchangeGUsubelIceEnum,this->lid,&GUsub[SLGEOM_ICE],&size);
+			this->inputs->GetArrayPtr(SealevelchangeGUsubelHydroEnum,this->lid,&GUsub[SLGEOM_WATER],&size);
+			this->inputs->GetArrayPtr(SealevelchangeGUsubelOceanEnum,this->lid,&GUsub[SLGEOM_OCEAN],&size);
+			if(horiz){
+				this->inputs->GetArrayPtr(SealevelchangeGNEnum,this->lid,&GN,&size);
+				this->inputs->GetArrayPtr(SealevelchangeGNsubelIceEnum,this->lid,&GNsub[SLGEOM_ICE],&size);
+				this->inputs->GetArrayPtr(SealevelchangeGNsubelHydroEnum,this->lid,&GNsub[SLGEOM_WATER],&size);
+				this->inputs->GetArrayPtr(SealevelchangeGNsubelOceanEnum,this->lid,&GNsub[SLGEOM_OCEAN],&size);
+
+				this->inputs->GetArrayPtr(SealevelchangeGEEnum,this->lid,&GE,&size);
+				this->inputs->GetArrayPtr(SealevelchangeGEsubelIceEnum,this->lid,&GEsub[SLGEOM_ICE],&size);
+				this->inputs->GetArrayPtr(SealevelchangeGEsubelHydroEnum,this->lid,&GEsub[SLGEOM_WATER],&size);
+				this->inputs->GetArrayPtr(SealevelchangeGEsubelOceanEnum,this->lid,&GEsub[SLGEOM_OCEAN],&size);
+			}
+		}
+		this->SealevelchangeGxL(&RSLGrd[0],G, Gsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousRSLEnum,computefuture=true);
+
+		if(elastic){
+			this->SealevelchangeGxL(&UGrd[0],GU, GUsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousUEnum,computefuture=true);
+			if(horiz ){
+				this->SealevelchangeGxL(&NGrd[0],GN, GNsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousNEnum,computefuture=true);
+				this->SealevelchangeGxL(&EGrd[0],GE, GEsub, loads, slgeom, nel,percpu=false,SealevelchangeViscousEEnum,computefuture=true);
+			}
+		}
+	}
+
+	if(rotation){
+		Element::GetInputListOnVertices(&Grotm1[0],SealevelGrotm1Enum);
+		Element::GetInputListOnVertices(&Grotm2[0],SealevelGrotm2Enum);
+		Element::GetInputListOnVertices(&Grotm3[0],SealevelGrotm3Enum);
+
+		for(int i=0;i<NUMVERTICES;i++){
+			if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+				RSLGrd[i]+=Grotm1[i]*polarmotionvector[0]+Grotm2[i]*polarmotionvector[1]+Grotm3[i]*polarmotionvector[2];
+			}
+		}
+
+		if (elastic){
+			Element::GetInputListOnVertices(&GUrotm1[0],SealevelGUrotm1Enum);
+			Element::GetInputListOnVertices(&GUrotm2[0],SealevelGUrotm2Enum);
+			Element::GetInputListOnVertices(&GUrotm3[0],SealevelGUrotm3Enum);
+
+			for(int i=0;i<NUMVERTICES;i++){
+				if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+					UGrd[i]+=GUrotm1[i]*polarmotionvector[0]+GUrotm2[i]*polarmotionvector[1]+GUrotm3[i]*polarmotionvector[2];
+				}
+			}
+			if (horiz){
+				Element::GetInputListOnVertices(&GNrotm1[0],SealevelGNrotm1Enum);
+				Element::GetInputListOnVertices(&GNrotm2[0],SealevelGNrotm2Enum);
+				Element::GetInputListOnVertices(&GNrotm3[0],SealevelGNrotm3Enum);
+				Element::GetInputListOnVertices(&GErotm1[0],SealevelGErotm1Enum);
+				Element::GetInputListOnVertices(&GErotm2[0],SealevelGErotm2Enum);
+				Element::GetInputListOnVertices(&GErotm3[0],SealevelGErotm3Enum);
+
+				for(int i=0;i<NUMVERTICES;i++){
+					if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+						NGrd[i]+=GNrotm1[i]*polarmotionvector[0]+GNrotm2[i]*polarmotionvector[1]+GNrotm3[i]*polarmotionvector[2];
+						EGrd[i]+=GErotm1[i]*polarmotionvector[0]+GErotm2[i]*polarmotionvector[1]+GErotm3[i]*polarmotionvector[2];
+					}
+				}
+			}
+		}
+	}
+
+	if (planethasocean){ //We must also output the RSL on vertices to compute the ocean mass conservation
+		for(int i=0;i<NUMVERTICES;i++){
+			if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+				sealevelpercpu[this->vertices[i]->lid]=RSLGrd[i];
+			}
+		}
+	}
+
+	/*Create geoid: */
+	for(int i=0;i<NUMVERTICES;i++)SealevelGrd[i]=UGrd[i]+RSLGrd[i];
+
+	/*Create inputs*/
+	this->AddInput(SealevelGRDEnum,SealevelGrd,P1Enum);
+	this->AddInput(BedGRDEnum,UGrd,P1Enum);
+	if(horiz){
+		this->AddInput(BedNorthGRDEnum,NGrd,P1Enum);
+		this->AddInput(BedEastGRDEnum,EGrd,P1Enum);
+	}
+
+} /*}}}*/
+void       Tria::SealevelchangeGxL(IssmDouble* grdfieldout, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool percpu, int viscousenum, bool computefuture) { /*{{{*/
+
+	IssmDouble* grdfield=NULL;
+	int i,e,l,t,nbar;
+	bool computeviscous=false;
+	IssmDouble* viscousfield=NULL;
+	int nt=1; //important
+	int viscousindex=0; //important
+	int viscousnumsteps=1; //important
+
+	this->parameters->FindParam(&computeviscous,SolidearthSettingsViscousEnum);
+	if(computeviscous){
+		this->parameters->FindParam(&viscousnumsteps,SealevelchangeViscousNumStepsEnum);
+		if(computefuture) nt=viscousnumsteps;
+		else nt=1;
+
+		//allocate
+		grdfield=xNewZeroInit<IssmDouble>(3*nt);
+	}
+	else grdfield=xNewZeroInit<IssmDouble>(3*nt);
+
+	if(loads->sealevelloads){
+
+		for(i=0;i<NUMVERTICES;i++) {
+			if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+			for (e=0;e<nel;e++){
+				for(t=0;t<nt;t++){
+					int index=i*nel*viscousnumsteps+e*viscousnumsteps+t;
+					grdfield[i*nt+t]+=G[index]*(loads->sealevelloads[e]+loads->loads[e]);
+				}
+			}
+			for(l=0;l<SLGEOM_NUMLOADS;l++){
+				nbar=slgeom->nbar[l];
+				for (e=0;e<nbar;e++){
+					for(t=0;t<nt;t++){
+						int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t;
+						grdfield[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]);
+					}
+				}
+				if(l==SLGEOM_OCEAN){
+					for (e=0;e<nbar;e++){
+						for(t=0;t<nt;t++){
+							int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t;
+							grdfield[i*nt+t]+=Gsub[l][index]*(loads->subsealevelloads[e]);
+						}
+					}
+				}
+			}
+		}
+	}
+	else{  //this is the initial convolution where only loads are provided
+
+		for(i=0;i<NUMVERTICES;i++) {
+			if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+			for (e=0;e<nel;e++){
+				for(t=0;t<nt;t++){
+					int index=i*nel*viscousnumsteps+e*viscousnumsteps+t;
+					grdfield[i*nt+t]+=G[index]*(loads->loads[e]);
+				}
+			}
+			for(l=0;l<SLGEOM_NUMLOADS;l++){
+				nbar=slgeom->nbar[l];
+				for (e=0;e<nbar;e++){
+					for(t=0;t<nt;t++){
+						int index=i*nbar*viscousnumsteps+e*viscousnumsteps+t;
+						grdfield[i*nt+t]+=Gsub[l][index]*(loads->subloads[l][e]);
+					}
+				}
+			}
+		}
+	}
+
+	if(computeviscous){
+		IssmDouble* grdfieldinterp=NULL;
+		IssmDouble* viscoustimes=NULL;
+		IssmDouble  final_time;
+		IssmDouble  lincoeff;
+		IssmDouble  timeacc;
+
+		this->parameters->FindParam(&viscousindex,SealevelchangeViscousIndexEnum);
+		this->parameters->FindParam(&viscoustimes,NULL,SealevelchangeViscousTimesEnum);
+		this->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
+		this->parameters->FindParam(&timeacc,SolidearthSettingsTimeAccEnum);
+		this->inputs->GetArrayPtr(viscousenum,this->lid,&viscousfield,NULL);
+		if(computefuture){
+			grdfieldinterp=xNew<IssmDouble>(3*nt); 
+			if(viscoustimes[viscousindex]<final_time){
+				lincoeff=(viscoustimes[viscousindex+1]-viscoustimes[viscousindex])/timeacc;
+				for(int t=viscousindex;t<nt;t++){
+					if(t==viscousindex){
+						for(int i=0;i<NUMVERTICES;i++){
+							if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+							grdfieldinterp[i*nt+t]=  grdfield[i*nt+0];
+						}
+					}
+					else{
+						for(int i=0;i<NUMVERTICES;i++){
+							if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+							grdfieldinterp[i*nt+t]=  (1-lincoeff)*grdfield[i*nt+(t-viscousindex-1)]+lincoeff*grdfield[i*nt+(t-viscousindex)];
+						}
+					}
+				}
+			}
+		}
+
+		/*update grdfield at present time using viscous stack at present time: */
+		for(int i=0;i<NUMVERTICES;i++){
+			if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+			grdfield[i*nt+0]+=viscousfield[i*viscousnumsteps+viscousindex]; 
+		}
+
+		if(computefuture){ /*update viscous stack with future deformation from present load: */
+
+			for(int t=nt-1;t>=viscousindex;t--){
+				for(int i=0;i<NUMVERTICES;i++){
+					if(slgeom->lids[this->vertices[i]->lid]!=this->lid)continue;
+					//offset viscousfield to remove all deformation that has already been added
+					viscousfield[i*viscousnumsteps+t]+=grdfieldinterp[i*nt+t]-grdfieldinterp[i*nt+viscousindex]-viscousfield[i*viscousnumsteps+viscousindex];
+				}
+			}
+			/*Re-add viscous stack now that we updated:*/
+			this->inputs->SetArrayInput(viscousenum,this->lid,viscousfield,3*viscousnumsteps);
+		}
+
+		/*Free allocatoins:*/
+		xDelete<IssmDouble>(viscoustimes);
+	}
+
+	/*store values computed on vertices, but don't repeat the computation if another element already computed it!:*/
+	if(percpu){
+		for(i=0;i<NUMVERTICES;i++){
+			if(slgeom->lids[this->vertices[i]->lid]==this->lid){
+				grdfieldout[this->vertices[i]->lid]=grdfield[i*nt+0];
+			}
+		}
+	}
+	else{
+		for(i=0;i<NUMVERTICES;i++) grdfieldout[i]=grdfield[i*nt+0];
+	}
+
+} /*}}}*/
+void       Tria::SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom){/*{{{*/
+
+	IssmDouble S=0;
+
+	/*Compute area of element:*/
+	IssmDouble area,planetarea,re;
+	IssmDouble late,longe;
 	this->Element::GetInputValue(&area,AreaEnum);
 
-	/*Compute fraction of the element that is grounded: */
-	if(notfullygrounded){
-		IssmDouble xyz_list[NUMVERTICES][3];
-		::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-
-		phi=this->GetGroundedPortion(&xyz_list[0][0]); //watch out, this only works because of the Thales theorem! We are in 3D, but this routine is inherently for 2D trias
-		if(glfraction==0)phi=1;
-		#ifdef _ISSM_DEBUG_
-		this->AddInput(SealevelEustaticMaskEnum,&phi,P0Enum);
-		#endif
-	}
-	else phi=1.0;
-
-	/*Retrieve ice thickness at vertices: */
-	Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessChangeEnum);
-	if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
-
-	/*/Average ice thickness over grounded area of the element only: {{{*/
-	if(!notfullygrounded)deltathickness_input->GetInputAverage(&I);
-	else{
-		IssmDouble total_weight=0;
-		bool mainlyfloating = true;
-		int         point1;
-		IssmDouble  fraction1,fraction2;
-
-		/*Recover portion of element that is grounded*/
-		this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
-		Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
-
-		/* Start  looping on the number of gaussian points and average over these gaussian points: */
-		total_weight=0;
-		I=0;
-		while(gauss->next()){
-			IssmDouble Ig=0;
-			deltathickness_input->GetInputValue(&Ig,gauss);
-			I+=Ig*gauss->weight;
-			total_weight+=gauss->weight;
-		}
-		I=I/total_weight;
-		delete gauss;
-	}
-	/*}}}*/
-
-	/*Compute barystatic contribution:*/
-	_assert_(oceanarea>0.);
-	if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2
-	bslrice = rho_ice*area*phi*I/(oceanarea*rho_water);
-	_assert_(!xIsNan<IssmDouble>(bslrice));
-
-	if(computerigid){
-		/*convert from m to kg/m^2:*/
-		I=I*rho_ice*phi;
-
-		/*convolve:*/
-		for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*I;
-	}
-
-	/*Plug bslrice into barystatic contribution vector:*/
-	if(barystatic_contribution){
-		id=reCast<int>(partition[this->Sid()])+1;
-		barystatic_contribution->SetValue(id,bslrice,ADD_VAL);
-	}
-	/*return :*/
-	return bslrice;
-}
-/*}}}*/
-IssmDouble Tria::SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
-	IssmDouble area;
-	IssmDouble phi=1.0; //WARNING: do not touch this, default is entire elemnt contributes barystatic
-	IssmDouble W;  //change in water height thickness (Farrel and Clarke, Equ. 4)
-	bool notfullygrounded=false;
-	bool scaleoceanarea= false;
-	bool computeelastic= false;
-
-	/*elastic green function:*/
-	IssmDouble* G=NULL;
-
-	/*ice properties: */
-	IssmDouble rho_water;
-	IssmDouble rho_freshwater;
-
-	/*output:*/
-	IssmDouble bslrhydro = 0;
-
-	/*early return if we are on an ice cap. Nop, we may have hydro
-	 * and ice on the same masscon:*/
-	/*if(masks->isiceonly[this->lid]){ 
-		bslrhydro=0;
-		return bslrhydro; 
-	}*/
-
-	/*early return if we are fully floating:*/
-	if (masks->isfullyfloating[this->lid]){ 
-		bslrhydro=0;
-		return bslrhydro; 
-	}
-
-	/*If we are here, we are on earth, not on ice: */
-
 	/*recover parameters: */
-	rho_water=FindParam(MaterialsRhoSeawaterEnum);
-	rho_freshwater=FindParam(MaterialsRhoFreshwaterEnum);
-	this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum);
-	this->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum);
-
-	/*retrieve precomputed G:*/
-	if(computeelastic)this->inputs->GetArrayPtr(SealevelriseGEnum,this->lid,&G,&gsize);
-
-	/*Get area of element: precomputed in the sealevelrise_core_geometry:*/
-	this->Element::GetInputValue(&area,AreaEnum);
-
-	/*Retrieve water height at vertices: */
-	Input* deltathickness_input=this->GetInput(SurfaceloadWaterHeightChangeEnum);
-	if (!deltathickness_input)_error_("SurfaceloadWaterHeightChangeEnum input needed to compute sea level rise!");
-	deltathickness_input->GetInputAverage(&W);
-
-	/*Compute barystatic component:*/
-	_assert_(oceanarea>0.);
-	if(scaleoceanarea) oceanarea=3.619e+14; // use true ocean area, m^2
-	bslrhydro = rho_freshwater*area*phi*W/(oceanarea*rho_water);
-	_assert_(!xIsNan<IssmDouble>(bslrhydro));
-
-	if(computeelastic){
-		/*convert from m to kg/m^2:*/
-		W=W*rho_freshwater*phi;
-
-		/*convolve:*/
-		for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*W;
-	}
-
-	/*Plug bslrice into barystatic contribution vector:*/
-	if(barystatic_contribution){
-		id=reCast<int>(partition[this->Sid()])+1;
-		barystatic_contribution->SetValue(id,bslrhydro,ADD_VAL);
-	}
-	/*output:*/
-	return bslrhydro;
-}
-/*}}}*/
-void    Tria::SealevelriseEustaticBottomPressure(IssmDouble* Sgi,SealevelMasks* masks){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
-	IssmDouble area;
-	IssmDouble BP;  //change in bottom pressure (Farrel and Clarke, Equ. 4)
-	IssmDouble constant;
-	bool computeelastic= false;
-
-	/*elastic green function:*/
-	IssmDouble* G=NULL;
-
-	/*water properties: */
-	IssmDouble rho_water;
-
-	/*exit now?:*/
-	this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum);
-	if(!computeelastic)return;
-
-	/*we are here to compute fingerprints originating fromn bottom pressure changes:*/
-	if(!masks->isoceanin[this->lid])return;
-
-	/*Inform mask: */
-	#ifdef _ISSM_DEBUG_
-	constant=1; this->AddInput(SealevelEustaticMaskEnum,&constant,P0Enum);
-	#endif
-
-	/*recover material parameters: */
-	rho_water=FindParam(MaterialsRhoSeawaterEnum);
-
-	/*retrieve precomputed G:*/
-	this->inputs->GetArrayPtr(SealevelriseGEnum,this->lid,&G,&gsize);
-
-	/*Get area of element: precomputed in the sealevelrise_core_geometry:*/
-	this->Element::GetInputValue(&area,AreaEnum);
-
-	/*Retrieve bottom pressure change and average over the element: */
-	Input* bottompressure_change_input=this->GetInput(DslSeaWaterPressureChangeAtSeaFloorEnum);
-	if (!bottompressure_change_input)_error_("bottom pressure input needed to compute sea level rise fingerprint!");
-	bottompressure_change_input->GetInputAverage(&BP);
-
-	/*convert from m to kg/m^2:*/
-	BP=BP*rho_water;
-
-	/*convolve:*/
-	for(int i=0;i<gsize;i++) Sgi[i]+=G[i]*BP;
-
+	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
+	this->parameters->FindParam(&re,SolidearthPlanetRadiusEnum);
+	late=slgeom->late[this->lid]/180*M_PI;
+	longe=slgeom->longe[this->lid]/180*M_PI;
+
+	/*recover total load: */
+	if(loads->loads) S+=loads->loads[this->Sid()];
+	if(loads->sealevelloads) S+=loads->sealevelloads[this->Sid()];
+
+	/* Perturbation terms for moment of inertia (moi_list):
+	 * computed analytically (see Wu & Peltier, eqs 10 & 32)
+	 * also consistent with my GMD formulation!
+	 * ALL in geographic coordinates
+	 * */
+	dI_list[0] = -4*M_PI*(S*area)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea;
+	dI_list[1] = -4*M_PI*(S*area)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea;
+	dI_list[2] = +4*M_PI*(S*area)*pow(re,4)*(1-pow(sin(late),2))/planetarea;
 	return;
-}
-/*}}}*/
-void    Tria::SealevelriseNonEustatic(IssmDouble* Sgo,IssmDouble* Sg_old, SealevelMasks* masks){ /*{{{*/
-
-	/*diverse:*/
-	int gsize,dummy;
-	IssmDouble S;  //change in water water level(Farrel and Clarke, Equ. 4)
-	IssmDouble constant=0;
-	IssmDouble rho_water;
-	IssmDouble* G=NULL;
-	int  bp_compute_fingerprints= 0;
-
-	/*retrieve parameters:*/
-	this->parameters->FindParam(&bp_compute_fingerprints,DslComputeFingerprintsEnum);
-	rho_water=FindParam(MaterialsRhoSeawaterEnum);
-
-	/*early return if we are not on the ocean:*/
-	if (!masks->isoceanin[this->lid]){
-		constant=0;
-		#ifdef _ISSM_DEBUG_
-		this->AddInput(SealevelEustaticOceanMaskEnum,&constant,P0Enum);
-		#endif
-		return;
-	}
-	constant=1;
-	#ifdef _ISSM_DEBUG_
-	this->AddInput(SealevelEustaticOceanMaskEnum,&constant,P0Enum);
-	#endif
-
-	/*how many dofs are we working with here? */
-	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
-
-	/*retrieve precomputed G:*/
-	this->inputs->GetArrayPtr(SealevelriseGEnum,this->lid,&G,&dummy); _assert_(dummy==gsize);
-
-	/*From Sg_old, recover water sea level rise:*/
-	S=0; for(int i=0;i<NUMVERTICES;i++) S+=Sg_old[this->vertices[i]->Sid()]/NUMVERTICES;
-
-	/*convert to kg/m^2: */
-	S=S*rho_water;
-
-	for(int i=0;i<gsize;i++) Sgo[i]+=G[i]*S;
+}/*}}}*/
+void       Tria::SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* grdloads,  SealevelGeometry* slgeom){/*{{{*/
+
+	IssmDouble  SA=0;
+	IssmDouble* loads=NULL;
+	IssmDouble* sealevelloads=NULL;
+	IssmDouble  late,longe,re;
+	int         intj;
+	IssmDouble  area;
+	IssmDouble  planetarea;
+
+	/*recover parameters: */
+	this->parameters->FindParam(&planetarea,SolidearthPlanetAreaEnum);
+	this->parameters->FindParam(&re,SolidearthPlanetRadiusEnum);
+
+	/*Initalize:*/
+	for(int i=0;i<3;i++)dI_list[i]=0;
+
+	/*Go through our loads:*/
+	for(int i=0;i<SLGEOM_NUMLOADS;i++){
+		if(slgeom->issubelement[i][this->lid]){
+			loads=grdloads->subloads[i];
+			if(i==SLGEOM_OCEAN) sealevelloads=grdloads->subsealevelloads;
+			intj=slgeom->subelementmapping[i][this->lid];
+			late=slgeom->latbarycentre[i][intj]/180*M_PI;
+			longe=slgeom->longbarycentre[i][intj]/180*M_PI;
+			area=slgeom->area_subel[i][intj];
+
+			/*recover total load: */
+			if(loads) SA+=loads[intj]*area;
+			if(sealevelloads) SA+=sealevelloads[intj]*area;
+		}
+	}
+
+	/* Perturbation terms for moment of inertia (moi_list):
+	 * computed analytically (see Wu & Peltier, eqs 10 & 32)
+	 * also consistent with my GMD formulation!
+	 * ALL in geographic coordinates
+	 * */
+	dI_list[0] += -4*M_PI*(SA)*pow(re,4)*(sin(late)*cos(late)*cos(longe))/planetarea;
+	dI_list[1] += -4*M_PI*(SA)*pow(re,4)*(sin(late)*cos(late)*sin(longe))/planetarea;
+	dI_list[2] += +4*M_PI*(SA)*pow(re,4)*(1-pow(sin(late),2))/planetarea;
 
 	return;
-}
-/*}}}*/
-void    Tria::SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North ,IssmDouble* East,IssmDouble* Sg, SealevelMasks* masks){ /*{{{*/
-
-	/*diverse:*/
-	int gsize;
-	IssmDouble I, S, BP;		//change in relative ice thickness and sea level
-	IssmDouble rho_ice,rho_water;
-	int horiz;
-	int  bp_compute_fingerprints= 0;
-
-	/*precomputed elastic green functions:*/
-	IssmDouble* GU=NULL;
-	IssmDouble* GN=NULL;
-	IssmDouble* GE=NULL;
-
-	/*computational flags:*/
-	bool computeelastic= false;
-
-	/*early return if we are not on the ocean or on an ice cap:*/
-	if(!masks->isiceonly[this->lid] && !masks->isoceanin[this->lid]) return;
-
-	/*recover parameters:*/
-	this->parameters->FindParam(&computeelastic,SolidearthSettingsElasticEnum);
-	this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
-	this->parameters->FindParam(&bp_compute_fingerprints,DslComputeFingerprintsEnum);
-
-	/*early return if elastic not requested:*/
-	if(!computeelastic) return;
-
-	/*recover material parameters: */
-	rho_ice=FindParam(MaterialsRhoIceEnum);
-	rho_water=FindParam(MaterialsRhoSeawaterEnum);
-
-	/*recover elastic Green's functions for displacement:*/
-	this->inputs->GetArrayPtr(SealevelriseGUEnum,this->lid,&GU,&gsize);
-	if(horiz){
-		this->inputs->GetArrayPtr(SealevelriseGEEnum,this->lid,&GE,&gsize);
-		this->inputs->GetArrayPtr(SealevelriseGNEnum,this->lid,&GN,&gsize);
-	}
-
-
-	if(masks->isoceanin[this->lid]){
-		/*From Sg, recover water sea level rise:*/
-		S=0; for(int i=0;i<NUMVERTICES;i++) S+=Sg[this->vertices[i]->Sid()]/NUMVERTICES;
-
-		/*convert to kg/m^2:*/
-		S=rho_water*S;
-		
-		/*If bottom pressures are available, retrieve them to load the bedrock:*/
-		if(bp_compute_fingerprints){
-			Input* bottompressure_change_input=this->GetInput(DslSeaWaterPressureChangeAtSeaFloorEnum);
-			if (!bottompressure_change_input)_error_("bottom pressure input needed to compute sea level rise fingerprint!");
-			bottompressure_change_input->GetInputAverage(&BP);
-
-			/*convert from m to kg/m^2:*/
-			BP=BP*rho_water;
-
-			S+=BP;
-		}
-
-		for(int i=0;i<gsize;i++){
-			Up[i]+=S*GU[i];
-			if(horiz){
-				North[i]+=S*GN[i];
-				East[i]+=S*GE[i];
-			}
-		}
-	}
-	else if (masks->isiceonly[this->lid]){
-
-		/*Compute ice thickness change: */
-		Input* deltathickness_input=this->GetInput(SurfaceloadIceThicknessChangeEnum);
-		if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
-		deltathickness_input->GetInputAverage(&I);
-
-		/*convert to kg/m^2*/
-		I=I*rho_ice;
-
-		for(int i=0;i<gsize;i++){
-			Up[i]+=I*GU[i];
-			if(horiz){
-				North[i]+=I*GN[i];
-				East[i]+=I*GE[i];
-			}
-		}
-	}
-
-	return;
-}
-/*}}}*/
+}/*}}}*/
+void       Tria::SealevelchangeShift(GrdLoads* loads,  IssmDouble offset, SealevelGeometry* slgeom){ /*{{{*/
+
+	if(slgeom->isoceanin[this->lid]){
+		if(slgeom->issubelement[SLGEOM_OCEAN][this->lid]){
+			int intj=slgeom->subelementmapping[SLGEOM_OCEAN][this->lid];
+			loads->vsubsealevelloads->SetValue(intj,offset,ADD_VAL);
+		}
+		else loads->vsealevelloads->SetValue(this->sid,offset,ADD_VAL);
+	}
+
+} /*}}}*/
 #endif
 
@@ -5983,5 +7727,5 @@
 	int interp;
 	int type;
-	
+
 	/*Branch according to whether we have a transient or not input: */
 	type=this->inputs->GetInputObjectEnum(name);
@@ -5992,5 +7736,5 @@
 		this->InputServe(triainput);
 		interp=triainput->GetInterpolation();
-		
+
 		if (interp==P0Enum){
 			/*Update the value if this element belongs to the partition: */
@@ -6149,5 +7893,5 @@
 
 					/*build new bed and surface: */
-					if (this->IsFloating()){
+					if (this->IsAllFloating()){
 						/*hydrostatic equilibrium: */
 						IssmDouble rho_ice,rho_water,di;
Index: issm/trunk/src/c/classes/Elements/Tria.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Tria.h	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/Tria.h	(revision 26744)
@@ -17,4 +17,5 @@
 class Node;
 class Material;
+class Matlitho;
 class Seg;
 class ElementMatrix;
@@ -69,4 +70,6 @@
 		void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum,int control_interp);
 		void        CreateDistanceInputFromSegmentlist(IssmDouble* distances,int distanceenum);
+		void        ElementCoordinates(Vector<IssmDouble>* vxe,Vector<IssmDouble>* vye,Vector<IssmDouble>* vze, Vector<IssmDouble>* vareae, bool spherical=false);
+		void        ElementCoordinates(Vector<IssmDouble>* vlonge,Vector<IssmDouble>* vlate,Vector<IssmDouble>* vareae);
 		int         EdgeOnBaseIndex();
 		void        EdgeOnBaseIndices(int* pindex1,int* pindex);
@@ -82,4 +85,9 @@
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+		void        GetFractionGeometry(IssmDouble* weights, IssmDouble* pphi, int* ppoint1,IssmDouble* pfraction1,IssmDouble* pfraction2, bool* ptrapezeisnegative, IssmDouble* gl);
+		void        GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area,  int levelsetenum);
+		void        GetNodalWeightsAndAreaAndCentroidsFromLeveset(IssmDouble* loadweights, IssmDouble* ploadarea, IssmDouble* platbar, IssmDouble* plongbar, IssmDouble late, IssmDouble longe, IssmDouble area, int levelset1enum, int levelset2enum);
+		void        GetBarycenterFromLevelset(IssmDouble* platbar, IssmDouble* plongbar,IssmDouble phi,IssmDouble fraction1,IssmDouble fraction2,IssmDouble late, IssmDouble longe, int point1,int istrapeze1, IssmDouble planetradius);
+		IssmDouble  GetTriangleAreaSpherical(IssmDouble xyz_list[3][3]);
 		IssmDouble  GetIcefrontArea();
 		void	      GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
@@ -124,7 +132,7 @@
 		void        ResetHooks();
 		void        ResetLevelsetFromSegmentlist(IssmDouble* segments,int numsegments);
-		void        RignotMeltParameterization();
-		void        SetElementInput(int enum_in,IssmDouble values);
-		void        SetElementInput(Inputs* inputs,int enum_in,IssmDouble values);
+		void        SetElementInput(int enum_in,IssmDouble value);
+		void        SetElementInput(int enum_in,IssmDouble value,int type);
+		void        SetElementInput(Inputs* inputs,int enum_in,IssmDouble value);
 		void        SetElementInput(Inputs* inputs,int numindices,int* indices,IssmDouble* values,int enum_in);
 		void        SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset,int M,int N);
@@ -132,4 +140,5 @@
 	   Element*    SpawnBasalElement(bool depthaverage_materials);
 		Element*    SpawnTopElement(void);
+		bool        IsSpawnedElement(void);
 		void			StrainRateparallel();
 		void			StrainRateperpendicular();
@@ -153,21 +162,22 @@
 		void			WriteFieldIsovalueSegment(DataSet* segments,int fieldenum,IssmDouble fieldvalue);
 
-		#ifdef _HAVE_GIA_
-		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
-		#endif
 		#ifdef _HAVE_ESA_
 		void    EsaGeodetic2D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,  Vector<IssmDouble>* pX,Vector<IssmDouble>* pY,IssmDouble* xx,IssmDouble* yy);
 		void    EsaGeodetic3D(Vector<IssmDouble>* pUp,Vector<IssmDouble>* pNorth,Vector<IssmDouble>* pEast,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble* xx,IssmDouble* yy,IssmDouble* zz);
 		#endif
-		#ifdef _HAVE_SEALEVELRISE_
-		IssmDouble OceanAverage(IssmDouble* Sg, SealevelMasks* masks);
-		void    SealevelriseMomentOfInertia(IssmDouble* dI_list,IssmDouble* Sg_old,SealevelMasks* masks);
-		void    SetSealevelMasks(SealevelMasks* masks);
-		void    SealevelriseGeometry(IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz);
-		IssmDouble    SealevelriseEustaticIce(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition, IssmDouble oceanarea);
-		IssmDouble    SealevelriseEustaticHydro(IssmDouble* Sgi, SealevelMasks* masks, Vector<IssmDouble>* barystatic_contribution, IssmDouble* partition,IssmDouble oceanarea);
-		void    SealevelriseEustaticBottomPressure(IssmDouble* Sgi,SealevelMasks* masks);
-		void    SealevelriseNonEustatic(IssmDouble* Sgo,IssmDouble* Sg_old,SealevelMasks* masks);
-		void    SealevelriseGeodetic(IssmDouble* Up, IssmDouble* North, IssmDouble* East, IssmDouble* Sg,SealevelMasks* masks);
+		#ifdef _HAVE_SEALEVELCHANGE_
+		void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,Matlitho* litho, IssmDouble* x,IssmDouble* y);
+		void       SealevelchangeGeometryInitial(IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae);
+		void       SealevelchangeGeometrySubElementKernel(SealevelGeometry* slgeom);
+		void       SealevelchangeGeometrySubElementLoads(SealevelGeometry* slgeom, IssmDouble* areae);
+		void       SealevelchangeGeometryCentroidLoads(SealevelGeometry* slgeom, IssmDouble* xxe, IssmDouble* yye, IssmDouble* zze, IssmDouble* areae);
+		void       SealevelchangeBarystaticLoads(GrdLoads* loads, BarystaticContributions* barycontrib, SealevelGeometry* slgeom);
+		void       SealevelchangeConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom);
+		void       SealevelchangeOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble* sealevelpercpu, SealevelGeometry* slgeom);
+		void       SealevelchangeDeformationConvolution(IssmDouble* sealevelpercpu, GrdLoads* loads, IssmDouble* rotationvector,SealevelGeometry* slgeom);
+		void       SealevelchangeShift(GrdLoads* loads,  IssmDouble offset, SealevelGeometry* slgeom);
+		void       SealevelchangeMomentOfInertiaCentroid(IssmDouble* dI_list, GrdLoads* loads,  SealevelGeometry* slgeom);
+		void       SealevelchangeMomentOfInertiaSubElement(IssmDouble* dI_list, GrdLoads* loads, SealevelGeometry* slgeom);
+		void       SealevelchangeUpdateViscousFields();
 		#endif
 		/*}}}*/
@@ -202,11 +212,12 @@
 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+		void	       MovingFrontalVelocity(void);
 		Gauss*         NewGauss(void);
 		Gauss*         NewGauss(int order);
-      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
-      Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order);
-      Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,int order);
-      Gauss*         NewGauss(IssmDouble fraction1,IssmDouble fraction2,int order);
-      Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
+        Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order);
+        Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order);
+        Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,int order);
+        Gauss*         NewGauss(IssmDouble fraction1,IssmDouble fraction2,int order);
+        Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
 		Gauss*         NewGaussBase(int order);
 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order){_error_("not implemented yet");};
@@ -227,9 +238,10 @@
 		void           SetTemporaryElementType(int element_type_in){_error_("not implemented yet");};
 		void           InputServe(Input* input_in);
-		Seg*	         SpawnSeg(int index1,int index2);
+		Seg*	       SpawnSeg(int index1,int index2);
 		IssmDouble     StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");};
 		void           StabilizationParameterAnisotropic(IssmDouble* tau_parameter_ansiotropic, IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble hx, IssmDouble hy, IssmDouble hz, IssmDouble kappa){_error_("not implemented yet");};
 		void           UpdateConstraintsExtrudeFromBase(void);
 		void           UpdateConstraintsExtrudeFromTop(void);
+		void           SealevelchangeGxL(IssmDouble* sealevel, IssmDouble* G, IssmDouble** Gsub, GrdLoads* loads, SealevelGeometry* slgeom, int nel, bool percpu,int stackenum,bool computefuture);
 		/*}}}*/
 
Index: issm/trunk/src/c/classes/Elements/TriaRef.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/TriaRef.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Elements/TriaRef.cpp	(revision 26744)
@@ -236,5 +236,5 @@
 	IssmDouble y2 = xyz_list[3*1+1];
 
-	*Jdet = .5*sqrt(pow(x2-x1,2) + pow(y2-y1,2));
+	*Jdet = .5*sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
 	if(*Jdet<0) _error_("negative jacobian determinant!");
 
Index: issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h
===================================================================
--- issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 25994)
+++ issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 26744)
@@ -606,5 +606,4 @@
 template <> inline void GenericExternalResult<IssmPDouble*>::Transpose(void){/*{{{*/
 
-
 	/*Perform transpose only if we have a matrix*/
 	if(M>1 && N>1){
@@ -624,6 +623,4 @@
 	this->M = temp2;
 
-
-
 } /*}}}*/
 
@@ -679,4 +676,73 @@
 #endif
 
+	/*Specific instantiations for IssmComplex*: */
+template <> inline GenericExternalResult<IssmComplex*>::GenericExternalResult(int in_id, int in_enum_type,IssmComplex* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
+
+	id = in_id;
+	M  = in_M;
+	N  = in_N;
+
+	EnumToStringx(&this->result_name,in_enum_type);
+
+	step = in_step;
+	time = in_time;
+
+	/*Copy result in values*/
+	if(M*N){
+		value=xNew<IssmComplex>(M*N);
+		xMemCpy<IssmComplex>(value,in_values,M*N);
+	}
+	else value=NULL;
+}
+/*}}}*/
+template <> inline void GenericExternalResult<IssmComplex*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
+
+	int     my_rank;
+	int     type;
+	int     rows,cols;
+	char   *name    = NULL;
+	IssmPDouble passiveDouble;
+	IssmDouble* reals=NULL;
+	IssmDouble* imags=NULL;
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+
+	if(io_gather){
+		/*we are gathering the data on cpu 0, don't write on other cpus: */
+		if(my_rank) return;
+	}
+
+	/*First write enum: */
+	int length=(strlen(this->result_name)+1)*sizeof(char);
+	fwrite(&length,sizeof(int),1,fid);
+	fwrite(this->result_name,length,1,fid);
+
+	/*Now write time and step: */
+	passiveDouble=reCast<IssmPDouble>(time);
+	fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
+	fwrite(&step,sizeof(int),1,fid);
+
+	/*writing a IssmComplex array, type is 3:*/
+	type=5;
+	fwrite(&type,sizeof(int),1,fid);
+	rows=this->M;
+	fwrite(&rows,sizeof(int),1,fid);
+	cols=this->N;
+	fwrite(&cols,sizeof(int),1,fid);
+
+	/*write complex array into two real arrays:*/
+	reals=xNew<IssmDouble>(cols*rows);
+	imags=xNew<IssmDouble>(cols*rows);
+	for(int i=0;i<cols*rows;i++){
+		reals[i]=value[i].real();
+		imags[i]=value[i].imag();
+	}
+	fwrite(reals,cols*rows*sizeof(IssmComplex),1,fid);
+	fwrite(imags,cols*rows*sizeof(IssmComplex),1,fid);
+
+}
+/*}}}*/
+
 	/*Specifics instantiations for Vector*/
 	template <> inline GenericExternalResult<Vector<IssmPDouble>*>::GenericExternalResult(int in_id, int in_enum_type,Vector<IssmPDouble>* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
Index: issm/trunk/src/c/classes/FemModel.cpp
===================================================================
--- issm/trunk/src/c/classes/FemModel.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/FemModel.cpp	(revision 26744)
@@ -14,4 +14,5 @@
 #include "../shared/io/io.h"
 #include "./classes.h"
+#include "./Inputs/TriaInput.h"
 #include "./modules/modules.h"
 #include "../shared/Enum/Enum.h"
@@ -243,5 +244,4 @@
 	_error_("Could not find index of analysis " << EnumToStringx(analysis_enum) << " in list of FemModel analyses");
 
-
 }/*}}}*/
 void FemModel::CheckPoint(void){/*{{{*/
@@ -821,8 +821,4 @@
 			break;
 
-		case GiaSolutionEnum:
-			analyses_temp[numanalyses++]=GiaAnalysisEnum;
-			break;
-
 		case LoveSolutionEnum:
 			analyses_temp[numanalyses++]=LoveAnalysisEnum;
@@ -833,7 +829,6 @@
 			break;
 
-		case SealevelriseSolutionEnum:
-			analyses_temp[numanalyses++]=SealevelriseAnalysisEnum;
-			analyses_temp[numanalyses++]=GiaAnalysisEnum;
+		case SamplingSolutionEnum:
+			analyses_temp[numanalyses++]=SamplingAnalysisEnum;
 			break;
 
@@ -848,8 +843,9 @@
 		case TransientSolutionEnum:{
 			/*We have multiple analyses here, process one by one*/
-			bool isSIA,isFS,isthermal,isenthalpy,ismasstransport,isgroundingline,isstressbalance,ismovingfront,ishydrology,isdamage,issmb,isslr,isesa,isgia;
+			bool isSIA,isFS,isthermal,isenthalpy,ismasstransport,isoceantransport,isgroundingline,isstressbalance,ismovingfront,ishydrology,isdamage,issmb,isslc,isesa,issampling;
 			iomodel->FindConstant(&isthermal,"md.transient.isthermal");
 			iomodel->FindConstant(&ismovingfront,"md.transient.ismovingfront");
 			iomodel->FindConstant(&ismasstransport,"md.transient.ismasstransport");
+			iomodel->FindConstant(&isoceantransport,"md.transient.isoceantransport");
 			iomodel->FindConstant(&isstressbalance,"md.transient.isstressbalance");
 			iomodel->FindConstant(&isgroundingline,"md.transient.isgroundingline");
@@ -857,9 +853,9 @@
 			iomodel->FindConstant(&ishydrology,"md.transient.ishydrology");
 			iomodel->FindConstant(&issmb,"md.transient.issmb");
-			iomodel->FindConstant(&isslr,"md.transient.isslr");
+			iomodel->FindConstant(&isslc,"md.transient.isslc");
 			iomodel->FindConstant(&isesa,"md.transient.isesa");
-			iomodel->FindConstant(&isgia,"md.transient.isgia");
-         int* analyses_iter     = NULL;
-         int  num_analyses_iter = 0;
+			iomodel->FindConstant(&issampling,"md.transient.issampling");
+      int* analyses_iter     = NULL;
+      int  num_analyses_iter = 0;
 			if(isstressbalance){
 				SolutionAnalysesList(&analyses_iter,&num_analyses_iter,iomodel,StressbalanceSolutionEnum);
@@ -897,13 +893,15 @@
 				analyses_temp[numanalyses++]=DamageEvolutionAnalysisEnum;
 			}
-			if(isslr){
-				analyses_temp[numanalyses++]=GiaAnalysisEnum;
-				analyses_temp[numanalyses++]=SealevelriseAnalysisEnum;
+			if(isoceantransport){
+				analyses_temp[numanalyses++]=OceantransportAnalysisEnum;
+			}
+			if(isslc){
+				analyses_temp[numanalyses++]=SealevelchangeAnalysisEnum;
 			}
 			if(isesa){
 				analyses_temp[numanalyses++]=EsaAnalysisEnum;
 			}
-			if(isgia){
-				analyses_temp[numanalyses++]=GiaAnalysisEnum;
+			if(issampling){
+				analyses_temp[numanalyses++]=SamplingAnalysisEnum;
 			}
 
@@ -986,5 +984,4 @@
 		if(profiler->Used(SMBCORE)) _printf0_("   "<<setw(40)<<left<<"SMB core elapsed time:"<<setw(7)<<setprecision(6)<<profiler->TotalTime(SMBCORE) << " sec\n");
 		if(profiler->Used(GROUNDINGLINECORE)) _printf0_("   "<<setw(40)<<left<<"Groundingline migration core elapsed time:"<<setw(7)<<setprecision(6)<<profiler->TotalTime(GROUNDINGLINECORE) << " sec\n");
-		if(profiler->Used(GIACORE)) _printf0_("   "<<setw(40)<<left<<"GIA core elapsed time:"<<setw(7)<<setprecision(6)<<profiler->TotalTime(GIACORE) << " sec\n");
 		if(profiler->Used(ESACORE)) _printf0_("   "<<setw(40)<<left<<"ESA core elapsed time:"<<setw(7)<<setprecision(6)<<profiler->TotalTime(ESACORE) << " sec\n");
 		if(profiler->Used(SLRCORE)) _printf0_("   "<<setw(40)<<left<<"SLR core elapsed time:"<<setw(7)<<setprecision(6)<<profiler->TotalTime(SLRCORE) << " sec\n");
@@ -1177,5 +1174,5 @@
 		Element* basalelement = element->SpawnBasalElement();
 		basalelement->WriteFieldIsovalueSegment(segments,fieldenum,fieldvalue);
-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	}
 
@@ -1605,34 +1602,27 @@
 void FemModel::IcefrontAreax(){/*{{{*/
 
-	int numvertices      = 6;
-	int numbasins;
-	IssmDouble* BasinId   = xNew<IssmDouble>(numvertices);
+	int numbasins,BasinId;
 	this->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
-	IssmDouble* basin_icefront_area           = xNewZeroInit<IssmDouble>(numbasins);
-
-	for(int basin=1;basin<numbasins+1;basin++){
+	IssmDouble* basin_icefront_area = xNewZeroInit<IssmDouble>(numbasins);
+
+	for(int basin=0;basin<numbasins;basin++){
 		IssmDouble local_icefront_area = 0;
 		IssmDouble total_icefront_area;
 
+		/*Add contribution of each element to icefront area of the basin*/
 		for(Object* & object : this->elements->objects){
 			Element* element= xDynamicCast<Element*>(object);
-			element->GetInputListOnVertices(BasinId,FrontalForcingsBasinIdEnum);
-			for(int j=0;j<numvertices;j++){
-				if(BasinId[j]==basin){
-					local_icefront_area+=element->GetIcefrontArea();
-					break;
-				}
-			}
+			element->GetInputValue(&BasinId,FrontalForcingsBasinIdEnum);
+			if(BasinId==basin) local_icefront_area+=element->GetIcefrontArea();
 		}
 		ISSM_MPI_Reduce(&local_icefront_area,&total_icefront_area,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
 		ISSM_MPI_Bcast(&total_icefront_area,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
 
-		basin_icefront_area[basin-1]=total_icefront_area;
-	}
-
+		basin_icefront_area[basin]=total_icefront_area;
+	}
+	
 	this->parameters->AddObject(new DoubleVecParam(FrontalForcingsBasinIcefrontAreaEnum,basin_icefront_area,numbasins));
 
 	xDelete<IssmDouble>(basin_icefront_area);
-	xDelete<IssmDouble>(BasinId);
 }/*}}}*/
 void FemModel::IcefrontMassFluxx(IssmDouble* pM, bool scaled){/*{{{*/
@@ -2112,4 +2102,9 @@
 
 }/*}}}*/
+void FemModel::MmeToInputFromId(int id, int rootenum, int interpolationenum){ /*{{{*/
+
+	MmeToInputFromIdx(this->inputs,this->elements,id,rootenum,interpolationenum);
+
+}	//}}}
 void FemModel::OmegaAbsGradientx( IssmDouble* pJ){/*{{{*/
 
@@ -2304,5 +2299,11 @@
 
 			#if defined(_HAVE_CODIPACK_)
+			#if _CODIPACK_MAJOR_==2
+			auto& tape_codi = IssmDouble::getTape();
+			#elif _CODIPACK_MAJOR_==1
 			auto& tape_codi = IssmDouble::getGlobalTape();
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
 			#endif
 
@@ -2316,5 +2317,11 @@
 						tape_codi.registerOutput(output_value);
 						dependents[i] = output_value.getValue();
+						#if _CODIPACK_MAJOR_==2
+						codi_global.output_indices.push_back(output_value.getIdentifier());
+						#elif _CODIPACK_MAJOR_==1
 						codi_global.output_indices.push_back(output_value.getGradientData());
+						#else
+						#error "_CODIPACK_MAJOR_ not supported"
+						#endif
 					#else
 						output_value>>=dependents[i];
@@ -2352,5 +2359,4 @@
 	if(numonnodes) parameters->FindParam(&resultsonnodes,&numonnodes,SettingsResultsOnNodesEnum);
 
-
 	/*Go through all requested output*/
 	for(int i=0;i<numoutputs;i++){
@@ -2358,5 +2364,4 @@
 		output_enum   = StringToEnumx(output_string,false);
 		isvec         = false;
-
 
 		/*If string is not an enum, it is defined in output definitions*/
@@ -2478,5 +2483,4 @@
 					}
 					break;
-
 
 				   /*Default is always Vector */
@@ -3655,5 +3659,4 @@
 	}
 
-
 	/*Cleanup*/
 	xDelete<IssmDouble>(P0inputs);
@@ -4667,15 +4670,4 @@
 /*}}}*/
 #endif
-#ifdef _HAVE_GIA_
-void FemModel::Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y){ /*{{{*/
-
-	/*Go through elements, and add contribution from each element to the deflection vector wg:*/
-	for(Object* & object : this->elements->objects){
-		Element* element = xDynamicCast<Element*>(object);
-		element->GiaDeflection(wg,dwgdt, x,y);
-	}
-}
-/*}}}*/
-#endif
 #ifdef _HAVE_ESA_
 void FemModel::EsaGeodetic2D(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pX, Vector<IssmDouble>* pY, IssmDouble* xx, IssmDouble* yy){/*{{{*/
@@ -4753,341 +4745,4 @@
 	xDelete<IssmDouble>(yy);
 	xDelete<IssmDouble>(zz);
-}
-/*}}}*/
-#endif
-#ifdef _HAVE_SEALEVELRISE_
-void FemModel::SealevelriseEustatic(Vector<IssmDouble>* pRSLgi, IssmDouble* poceanarea, IssmDouble* pbslr,IssmDouble* pbslrice, IssmDouble* pbslrhydro, IssmDouble** pbslrice_partition,IssmDouble** pbslrhydro_partition,SealevelMasks* masks) { /*{{{*/
-
-	/*serialized vectors:*/
-	IssmDouble  bslrice       = 0.;
-	IssmDouble  bslrice_cpu   = 0.;
-	IssmDouble  bslrhydro       = 0.;
-	IssmDouble  bslrhydro_cpu   = 0.;
-	IssmDouble  area      = 0.;
-	IssmDouble  oceanarea      = 0.;
-	IssmDouble  oceanarea_cpu  = 0.;
-	int bp_compute_fingerprints= 0;
-
-	Vector<IssmDouble>* bslrice_partition=NULL;
-	IssmDouble* bslrice_partition_serial=NULL;
-	IssmDouble* partitionice=NULL;
-	int npartice,nel; 
-
-	Vector<IssmDouble>* bslrhydro_partition=NULL;
-	IssmDouble* bslrhydro_partition_serial=NULL;
-	IssmDouble* partitionhydro=NULL;
-	int nparthydro; 
-		
-
-   /*Initialize temporary vector that will be used to sum eustatic components
-    * on all local elements, prior to assembly:*/
-	int gsize = this->nodes->NumberOfDofs(GsetEnum);
-	IssmDouble* RSLgi=xNewZeroInit<IssmDouble>(gsize);
-	int* indices=xNew<int>(gsize);
-   for(int i=0;i<gsize;i++) indices[i]=i;
-
-	/*First, figure out the area of the ocean, which is needed to compute the eustatic component: */
-	int i = -1;
-	for(Object* & object : this->elements->objects){
-		i +=1;
-		Element* element = xDynamicCast<Element*>(object);
-		element->GetInputValue(&area,AreaEnum);
-		if (masks->isoceanin[i]) oceanarea_cpu += area;
-	}
-	ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&oceanarea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-	_assert_(oceanarea>0.);
-
-	/*Initialize partition vectors to retrieve barystatic contributions: */
-	this->parameters->FindParam(&npartice,SolidearthNpartIceEnum);
-	if(npartice){
-		this->parameters->FindParam(&partitionice,&nel,NULL,SolidearthPartitionIceEnum);
-		bslrice_partition= new Vector<IssmDouble>(npartice);
-	}
-
-	this->parameters->FindParam(&nparthydro,SolidearthNpartHydroEnum);
-	if(nparthydro){
-		this->parameters->FindParam(&partitionhydro,&nel,NULL,SolidearthPartitionHydroEnum);
-		bslrhydro_partition= new Vector<IssmDouble>(nparthydro);
-	}
-
-
-	/*Call the sea level rise core for ice : */
-	bslrice_cpu=0;
-	for(Object* & object : this->elements->objects){
-		Element* element = xDynamicCast<Element*>(object);
-		bslrice_cpu+=element->SealevelriseEustaticIce(RSLgi,masks, bslrice_partition,partitionice,oceanarea);
-	}
-
-	/*Call the sea level rise core for hydro: */
-	bslrhydro_cpu=0;
-	for(int i=0;i<elements->Size();i++){
-		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
-		bslrhydro_cpu+=element->SealevelriseEustaticHydro(RSLgi,masks, bslrhydro_partition,partitionhydro,oceanarea);
-	}
-
-	/*Call the sea level rise core for bottom pressures: */
-	this->parameters->FindParam(&bp_compute_fingerprints,DslComputeFingerprintsEnum);
-	if(bp_compute_fingerprints){
-		for(int i=0;i<elements->Size();i++){
-			Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
-			element->SealevelriseEustaticBottomPressure(RSLgi,masks);
-		}
-	}
-
-	/*Plug values once and assemble: */
-	pRSLgi->SetValues(gsize,indices,RSLgi,ADD_VAL);
-	pRSLgi->Assemble();
-
-	/*Sum all eustatic components from all cpus:*/
-	ISSM_MPI_Reduce (&bslrice_cpu,&bslrice,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&bslrice,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-	_assert_(!xIsNan<IssmDouble>(bslrice));
-
-	ISSM_MPI_Reduce (&bslrhydro_cpu,&bslrhydro,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&bslrhydro,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-	_assert_(!xIsNan<IssmDouble>(bslrhydro));
-
-	/*Take care of partition vectors:*/
-	if(bslrice_partition){
-		bslrice_partition->Assemble();
-		bslrice_partition_serial=bslrice_partition->ToMPISerial();
-	}
-	if(bslrhydro_partition){
-		bslrhydro_partition->Assemble();
-		bslrhydro_partition_serial=bslrhydro_partition->ToMPISerial();
-	}
-
-
-	/*Free ressources:*/
-	xDelete<int>(indices);
-	xDelete<IssmDouble>(RSLgi);
-	if(bslrhydro_partition)delete bslrhydro_partition;
-	if(bslrice_partition)delete bslrice_partition;
-	if(partitionhydro)xDelete<IssmDouble>(partitionhydro);
-	if(partitionice)xDelete<IssmDouble>(partitionice);
-
-	/*Assign output pointers:*/
-	*poceanarea = oceanarea;
-	*pbslrice  = bslrice;
-	*pbslrhydro  = bslrhydro;
-	*pbslr=bslrhydro+bslrice;
-	*pbslrice_partition=bslrice_partition_serial;
-	*pbslrhydro_partition=bslrhydro_partition_serial;
-
-}
-/*}}}*/
-void FemModel::SealevelriseNonEustatic(Vector<IssmDouble>* pRSLgo, Vector<IssmDouble>* pRSLg_old,  SealevelMasks* masks, bool verboseconvolution){/*{{{*/
-
-	/*serialized vectors:*/
-	IssmDouble* RSLg_old=NULL;
-
-	IssmDouble* RSLgo  = NULL;
-	int* indices = NULL;
-	int         gsize;
-
-	bool computerigid = true;
-	bool computeelastic= true;
-
-	/*recover computational flags: */
-	this->parameters->FindParam(&computerigid,SolidearthSettingsRigidEnum);
-
-	/*Initialize temporary vector that will be used to sum eustatic components on all local elements, prior
-	 * to assembly:*/
-	gsize = this->nodes->NumberOfDofs(GsetEnum);
-	RSLgo=xNewZeroInit<IssmDouble>(gsize);
-	indices=xNew<int>(gsize); for (int i=0;i<gsize;i++)indices[i]=i;
-
-	/*Serialize vectors from previous iteration:*/
-	RSLg_old=pRSLg_old->ToMPISerial();
-
-	/*Call the sea level rise non-eustatic core only if required: */
-	if(computerigid){
-		for(Object* & object : this->elements->objects){
-			Element* element = xDynamicCast<Element*>(object);
-			element->SealevelriseNonEustatic(RSLgo,RSLg_old,masks);
-		}
-	}
-	pRSLgo->SetValues(gsize,indices,RSLgo,ADD_VAL);
-	pRSLgo->Assemble();
-
-	/*Free ressources:*/
-	xDelete<int>(indices);
-	xDelete<IssmDouble>(RSLgo);
-	xDelete<IssmDouble>(RSLg_old);
-
-}
-/*}}}*/
-void FemModel::SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz,  SealevelMasks* masks){/*{{{*/
-
-	/*serialized vectors:*/
-	bool spherical=true;
-	IssmDouble* RSLg_old=NULL;
-	IssmDouble*	tide_love_h  = NULL;
-	IssmDouble*	tide_love_k  = NULL;
-	IssmDouble*	load_love_k  = NULL;
-	IssmDouble  tide_love_k2secular;
-	IssmDouble  moi_e, moi_p, omega, g;
-	IssmDouble	m1, m2, m3;
-	IssmDouble	lati, longi, radi, value;
-	IssmDouble          *latitude    = NULL;
-	IssmDouble          *longitude    = NULL;
-	IssmDouble          *radius    = NULL;
-
-	/*Serialize vectors from previous iteration:*/
-	RSLg_old=pRSLg_old->ToMPISerial();
-
-	IssmDouble moi_list[3]={0,0,0};
-	IssmDouble moi_list_cpu[3]={0,0,0};
-	for(Object* & object : this->elements->objects){
-		Element* element = xDynamicCast<Element*>(object);
-		element->SealevelriseMomentOfInertia(&moi_list[0],RSLg_old,masks );
-		moi_list_cpu[0] += moi_list[0];
-		moi_list_cpu[1] += moi_list[1];
-		moi_list_cpu[2] += moi_list[2];
-	}
-	ISSM_MPI_Reduce (&moi_list_cpu[0],&moi_list[0],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&moi_list[0],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-	//
-	ISSM_MPI_Reduce (&moi_list_cpu[1],&moi_list[1],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&moi_list[1],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-	//
-	ISSM_MPI_Reduce (&moi_list_cpu[2],&moi_list[2],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&moi_list[2],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-
-	/*pull out some useful parameters: */
-	parameters->FindParam(&load_love_k,NULL,NULL,LoadLoveKEnum);
-	parameters->FindParam(&tide_love_h,NULL,NULL,TidalLoveHEnum);
-	parameters->FindParam(&tide_love_k,NULL,NULL,TidalLoveKEnum);
-	parameters->FindParam(&tide_love_k2secular,TidalLoveK2SecularEnum);
-	parameters->FindParam(&moi_e,RotationalEquatorialMoiEnum);
-	parameters->FindParam(&moi_p,RotationalPolarMoiEnum);
-	parameters->FindParam(&omega,RotationalAngularVelocityEnum);
-
-	/*compute perturbation terms for angular velocity vector: */
-	m1 = 1/(1-tide_love_k[2]/tide_love_k2secular) * (1+load_love_k[2])/(moi_p-moi_e) * moi_list[0];
-	m2 = 1/(1-tide_love_k[2]/tide_love_k2secular) * (1+load_love_k[2])/(moi_p-moi_e) * moi_list[1];
-	m3 = -(1+load_love_k[2])/moi_p * moi_list[2];	// term associated with fluid number (3-order-of-magnitude smaller) is negelected
-
-	/*recover lat,long and radius vectors from vertices: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,this->vertices,spherical);
-
-	/* Green's function (1+k_2-h_2/g): checked against Glenn Milne's thesis Chapter 3 (eqs: 3.3-4, 3.10-11)
-	 * Perturbation terms for angular velocity vector (m1, m2, m3): checked against Mitrovica (2005 Appendix) & Jensen et al (2013 Appendix A3)
-	 * Sea level rotational feedback: checked against GMD eqs 8-9 (only first order terms, i.e., degree 2 order 0 & 1 considered)
-	 * all DONE in Geographic coordinates: theta \in [-90,90], lambda \in [-180 180]
-	 */
-	for(Object* & object : vertices->objects){
-		Vertex* vertex=xDynamicCast<Vertex*>(object);
-		int sid=vertex->Sid();
-
-		lati=latitude[sid]/180*PI;
-		longi=longitude[sid]/180*PI;
-		radi=radius[sid];
-
-		/*only first order terms are considered now: */
-		value=((1.0+tide_love_k[2]-tide_love_h[2])/9.81)*pow(omega*radi,2.0)*
-						(-m3/6.0 + 0.5*m3*cos(2.0*lati) - 0.5*sin(2.*lati)*(m1*cos(longi)+m2*sin(longi)));
-
-		pRSLgo_rot->SetValue(sid,value,INS_VAL); //INS_VAL ensures that you don't add several times
-	}
-
-	/*Assemble mesh velocity*/
-	pRSLgo_rot->Assemble();
-
-	/*Assign output pointers:*/
-	if(pIxz)*pIxz=moi_list[0];
-	if(pIyz)*pIyz=moi_list[1];
-	if(pIzz)*pIzz=moi_list[2];
-	xDelete<IssmDouble>(latitude);
-	xDelete<IssmDouble>(longitude);
-	xDelete<IssmDouble>(tide_love_h);
-	xDelete<IssmDouble>(tide_love_k);
-	xDelete<IssmDouble>(load_love_k);
-
-	xDelete<IssmDouble>(radius);
-
-	/*Free ressources:*/
-	xDelete<IssmDouble>(RSLg_old);
-
-}
-/*}}}*/
-void FemModel::SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pRSLg, SealevelMasks* masks){/*{{{*/
-
-	/*serialized vectors:*/
-	IssmDouble* RSLg=NULL;
-
-	IssmDouble* Up  = NULL;
-	IssmDouble* North  = NULL;
-	IssmDouble* East  = NULL;
-	int* indices = NULL;
-	int  gsize;
-	int  horiz;
-
-	/*retrieve parameters:*/
-	this->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
-
-	/*Serialize vectors from previous iteration:*/
-	RSLg=pRSLg->ToMPISerial();
-
-	/*Initialize temporary vector that will be used to sum eustatic components on all local elements, prior
-	 * to assembly:*/
-	gsize = this->nodes->NumberOfDofs(GsetEnum);
-	Up=xNewZeroInit<IssmDouble>(gsize);
-	if(horiz){
-		North=xNewZeroInit<IssmDouble>(gsize);
-		East=xNewZeroInit<IssmDouble>(gsize);
-	}
-	indices=xNew<int>(gsize); for (int i=0;i<gsize;i++)indices[i]=i;
-
-	/*Call the sea level rise core: */
-	for(Object* & object : this->elements->objects){
-		Element* element = xDynamicCast<Element*>(object);
-		element->SealevelriseGeodetic(Up,North,East,RSLg,masks);
-	}
-
-	pUp->SetValues(gsize,indices,Up,ADD_VAL);
-	pUp->Assemble();
-	if (horiz){
-		pNorth->SetValues(gsize,indices,North,ADD_VAL);
-		pNorth->Assemble();
-		pEast->SetValues(gsize,indices,East,ADD_VAL);
-		pEast->Assemble();
-	}
-
-	/*Free ressources:*/
-	xDelete<IssmDouble>(Up);
-	if(horiz){
-		xDelete<IssmDouble>(North);
-		xDelete<IssmDouble>(East);
-	}
-	xDelete<int>(indices);
-	xDelete<IssmDouble>(RSLg);
-}
-/*}}}*/
-IssmDouble FemModel::SealevelriseOceanAverage(Vector<IssmDouble>* RSLg,SealevelMasks* masks, IssmDouble oceanarea) { /*{{{*/
-
-	IssmDouble* RSLg_serial=NULL;
-	IssmDouble  oceanvalue,oceanvalue_cpu;
-
-	/*Serialize vectors from previous iteration:*/
-	RSLg_serial=RSLg->ToMPISerial();
-
-	/*Initialize:*/
-	oceanvalue_cpu=0;
-
-	/*Go through elements, and add contribution from each element and divide by overall ocean area:*/
-	for(Object* & object : this->elements->objects){
-		Element* element = xDynamicCast<Element*>(object);
-		oceanvalue_cpu += element->OceanAverage(RSLg_serial,masks);
-	}
-
-	ISSM_MPI_Reduce (&oceanvalue_cpu,&oceanvalue,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
-	ISSM_MPI_Bcast(&oceanvalue,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
-
-	/*Free ressources:*/
-	xDelete<IssmDouble>(RSLg_serial);
-
-	return oceanvalue/oceanarea;
 }
 /*}}}*/
@@ -5157,5 +4812,4 @@
 	serial_active=active->ToMPISerial();
 	delete active;
-
 
 	/*Update node activation accordingly*/
@@ -5193,8 +4847,5 @@
 		}
 		xDelete<IssmDouble>(base);
-		if(domaintype!=Domain2DhorizontalEnum){
-			basalelement->DeleteMaterials();
-			delete basalelement;
-		}
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	}
 	xDelete<IssmDouble>(serial_active);
@@ -5795,5 +5446,4 @@
 	bool refine;
 
-
 	/*Fill variables*/
 	switch(errorestimator_type){
@@ -5883,5 +5533,4 @@
 
 	//itapopo esse metodo pode ser deletado
-
 
 	/*Here, "zero level set" means grounding line or ice front, depending on the level set type*/
Index: issm/trunk/src/c/classes/FemModel.h
===================================================================
--- issm/trunk/src/c/classes/FemModel.h	(revision 25994)
+++ issm/trunk/src/c/classes/FemModel.h	(revision 26744)
@@ -130,4 +130,5 @@
 		void MinVyx(IssmDouble* presponse);
 		void MinVzx(IssmDouble* presponse);
+		void MmeToInputFromId(int id, int rootenum, int interpolationenum);
 		void DistanceToFieldValue(int fieldenum,IssmDouble fieldvalue,int distanceenum);
 		void ResetLevelset();
@@ -158,17 +159,7 @@
 		void ThicknessAbsGradientx( IssmDouble* pJ);
 		void ThicknessPositivex(IssmDouble* pJ);
-		#ifdef _HAVE_GIA_
-		void Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y);
-		#endif
 		#ifdef _HAVE_ESA_
 		void EsaGeodetic2D(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pX, Vector<IssmDouble>* pY, IssmDouble* xx, IssmDouble* yy);
 		void EsaGeodetic3D(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz);
-		#endif
-		#ifdef _HAVE_SEALEVELRISE_
-		void SealevelriseEustatic(Vector<IssmDouble>* pRSLgi, IssmDouble* poceanarea, IssmDouble* pbslr,IssmDouble* pbslrice, IssmDouble* pbslrhydro, IssmDouble** pbslrice_partition,IssmDouble** pbslrhydro_partition, SealevelMasks* masks); 
-		void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old,  SealevelMasks* masks,bool verboseconvolution);
-		void SealevelriseRotationalFeedback(Vector<IssmDouble>* pRSLgo_rot, Vector<IssmDouble>* pRSLg_old, IssmDouble* pIxz, IssmDouble* pIyz, IssmDouble* pIzz, SealevelMasks* masks);
-		void SealevelriseElastic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pSg_old, SealevelMasks* masks);
-		IssmDouble SealevelriseOceanAverage(Vector<IssmDouble>* Sg,SealevelMasks* masks, IssmDouble oceanarea);
 		#endif
 		void HydrologyEPLupdateDomainx(IssmDouble* pEplcount);
Index: issm/trunk/src/c/classes/GrdLoads.cpp
===================================================================
--- issm/trunk/src/c/classes/GrdLoads.cpp	(revision 26744)
+++ issm/trunk/src/c/classes/GrdLoads.cpp	(revision 26744)
@@ -0,0 +1,69 @@
+/*
+ * \file GrdLoads.cpp
+ * \brief: Implementation of GrdLoads class
+ */
+
+/*Headers: {{{*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./GrdLoads.h"
+#include "./SealevelGeometry.h"
+using namespace std;
+/*}}}*/
+
+/*Object constructors and destructor*/
+GrdLoads::GrdLoads(int nel,SealevelGeometry* slgeom){ /*{{{*/
+
+	vloads=new Vector<IssmDouble>(nel);
+	for (int i=0;i<SLGEOM_NUMLOADS;i++) vsubloads[i]=new Vector<IssmDouble>(slgeom->nbar[i]);
+
+	vsealevelloads=new Vector<IssmDouble>(nel);
+	vsealevelloads->Set(0);vsealevelloads->Assemble();
+
+	vsubsealevelloads=new Vector<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]);
+
+}; /*}}}*/
+GrdLoads::~GrdLoads(){ /*{{{*/
+
+	delete vloads;
+	xDelete<IssmDouble>(loads);
+	for(int i=0;i<SLGEOM_NUMLOADS;i++){
+		delete vsubloads[i];
+		xDelete<IssmDouble>(subloads[i]);
+	}
+	delete vsealevelloads;
+	xDelete<IssmDouble>(sealevelloads);
+	delete vsubsealevelloads;
+	xDelete<IssmDouble>(subsealevelloads);
+}; /*}}}*/
+
+void GrdLoads::BroadcastLoads(void){ /*{{{*/
+
+	/*Initialize barycentre vectors, now that we know their size: */
+	vloads->Assemble();
+	for (int i=0;i<SLGEOM_NUMLOADS;i++){
+		vsubloads[i]->Assemble();
+	}
+
+	loads=vloads->ToMPISerial();
+	for (int i=0;i<SLGEOM_NUMLOADS;i++){
+		subloads[i]=vsubloads[i]->ToMPISerial();
+	}
+
+} /*}}}*/
+void GrdLoads::AssembleSealevelLoads(void){ /*{{{*/
+
+	vsealevelloads->Assemble();
+	vsubsealevelloads->Assemble();
+
+} /*}}}*/
+void GrdLoads::BroadcastSealevelLoads(void){ /*{{{*/
+
+	sealevelloads=vsealevelloads->ToMPISerial();
+	subsealevelloads=vsubsealevelloads->ToMPISerial();
+
+} /*}}}*/
Index: issm/trunk/src/c/classes/GrdLoads.h
===================================================================
--- issm/trunk/src/c/classes/GrdLoads.h	(revision 26744)
+++ issm/trunk/src/c/classes/GrdLoads.h	(revision 26744)
@@ -0,0 +1,32 @@
+/*!\file GrdLoads.h
+ * \brief: header file for GrdLoads
+ */
+
+#ifndef _SEALEVELGRDLOADS_H_
+#define _SEALEVELGRDLOADS_H_
+
+/*Headers:*/
+#include "./SealevelGeometry.h"
+#include "../toolkits/toolkits.h"
+
+class GrdLoads{ 
+
+	public: 
+
+		Vector<IssmDouble>* vloads=NULL;
+		IssmDouble*         loads=NULL;
+		Vector<IssmDouble>* vsubloads[SLGEOM_NUMLOADS];
+		IssmDouble*         subloads[SLGEOM_NUMLOADS];
+		Vector<IssmDouble>* vsealevelloads=NULL;
+		IssmDouble*         sealevelloads=NULL;
+		Vector<IssmDouble>* vsubsealevelloads=NULL;
+		IssmDouble*         subsealevelloads=NULL;
+
+		GrdLoads(int nel, SealevelGeometry* slgeom);
+		~GrdLoads();
+
+		void AssembleSealevelLoads(void);
+		void BroadcastLoads(void);
+		void BroadcastSealevelLoads(void);
+};
+#endif  /* _SEALEVELGRDLOADS_H_ */
Index: issm/trunk/src/c/classes/Inputs/ControlInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/ControlInput.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/ControlInput.cpp	(revision 26744)
@@ -223,5 +223,4 @@
 	//}
 
-
 	//NEW??
 	//this->gradient->SetInput(interp,numindices,indices,values_in);
@@ -282,5 +281,5 @@
 	else{
 		int* temp = xNew<int>(3);
-		_error_("not supported");
+		_error_("Gradient is of type "<<EnumToStringx(this->gradient->ObjectEnum()) <<", which is not supported yet");
 	}
 
Index: issm/trunk/src/c/classes/Inputs/DatasetInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/DatasetInput.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/DatasetInput.cpp	(revision 26744)
@@ -90,7 +90,50 @@
 	marshallhandle->call(this->numberofvertices_local);
 	marshallhandle->call(this->ids,numids);
-	//if (marshallhandle->OperationNumber() == MARSHALLING_LOAD) inputs = new Inputs();
-	//inputs->Marshall(marshallhandle);
-	_error_("not implemented");
+
+	/*Allocate memory if need be*/
+	int N = this->numids; _assert_(N>=0 && N<1e6);
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		if(N){
+			this->inputs = xNew<Input*>(N);
+			for(int i=0;i<N;i++) this->inputs[i] = NULL;
+		}
+		else{
+			this->inputs = NULL;
+		}
+	}
+
+	/*Marshall!*/
+	if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
+		for(int i=0;i<N;i++){
+			_assert_(this->inputs[i]);
+			object_enum = this->inputs[i]->ObjectEnum();
+			marshallhandle->call(object_enum);
+			this->inputs[i]->Marshall(marshallhandle);
+		}
+	}
+	else{
+		for(int i=0;i<N;i++){
+			marshallhandle->call(object_enum);
+
+			if(object_enum==TriaInputEnum){
+				TriaInput* triainput2=new TriaInput();
+				triainput2->Marshall(marshallhandle);
+				this->inputs[i]=triainput2;
+			}
+			else if(object_enum==PentaInputEnum){
+				PentaInput* pentainput2=new PentaInput();
+				pentainput2->Marshall(marshallhandle);
+				this->inputs[i]=pentainput2;
+			}
+			else if(object_enum==TransientInputEnum){
+				TransientInput* transinput2=new TransientInput();
+				transinput2->Marshall(marshallhandle);
+				this->inputs[i]=transinput2;
+			}
+			else{
+				_error_("input "<<EnumToStringx(object_enum)<<" not supported");
+			}
+		}
+	}
 
 }
Index: issm/trunk/src/c/classes/Inputs/DatasetInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/DatasetInput.h	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/DatasetInput.h	(revision 26744)
@@ -20,5 +20,5 @@
 		int             numberofelements_local;
 		int             numberofvertices_local;
-		
+
 	public:
 		int GetNumIds() const {return this->numids;};
Index: issm/trunk/src/c/classes/Inputs/Input.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/Input.h	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/Input.h	(revision 26744)
@@ -44,4 +44,5 @@
 
 		virtual void   AXPY(Input* xinput,IssmDouble scalar){_error_("Not implemented yet");};
+		virtual void   Shift(IssmDouble scalar){_error_("Not implemented yet");};
 		virtual void   PointWiseMult(Input* xinput){_error_("Not implemented yet");};
 		virtual void   Pow(IssmDouble scale_factor){_error_("Not implemented yet");};
Index: issm/trunk/src/c/classes/Inputs/Inputs.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/Inputs.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/Inputs.cpp	(revision 26744)
@@ -76,4 +76,17 @@
 		if(this->inputs[i]) _printf_(setw(25)<<EnumToStringx(i+InputsSTARTEnum+1)<<": set as "<<EnumToStringx(this->inputs[i]->ObjectEnum())<<"\n");
 	}
+	return;
+}
+/*}}}*/
+void Inputs::DeepEcho(int enum_in){/*{{{*/
+	int index= EnumToIndex(enum_in);
+	if(this->inputs[index])this->inputs[index]->DeepEcho();
+	return;
+}
+/*}}}*/
+void Inputs::Echo(int enum_in){/*{{{*/
+	_printf_("Inputs Echo:\n");
+	int index= EnumToIndex(enum_in);
+	if(this->inputs[index])this->inputs[index]->Echo();
 	return;
 }
@@ -144,4 +157,14 @@
 				this->inputs[index]=input;
 			}
+			else if(object_enum==TransientInputEnum){
+				TransientInput* input=new TransientInput();
+				input->Marshall(marshallhandle);
+				this->inputs[index]=input;
+			}
+			else if(object_enum==DatasetInputEnum){
+				DatasetInput* input=new DatasetInput();
+				input->Marshall(marshallhandle);
+				this->inputs[index]=input;
+			}
 			else{
 				_error_("input "<<EnumToStringx(object_enum)<<" not supported");
@@ -232,4 +255,57 @@
 	/*Add copy*/
 	this->inputs[index_new] = copy;
+}
+/*}}}*/
+void Inputs::ZAXPY(IssmDouble alpha, int xenum, int yenum, int zenum){/*{{{*/
+
+	_assert_(this);
+
+	/*Get indices from enums*/
+	int index_x = EnumToIndex(xenum);
+	int index_y = EnumToIndex(yenum);
+	int index_z = EnumToIndex(zenum);
+
+	/*Delete output if it already exists*/
+	if(this->inputs[index_z]) delete this->inputs[index_z];
+
+	/*Make sure that old one exists*/
+	if(!this->inputs[index_x]) _error_("Input "<<EnumToStringx(xenum)<<" not found");
+	if(!this->inputs[index_y]) _error_("Input "<<EnumToStringx(yenum)<<" not found");
+
+	/*Make a copy*/
+	this->inputs[index_z]=this->inputs[index_y]->copy();
+
+	/*AXPY: */
+	this->inputs[index_z]->AXPY(this->inputs[index_x],alpha);
+}
+/*}}}*/
+void Inputs::AXPY(IssmDouble alpha, int xenum, int yenum ){/*{{{*/
+
+	_assert_(this);
+
+	/*Get indices from enums*/
+	int index_x = EnumToIndex(xenum);
+	int index_y = EnumToIndex(yenum);
+
+	/*Make sure that old one exists*/
+	if(!this->inputs[index_x]) _error_("Input "<<EnumToStringx(xenum)<<" not found");
+	if(!this->inputs[index_y]) _error_("Input "<<EnumToStringx(yenum)<<" not found");
+
+	/*AXPY: */
+	this->inputs[index_y]->AXPY(this->inputs[index_x],alpha);
+}
+/*}}}*/
+void     Inputs::Shift(int xenum, IssmDouble alpha){/*{{{*/
+
+	_assert_(this);
+
+	/*Get indices from enums*/
+	int index_x = EnumToIndex(xenum);
+
+	/*Make sure that x exists*/
+	if(!this->inputs[index_x]) _error_("Input "<<EnumToStringx(xenum)<<" not found");
+
+	/*Shift: */
+	this->inputs[index_x]->Shift(alpha);
 }
 /*}}}*/
Index: issm/trunk/src/c/classes/Inputs/Inputs.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/Inputs.h	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/Inputs.h	(revision 26744)
@@ -46,6 +46,11 @@
 		int      DeleteInput(int enum_type);
 		void     DuplicateInput(int original_enum,int new_enum);
+		void     ZAXPY(IssmDouble alpha, int xenum, int yenum, int zenum);
+		void     AXPY(IssmDouble alpha, int xenum, int yenum);
+		void     Shift(int inputenum, IssmDouble alpha);
 		void     DeepEcho(void);
+		void     DeepEcho(int enum_in);
 		void     Echo(void);
+		void     Echo(int enum_in);
 		bool     Exist(int enum_type);
 		void     GetInputsInterpolations(int* pnuminputs,int** pinterpolations,int** penum);
Index: issm/trunk/src/c/classes/Inputs/PentaInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/PentaInput.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/PentaInput.cpp	(revision 26744)
@@ -177,4 +177,13 @@
 		}
 	}
+	else if(interp_in==P0Enum && this->interpolation==P0Enum){
+		_assert_(this->N==1);
+		for(int i=0;i<numindices;i++){
+			int row = indices[i];
+			_assert_(row>=0);
+			_assert_(row<this->M);
+			this->values[row] = values_in[i];
+		}
+	}
 	else if(this->interpolation!=P1Enum && interp_in==P1Enum){
 		this->Reset(interp_in);
Index: issm/trunk/src/c/classes/Inputs/TransientInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/TransientInput.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/TransientInput.cpp	(revision 26744)
@@ -94,11 +94,25 @@
 void TransientInput::DeepEcho(void){/*{{{*/
 
-	int i;
-
 	_printf_("TransientInput:\n");
 	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
 	_printf_("   numtimesteps: " << this->numtimesteps << "\n");
 	_printf_("---inputs: \n");
-	for(i=0;i<this->numtimesteps;i++){
+	for(int i=0;i<this->numtimesteps;i++){
+		_printf_("   time: " << this->timesteps[i]<<"  ");
+		if(this->inputs[i]) this->inputs[i]->DeepEcho();
+		else                _printf_(" NOT SET! \n");
+	}
+}
+/*}}}*/
+void TransientInput::Configure(Parameters* params){/*{{{*/
+	this->parameters=params;
+}
+/*}}}*/
+void TransientInput::Echo(void){/*{{{*/
+	_printf_("TransientInput:\n");
+	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
+	_printf_("   numtimesteps: " << this->numtimesteps << "\n");
+	_printf_("---inputs: \n");
+	for(int i=0;i<this->numtimesteps;i++){
 		_printf_("   time: " << this->timesteps[i]<<"  ");
 		if(this->inputs[i]) this->inputs[i]->Echo();
@@ -107,29 +121,58 @@
 }
 /*}}}*/
-void TransientInput::Configure(Parameters* params){/*{{{*/
-	this->parameters=params;
-}
-/*}}}*/
-void TransientInput::Echo(void){/*{{{*/
-	this->DeepEcho();
-}
-/*}}}*/
 int  TransientInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
 void TransientInput::Marshall(MarshallHandle* marshallhandle){ /*{{{*/
-
-	if (marshallhandle->OperationNumber() == MARSHALLING_LOAD){
-		_error_("not implmented");
-		//inputs = new Inputs();
-	}
 
 	int object_enum = TransientInputEnum;
    marshallhandle->call(object_enum);
 
+	marshallhandle->call(this->numberofelements_local);
+	marshallhandle->call(this->numberofvertices_local);
 	marshallhandle->call(this->enum_type);
 	marshallhandle->call(this->numtimesteps);
 	marshallhandle->call(this->timesteps,numtimesteps);
-	//inputs->Marshall(marshallhandle);
-	_error_("not implemented");
+
+	/*Allocate memory if need be*/
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		int N = this->numtimesteps; _assert_(N>=0 && N<1e6);
+		if(N){
+			this->inputs = xNew<Input*>(N);
+			for(int i=0;i<N;i++) this->inputs[i] = NULL;
+		}
+		else{
+			this->inputs = NULL;
+		}
+	}
+
+	/*Marshall!*/
+	if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
+		for(int i=0;i<this->numtimesteps;i++){
+			_assert_(this->inputs[i]);
+			object_enum = this->inputs[i]->ObjectEnum();
+			marshallhandle->call(object_enum);
+			this->inputs[i]->Marshall(marshallhandle);
+		}
+	}
+	else{
+		for(int i=0;i<this->numtimesteps;i++){
+			marshallhandle->call(object_enum);
+
+			if(object_enum==TriaInputEnum){
+				TriaInput* triainput2=new TriaInput();
+				triainput2->Marshall(marshallhandle);
+				this->inputs[i]=triainput2;
+			}
+			else if(object_enum==PentaInputEnum){
+				PentaInput* pentainput2=new PentaInput();
+				pentainput2->Marshall(marshallhandle);
+				this->inputs[i]=pentainput2;
+			}
+			else{
+				_error_("input "<<EnumToStringx(object_enum)<<" not supported");
+			}
+		}
+	}
+
 }
 /*}}}*/
@@ -348,5 +391,4 @@
 PentaInput* TransientInput::GetPentaInput(int offset){/*{{{*/
 
-
 	/*Check offset*/
 	if(offset<0 || offset>this->numtimesteps-1){
@@ -379,6 +421,40 @@
 
 	/*First, recover current time from parameters: */
-	bool linear_interp;
-	this->parameters->FindParam(&linear_interp,TimesteppingInterpForcingsEnum);
+	bool linear_interp,cycle;
+	IssmDouble dt;
+	this->parameters->FindParam(&linear_interp,TimesteppingInterpForcingEnum);
+	this->parameters->FindParam(&cycle,TimesteppingCycleForcingEnum);
+	this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);          /*transient core time step*/
+
+	/*Change input time if we cycle through the forcing*/
+	IssmDouble time0 = this->timesteps[0];
+	IssmDouble time1 = this->timesteps[this->numtimesteps - 1];
+
+	/*We need the end time to be the last timestep that would be taken*/
+	/* i.e., the case where GEMB has time stamps (finer timestep) after the last timestep */
+	IssmDouble nsteps = reCast<int,IssmDouble>(time1/dt);
+	if (reCast<IssmDouble>(nsteps)<time1/dt) nsteps=nsteps+1;
+	time1 = nsteps*dt;
+
+	if(cycle){
+
+		/*See by how many intervals we have to offset time*/
+		IssmDouble deltat = time1-time0;
+
+		//int num_intervals = floor((time-time0)/deltat); //Cannot do that because of AD!
+		int num_intervals = reCast<int,IssmDouble>(fabs(time-time0)/deltat);
+
+		/*Uncomment following line if you would like to apply a cycle BEFORE the time series starts*/
+		if(time<time0) num_intervals = -num_intervals-1;
+
+		if(fabs(time-time0)/deltat == reCast<IssmDouble>(num_intervals)){
+			/*Hack to make sure we always cover the last value of the series (discussion with Nicole)*/
+			time = time1;
+		}
+		else{
+			/*Now offset time so that we do the right interpolation below*/
+			time = time - num_intervals*deltat;
+		}
+	}
 
 	/*Figure step out*/
@@ -440,5 +516,4 @@
 		this->current_input->AXPY(input2,alpha2);
 	}
-
 }/*}}}*/
 void TransientInput::SetAverageAsCurrentTimeInput(IssmDouble start_time,IssmDouble end_time, int averaging_method){/*{{{*/
Index: issm/trunk/src/c/classes/Inputs/TransientInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/TransientInput.h	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/TransientInput.h	(revision 26744)
@@ -18,12 +18,12 @@
 
 	public:
-		int         enum_type;
-		int         numtimesteps;
-		Input**    inputs;
-		IssmDouble *timesteps;
-		Parameters *parameters;     //to find current time.
+		int          enum_type;
+		int          numtimesteps;
+		Input      **inputs;
+		IssmDouble  *timesteps;
+		Parameters  *parameters;      //to find current time.
 
-		IssmDouble  current_step;
-		Input*     current_input;
+		IssmDouble   current_step;
+		Input       *current_input;
 
 		/*TransientInput constructors, destructors: {{{*/
Index: issm/trunk/src/c/classes/Inputs/TriaInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/TriaInput.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/TriaInput.cpp	(revision 26744)
@@ -384,4 +384,11 @@
 }
 /*}}}*/
+void TriaInput::Shift(IssmDouble alpha){/*{{{*/
+
+	/*Carry out the shift operation:*/
+	for(int i=0;i<this->M*this->N;i++) this->values[i] +=alpha;
+	for(int i=0;i<TriaRef::NumberofNodes(this->interpolation);i++) this->element_values[i] += alpha;
+}
+/*}}}*/
 void TriaInput::PointWiseMult(Input* xinput){/*{{{*/
 
Index: issm/trunk/src/c/classes/Inputs/TriaInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/TriaInput.h	(revision 25994)
+++ issm/trunk/src/c/classes/Inputs/TriaInput.h	(revision 26744)
@@ -40,4 +40,5 @@
 		void Pow(IssmDouble scalar);
 		void AXPY(Input* xinput,IssmDouble scalar);
+		void Shift(IssmDouble scalar);
 		void PointWiseMult(Input* xinput);
 		void Serve(int numindices,int* indices);
Index: issm/trunk/src/c/classes/IoModel.cpp
===================================================================
--- issm/trunk/src/c/classes/IoModel.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/IoModel.cpp	(revision 26744)
@@ -449,4 +449,16 @@
 }
 /*}}}*/
+void  IoModel::ConstantToInput(Inputs* inputs,Elements* elements,IssmDouble value, int vector_enum,int type){/*{{{*/
+
+	if (type==P1Enum){
+		for(Object* & object : elements->objects){
+			Element* element=xDynamicCast<Element*>(object);
+			element->InputCreateP1FromConstant(inputs,this,value,vector_enum);
+		}
+	}
+	else _error_("not supported yet!");
+	return;
+}
+/*}}}*/
 void  IoModel::DeclareIndependents(bool trace,IssmPDouble* X){/*{{{*/
 
@@ -600,9 +612,9 @@
 				record_name=xNew<char>(record_name_size+1);
 				record_name[record_name_size]='\0';
-				
+
 				/*Read record_name: */
 				if(fread(record_name,record_name_size*sizeof(char),1,fid)!=0){};
-				
-				_error_("error while looking in binary file. String " << record_name << " a string of size "<<record_name_size);
+
+				_error_("error while looking in binary file. String \"" << record_name << "\" is a string of size "<<record_name_size);
 			}
 
@@ -656,4 +668,5 @@
 					if(strcmp(record_name,"md.timestepping.type")==0) integer = IoCodeToEnumTimestepping(integer);
 					if(strcmp(record_name,"md.amr.type")==0) integer = IoCodeToEnumAmr(integer);
+					if(strcmp(record_name,"md.solidearth.settings.grdmodel")==0) integer = IoCodeToEnumGrd(integer);
 
 					/*Broadcast to other cpus*/
@@ -683,4 +696,7 @@
 							/*create DoubleParam: */
 							this->AddConstant(new IoConstant(scalar,record_name));
+						}
+						else{
+							if(fread(&pscalar,sizeof(IssmPDouble),1,this->fid)!=1) _error_("could not read scalar ");
 						}
 					  }
@@ -1822,8 +1838,4 @@
 				matrix=array[i];
 
-				//recover time vector: 
-				times=xNew<IssmDouble>(N);
-				for(int t=0;t<N;t++) times[t] = matrix[(M-1)*N+t];
-
 				//initialize transient input dataset:
 				TransientInput* transientinput=inputs->SetDatasetTransientInput(input_enum,i, times,N);
@@ -1837,5 +1849,4 @@
 					int        *vertexlids = xNew<int>(numvertices);
 					int        *vertexsids = xNew<int>(numvertices);
-
 
 					/*Recover vertices ids needed to initialize inputs*/
@@ -1847,4 +1858,9 @@
 
 					if(M==this->numberofvertices || M==(this->numberofvertices+1)){
+
+						//recover time vector: 
+						times=xNew<IssmDouble>(N);
+						if(M==this->numberofvertices) times[0] = matrix[M-1];
+						if(M==this->numberofvertices+1) for(int t=0;t<N;t++) times[t] = matrix[(M-1)*N+t];
 
 						IssmDouble* values=xNew<IssmDouble>(numvertices);
@@ -1865,8 +1881,12 @@
 						IssmDouble value;
 
+						//recover time vector: 
+						times=xNew<IssmDouble>(N);
+						if(M==this->numberofelements) times[0] = matrix[M-1];
+						if(M==this->numberofelements+1) for(int t=0;t<N;t++) times[t] = matrix[(M-1)*N+t];
+
 						for(int t=0;t<N;t++){ 
 
 							value=matrix[N*element->Sid()+t];
-							//if(element->Sid()==188 && t==0)_printf_("value: " << value << "\n");
 							switch(element->ObjectEnum()){
 								case TriaEnum:  transientinput->AddTriaTimeInput( t,1,&element->lid,&value,P0Enum); break;
@@ -1876,6 +1896,25 @@
 						}
 					}
+					else if(M==2 || M==1){
+						IssmDouble value;
+
+						//recover time vector: 
+						times=xNew<IssmDouble>(N);
+						if(M==1) times[0] = 0;
+						if(M==2) for(int t=0;t<N;t++) times[t] = matrix[(M-1)*N+t];
+
+						for(int t=0;t<N;t++){ 
+
+							value=matrix[t];
+							switch(element->ObjectEnum()){
+								case TriaEnum:  transientinput->AddTriaTimeInput( t,1,&element->lid,&value,P0Enum); break;
+								case PentaEnum:  transientinput->AddPentaTimeInput( t,1,&element->lid,&value,P0Enum); break;
+								default: _error_("Not implemented yet");
+							}
+						}
+
+					}
 					else _error_("FetchDataToInput error message: row size of MatArray elements should be either numberofelements (+1) or numberofvertices (+1)");
-					
+
 					xDelete<int>(vertexlids);
 					xDelete<int>(vertexsids);
@@ -2024,7 +2063,16 @@
 				scalar=pscalar;
 			}
+			#if _CODIPACK_MAJOR_==2
+			auto& tape_codi = IssmDouble::getTape();
+			tape_codi.registerInput(scalar);
+			codi_global.input_indices.push_back(scalar.getIdentifier());
+			#elif _CODIPACK_MAJOR_==1
 			auto& tape_codi = IssmDouble::getGlobalTape();
 			tape_codi.registerInput(scalar);
 			codi_global.input_indices.push_back(scalar.getGradientData());
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 		#else
 			if(X){
@@ -2097,10 +2145,24 @@
 			#if defined(_HAVE_CODIPACK_)
 				// FIXME codi here we just assign instead of using "operator <<="
+				#if _CODIPACK_MAJOR_==2
+				auto& tape_codi = IssmDouble::getTape();
+				#elif _CODIPACK_MAJOR_==1
 				auto& tape_codi = IssmDouble::getGlobalTape();
+				#else
+				#error "_CODIPACK_MAJOR_ not supported"
+				#endif
+
 				if(X){
 					for (int i=0;i<M*N;i++) {
 						matrix[i]=X[Xcount+i];
 						tape_codi.registerInput(matrix[i]);
+						#if _CODIPACK_MAJOR_==2
+						codi_global.input_indices.push_back(matrix[i].getIdentifier());
+						#elif _CODIPACK_MAJOR_==1
 						codi_global.input_indices.push_back(matrix[i].getGradientData());
+						#else
+						#error "_CODIPACK_MAJOR_ not supported"
+						#endif
+
 					}
 				}
@@ -2109,5 +2171,11 @@
 						matrix[i]=buffer[i];
 						tape_codi.registerInput(matrix[i]);
+						#if _CODIPACK_MAJOR_==2
+						codi_global.input_indices.push_back(matrix[i].getIdentifier());
+						#elif _CODIPACK_MAJOR_==1
 						codi_global.input_indices.push_back(matrix[i].getGradientData());
+						#else
+						#error "_CODIPACK_MAJOR_ not supported"
+						#endif
 					}
 				}
@@ -2922,5 +2990,12 @@
 		 * -> These parameters are not read for the CoDiPack ISSM version!
 		 */
+		#if _CODIPACK_MAJOR_==2
+		auto& tape_codi = IssmDouble::getTape();
+		#elif _CODIPACK_MAJOR_==1
 		auto& tape_codi = IssmDouble::getGlobalTape();
+		#else
+		#error "_CODIPACK_MAJOR_ not supported"
+		#endif
+
 		tape_codi.setActive();
 		#if _AD_TAPE_ALLOC_
@@ -2935,5 +3010,5 @@
 		/*
 		std::stringstream out_s;
-		IssmDouble::getGlobalTape().printStatistics(out_s);
+		IssmDouble::getTape().printStatistics(out_s);
 		_printf0_("StartTrace::Tape Statistics	   : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str());
 		*/
Index: issm/trunk/src/c/classes/IoModel.h
===================================================================
--- issm/trunk/src/c/classes/IoModel.h	(revision 25994)
+++ issm/trunk/src/c/classes/IoModel.h	(revision 26744)
@@ -123,4 +123,5 @@
 		void        CheckFile(void);
 		Param      *CopyConstantObject(const char* constant_name,int param_enum);
+		void        ConstantToInput(Inputs* inputs,Elements* elements,IssmDouble value, int vector_enum,int type);
 		IssmDouble *Data(const char* data_name);
 		void        DeclareIndependents(bool trace,IssmPDouble* X);
Index: issm/trunk/src/c/classes/Loads/Channel.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Channel.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Channel.cpp	(revision 26744)
@@ -320,5 +320,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -336,5 +336,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
Index: issm/trunk/src/c/classes/Loads/Friction.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Friction.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Friction.cpp	(revision 26744)
@@ -18,14 +18,51 @@
 Friction::Friction(){/*{{{*/
 	this->element=NULL;
-	this->dim=0;
 	this->law=0;
-
+	this->apply_dim = 1.;
+	this->domaintype=-1;
+	this->vx_input=NULL;
+	this->vy_input=NULL;
+	this->vz_input=NULL;
 }
 /*}}}*/
-Friction::Friction(Element* element_in,int dim_in){/*{{{*/
-
+Friction::Friction(Element* element_in){/*{{{*/
+	/* Determine the dimension according to the domain type automatically. 
+	 * There are exceptions, e.g. HO, which needs the user to specify the dimension used in Friciton.*/
 	this->element=element_in;
-	this->dim=dim_in;
+
+	/* Load necessary parameters */
 	element_in->FindParam(&this->law,FrictionLawEnum);
+	element_in->FindParam(&this->domaintype,DomainTypeEnum);
+
+	/* Load VxBase and VyBase for this special case */
+	switch(this->domaintype){
+		case Domain2DhorizontalEnum: 
+			this->apply_dim = 2.;
+			this->vx_input = element_in->GetInput(VxBaseEnum);			_assert_(this->vx_input); 
+			this->vy_input = element_in->GetInput(VyBaseEnum);			_assert_(this->vy_input);
+			this->vz_input = NULL;
+			break;
+      case Domain2DverticalEnum:
+			this->apply_dim = 2.;
+			this->vx_input = element_in->GetInput(VxEnum);				_assert_(this->vx_input);
+			this->vy_input = element_in->GetInput(VyEnum);				_assert_(this->vy_input);
+			this->vz_input = NULL;
+			break;
+      case Domain3DEnum:           
+			this->apply_dim = 3.;
+			this->vx_input = element_in->GetInput(VxEnum);				_assert_(this->vx_input);
+			this->vy_input = element_in->GetInput(VyEnum);				_assert_(this->vy_input);
+			this->vz_input = element_in->GetInput(VzEnum);				_assert_(this->vz_input);
+			break;
+      default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+}
+/*}}}*/
+Friction::Friction(Element* element_in,int dim) : Friction(element_in) {/*{{{*/
+	this->apply_dim = reCast<IssmDouble>(dim);
+}
+/*}}}*/
+Friction::Friction(Element* element_in,IssmDouble dim) : Friction(element_in) {/*{{{*/
+	this->apply_dim = dim;
 }
 /*}}}*/
@@ -34,8 +71,9 @@
 /*}}}*/
 
+
 /*methods: */
 void Friction::Echo(void){/*{{{*/
 	_printf_("Friction:\n");
-	_printf_("   dim: " << this->dim<< "\n");
+	_printf_("   Domain type: " << this->domaintype<< "\n");
 }
 /*}}}*/
@@ -61,5 +99,4 @@
 			_error_("not supported");
 	}
-
 
 	/*Checks*/
@@ -160,7 +197,13 @@
 	IssmDouble vmag = VelMag(gauss);
 
-	/*Check to prevent dividing by zero if vmag==0*/
-	if(vmag==0. && (s-1.)<0.) alpha_complement=0.;
-	else alpha_complement=pow(Neff,r)*pow(vmag,(s-1));
+	if(s==1.){
+		/*This is to make AD happy and avoid 0^0*/
+		alpha_complement=pow(Neff,r);
+	}
+	else{
+		/*Check to prevent dividing by zero if vmag==0*/
+		if(vmag==0. && (s-1.)<0.) alpha_complement=0.;
+		else alpha_complement=pow(Neff,r)*pow(vmag,(s-1.));
+	}
 
 	/*Assign output pointers:*/
@@ -219,5 +262,5 @@
 	if(vmag==0. && (1./m-1.)<0.) alpha_complement=0.;
 	else alpha_complement= pow(vmag, 1.0/m-1.);
-	
+
 	/*Assign output pointers:*/
 	*palpha_complement=alpha_complement;
@@ -261,4 +304,7 @@
 		case 12:
 			GetAlpha2Tsai(palpha2,gauss);
+			break;
+		case 13:
+			GetAlpha2Coulomb2(palpha2,gauss);
 			break;
 	  default:
@@ -304,10 +350,12 @@
 	IssmDouble vmag = VelMag(gauss);
 
-	/*Check to prevent dividing by zero if vmag==0*/
-	if(vmag==0. && (s-1.)<0.){
-		alpha2=0.;
+	if(s==1.){
+		/*This is to make AD happy and avoid 0^0*/
+		alpha2=drag_coefficient*drag_coefficient*pow(Neff,r);
 	}
 	else{
-		alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+		/*Check to prevent dividing by zero if vmag==0*/
+		if(vmag==0. && (s-1.)<0.) alpha2=0.;
+		else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
 	}
 
@@ -461,5 +509,4 @@
 	deltaT = T-Tpmp;
 
-
 	/*Compute gamma*/
 	element->parameters->FindParam(&time,TimeEnum);
@@ -498,10 +545,31 @@
 
 	/*Get effective pressure and basal velocity*/
-	IssmDouble Neff = EffectivePressure(gauss);
 	IssmDouble vmag = VelMag(gauss);
 
+	bool ispwStochastic;
+	IssmDouble Neff;
+	element->parameters->FindParam(&ispwStochastic,StochasticForcingIsWaterPressureEnum);
+	if(ispwStochastic){
+		/*Retrieve stochastic water pressure and compute ice pressure*/
+		IssmDouble p_ice,p_water,Neff_limit;
+		element->GetInputValue(&p_water,gauss,FrictionWaterPressureEnum);
+		element->parameters->FindParam(&Neff_limit,FrictionEffectivePressureLimitEnum);
+		p_ice = IcePressure(gauss);
+		Neff  = max(Neff_limit*p_ice, p_ice - p_water);
+	}	
+	else{
+		/*Compute effective pressure directly*/
+		Neff = EffectivePressure(gauss);
+	}
+
 	/*Check to prevent dividing by zero if vmag==0*/
-	if(vmag==0. && (s-1.)<0.) alpha2=0.;
-	else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+	if(s==1.){
+		/*This is to make AD happy and avoid 0^0*/
+		alpha2=drag_coefficient*drag_coefficient*pow(Neff,r);
+	}
+	else{
+		if(vmag==0. && (s-1.)<0.) alpha2=0.;
+		else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+	}
 
 	/*Assign output pointers:*/
@@ -547,7 +615,13 @@
 	IssmDouble vmag = VelMag(gauss);
 
-	/*Check to prevent dividing by zero if vmag==0*/
-	if(vmag==0. && (s-1.)<0.) alpha2=0.;
-	else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+	if(s==1.){
+		/*This is to make AD happy and avoid 0^0*/
+		alpha2=drag_coefficient*drag_coefficient*pow(Neff,r);
+	}
+	else{
+		/*Check to prevent dividing by zero if vmag==0*/
+		if(vmag==0. && (s-1.)<0.) alpha2=0.;
+		else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+	}
 
 	/*Assign output pointers:*/
@@ -695,5 +769,5 @@
 
 	/*Compute alpha^2*/
-	if(ub<1e-10){
+	if((ub<1e-10) ||(N==0.0)){
 		alpha2 = 0.;
 	}
@@ -735,4 +809,36 @@
 
 		alpha2 = alpha2/ub;
+	}
+
+	/*Assign output pointers:*/
+	*palpha2=alpha2;
+}/*}}}*/
+void Friction::GetAlpha2Coulomb2(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
+
+	/*This routine calculates the basal friction coefficient
+	 *
+	 *               C^2 |u_b|^(m-1) * (.5*N)
+	 * alpha2= ___________________________________
+	 *          (C^(2/m) |u_b| + (0.5*N)^(1/m) )^m
+	 *
+	 * */
+
+	/*diverse: */
+	IssmDouble  C,m,alpha2;
+
+	/*Recover parameters: */
+	element->GetInputValue(&C,gauss,FrictionCEnum);
+	element->GetInputValue(&m,gauss,FrictionMEnum);
+
+	/*Get effective pressure and velocity magnitude*/
+	IssmDouble N  = EffectivePressure(gauss);
+	IssmDouble ub = VelMag(gauss);
+
+	/*Compute alpha^2*/
+	if(ub<1e-10){
+		alpha2 = 0.;
+	}
+	else{
+		alpha2= (pow(C,2)*pow(ub,m-1.)*(0.5*N)) / pow(pow(C,2./m)*ub + pow(0.5*N,1./m),m);
 	}
 
@@ -754,14 +860,14 @@
 	element->parameters->FindParam(&Neff_limit,FrictionEffectivePressureLimitEnum);
 
+	/*Compute ice pressure*/
+	p_ice = IcePressure(gauss);
+
 	/*From base and thickness, compute effective pressure when drag is viscous, or get Neff from forcing:*/
 	switch(coupled_flag){
 		case 0:{
-			element->GetInputValue(&thickness, gauss,ThicknessEnum);
 			element->GetInputValue(&base, gauss,BaseEnum);
 			element->GetInputValue(&sealevel, gauss,SealevelEnum);
 			IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
-			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
 			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
-			p_ice   = gravity*rho_ice*thickness;
 			p_water = rho_water*gravity*(sealevel-base);
 			Neff = p_ice - p_water;
@@ -769,8 +875,4 @@
 			break;
 		case 1:{
-			element->GetInputValue(&thickness, gauss,ThicknessEnum);
-			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
-			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
-			p_ice   = gravity*rho_ice*thickness;
 			p_water = 0.;
 			Neff = p_ice - p_water;
@@ -778,11 +880,8 @@
 			break;
 		case 2:{
-			element->GetInputValue(&thickness, gauss,ThicknessEnum);
 			element->GetInputValue(&base, gauss,BaseEnum);
 			element->GetInputValue(&sealevel, gauss,SealevelEnum);
 			IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
-			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
 			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
-			p_ice   = gravity*rho_ice*thickness;
 			p_water = max(0.,rho_water*gravity*(sealevel-base));
 			Neff = p_ice - p_water;
@@ -791,16 +890,8 @@
 		case 3:{
 			element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
-			element->GetInputValue(&thickness, gauss,ThicknessEnum);
-			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
-			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
-			p_ice   = gravity*rho_ice*thickness;
 		}
 			break;
 		case 4:{
 			element->GetInputValue(&Neff,gauss,EffectivePressureEnum);
-			element->GetInputValue(&thickness, gauss,ThicknessEnum);
-			IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
-			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
-			p_ice   = gravity*rho_ice*thickness;
 		}
 			break;
@@ -816,32 +907,111 @@
 
 }/*}}}*/
+IssmDouble Friction::IcePressure(Gauss* gauss){/*{{{*/
+	/*Get ice pressure*/
+
+	IssmDouble  thickness,p_ice;
+	/*Recover Inputs and Parameters*/
+	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+	IssmDouble rho_ice = element->FindParam(MaterialsRhoIceEnum);
+	IssmDouble gravity = element->FindParam(ConstantsGEnum);
+
+	/*Compute*/
+	p_ice = gravity*rho_ice*thickness;
+
+	/*Return ice pressure*/
+	return p_ice;
+
+}/*}}}*/
+IssmDouble Friction::SubglacialWaterPressure(Gauss* gauss){/*{{{*/
+	/*Get water pressure as a function of  flag */
+
+	int         coupled_flag;
+	IssmDouble  base,sealevel,p_water;
+
+	/*Recover parameters: */
+	element->parameters->FindParam(&coupled_flag,FrictionCouplingEnum);
+
+	switch(coupled_flag){
+		case 0:{
+			element->GetInputValue(&base, gauss,BaseEnum);
+			element->GetInputValue(&sealevel, gauss,SealevelEnum);
+			IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
+			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
+			p_water = rho_water*gravity*(sealevel-base);
+		}
+			break;
+		case 1:{
+			p_water = 0.;
+		}
+			break;
+		case 2:{
+			element->GetInputValue(&base, gauss,BaseEnum);
+			element->GetInputValue(&sealevel, gauss,SealevelEnum);
+			IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
+			IssmDouble gravity   = element->FindParam(ConstantsGEnum);
+			p_water = max(0.,rho_water*gravity*(sealevel-base));
+		}
+			break;
+		case 3:{
+			_error_("water pressure not computed for coupling==3 in friction law");
+		}
+			break;
+		case 4:{
+			_error_("water pressure not computed for coupling==4 in friction law");
+		}
+			break;
+		default:
+			_error_("not supported");
+	}
+
+	/*Return water pressure*/
+	return p_water;
+
+}/*}}}*/
 IssmDouble Friction::VelMag(Gauss* gauss){/*{{{*/
-	/*Get effective pressure as a function of  flag */
-
+	/*Get the velocity magnitude as a function of flag */
 
 	/*diverse*/
 	IssmDouble vx,vy,vz,vmag;
 
-	switch(dim){
-		case 1:
-			element->GetInputValue(&vx,gauss,VxEnum);
-			vmag=sqrt(vx*vx);
-			break;
-		case 2:
-			element->GetInputValue(&vx,gauss,VxEnum);
-			element->GetInputValue(&vy,gauss,VyEnum);
-			vmag=sqrt(vx*vx+vy*vy);
-			break;
-		case 3:
-			element->GetInputValue(&vx,gauss,VxEnum);
-			element->GetInputValue(&vy,gauss,VyEnum);
-			element->GetInputValue(&vz,gauss,VzEnum);
-			vmag=sqrt(vx*vx+vy*vy+vz*vz);
-			break;
-		default:
-			_error_("not supported");
-	}
-
+	this->vx_input->GetInputValue(&vx, gauss);
+	this->vy_input->GetInputValue(&vy, gauss);
+
+	if ((this->vz_input == NULL) || (this->apply_dim<3.)) vz = 0.0;
+	else this->vz_input->GetInputValue(&vz, gauss);
+
+	if (this->apply_dim<2.) vy = 0.0;
+
+	vmag = sqrt(vx*vx+vy*vy+vz*vz);
 	return vmag;
-
-}/*}}}*/
+}/*}}}*/
+void Friction::GetBasalSlidingSpeeds(IssmDouble* pvx, Gauss* gauss){/*{{{*/
+
+	this->vx_input->GetInputValue(pvx, gauss);
+	/*Checks*/
+	_assert_(!xIsNan<IssmDouble>(*pvx));
+	_assert_(!xIsInf<IssmDouble>(*pvx));
+}/*}}}*/
+void Friction::GetBasalSlidingSpeeds(IssmDouble* pvx, IssmDouble* pvy, Gauss* gauss){/*{{{*/
+
+	this->vx_input->GetInputValue(pvx, gauss);
+	this->vy_input->GetInputValue(pvy, gauss);
+	/*Checks*/
+	_assert_(!xIsNan<IssmDouble>(*pvx));
+	_assert_(!xIsInf<IssmDouble>(*pvx));
+	_assert_(!xIsNan<IssmDouble>(*pvy));
+	_assert_(!xIsInf<IssmDouble>(*pvy));
+}/*}}}*/
+void Friction::GetBasalSlidingSpeeds(IssmDouble* pvx, IssmDouble* pvy, IssmDouble* pvz, Gauss* gauss){/*{{{*/
+
+	this->vx_input->GetInputValue(pvx, gauss);
+	this->vy_input->GetInputValue(pvy, gauss);
+	this->vz_input->GetInputValue(pvz, gauss);
+	/*Checks*/
+	_assert_(!xIsNan<IssmDouble>(*pvx));
+	_assert_(!xIsInf<IssmDouble>(*pvx));
+	_assert_(!xIsNan<IssmDouble>(*pvy));
+	_assert_(!xIsInf<IssmDouble>(*pvy));
+	_assert_(!xIsNan<IssmDouble>(*pvz));
+	_assert_(!xIsInf<IssmDouble>(*pvz));
+}/*}}}*/
Index: issm/trunk/src/c/classes/Loads/Friction.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Friction.h	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Friction.h	(revision 26744)
@@ -14,11 +14,17 @@
 
 	public:
-		Element* element;
-		int      dim;
-		int      law;
+		Element    *element;
+		int         law;
+		int         domaintype;
+		IssmDouble  apply_dim;
+		Input      *vx_input;
+		Input      *vy_input;
+		Input      *vz_input;
 
 		/*methods: */
 		Friction();
-		Friction(Element* element_in,int dim_in);
+		Friction(Element* element_in);
+		Friction(Element* element_in, int dim);
+		Friction(Element* element_in, IssmDouble dim);
 		~Friction();
 
@@ -32,4 +38,5 @@
 		void  GetAlpha2(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Coulomb(IssmDouble* palpha2,Gauss* gauss);
+		void  GetAlpha2Coulomb2(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Hydro(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Josh(IssmDouble* palpha2,Gauss* gauss);
@@ -45,5 +52,10 @@
 
 		IssmDouble EffectivePressure(Gauss* gauss);
+		IssmDouble IcePressure(Gauss* gauss);
+		IssmDouble SubglacialWaterPressure(Gauss* gauss);
 		IssmDouble VelMag(Gauss* gauss);
+		void GetBasalSlidingSpeeds(IssmDouble* pvx, Gauss* gauss);
+		void GetBasalSlidingSpeeds(IssmDouble* pvx, IssmDouble* pvy, Gauss* gauss);
+		void GetBasalSlidingSpeeds(IssmDouble* pvx, IssmDouble* pvy, IssmDouble* pvz, Gauss* gauss);
 };
 
Index: issm/trunk/src/c/classes/Loads/Moulin.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Moulin.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Moulin.cpp	(revision 26744)
@@ -291,5 +291,5 @@
 		switch(set2_enum){
 			case FsetEnum:
-				if(node->fsize){
+				if(node->FSize()){
 					if(this->node->IsClone())
 					 o_nz += 1;
@@ -307,5 +307,5 @@
 				break;
 			case SsetEnum:
-				if(node->ssize){
+				if(node->SSize()){
 					if(this->node->IsClone())
 					 o_nz += 1;
Index: issm/trunk/src/c/classes/Loads/Neumannflux.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Neumannflux.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Neumannflux.cpp	(revision 26744)
@@ -306,5 +306,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -322,5 +322,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -354,5 +354,5 @@
 	Tria*  tria=(Tria*)element;
 	_assert_(tria->FiniteElement()==P1Enum); 
-	if(!tria->IsIceInElement() || tria->IsFloating()) return NULL;
+	if(!tria->IsIceInElement() || tria->IsAllFloating()) return NULL;
 
 	/*Initialize Element vector and other vectors*/
@@ -396,5 +396,5 @@
 	Tria*  tria=(Tria*)element;
 	_assert_(tria->FiniteElement()==P1Enum); 
-	if(!tria->IsIceInElement() || tria->IsFloating()) return NULL;
+	if(!tria->IsIceInElement() || tria->IsAllFloating()) return NULL;
 
 	/*Initialize Element vector and other vectors*/
Index: issm/trunk/src/c/classes/Loads/Numericalflux.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Numericalflux.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Numericalflux.cpp	(revision 26744)
@@ -430,5 +430,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -446,5 +446,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
Index: issm/trunk/src/c/classes/Loads/Pengrid.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Pengrid.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Pengrid.cpp	(revision 26744)
@@ -294,5 +294,5 @@
 		switch(set2_enum){
 			case FsetEnum:
-				if(node->fsize){
+				if(node->FSize()){
 					if(this->node->IsClone())
 					 o_nz += 1;
@@ -310,5 +310,5 @@
 				break;
 			case SsetEnum:
-				if(node->ssize){
+				if(node->SSize()){
 					if(this->node->IsClone())
 					 o_nz += 1;
Index: issm/trunk/src/c/classes/Loads/Penpair.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Penpair.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Penpair.cpp	(revision 26744)
@@ -235,5 +235,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -251,5 +251,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -355,4 +355,14 @@
 				default: _error_("Approximation "<<EnumToStringx(approximation1)<<" not supported yet");
 			}
+		case MLHOApproximationEnum:
+			switch(approximation1){
+				case MLHOApproximationEnum:   return PenaltyCreateKMatrixStressbalanceSSAHO(kmax); 
+				default: _error_("Approximation "<<EnumToStringx(approximation1)<<" not supported yet");
+			}
+		case L1L2ApproximationEnum:
+			switch(approximation1){
+				case L1L2ApproximationEnum:   return PenaltyCreateKMatrixStressbalanceSSAHO(kmax); 
+				default: _error_("Approximation "<<EnumToStringx(approximation1)<<" not supported yet");
+			}
 		case FSvelocityEnum:
 			switch(approximation1){
Index: issm/trunk/src/c/classes/Loads/Riftfront.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Riftfront.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Loads/Riftfront.cpp	(revision 26744)
@@ -392,5 +392,5 @@
 			switch(set2_enum){
 				case FsetEnum:
-					if(nodes[i]->fsize){
+					if(nodes[i]->FSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
@@ -408,5 +408,5 @@
 					break;
 				case SsetEnum:
-					if(nodes[i]->ssize){
+					if(nodes[i]->SSize()){
 						if(this->nodes[i]->IsClone())
 						 o_nz += 1;
Index: issm/trunk/src/c/classes/Masscon.h
===================================================================
--- issm/trunk/src/c/classes/Masscon.h	(revision 25994)
+++ issm/trunk/src/c/classes/Masscon.h	(revision 26744)
@@ -24,5 +24,5 @@
 		IssmDouble* levelset;
 		int         M;
-		
+
 		/*Masscon constructors, destructors :*/
 		Masscon(){/*{{{*/
@@ -101,5 +101,4 @@
 			 IssmDouble all_mass_t=0.;
 
-
 			 for(i=0;i<femmodel->elements->Size();i++){
 				 Element* element=(Element*)femmodel->elements->GetObjectByOffset(i);
@@ -109,5 +108,5 @@
 			 ISSM_MPI_Allreduce ( (void*)&mass_t,(void*)&all_mass_t,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
 			 mass_t=all_mass_t;
-			 
+
 			 return mass_t;
 		 }
Index: issm/trunk/src/c/classes/Massconaxpby.h
===================================================================
--- issm/trunk/src/c/classes/Massconaxpby.h	(revision 25994)
+++ issm/trunk/src/c/classes/Massconaxpby.h	(revision 26744)
@@ -26,5 +26,5 @@
 		IssmDouble  alpha;
 		IssmDouble  beta;
-		
+
 		/*Massconaxpby constructors, destructors :*/
 		Massconaxpby(){/*{{{*/
@@ -47,5 +47,5 @@
 			this->namex   = xNew<char>(strlen(in_namex)+1);
 			xMemCpy<char>(this->namex,in_namex,strlen(in_namex)+1);
-			
+
 			this->namey   = xNew<char>(strlen(in_namey)+1);
 			xMemCpy<char>(this->namey,in_namey,strlen(in_namey)+1);
Index: issm/trunk/src/c/classes/Massfluxatgate.h
===================================================================
--- issm/trunk/src/c/classes/Massfluxatgate.h	(revision 25994)
+++ issm/trunk/src/c/classes/Massfluxatgate.h	(revision 26744)
@@ -32,11 +32,15 @@
 		Massfluxatgate(){/*{{{*/
 			this->definitionenum        = -1;
-			this->name        = 0;
+			this->name        = NULL;
 			this->numsegments = 0;
-			this->segments    = 0;
+			this->elements    = NULL;
+			this->x1				= NULL;
+			this->x2				= NULL;
+			this->y1				= NULL;
+			this->y2				= NULL;
 		}
 		/*}}}*/
 		Massfluxatgate(char* in_name, int in_definitionenum, int in_numsegments, doubletype* in_segments) {/*{{{*/
-			
+
 			int i;
 
@@ -79,5 +83,5 @@
 				this->y2=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->y2,in_y2,this->numsegments);
 				this->elements=xNew<int>(this->numsegments); xMemCpy<int>(this->elements,in_elements,this->numsegments);
-				
+
 			}
 		}
Index: issm/trunk/src/c/classes/Materials/Material.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Material.h	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Material.h	(revision 26744)
@@ -51,4 +51,6 @@
 		virtual void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input)=0;
 		virtual void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
+		virtual void       ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input)=0;
+		virtual void       ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input)=0;
 		virtual void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf)=0;
 		virtual void       ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input)=0;
Index: issm/trunk/src/c/classes/Materials/Matestar.cpp
===================================================================
--- issm/trunk/src/c/classes/Materials/Matestar.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matestar.cpp	(revision 26744)
@@ -567,4 +567,10 @@
 	*pviscosity=GetViscosityGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged,gauss);
 }/*}}}*/
+void  Matestar::ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
+void  Matestar::ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){/*{{{*/
+	_error_("not implemented yet");
+}/*}}}*/
 void  Matestar::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
 	_error_("not implemented yet");
Index: issm/trunk/src/c/classes/Materials/Matestar.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Matestar.h	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matestar.h	(revision 26744)
@@ -28,5 +28,4 @@
 		Hook    *helement;
 		Element *element;
-		int      rheology_law;
 
 	public:
@@ -77,4 +76,6 @@
 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+		void       ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input);
+		void       ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input);
 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
 		void       ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
Index: issm/trunk/src/c/classes/Materials/Matice.cpp
===================================================================
--- issm/trunk/src/c/classes/Materials/Matice.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matice.cpp	(revision 26744)
@@ -292,10 +292,10 @@
 }
 /*}}}*/
-bool Matice::IsDamage(){/*{{{*/
+bool       Matice::IsDamage(){/*{{{*/
 
 	return this->isdamaged;
 }
 /*}}}*/
-bool Matice::IsEnhanced(){/*{{{*/
+bool       Matice::IsEnhanced(){/*{{{*/
 
 	return this->isenhanced;
@@ -736,4 +736,133 @@
 	*pviscosity=viscosity;
 }/*}}}*/
+void  Matice::ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vxbase_input,Input* vybase_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){/*{{{*/
+
+	/*Intermediaries*/
+	IssmDouble epsilon[5];	/* epsilon=[exx,eyy,exy,exz,eyz]; */
+	IssmDouble epsilon_eff;
+	IssmDouble zeta,H,n;
+	IssmDouble f[4],F[4];
+	IssmDouble mubar[4];
+	IssmDouble mu;
+	int order=5; 
+
+	for(int i=0;i<4;++i) mubar[i]=0;
+
+	GaussSeg* gauss_seg=new GaussSeg(order);
+	//IssmDouble eps_eff_averaged=0;
+	while(gauss_seg->next()){
+
+		/*Compute zeta for gauss_seg point (0=surface, 1=base)*/
+		zeta=0.5*(gauss_seg->coord1+1);	
+
+		/* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy (for a given zeta)*/
+		element->StrainRateMLHO(&epsilon[0],xyz_list,gauss,
+						vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+		epsilon_eff=sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2] 
+						  +  epsilon[3]*epsilon[3] + epsilon[4]*epsilon[4] + epsilon[0]*epsilon[1]);
+
+		/*Get viscosity at zeta */
+//?? need to use Bar for the current inversion
+//    this->GetViscosity(&mu,epsilon_eff,gauss);
+		this->GetViscosityBar(&mu, epsilon_eff,gauss);
+		thickness_input->GetInputValue(&H, gauss);
+      n_input->GetInputValue(&n,gauss);
+
+		/*Compute fi and Fi at zeta*/
+		f[0]=1;
+		f[1]=(1-pow(zeta,n+1));
+		f[2]=(1-pow(zeta,n+1))*(1-pow(zeta,n+1));
+		f[3]=((n+1)/H)*pow(zeta,n) * ((n+1)/H)*pow(zeta,n);
+
+		F[0]=H;
+		F[1]=H*(n+1)/(n+2);
+		F[2]=2*H*(n+1)*(n+1)/( (2*n+3)*(n+2) );
+		F[3]=(n+1)*(n+1)/( H*(2*n+1) );
+
+		/*Sum the viscosity*/
+		mubar[0]+=(H/(2*F[0]))*gauss_seg->weight*mu*f[0];
+		mubar[1]+=(H/(2*F[1]))*gauss_seg->weight*mu*f[1];
+		mubar[2]+=(H/(2*F[2]))*gauss_seg->weight*mu*f[2];
+		mubar[3]+=(H/(2*F[3]))*gauss_seg->weight*mu*f[3];
+
+	}//while
+
+	/*Assign output pointer*/
+	pviscosity[0]=mubar[0];
+	pviscosity[1]=mubar[1];
+	pviscosity[2]=mubar[2];
+	pviscosity[3]=mubar[3];
+
+	/*Clean up*/
+	delete gauss_seg;
+}/*}}}*/
+void  Matice::ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vxbase_input,Input* vybase_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){/*{{{*/
+
+	/* To compute the additional 5 terms in the viscosity appear in the adjoint equation*/
+	/*Intermediaries*/
+	IssmDouble epsilon[5];	/* epsilon=[exx,eyy,exy,exz,eyz]; */
+	IssmDouble epsilon_eff;
+	IssmDouble zeta,H,n;
+	IssmDouble f[9],F[9];
+	IssmDouble mubar[9];
+	IssmDouble mu;
+	int order=10; 
+
+	for(int i=0;i<9;++i) mubar[i]=0;
+
+	GaussSeg* gauss_seg=new GaussSeg(order);
+	//IssmDouble eps_eff_averaged=0;
+	while(gauss_seg->next()){
+		
+		/*Compute zeta for gauss_seg point (0=surface, 1=base)*/
+		zeta=0.5*(gauss_seg->coord1+1);	
+
+		/* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy (for a given zeta)*/
+		element->StrainRateMLHO(&epsilon[0],xyz_list,gauss,
+						vxbase_input,vybase_input,vxshear_input,vyshear_input,thickness_input,n_input,zeta);
+		epsilon_eff=sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[2]*epsilon[2] 
+						  +  epsilon[3]*epsilon[3] + epsilon[4]*epsilon[4] + epsilon[0]*epsilon[1]);
+
+		this->GetViscosity(&mu,epsilon_eff,gauss);
+		/*the adjoint viscosity with zeta dependent term*/
+		mu = mu /epsilon_eff/epsilon_eff;
+
+		thickness_input->GetInputValue(&H, gauss);
+      n_input->GetInputValue(&n,gauss);
+
+		/*Compute fi and Fi at zeta*/
+		f[0]=1;
+		f[1]=(1-pow(zeta,n+1));
+		f[2]=(1-pow(zeta,n+1))*(1-pow(zeta,n+1));
+		f[3]=pow(zeta,2*n); // NOTE: this is different from the forward formulation
+		f[4]=(1-pow(zeta,n+1))*(1-pow(zeta,n+1))*(1-pow(zeta,n+1));
+		f[5]=(1-pow(zeta,n+1))*(1-pow(zeta,n+1))*(1-pow(zeta,n+1))*(1-pow(zeta,n+1));
+		f[6]=(1-pow(zeta,n+1))*pow(zeta,2*n);
+		f[7]=(1-pow(zeta,n+1))*(1-pow(zeta,n+1))*pow(zeta,2*n);
+		f[8]=pow(zeta,4*n);
+
+	
+		F[0]=H;
+		F[1]=H*(n+1)/(n+2);
+		F[2]=2*H*(n+1)*(n+1)/( (2*n+3)*(n+2) );
+		F[3]=H/(2*n+1);
+		F[4]=6*H*(n+1)*(n+1)*(n+1)/( (n+2)*(2*n+3)*(3*n+4) );
+		F[5]=24*H*(n+1)*(n+1)*(n+1)*(n+1)/( (n+2)*(2*n+3)*(3*n+4)*(4*n+5) );
+		F[6]=H*(n+1)/( (2*n+1)*(3*n+2) );
+		F[7]=2*H*(n+1)*(n+1)/( (2*n+1)*(3*n+2)*(4*n+3) );
+		F[8]=H/(4*n+1);
+
+		/*Sum the viscosity*/
+		for(int i=0;i<9;i++) {
+			mubar[i]+=(H/2)*gauss_seg->weight*mu*f[i];
+		}
+	}//while
+
+	/*Assign output pointer*/
+	for(int i=0;i<9;i++) pviscosity[i]=mubar[i];
+
+	/*Clean up*/
+	delete gauss_seg;
+}/*}}}*/
 void  Matice::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
 	/*Compute the L1L2 viscosity
Index: issm/trunk/src/c/classes/Materials/Matice.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Matice.h	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matice.h	(revision 26744)
@@ -28,5 +28,4 @@
 		bool     isdamaged;
 		bool     isenhanced;
-		int      rheology_law;
 		Hook    *helement;
 		Element *element;
@@ -79,4 +78,6 @@
 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
+		void       ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input);
+		void       ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input);
 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf);
 		void       ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
Index: issm/trunk/src/c/classes/Materials/Matlitho.cpp
===================================================================
--- issm/trunk/src/c/classes/Materials/Matlitho.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matlitho.cpp	(revision 26744)
@@ -21,6 +21,10 @@
 	this->burgers_viscosity=NULL;
 	this->burgers_mu=NULL;
+	this->ebm_alpha=NULL;
+	this->ebm_delta=NULL;	
+	this->ebm_taul=NULL;
+	this->ebm_tauh=NULL;
 	this->density=NULL;
-	this->isburgers=NULL;
+	this->rheologymodel=NULL;
 	this->issolid=NULL;
 	return;
@@ -29,5 +33,5 @@
 Matlitho::Matlitho(int matlitho_mid, IoModel* iomodel){/*{{{*/
 
-	IssmDouble* isburgersd=NULL;
+	IssmDouble* rheologymodeld=NULL;
 	IssmDouble* issolidd=NULL;
 
@@ -53,17 +57,29 @@
 	xMemCpy<IssmDouble>(this->burgers_mu, iomodel->Data("md.materials.burgers_mu"),this->numlayers);
 
+	this->ebm_alpha=xNew<IssmDouble>(this->numlayers);
+	xMemCpy<IssmDouble>(this->ebm_alpha, iomodel->Data("md.materials.ebm_alpha"),this->numlayers);
+
+	this->ebm_delta=xNew<IssmDouble>(this->numlayers);
+	xMemCpy<IssmDouble>(this->ebm_delta, iomodel->Data("md.materials.ebm_delta"),this->numlayers);
+
+	this->ebm_taul=xNew<IssmDouble>(this->numlayers);
+	xMemCpy<IssmDouble>(this->ebm_taul, iomodel->Data("md.materials.ebm_taul"),this->numlayers);
+
+	this->ebm_tauh=xNew<IssmDouble>(this->numlayers);
+	xMemCpy<IssmDouble>(this->ebm_tauh, iomodel->Data("md.materials.ebm_tauh"),this->numlayers);
+
 	this->density=xNew<IssmDouble>(this->numlayers);
 	xMemCpy<IssmDouble>(this->density, iomodel->Data("md.materials.density"),this->numlayers);
 
-	this->isburgers=xNew<IssmDouble>(this->numlayers);
-	xMemCpy<IssmDouble>(this->isburgers, iomodel->Data("md.materials.isburgers"),this->numlayers);
+	this->rheologymodel=xNew<IssmDouble>(this->numlayers);
+	xMemCpy<IssmDouble>(this->rheologymodel, iomodel->Data("md.materials.rheologymodel"),this->numlayers);
 
 	this->issolid=xNew<IssmDouble>(this->numlayers);
 	xMemCpy<IssmDouble>(this->issolid, iomodel->Data("md.materials.issolid"),this->numlayers);
 
-	/*isburgersd= xNew<IssmDouble>(this->numlayers);
-	this->isburgers=xNew<bool>(this->numlayers);
-	xMemCpy<IssmDouble>(isburgersd, iomodel->Data("md.materials.isburgers"),this->numlayers);
-	for (int i=0;i<this->numlayers;i++)this->isburgers[i]=reCast<bool,IssmDouble>(isburgersd[i]);
+	/*rheologymodeld= xNew<IssmDouble>(this->numlayers);
+	this->rheologymodel=xNew<bool>(this->numlayers);
+	xMemCpy<IssmDouble>(rheologymodeld, iomodel->Data("md.materials.rheologymodel"),this->numlayers);
+	for (int i=0;i<this->numlayers;i++)this->rheologymodel[i]=reCast<bool,IssmDouble>(rheologymodeld[i]);
 
 	issolidd= xNew<IssmDouble>(this->numlayers);
@@ -73,5 +89,5 @@
 
 	/*free ressources: */
-	xDelete<IssmDouble>(isburgersd);
+	xDelete<IssmDouble>(rheologymodeld);
 	xDelete<IssmDouble>(issolidd);
 }
@@ -85,6 +101,10 @@
 	xDelete<IssmDouble>(burgers_viscosity);
 	xDelete<IssmDouble>(burgers_mu);
+	xDelete<IssmDouble>(ebm_alpha);
+	xDelete<IssmDouble>(ebm_delta);
+	xDelete<IssmDouble>(ebm_taul);
+	xDelete<IssmDouble>(ebm_tauh);
 	xDelete<IssmDouble>(density);
-	xDelete<IssmDouble>(isburgers);
+	xDelete<IssmDouble>(rheologymodel);
 	xDelete<IssmDouble>(issolid);
 
@@ -116,8 +136,12 @@
 		matlitho->burgers_viscosity=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->burgers_viscosity, this->burgers_viscosity,this->numlayers);
 		matlitho->burgers_mu=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->burgers_mu, this->burgers_mu,this->numlayers);
+		matlitho->ebm_alpha=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->ebm_alpha, this->ebm_alpha,this->numlayers);
+		matlitho->ebm_delta=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->ebm_delta, this->ebm_delta,this->numlayers);
+		matlitho->ebm_taul=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->ebm_taul, this->ebm_taul,this->numlayers);
+		matlitho->ebm_tauh=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->ebm_tauh, this->ebm_tauh,this->numlayers);
 		matlitho->density=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->density, this->density,this->numlayers);
-		matlitho->isburgers=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->isburgers, this->isburgers,this->numlayers);
+		matlitho->rheologymodel=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->rheologymodel, this->rheologymodel,this->numlayers);
 		matlitho->issolid=xNew<IssmDouble>(this->numlayers); xMemCpy<IssmDouble>(matlitho->issolid, this->issolid,this->numlayers);
-		/*matlitho->isburgers=xNew<bool>(this->numlayers); for(int i=0;i<this->numlayers;i++)matlitho->isburgers[i]=this->isburgers[i]; 
+		/*matlitho->rheologymodel=xNew<bool>(this->numlayers); for(int i=0;i<this->numlayers;i++)matlitho->rheologymodel[i]=this->rheologymodel[i]; 
 		matlitho->issolid=xNew<bool>(this->numlayers); for(int i=0;i<this->numlayers;i++)matlitho->issolid[i]=this->issolid[i];*/ 
 	}
@@ -136,7 +160,7 @@
 	_printf_("   mid: " << mid << "\n");
 	_printf_("   numlayers: " << numlayers << "\n");
-	_printf_("layer radius viscosity lame_lambda lame_mu burgers_viscosity burgers_mu density isburgers issolid\n");
+	_printf_("layer radius viscosity lame_lambda lame_mu burgers_viscosity burgers_mu ebm_alpha ebm_delta ebm_taul ebm_tauh density rheologymodel issolid\n");
 	for (int i=0;i<numlayers;i++){
-		_printf_(i << " " << radius[i] << " " << viscosity[i] << " " << lame_lambda[i] << " " << lame_mu[i] << " " << burgers_viscosity[i] << " " << burgers_mu[i] << " " << density[i] << " " << isburgers[i] << " " << issolid[i]);
+		_printf_(i << " " << radius[i] << " " << viscosity[i] << " " << lame_lambda[i] << " " << lame_mu[i] << " " << burgers_viscosity[i] << " " << burgers_mu[i] << " " << ebm_alpha[i] << " " << ebm_delta[i] << " " << ebm_taul[i] << " " << ebm_tauh[i] << " " << density[i] << " " << rheologymodel[i] << " " << issolid[i]);
 	}
 	return;
@@ -158,6 +182,10 @@
 		marshallhandle->call(this->burgers_viscosity,numlayers);
 		marshallhandle->call(this->burgers_mu,numlayers);
+		marshallhandle->call(this->ebm_alpha,numlayers);
+		marshallhandle->call(this->ebm_delta,numlayers);
+		marshallhandle->call(this->ebm_taul,numlayers);
+		marshallhandle->call(this->ebm_tauh,numlayers);
 		marshallhandle->call(this->density,numlayers);
-		marshallhandle->call(this->isburgers,numlayers);
+		marshallhandle->call(this->rheologymodel,numlayers);
 		marshallhandle->call(this->issolid,numlayers);
 	}
@@ -169,6 +197,10 @@
 		burgers_viscosity = NULL;
 		burgers_mu        = NULL;
+		ebm_alpha         = NULL;
+		ebm_delta         = NULL;
+		ebm_taul          = NULL;
+		ebm_tauh          = NULL;
 		density           = NULL;
-		isburgers         = NULL;
+		rheologymodel     = NULL;
 		issolid           = NULL;
 	}
Index: issm/trunk/src/c/classes/Materials/Matlitho.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Matlitho.h	(revision 25994)
+++ issm/trunk/src/c/classes/Materials/Matlitho.h	(revision 26744)
@@ -23,6 +23,10 @@
 		IssmDouble*  burgers_viscosity;
 		IssmDouble*  burgers_mu;
+		IssmDouble*  ebm_alpha;
+		IssmDouble*  ebm_delta;
+		IssmDouble*  ebm_taul;
+		IssmDouble*  ebm_tauh;
 		IssmDouble*  density;
-		IssmDouble*  isburgers;
+		IssmDouble*  rheologymodel;
 		IssmDouble*  issolid;
 
@@ -68,4 +72,6 @@
 		void       ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not supported");};
 		void       ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not supported");};
+		void       ViscosityMLHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){_error_("not supported");};
+		void       ViscosityMLHOAdjoint(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vxshear_input,Input* vyshear_input,Input* thickness_input,Input* n_input){_error_("not supported");};
 		void       ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surf){_error_("not supported");};
 		void       ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){_error_("not supported");};
Index: issm/trunk/src/c/classes/Misfit.h
===================================================================
--- issm/trunk/src/c/classes/Misfit.h	(revision 25994)
+++ issm/trunk/src/c/classes/Misfit.h	(revision 26744)
@@ -24,13 +24,13 @@
 		char*       timeinterpolation;
 		int         weights_enum;
-		
+
 		int         lock; // if lock is on, we just return the value stored in "misfit".  this is used so we don't compute misfit past the final_time
 		IssmDouble  misfit; //value carried over in time.
-		
+
 		/*Misfit constructors, destructors :*/
 		Misfit();
 		Misfit(char* in_name, int in_definitionenum, int in_model_enum, int in_observation_enum, char* in_timeinterpolation, int in_local, int in_weights_enum);
 		~Misfit();
-		
+
 		/*Object virtual function resolutoin: */
 		Object* copy();
@@ -40,5 +40,5 @@
 		void Marshall(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
-		
+
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum();
Index: issm/trunk/src/c/classes/Node.cpp
===================================================================
--- issm/trunk/src/c/classes/Node.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Node.cpp	(revision 26744)
@@ -20,6 +20,4 @@
 	this->approximation  = 0;
 	this->gsize          = -1;
-	this->fsize          = -1;
-	this->ssize          = -1;
 	this->clone          = false;
 	this->active         = true;
@@ -68,11 +66,9 @@
 		this->svalues        = xNew<IssmDouble>(this->gsize);
 		this->gdoflist       = xNew<int>(this->gsize);
-		this->gdoflist_local = xNewZeroInit<int>(this->gsize);
-		this->fsize          = -1;
-		this->ssize          = -1;
-		this->fdoflist       = NULL;
-		this->sdoflist       = NULL;
-		this->fdoflist_local = NULL;
-		this->sdoflist_local = NULL;
+		this->gdoflist_local = xNew<int>(this->gsize);
+		this->fdoflist       = xNew<int>(this->gsize);
+		this->sdoflist       = xNew<int>(this->gsize);
+		this->fdoflist_local = xNew<int>(this->gsize);
+		this->sdoflist_local = xNew<int>(this->gsize);
 	}
 	else{
@@ -82,6 +78,4 @@
 		this->gdoflist       = NULL;
 		this->gdoflist_local = NULL;
-		this->fsize          = -1;
-		this->ssize          = -1;
 		this->fdoflist       = NULL;
 		this->sdoflist       = NULL;
@@ -96,4 +90,9 @@
 		this->svalues[i]  = 0.;
 		this->gdoflist[i] = -1;
+		this->fdoflist[i] = -1;
+		this->sdoflist[i] = -1;
+		this->gdoflist_local[i] = -1;
+		this->fdoflist_local[i] = -1;
+		this->sdoflist_local[i] = -1;
 	}
 
@@ -210,6 +209,4 @@
 	output->indexingupdate = this->indexingupdate;
 	output->gsize  = this->gsize;
-	output->fsize  = this->fsize;
-	output->ssize  = this->ssize;
 	output->clone  = this->clone;
 	output->active = this->active;
@@ -222,12 +219,8 @@
 		output->gdoflist=xNew<int>(output->gsize);
 		output->gdoflist_local=xNew<int>(output->gsize);
-	}
-	if(output->fsize>0){
-		output->fdoflist=xNew<int>(output->fsize);
-		output->fdoflist_local=xNew<int>(output->fsize);
-	}
-	if(output->ssize>0){
-		output->sdoflist=xNew<int>(output->ssize);
-		output->sdoflist_local=xNew<int>(output->ssize);
+		output->fdoflist=xNew<int>(output->gsize);
+		output->fdoflist_local=xNew<int>(output->gsize);
+		output->sdoflist=xNew<int>(output->gsize);
+		output->sdoflist_local=xNew<int>(output->gsize);
 	}
 
@@ -239,12 +232,8 @@
 		memcpy(output->gdoflist,this->gdoflist,output->gsize*sizeof(int));
 		memcpy(output->gdoflist_local,this->gdoflist_local,output->gsize*sizeof(int));
-	}
-	if(output->fsize>0){
-		memcpy(output->fdoflist,this->fdoflist,output->fsize*sizeof(int));
-		memcpy(output->fdoflist_local,this->fdoflist_local,output->fsize*sizeof(int));
-	}
-	if(output->ssize>0){
-		memcpy(output->sdoflist,this->sdoflist,output->ssize*sizeof(int));
-		memcpy(output->sdoflist_local,this->sdoflist_local,output->ssize*sizeof(int));
+		memcpy(output->fdoflist,this->fdoflist,output->gsize*sizeof(int));
+		memcpy(output->fdoflist_local,this->fdoflist_local,output->gsize*sizeof(int));
+		memcpy(output->sdoflist,this->sdoflist,output->gsize*sizeof(int));
+		memcpy(output->sdoflist_local,this->sdoflist_local,output->gsize*sizeof(int));
 	}
 
@@ -267,6 +256,4 @@
 
 	marshallhandle->call(this->gsize);
-	marshallhandle->call(this->fsize);
-	marshallhandle->call(this->ssize);
 	marshallhandle->call(this->clone);
 	marshallhandle->call(this->active);
@@ -277,9 +264,9 @@
 	marshallhandle->call(this->doftype,gsize);
 	marshallhandle->call(this->gdoflist,gsize);
-	marshallhandle->call(this->fdoflist,fsize);
-	marshallhandle->call(this->sdoflist,ssize);
+	marshallhandle->call(this->fdoflist,gsize);
+	marshallhandle->call(this->sdoflist,gsize);
 	marshallhandle->call(this->gdoflist_local,gsize);
-	marshallhandle->call(this->fdoflist_local,fsize);
-	marshallhandle->call(this->sdoflist_local,ssize);
+	marshallhandle->call(this->fdoflist_local,gsize);
+	marshallhandle->call(this->sdoflist_local,gsize);
 } /*}}}*/
 
@@ -295,6 +282,4 @@
 	_printf_("   indexingupdate: " << indexingupdate << "\n");
 	_printf_("   gsize:  " << gsize << "\n");
-	_printf_("   fsize:  " << fsize << "\n");
-	_printf_("   ssize:  " << ssize << "\n");
 	_printf_("   clone:  " << clone << "\n");
 	_printf_("   active: " << active << "\n");
@@ -306,5 +291,5 @@
 	for(i=0;i<gsize;i++) _printf_((s_set[i]?1:0)<< " ");
 	_printf_("]\n");
-	_printf_("   svalues (" << this->ssize << "): |");
+	_printf_("   svalues: |");
 	for(i=0;i<this->gsize;i++){
 		if(this->s_set[i])_printf_(" " << svalues[i] << " |");
@@ -327,16 +312,16 @@
 	_printf_("\n");
 
-	_printf_("   f_doflist (" << this->fsize << "): |");
-	for(i=0;i<this->fsize;i++) _printf_(" " << fdoflist[i] << " |");
+	_printf_("   f_doflist (" << this->gsize << "): |");
+	for(i=0;i<this->gsize;i++) _printf_(" " << fdoflist[i] << " |");
 	_printf_("\n");
-	_printf_("   f_doflist_local (" << this->fsize << "): |");
-	for(i=0;i<this->fsize;i++) _printf_(" " << fdoflist_local[i] << " |");
+	_printf_("   f_doflist_local (" << this->gsize << "): |");
+	for(i=0;i<this->gsize;i++) _printf_(" " << fdoflist_local[i] << " |");
 	_printf_("\n");
 
-	_printf_("   s_doflist (" << this->ssize << "): |");
-	for(i=0;i<this->ssize;i++) _printf_(" " << sdoflist[i] << " |");
+	_printf_("   s_doflist (" << this->gsize << "): |");
+	for(i=0;i<this->gsize;i++) _printf_(" " << sdoflist[i] << " |");
 	_printf_("\n");
-	_printf_("   s_doflist_local (" << this->ssize << "): |");
-	for(i=0;i<this->ssize;i++) _printf_(" " << sdoflist_local[i] << " |");
+	_printf_("   s_doflist_local (" << this->gsize << "): |");
+	for(i=0;i<this->gsize;i++) _printf_(" " << sdoflist_local[i] << " |");
 	_printf_("\n");
 
@@ -354,6 +339,4 @@
 	_printf_("   indexingupdate: " << indexingupdate << "\n");
 	_printf_("   gsize:  " << gsize << "\n");
-	_printf_("   fsize:  " << fsize << "\n");
-	_printf_("   ssize:  " << ssize << "\n");
 	_printf_("   clone:  " << clone << "\n");
 	_printf_("   active: " << active << "\n");
@@ -386,9 +369,9 @@
 	}
 	else if(setenum==FsetEnum){
-		_assert_(dofindex>=0 && dofindex<fsize);
+		_assert_(dofindex>=0 && dofindex<gsize);
 		return fdoflist[dofindex];
 	}
 	else if(setenum==SsetEnum){
-		_assert_(dofindex>=0 && dofindex<ssize);
+		_assert_(dofindex>=0 && dofindex<gsize);
 		return sdoflist[dofindex];
 	}
@@ -397,226 +380,48 @@
 } /*}}}*/
 void Node::GetDofList(int* outdoflist,int approximation_enum,int setenum){/*{{{*/
+	_assert_(!this->indexingupdate);
 	int i;
-	int count=0;
-	int count2=0;
+
+	int* doflistpointer = NULL;
+	if(setenum==GsetEnum) doflistpointer = gdoflist;
+	else if(setenum==FsetEnum)for(i=0;i<this->gsize;i++) doflistpointer = fdoflist;
+	else if(setenum==SsetEnum)for(i=0;i<this->gsize;i++) doflistpointer = sdoflist;
+	else _error_("not supported");
+
+	if(approximation_enum==NoneApproximationEnum){
+		for(i=0;i<this->gsize;i++) outdoflist[i]=doflistpointer[i];
+	}
+	else{
+		if(doftype){
+			int count = 0;
+			for(i=0;i<this->gsize;i++){
+				if(doftype[i]==approximation_enum) outdoflist[count++]=doflistpointer[i];
+			}
+		}
+		else for(i=0;i<this->gsize;i++) outdoflist[i]=doflistpointer[i];
+	}
+}/*}}}*/
+void Node::GetDofListLocal(int* outdoflist,int approximation_enum,int setenum){/*{{{*/
 
 	_assert_(!this->indexingupdate);
+	int i;
+
+	int* doflistpointer = NULL;
+	if(setenum==GsetEnum) doflistpointer = gdoflist_local;
+	else if(setenum==FsetEnum)for(i=0;i<this->gsize;i++) doflistpointer = fdoflist_local;
+	else if(setenum==SsetEnum)for(i=0;i<this->gsize;i++) doflistpointer = sdoflist_local;
+	else _error_("not supported");
 
 	if(approximation_enum==NoneApproximationEnum){
-		if(setenum==GsetEnum)for(i=0;i<this->gsize;i++) outdoflist[i]=gdoflist[i];
-		if(setenum==FsetEnum)for(i=0;i<this->fsize;i++) outdoflist[i]=fdoflist[i];
-		if(setenum==SsetEnum)for(i=0;i<this->ssize;i++) outdoflist[i]=sdoflist[i];
+		for(i=0;i<this->gsize;i++) outdoflist[i]=doflistpointer[i];
 	}
 	else{
-
-		if(setenum==GsetEnum){
-			if(doftype){
-				count=0;
-				for(i=0;i<this->gsize;i++){
-					if(doftype[i]==approximation_enum){
-						outdoflist[count]=gdoflist[i];
-						count++;
-					}
-				}
-				_assert_(count); //at least one dof should be the approximation requested
-			}
-			else for(i=0;i<this->gsize;i++) outdoflist[i]=gdoflist[i];
-		}
-		else if(setenum==FsetEnum){
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(f_set[i]){
-						if(doftype[i]==approximation_enum){
-							outdoflist[count]=fdoflist[count2];
-							count++;
-						}
-						count2++;
-					}
-				}
-			}
-			else for(i=0;i<this->fsize;i++) outdoflist[i]=fdoflist[i];
-		}
-		else if(setenum==SsetEnum){
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(s_set[i]){
-						if(doftype[i]==approximation_enum){
-							outdoflist[count]=sdoflist[count2];
-							count++;
-						}
-						count2++;
-					}
-				}
-			}
-			else for(i=0;i<this->ssize;i++) outdoflist[i]=sdoflist[i];
-		}
-		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
-	}
-}
-/*}}}*/
-void Node::GetDofListLocal(int* outdoflist,int approximation_enum,int setenum){/*{{{*/
-	int i;
-	int count=0;
-	int count2=0;
-
-	_assert_(!this->indexingupdate);
-
-	if(approximation_enum==NoneApproximationEnum){
-		if(setenum==GsetEnum)for(i=0;i<this->gsize;i++) outdoflist[i]=gdoflist_local[i];
-		if(setenum==FsetEnum)for(i=0;i<this->fsize;i++) outdoflist[i]=fdoflist_local[i];
-		if(setenum==SsetEnum)for(i=0;i<this->ssize;i++) outdoflist[i]=sdoflist_local[i];
-	}
-	else{
-
-		if(setenum==GsetEnum){
-			if(doftype){
-				count=0;
-				for(i=0;i<this->gsize;i++){
-					if(doftype[i]==approximation_enum){
-						outdoflist[count]=gdoflist_local[i];
-						count++;
-					}
-				}
-				_assert_(count); //at least one dof should be the approximation requested
-			}
-			else for(i=0;i<this->gsize;i++) outdoflist[i]=gdoflist_local[i];
-		}
-		else if(setenum==FsetEnum){
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(f_set[i]){
-						if(doftype[i]==approximation_enum){
-							outdoflist[count]=fdoflist_local[count2];
-							count++;
-						}
-						count2++;
-					}
-				}
-			}
-			else for(i=0;i<this->fsize;i++) outdoflist[i]=fdoflist_local[i];
-		}
-		else if(setenum==SsetEnum){
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(s_set[i]){
-						if(doftype[i]==approximation_enum){
-							outdoflist[count]=sdoflist_local[count2];
-							count++;
-						}
-						count2++;
-					}
-				}
-			}
-			else for(i=0;i<this->ssize;i++) outdoflist[i]=sdoflist_local[i];
-		}
-		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
-	}
-}
-/*}}}*/
-void Node::GetLocalDofList(int* outdoflist,int approximation_enum,int setenum){/*{{{*/
-	int i;
-	int count=0;
-	int count2=0;
-
-	_assert_(!this->indexingupdate);
-
-	if(approximation_enum==NoneApproximationEnum){
-		if(setenum==GsetEnum)for(i=0;i<this->gsize;i++) outdoflist[i]=i;
-		else if(setenum==FsetEnum){
-			count=0;
+		if(doftype){
+			int count =0;
 			for(i=0;i<this->gsize;i++){
-				if(f_set[i]){
-					outdoflist[count]=i;
-					count++;
-				}
-			}
-		}
-		else if(setenum==SsetEnum){
-			count=0;
-			for(i=0;i<this->gsize;i++){
-				if(s_set[i]){
-					outdoflist[count]=i;
-					count++;
-				}
-			}
-		}
-		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
-	}
-	else{
-
-		if(setenum==GsetEnum){
-			if(doftype){
-				count=0;
-				for(i=0;i<this->gsize;i++){
-					if(doftype[i]==approximation_enum){
-						outdoflist[count]=count;
-						count++;
-					}
-				}
-				_assert_(count);
-			}
-			else for(i=0;i<this->gsize;i++) outdoflist[i]=i;
-		}
-		else if(setenum==FsetEnum){
-
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(doftype[i]==approximation_enum){
-						if(f_set[i]){
-							outdoflist[count]=count2;
-							count++;
-						}
-						count2++;
-					}
-				}
-				_assert_(count2);
-			}
-			else{
-
-				count=0;
-				for(i=0;i<this->gsize;i++){
-					if(f_set[i]){
-						outdoflist[count]=i;
-						count++;
-					}
-				}
-			}
-		}
-		else if(setenum==SsetEnum){
-			if(doftype){
-				count=0;
-				count2=0;
-				for(i=0;i<this->gsize;i++){
-					if(doftype[i]==approximation_enum){
-						if(s_set[i]){
-							outdoflist[count]=count2;
-							count++;
-						}
-						count2++;
-					}
-				}
-				_assert_(count2);
-			}
-			else{
-				count=0;
-				for(i=0;i<this->gsize;i++){
-					if(s_set[i]){
-						outdoflist[count]=i;
-						count++;
-					}
-				}
-			}
-		}
-		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
+				if(doftype[i]==approximation_enum) outdoflist[count++]=doflistpointer[i];
+			}
+		}
+		else for(i=0;i<this->gsize;i++) outdoflist[i]=doflistpointer[i];
 	}
 }
@@ -660,29 +465,10 @@
 void Node::CreateNodalConstraints(Vector<IssmDouble>* ys){/*{{{*/
 
-	int i;
-	IssmDouble* values=NULL;
-	int count;
-
-	/*Recover values for s set and plug them in constraints vector: */
-	if(this->ssize){
-		values=xNew<IssmDouble>(this->ssize);
-		count=0;
-		for(i=0;i<this->gsize;i++){
-			if(this->s_set[i]){
-				values[count]=this->svalues[i];
-				_assert_(!xIsNan<IssmDouble>(values[count]));
-				count++;
-			}
-		}
-
+	if(this->SSize()){
 		/*Add values into constraint vector: */
-		ys->SetValues(this->ssize,this->sdoflist,values,INS_VAL);
-	}
-
-	/*Free ressources:*/
-	xDelete<IssmDouble>(values);
-
-}
-/*}}}*/
+		ys->SetValues(this->gsize,this->sdoflist,this->svalues,INS_VAL);
+	}
+
+}/*}}}*/
 void Node::Deactivate(void){/*{{{*/
 
@@ -705,9 +491,9 @@
 	_assert_(this->active);
 
-	if(this->f_set[dof] == 0){
+	if(!this->f_set[dof]){
 		if(this->freeze) _error_("Cannot change dof of frozen node");
 		this->indexingupdate = true;
-		this->f_set[dof]=1; 
-		this->s_set[dof]=0;
+		this->f_set[dof]=true; 
+		this->s_set[dof]=false;
 	}
 }
@@ -719,9 +505,9 @@
 	_assert_(dof<this->gsize);
 
-	if(this->f_set[dof] == 1){
+	if(this->f_set[dof]){
 		//if(this->freeze) _error_("Cannot change dof of frozen node");
 		this->indexingupdate = true;
-		this->f_set[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
-		this->s_set[dof]=1;
+		this->f_set[dof]=false; //n splits into f (for which we solve) and s (single point constraints)
+		this->s_set[dof]=true;
 	}
 }
@@ -755,6 +541,6 @@
 	if(approximation_enum==NoneApproximationEnum){
 		if      (setenum==GsetEnum) numdofs=this->gsize;
-		else if (setenum==FsetEnum) numdofs=this->fsize;
-		else if (setenum==SsetEnum) numdofs=this->ssize;
+		else if (setenum==FsetEnum) numdofs=this->FSize();
+		else if (setenum==SsetEnum) numdofs=this->SSize();
 		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
 	}
@@ -776,5 +562,5 @@
 				}
 			}
-			else numdofs=this->fsize;
+			else numdofs=this->FSize();
 		}
 		else if (setenum==SsetEnum){
@@ -785,5 +571,5 @@
 				}
 			}
-			else numdofs=this->ssize;
+			else numdofs=this->SSize();
 		}
 		else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
@@ -800,21 +586,12 @@
 /*}}}*/
 bool Node::IsActive(void){/*{{{*/
-
 	return active;
-
-}
-/*}}}*/
+}/*}}}*/
 int  Node::IsClone(){/*{{{*/
-
 	return clone;
-
-}
-/*}}}*/
+}/*}}}*/
 void Node::ReindexingDone(void){/*{{{*/
-
 	this->indexingupdate = false;
-
-}
-/*}}}*/
+}/*}}}*/
 void Node::RelaxConstraint(int dof){/*{{{*/
 
@@ -837,7 +614,11 @@
 	if(this->IsClone()) return;
 
-	if(this->fsize){
-		int*        indices = xNew<int>(this->fsize);
-		IssmDouble* values  = xNew<IssmDouble>(this->fsize);
+	/*Get F size and S size*/
+	int fsize = this->FSize();
+	int ssize = this->SSize();
+
+	if(fsize){
+		int*        indices = xNew<int>(fsize);
+		IssmDouble* values  = xNew<IssmDouble>(fsize);
 
 		int count = 0;
@@ -845,19 +626,19 @@
 			if(this->f_set[i]){
 				_assert_(local_uf);
-				_assert_(this->fdoflist[count]==indices_uf[this->fdoflist_local[count]]);
-
-				values[count] =local_uf[this->fdoflist_local[count]];
+				_assert_(this->fdoflist[i]==indices_uf[this->fdoflist_local[i]]);
+
+				values[count] =local_uf[this->fdoflist_local[i]];
 				indices[count]=this->gdoflist[i];
 				count++;
 			}
 		}
-		ug->SetValues(this->fsize,indices,values,INS_VAL);
+		ug->SetValues(fsize,indices,values,INS_VAL);
 
 		xDelete<IssmDouble>(values);
 		xDelete<int>(indices);
 	}
-	if(this->ssize){
-		int*        indices = xNew<int>(this->ssize);
-		IssmDouble* values  = xNew<IssmDouble>(this->ssize);
+	if(ssize){
+		int*        indices = xNew<int>(ssize);
+		IssmDouble* values  = xNew<IssmDouble>(ssize);
 
 		int count = 0;
@@ -865,13 +646,13 @@
 			if(this->s_set[i]){
 				_assert_(local_ys);
-				_assert_(this->sdoflist[count]==indices_ys[this->sdoflist_local[count]]);
-
-				values[count] =local_ys[this->sdoflist_local[count]];
+				_assert_(this->sdoflist[i]==indices_ys[this->sdoflist_local[i]]);
+
+				values[count] =local_ys[this->sdoflist_local[i]];
 				indices[count]=this->gdoflist[i];
 				count++;
 			}
 		}
-		ug->SetValues(this->ssize,indices,values,INS_VAL);
-		
+		ug->SetValues(ssize,indices,values,INS_VAL);
+
 		xDelete<IssmDouble>(values);
 		xDelete<int>(indices);
@@ -881,11 +662,13 @@
 void Node::VecReduce(Vector<IssmDouble>* uf, IssmDouble* local_ug,int* indices_ug){/*{{{*/
 
-
 	/*Only perform operation if not clone*/
 	if(this->IsClone()) return;
 
-	if(this->fsize){
-		int*        indices = xNew<int>(this->fsize);
-		IssmDouble* values  = xNew<IssmDouble>(this->fsize);
+	/*Get F size*/
+	int fsize = this->FSize();
+
+	if(fsize){
+		int*        indices = xNew<int>(fsize);
+		IssmDouble* values  = xNew<IssmDouble>(fsize);
 
 		int count = 0;
@@ -894,11 +677,13 @@
 				_assert_(local_ug);
 				_assert_(this->gdoflist[i]==indices_ug[this->gdoflist_local[i]]);
+				_assert_(this->fdoflist[i]>=0);
 
 				values[count] =local_ug[this->gdoflist_local[i]];
-				indices[count]=this->fdoflist[count];
+				indices[count]=this->fdoflist[i];
 				count++;
 			}
 		}
-		uf->SetValues(this->fsize,indices,values,INS_VAL);
+		_assert_(count==fsize);
+		uf->SetValues(fsize,indices,values,INS_VAL);
 
 		xDelete<IssmDouble>(values);
@@ -909,42 +694,4 @@
 
 /* indexing routines:*/
-void Node::AllocateDofLists(int setenum){/*{{{*/
-
-	/*Initialize: */
-	int size=0;
-
-	if(setenum==FsetEnum){
-		for(int i=0;i<this->gsize;i++) if(f_set[i])size++;
-		this->fsize=size;
-		xDelete<int>(this->fdoflist);
-		xDelete<int>(this->fdoflist_local);
-
-		if(this->fsize){
-			this->fdoflist=xNew<int>(size);
-			this->fdoflist_local=xNew<int>(size);
-		}
-		else{
-			this->fdoflist=NULL;
-			this->fdoflist_local=NULL;
-		}
-	}
-	else if(setenum==SsetEnum){
-		for(int i=0;i<this->gsize;i++) if(s_set[i])size++;
-		this->ssize=size;
-		xDelete<int>(this->sdoflist);
-		xDelete<int>(this->sdoflist_local);
-
-		if(this->ssize){
-			this->sdoflist=xNew<int>(size);
-			this->sdoflist_local=xNew<int>(size);
-		}
-		else{
-			this->sdoflist=NULL;
-			this->sdoflist_local=NULL;
-		}
-	}
-	/*TODO, we should never be here for GSET! add an assert and track down whether this happens*/
-}
-/*}}}*/
 void Node::DistributeLocalDofs(int* pdofcount,int setenum){/*{{{*/
 
@@ -955,16 +702,17 @@
 	if(setenum==GsetEnum){
 		_assert_(this->gsize==0 || this->gdoflist_local);
-		for(int i=0;i<this->gsize;i++) gdoflist_local[i]=dofcount+i;
-		dofcount+=this->gsize;
+		for(int i=0;i<this->gsize;i++) gdoflist_local[i]=dofcount++;
 	}
 	else if(setenum==FsetEnum){
-		_assert_(this->fsize==0 || this->fdoflist_local);
-		for(int i=0;i<this->fsize;i++) fdoflist_local[i]=dofcount+i;
-		dofcount+=this->fsize;
+		for(int i=0;i<this->gsize;i++){
+			if(this->f_set[i]) fdoflist_local[i]=dofcount++;
+			else               fdoflist_local[i]=-1;
+		}
 	}
 	else if(setenum==SsetEnum){
-		_assert_(this->ssize==0 || this->sdoflist_local);
-		for(int i=0;i<this->ssize;i++) sdoflist_local[i]=dofcount+i;
-		dofcount+=this->ssize;
+		for(int i=0;i<this->gsize;i++){
+			if(this->s_set[i]) sdoflist_local[i]=dofcount++;
+			else               sdoflist_local[i]=-1;
+		}
 	}
 	else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
@@ -972,6 +720,5 @@
 	/*Assign output pointers: */
 	*pdofcount=dofcount;
-}
-/*}}}*/
+}/*}}}*/
 void Node::DistributeGlobalDofsMasters(int dofcount,int setenum){/*{{{*/
 
@@ -985,10 +732,14 @@
 	}
 	else if(setenum==FsetEnum){
-		_assert_(this->fsize==0 || this->fdoflist);
-		for(int i=0;i<this->fsize;i++) this->fdoflist[i]=this->fdoflist_local[i]+dofcount;
+		for(int i=0;i<this->gsize;i++){
+			if(this->f_set[i]) fdoflist[i]=this->fdoflist_local[i]+dofcount;
+			else               fdoflist[i]=-1;
+		}
 	}
 	else if(setenum==SsetEnum){
-		_assert_(this->ssize==0 || this->sdoflist);
-		for(int i=0;i<this->ssize;i++) this->sdoflist[i]=this->sdoflist_local[i]+dofcount;
+		for(int i=0;i<this->gsize;i++){
+			if(this->s_set[i]) sdoflist[i]=this->sdoflist_local[i]+dofcount;
+			else               sdoflist[i]=-1;
+		}
 	}
 	else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
@@ -1005,8 +756,8 @@
 			break;
 		case FsetEnum:
-			for(int j=0;j<this->fsize;j++) truedofs[j]=fdoflist[j];
+			for(int j=0;j<this->gsize;j++) truedofs[j]=fdoflist[j];
 			break;
 		case SsetEnum:
-			for(int j=0;j<this->ssize;j++) truedofs[j]=sdoflist[j];
+			for(int j=0;j<this->gsize;j++) truedofs[j]=sdoflist[j];
 			break;
 		default:
@@ -1027,8 +778,8 @@
 			break;
 		case FsetEnum:
-			for(int j=0;j<this->fsize;j++) fdoflist[j]=alltruedofs[j];
+			for(int j=0;j<this->gsize;j++) fdoflist[j]=alltruedofs[j];
 			break;
 		case SsetEnum:
-			for(int j=0;j<this->ssize;j++) sdoflist[j]=alltruedofs[j];
+			for(int j=0;j<this->gsize;j++) sdoflist[j]=alltruedofs[j];
 			break;
 		default:
@@ -1037,10 +788,27 @@
 }
 /*}}}*/
+int  Node::FSize(void){/*{{{*/
+
+	_assert_(this!=NULL && this->gdoflist);
+
+	int fsize = 0;
+	for(int i=0;i<this->gsize;i++) if(this->f_set[i]) fsize++;
+	return fsize;
+}
+/*}}}*/
+int  Node::SSize(void){/*{{{*/
+
+	_assert_(this!=NULL && this->s_set);
+
+	int ssize = 0;
+	for(int i=0;i<this->gsize;i++) if(this->s_set[i]) ssize++;
+	return ssize;
+}
+/*}}}*/
 
 /*Methods inherent to Node: */
 int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation){/*{{{*/
 
-	int  i,numdof,count;
-	int* ndof_list=NULL;
+	/*output*/
 	int *doflist = NULL;
 
@@ -1048,10 +816,10 @@
 
 		/*Allocate:*/
-		ndof_list=xNew<int>(numnodes);
+		int* ndof_list=xNew<int>(numnodes);
 
 		/*First, figure out size of doflist: */
-		numdof=0;
-		for(i=0;i<numnodes;i++){
-			ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation,setenum);
+		int numdof=0;
+		for(int i=0;i<numnodes;i++){
+			ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation,GsetEnum);
 			numdof+=ndof_list[i];
 		}
@@ -1062,6 +830,6 @@
 
 			/*Populate: */
-			count=0;
-			for(i=0;i<numnodes;i++){
+			int count=0;
+			for(int i=0;i<numnodes;i++){
 				nodes[i]->GetDofList(&doflist[count],approximation,setenum);
 				count+=ndof_list[i];
@@ -1069,65 +837,9 @@
 		}
 		else doflist=NULL;
-	}
-	/*Free ressources:*/
-	xDelete<int>(ndof_list);
-
-	return doflist;
-}
-/*}}}*/
-int* GetLocalDofList(Node** nodes,int numnodes,int setenum,int approximation){ /*{{{*/
-
-	int  i,j,count,numdof,numgdof;
-	int* ndof_list=NULL;
-	int* ngdof_list_cumulative=NULL;
-	int *doflist = NULL;
-
-	if(numnodes){
-		/*allocate: */
-		ndof_list=xNew<int>(numnodes);
-		ngdof_list_cumulative=xNew<int>(numnodes);
-
-		/*Get number of dofs per node, and total for this given set*/
-		numdof=0;
-		numgdof=0;
-		for(i=0;i<numnodes;i++){
-
-			/*Cumulative list= number of dofs before node i*/
-			ngdof_list_cumulative[i]=numgdof;
-
-			/*Number of dofs for node i for given set and for the g set*/
-			ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation,setenum);
-			numgdof    +=nodes[i]->GetNumberOfDofs(approximation,GsetEnum);
-			numdof     +=ndof_list[i];
-		}
-
-		if(numdof){
-			/*Allocate: */
-			doflist=xNew<int>(numdof);
-
-			/*Populate: */
-			count=0;
-			for(i=0;i<numnodes;i++){
-				nodes[i]->GetLocalDofList(&doflist[count],approximation,setenum);
-				count+=ndof_list[i];
-			}
-
-			/*We now have something like: [0 1 0 2 1 2]. Offset by gsize, to get something like: [0 1 2 4 6 7]:*/
-			count=0;
-			for(i=0;i<numnodes;i++){
-				for(j=0;j<ndof_list[i];j++){
-					doflist[count+j]+=ngdof_list_cumulative[i];
-				}
-				count+=ndof_list[i];
-			}
-		}
-		else doflist=NULL;
-	}
-
-	/*Free ressources:*/
-	xDelete<int>(ndof_list);
-	xDelete<int>(ngdof_list_cumulative);
-
-	/*CLean-up and return*/
+
+		/*Free ressources:*/
+		xDelete<int>(ndof_list);
+	}
+
 	return doflist;
 }
Index: issm/trunk/src/c/classes/Node.h
===================================================================
--- issm/trunk/src/c/classes/Node.h	(revision 25994)
+++ issm/trunk/src/c/classes/Node.h	(revision 26744)
@@ -43,6 +43,4 @@
 		/*sizes: */
 		int gsize;   //number of dofs for a node
-		int fsize;   //number of dofs solver for
-		int ssize;   //number of constrained dofs
 
 		/*Activation*/
@@ -56,5 +54,5 @@
 
 		/*types of dofs: */
-		int        *doftype;   //approximation type of the dofs (used only for coupling), size g_size
+		int  *doftype;   //approximation type of the dofs (used only for coupling), size g_size
 
 		/*list of degrees of freedom: */
@@ -80,5 +78,4 @@
 
 		/*Node numerical routines*/
-		void  AllocateDofLists(int setenum);
 		void  Activate(void);
 		void  ApplyConstraint(int dof,IssmDouble value);
@@ -94,11 +91,8 @@
 		void  GetDofList(int* poutdoflist,int approximation_enum,int setenum);
 		void  GetDofListLocal(int* poutdoflist,int approximation_enum,int setenum);
-		void  GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum);
 		int   GetNumberOfDofs(int approximation_enum,int setenum);
 		void  HardDeactivate(void);
 		bool  IsActive(void);
 		int   IsClone();
-		int   IsFloating();
-		int   IsGrounded();
 		int   Lid(void); 
 		void  DistributeGlobalDofsMasters(int dofcount,int setenum);
@@ -114,9 +108,10 @@
 		void  VecReduce(Vector<IssmDouble>* uf, IssmDouble* local_ug,int* indices_ug);
 		void  SetApproximation(int in_approximation);
+		int   SSize();
+		int   FSize();
 };
 
 /*Methods inherent to Node: */
 int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation);
-int* GetLocalDofList(Node** nodes,int numnodes,int setenum,int approximation);
 int  GetNumberOfDofs(Node** nodes,int numnodes,int setenum,int approximation);
 
Index: issm/trunk/src/c/classes/Nodes.cpp
===================================================================
--- issm/trunk/src/c/classes/Nodes.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Nodes.cpp	(revision 26744)
@@ -147,10 +147,4 @@
 	int num_procs = IssmComm::GetSize();
 
-	/*First, allocate dof lists based on fset and sset*/
-	for(Object* & object : this->objects){
-      Node* node = xDynamicCast<Node*>(object);
-		node->AllocateDofLists(setenum);
-	}
-
 	/*Now, Build local dofs for masters first*/
 	int  dofcount=0;
@@ -187,5 +181,5 @@
 	 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked
 	 * up by their clones: */
-	int  maxdofspernode = this->MaxNumDofs(setenum);
+	int  maxdofspernode = this->MaxNumDofs(GsetEnum);
 	int* truedofs       = xNewZeroInit<int>(this->Size()*maxdofspernode); //only one alloc
 	for(int rank=0;rank<num_procs;rank++){
Index: issm/trunk/src/c/classes/Numberedcostfunction.h
===================================================================
--- issm/trunk/src/c/classes/Numberedcostfunction.h	(revision 25994)
+++ issm/trunk/src/c/classes/Numberedcostfunction.h	(revision 26744)
@@ -9,5 +9,4 @@
 #include "./Definition.h"
 #include "./FemModel.h"
-
 
 IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,int output_enum);
Index: issm/trunk/src/c/classes/Options/Option.h
===================================================================
--- issm/trunk/src/c/classes/Options/Option.h	(revision 25994)
+++ issm/trunk/src/c/classes/Options/Option.h	(revision 26744)
@@ -28,5 +28,4 @@
 		int           ObjectEnum(){return OptionEnum;};
 
-
 		/*virtual functions: */
 		virtual char* Name()=0;
Index: issm/trunk/src/c/classes/Params/TransientArrayParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/TransientArrayParam.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Params/TransientArrayParam.cpp	(revision 26744)
@@ -20,5 +20,5 @@
 }
 /*}}}*/
-TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N,int in_M){/*{{{*/
+TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,bool cycle_in,int in_N,int in_M){/*{{{*/
 
 	_assert_(in_values && in_time);
@@ -28,10 +28,11 @@
 	this->N=in_N; //Number of timesteps
 	this->interpolation=interpolation_on;
+	this->cycle=cycle_in;
 
 	this->values=xNew<IssmDouble>(M*N);
-	xMemCpy<IssmDouble>(values,in_values,M*N);
+	xMemCpy<IssmDouble>(this->values,in_values,M*N);
 
 	this->timesteps=xNew<IssmDouble>(N);
-	xMemCpy<IssmDouble>(timesteps,in_time,N);
+	xMemCpy<IssmDouble>(this->timesteps,in_time,N);
 }
 /*}}}*/
@@ -44,5 +45,5 @@
 Param* TransientArrayParam::copy() {/*{{{*/
 
-	return new TransientArrayParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->M,this->N);
+	return new TransientArrayParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->cycle,this->M,this->N);
 
 }
@@ -80,4 +81,5 @@
 	marshallhandle->call(this->enum_type);
 	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->cycle);
 	marshallhandle->call(this->M);
 	marshallhandle->call(this->N);
@@ -102,4 +104,6 @@
 	bool       found;
 	_assert_(row>=0 && row<this->M); 
+
+	if(this->cycle) _error_("not implemented yet");
 
 	/*Ok, we have the time and row, go through the timesteps, and figure out which interval we 
@@ -129,5 +133,5 @@
 					IssmDouble deltat = this->timesteps[i+1]-this->timesteps[i];
 					IssmDouble alpha  = (time-this->timesteps[i])/deltat;
-					if(interpolation==true) output=(1.0-alpha)*this->values[row*this->N+i] + alpha*this->values[row*this->N+i+1];
+					if(this->interpolation==true) output=(1.0-alpha)*this->values[row*this->N+i] + alpha*this->values[row*this->N+i+1];
 					else output=this->values[row*this->N+i];
 					found=true;
Index: issm/trunk/src/c/classes/Params/TransientArrayParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/TransientArrayParam.h	(revision 25994)
+++ issm/trunk/src/c/classes/Params/TransientArrayParam.h	(revision 26744)
@@ -25,4 +25,5 @@
 		int         M;
 		bool        interpolation;
+		bool        cycle;
 		IssmDouble *values;
 		IssmDouble *timesteps;
@@ -31,5 +32,5 @@
 		/*TransientArrayParam constructors, destructors: {{{*/
 		TransientArrayParam();
-		TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N,int in_M);
+		TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,bool cycle_in,int in_N,int in_M);
 		~TransientArrayParam();
 		/*}}}*/
Index: issm/trunk/src/c/classes/Params/TransientParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/TransientParam.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Params/TransientParam.cpp	(revision 26744)
@@ -20,17 +20,18 @@
 }
 /*}}}*/
-TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N){/*{{{*/
+TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,bool cycle_in,int in_N){/*{{{*/
 
 	_assert_(in_values && in_time);
 
-	enum_type=in_enum_type;
-	N=in_N;
-	interpolation=interpolation_on;
+	this->enum_type=in_enum_type;
+	this->N=in_N;
+	this->interpolation=interpolation_on;
+	this->cycle=cycle_in;
 
-	values=xNew<IssmDouble>(N);
-	xMemCpy<IssmDouble>(values,in_values,N);
+	this->values=xNew<IssmDouble>(N);
+	xMemCpy<IssmDouble>(this->values,in_values,N);
 
-	timesteps=xNew<IssmDouble>(N);
-	xMemCpy<IssmDouble>(timesteps,in_time,N);
+	this->timesteps=xNew<IssmDouble>(N);
+	xMemCpy<IssmDouble>(this->timesteps,in_time,N);
 }
 /*}}}*/
@@ -44,5 +45,5 @@
 Param* TransientParam::copy() {/*{{{*/
 
-	return new TransientParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->N);
+	return new TransientParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->cycle,this->N);
 
 }
@@ -75,4 +76,5 @@
 	marshallhandle->call(this->enum_type);
 	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->cycle);
 	marshallhandle->call(this->N);
 	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
@@ -97,4 +99,6 @@
 	IssmDouble output;
 	bool   found;
+
+	if(this->cycle) _error_("not implemented yet!");
 
 	/*Ok, we have the time, go through the timesteps, and figure out which interval we 
@@ -124,5 +128,5 @@
 					IssmDouble deltat=this->timesteps[i+1]-this->timesteps[i];
 					IssmDouble alpha=(time-this->timesteps[i])/deltat;
-					if(interpolation==true) output=(1.0-alpha)*this->values[i] + alpha*this->values[i+1];
+					if(this->interpolation==true) output=(1.0-alpha)*this->values[i] + alpha*this->values[i+1];
 					else output=this->values[i];
 					found=true;
Index: issm/trunk/src/c/classes/Params/TransientParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/TransientParam.h	(revision 25994)
+++ issm/trunk/src/c/classes/Params/TransientParam.h	(revision 26744)
@@ -24,4 +24,5 @@
 		int         N;
 		bool        interpolation;
+		bool        cycle;
 		IssmDouble *values;
 		IssmDouble *timesteps;
@@ -30,5 +31,5 @@
 		/*TransientParam constructors, destructors: {{{*/
 		TransientParam();
-		TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N);
+		TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_in,bool cycle_in,int in_N);
 		~TransientParam();
 		/*}}}*/
Index: issm/trunk/src/c/classes/Profiler.h
===================================================================
--- issm/trunk/src/c/classes/Profiler.h	(revision 25994)
+++ issm/trunk/src/c/classes/Profiler.h	(revision 26744)
@@ -22,19 +22,19 @@
 #define MOVINGFRONTCORE		9 /*Profiling MOVINGFRONT */
 #define MASSTRANSPORTCORE	10 /*Profiling MASSTRANSPORT */
-#define SMBCORE				11 /*Profiling SMB */
-#define GROUNDINGLINECORE	12 /*Profiling GROUDINGLINE MIGRATION */
-#define GIACORE				13 /*Profiling GIA */
+#define OCEANTRANSPORTCORE	11 /*Profiling OCEANTRANSPORT */
+#define SMBCORE				12 /*Profiling SMB */
+#define GROUNDINGLINECORE	13 /*Profiling GROUDINGLINE MIGRATION */
 #define ESACORE				14 /*Profiling ESA */
 #define SLRCORE				15 /*Profiling SLR */
-#define MPISERIAL				16 /*Profiling MPISerial */
-#define SEDLOOP				17 /*Profiling MPISerial */
-#define SEDMatrix				18 /*Profiling MPISerial */
-#define SEDUpdate				19 /*Profiling MPISerial */
-#define EPLLOOP				20 /*Profiling MPISerial */
-#define EPLMasking			21 /*Profiling MPISerial */
-#define EPLMatrices			22 /*Profiling MPISerial */
-#define EPLUpdate				23 /*Profiling MPISerial */
-#define MAXPROFSIZE			24 /*Used to initialize static arrays*/
-
+#define SAMPLINGCORE	16 /*Profiling SAMPLING */
+#define MPISERIAL				17 /*Profiling MPISerial */
+#define SEDLOOP				18 /*Profiling MPISerial */
+#define SEDMatrix				19 /*Profiling MPISerial */
+#define SEDUpdate				20 /*Profiling MPISerial */
+#define EPLLOOP				21 /*Profiling MPISerial */
+#define EPLMasking			22 /*Profiling MPISerial */
+#define EPLMatrices			23 /*Profiling MPISerial */
+#define EPLUpdate				24 /*Profiling MPISerial */
+#define MAXPROFSIZE			25 /*Used to initialize static arrays*/
 
 class Profiler: public Object{
Index: issm/trunk/src/c/classes/Radar.h
===================================================================
--- issm/trunk/src/c/classes/Radar.h	(revision 25994)
+++ issm/trunk/src/c/classes/Radar.h	(revision 26744)
@@ -18,10 +18,10 @@
 		char* name;
 		int	definitionenum;
-		
+
 		/*Radar constructors, destructors :*/
 		Radar();
 		Radar(char* in_name, int in_definitionenum);
 		~Radar();
-		
+
 		/*Object virtual function resolutoin: */
 		Object* copy();
@@ -31,5 +31,5 @@
 		void Marshall(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
-		
+
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum();
Index: issm/trunk/src/c/classes/SealevelGeometry.cpp
===================================================================
--- issm/trunk/src/c/classes/SealevelGeometry.cpp	(revision 26744)
+++ issm/trunk/src/c/classes/SealevelGeometry.cpp	(revision 26744)
@@ -0,0 +1,156 @@
+/*
+ * \file SealevelGeometry.cpp
+ * \brief: Implementation of SealevelGeometry class
+ */
+
+/*Headers: {{{*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./SealevelGeometry.h"
+
+using namespace std;
+/*}}}*/
+
+/*Object constructors and destructor*/
+SealevelGeometry::SealevelGeometry(int localnelin,int localnodsin){ /*{{{*/
+	localnel=localnelin;
+	for(int i=0;i<SLGEOM_NUMLOADS;i++){
+		for (int j=0;j<SLMAXVERTICES;j++){
+			LoadWeigths[i][j]=xNewZeroInit<IssmDouble>(localnel);
+		}
+		vlatbarycentre[i]=NULL; //we don't know yet 
+		vlongbarycentre[i]=NULL;
+		vareae_subel[i]=NULL;
+		latbarycentre[i]=NULL; //we don't know yet 
+		longbarycentre[i]=NULL;
+		area_subel[i]=NULL;
+
+		LoadArea[i]=xNewZeroInit<IssmDouble>(localnel);
+		issubelement[i]=xNewZeroInit<bool>(localnel);
+		subelementmapping[i]=NULL;
+		nsubel[i]=0;
+		nbar[i]=0;
+	}
+	late=xNew<IssmDouble>(localnel);
+	longe=xNew<IssmDouble>(localnel);
+	isoceanin=xNew<bool>(localnel);
+	lids=xNew<int>(localnodsin);
+
+}; /*}}}*/
+SealevelGeometry::~SealevelGeometry(){ /*{{{*/
+	for(int i=0;i<SLGEOM_NUMLOADS;i++){
+		for (int j=0;j<SLMAXVERTICES;j++){
+			xDelete<IssmDouble>(LoadWeigths[i][j]);
+		}
+		xDelete<IssmDouble>(LoadArea[i]);
+		xDelete<bool>(issubelement[i]);
+		xDelete<int>(subelementmapping[i]);
+		delete  vlatbarycentre[i];
+		delete  vlongbarycentre[i];
+		delete  vareae_subel[i];
+		xDelete<IssmDouble>(latbarycentre[i]);
+		xDelete<IssmDouble>(longbarycentre[i]);
+		xDelete<IssmDouble>(area_subel[i]);
+	}
+	xDelete<IssmDouble>(late);
+	xDelete<IssmDouble>(longe);
+	xDelete<bool>(isoceanin);
+	xDelete<int>(lids);
+}; /*}}}*/
+
+void SealevelGeometry::InitializeMappingsAndBarycentres(void){ /*{{{*/
+
+	int dummy;
+	bool fromlocalsize=true;
+	int lower_row;
+
+	for (int i=0;i<SLGEOM_NUMLOADS;i++){
+		subelementmapping[i]=xNew<int>(localnel);
+		GetOwnershipBoundariesFromRange(&lower_row,&dummy,nsubel[i],IssmComm::GetComm());
+
+		int count=0;
+		for (int j=0;j<localnel;j++){
+			if(issubelement[i][j]){
+				subelementmapping[i][j]=lower_row+count;
+				count++;
+			}
+		}
+	}
+
+	/*Initialize barycentre vectors, now that we know their size: */
+	for (int i=0;i<SLGEOM_NUMLOADS;i++){
+		vlatbarycentre[i]=new Vector<IssmDouble>(nsubel[i],fromlocalsize);
+		vlongbarycentre[i]=new Vector<IssmDouble>(nsubel[i],fromlocalsize);
+		vareae_subel[i]=new Vector<IssmDouble>(nsubel[i],fromlocalsize);
+		vlatbarycentre[i]->GetSize(&nbar[i]);
+	}
+
+} /*}}}*/
+void SealevelGeometry::Assemble(void){ /*{{{*/
+
+	/*Initialize barycentre vectors, now that we know their size: */
+	for (int i=0;i<SLGEOM_NUMLOADS;i++){
+		vlatbarycentre[i]->Assemble();
+		vlongbarycentre[i]->Assemble();
+		vareae_subel[i]->Assemble();
+
+		latbarycentre[i]=vlatbarycentre[i]->ToMPISerial();
+		longbarycentre[i]=vlongbarycentre[i]->ToMPISerial();
+		area_subel[i]=vareae_subel[i]->ToMPISerial();
+	}
+
+	/*Also, we'll need the barycentre associated areas:*/
+
+} /*}}}*/
+int SealevelGeometry::GEnum(int l){ /*{{{*/
+
+	int output = -1;
+	switch(l){
+		case SLGEOM_OCEAN: output=SealevelchangeGsubelOceanEnum; break;
+		case SLGEOM_ICE:   output=SealevelchangeGsubelIceEnum;   break;
+		case SLGEOM_WATER: output=SealevelchangeGsubelHydroEnum; break;
+		default: _error_("not supported");
+	}
+	return output;
+
+} /*}}}*/
+int SealevelGeometry::GUEnum(int l){ /*{{{*/
+
+	int output = -1;
+	switch(l){
+		case SLGEOM_OCEAN: output=SealevelchangeGUsubelOceanEnum; break;
+		case SLGEOM_ICE:   output=SealevelchangeGUsubelIceEnum;   break;
+		case SLGEOM_WATER: output=SealevelchangeGUsubelHydroEnum; break;
+		default: _error_("not supported");
+	}
+	return output;
+
+} /*}}}*/
+int SealevelGeometry::GNEnum(int l){ /*{{{*/
+
+	int output = -1;
+	switch(l){
+		case SLGEOM_OCEAN: output=SealevelchangeGNsubelOceanEnum; break;
+		case SLGEOM_ICE:   output=SealevelchangeGNsubelIceEnum;   break;
+		case SLGEOM_WATER: output=SealevelchangeGNsubelHydroEnum; break;
+		default: _error_("not supported");
+	}
+
+	return output;
+} /*}}}*/
+int SealevelGeometry::GEEnum(int l){ /*{{{*/
+
+	int output = -1;
+	switch(l){
+		case SLGEOM_OCEAN: output=SealevelchangeGEsubelOceanEnum; break;
+		case SLGEOM_ICE:   output=SealevelchangeGEsubelIceEnum;   break;
+		case SLGEOM_WATER: output=SealevelchangeGEsubelHydroEnum; break;
+		default: _error_("not supported");
+	}
+	return output;
+
+} /*}}}*/
Index: issm/trunk/src/c/classes/SealevelGeometry.h
===================================================================
--- issm/trunk/src/c/classes/SealevelGeometry.h	(revision 26744)
+++ issm/trunk/src/c/classes/SealevelGeometry.h	(revision 26744)
@@ -0,0 +1,48 @@
+/*!\file SealevelGeometry.h
+ * \brief: header file for SealevelMask geometry
+ */
+
+#ifndef _SEALEVELGEOMETRY_H_
+#define _SEALEVELGEOMETRY_H_
+
+/*Headers:*/
+#define SLGEOM_NUMLOADS 3
+#define SLGEOM_OCEAN 0 
+#define SLGEOM_ICE 1 
+#define SLGEOM_WATER 2
+#define SLMAXVERTICES 3
+
+#include "../toolkits/toolkits.h"
+
+class SealevelGeometry{ 
+
+	public: 
+
+		int         localnel;
+		IssmDouble* LoadWeigths[SLGEOM_NUMLOADS][SLMAXVERTICES];
+		IssmDouble* LoadArea[SLGEOM_NUMLOADS];
+		Vector<IssmDouble>* vlatbarycentre[SLGEOM_NUMLOADS];
+		Vector<IssmDouble>* vlongbarycentre[SLGEOM_NUMLOADS];
+		Vector<IssmDouble>* vareae_subel[SLGEOM_NUMLOADS];
+		IssmDouble* latbarycentre[SLGEOM_NUMLOADS];
+		IssmDouble* longbarycentre[SLGEOM_NUMLOADS];
+		IssmDouble* area_subel[SLGEOM_NUMLOADS];
+		IssmDouble* late;
+		IssmDouble* longe;
+		bool* isoceanin;
+		bool*       issubelement[SLGEOM_NUMLOADS]; 
+		int*        subelementmapping[SLGEOM_NUMLOADS];
+		int         nsubel[SLGEOM_NUMLOADS];
+		int         nbar[SLGEOM_NUMLOADS];
+		int*        lids; 
+
+		SealevelGeometry(int localnel,int localnods);
+		~SealevelGeometry();
+		void InitializeMappingsAndBarycentres(void);
+		void Assemble(void);
+		int GEnum(int l);
+		int GUEnum(int l);
+		int GNEnum(int l);
+		int GEEnum(int l);
+};
+#endif  /* _SEALEVELGEOMETRY_H_ */
Index: issm/trunk/src/c/classes/SealevelMasks.h
===================================================================
--- issm/trunk/src/c/classes/SealevelMasks.h	(revision 25994)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*!\file SealevelMasks.h
- * \brief: header file for SealevelMask object
- */
-
-#ifndef _SEALEVELMASKS_H_
-#define _SEALEVELMASKS_H_
-
-/*Headers:*/
-
-class SealevelMasks {
-
-	public: 
-
-		bool*       isiceonly;
-		bool*       isfullyfloating;
-		bool*       notfullygrounded;
-		bool*       isoceanin; 
-		
-		/*SealevelMasks constructors, destructors :*/
-		SealevelMasks(int nel){
-			/*allocate fields:*/
-			this->isiceonly=xNew<bool>(nel);
-			this->isfullyfloating=xNew<bool>(nel);
-			this->notfullygrounded=xNew<bool>(nel);
-			this->isoceanin=xNew<bool>(nel);
-		};
-		~SealevelMasks(){
-			xDelete<bool>(this->isiceonly);
-			xDelete<bool>(this->isfullyfloating);
-			xDelete<bool>(this->notfullygrounded);
-			xDelete<bool>(this->isoceanin);
-		};
-};
-#endif  /* _SEALEVELMASKS_H_ */
Index: issm/trunk/src/c/classes/Vertex.cpp
===================================================================
--- issm/trunk/src/c/classes/Vertex.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/Vertex.cpp	(revision 26744)
@@ -182,4 +182,5 @@
 	switch(this->domaintype){
 		case Domain2DhorizontalEnum:
+		case Domain3DsurfaceEnum:
 			/*Nothing*/
 			return;
Index: issm/trunk/src/c/classes/classes.h
===================================================================
--- issm/trunk/src/c/classes/classes.h	(revision 25994)
+++ issm/trunk/src/c/classes/classes.h	(revision 26744)
@@ -18,5 +18,7 @@
 #include "./Massfluxatgate.h"
 #include "./Misfit.h"
-#include "./SealevelMasks.h"
+#include "./SealevelGeometry.h"
+#include "./GrdLoads.h"
+#include "./BarystaticContributions.h"
 #include "./Nodalvalue.h"
 #include "./Numberedcostfunction.h"
@@ -24,4 +26,5 @@
 #include "./Cfdragcoeffabsgrad.h"
 #include "./Cfsurfacelogvel.h"
+#include "./Cflevelsetmisfit.h"
 #include "./Masscon.h"
 #include "./Massconaxpby.h"
Index: issm/trunk/src/c/classes/gauss/GaussTria.cpp
===================================================================
--- issm/trunk/src/c/classes/gauss/GaussTria.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/gauss/GaussTria.cpp	(revision 26744)
@@ -636,6 +636,13 @@
 } /*}}}*/
 void GaussTria::SynchronizeGaussBase(Gauss* gauss){/*{{{*/
-
-	_error_("not supported");
-}
-/*}}}*/
+	//itapopo check this
+	_assert_(gauss->Enum()==GaussTriaEnum);
+   GaussTria* gauss_tria = xDynamicCast<GaussTria*>(gauss);
+
+   gauss_tria->coord1=this->coord1;
+   gauss_tria->coord2=this->coord2;
+   gauss_tria->coord3=this->coord3;
+   gauss_tria->weight=UNDEF;
+	//_error_("not supported");
+}
+/*}}}*/
Index: issm/trunk/src/c/classes/kriging/Covertree.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Covertree.h	(revision 25994)
+++ issm/trunk/src/c/classes/kriging/Covertree.h	(revision 26744)
@@ -95,5 +95,4 @@
 	bool isValidTree() const;
 
-
 	/**
 	 * Remove point p from the cover tree. If p is not present in the tree,
Index: issm/trunk/src/c/classes/kriging/ExponentialVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/ExponentialVariogram.h	(revision 25994)
+++ issm/trunk/src/c/classes/kriging/ExponentialVariogram.h	(revision 26744)
@@ -29,5 +29,4 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
-
 		/*Variogram functions*/
 		double Covariance(double deltax,double deltay);
Index: issm/trunk/src/c/classes/kriging/PowerVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/PowerVariogram.h	(revision 25994)
+++ issm/trunk/src/c/classes/kriging/PowerVariogram.h	(revision 26744)
@@ -29,5 +29,4 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
-
 		/*Variogram functions*/
 		double Covariance(double deltax,double deltay);
Index: issm/trunk/src/c/classes/kriging/Quadtree.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Quadtree.h	(revision 25994)
+++ issm/trunk/src/c/classes/kriging/Quadtree.h	(revision 26744)
@@ -33,5 +33,4 @@
 				int     ObjectEnum(){_error_("not implemented yet"); };
 
-
 				/*Methods*/
 				int          IsWithinRange(double  x,double y,double range);
Index: issm/trunk/src/c/classes/kriging/SphericalVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/SphericalVariogram.h	(revision 25994)
+++ issm/trunk/src/c/classes/kriging/SphericalVariogram.h	(revision 26744)
@@ -29,5 +29,4 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
-
 		/*Variogram functions*/
 		double Covariance(double deltax,double deltay);
Index: issm/trunk/src/c/classes/matrix/ElementMatrix.cpp
===================================================================
--- issm/trunk/src/c/classes/matrix/ElementMatrix.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/matrix/ElementMatrix.cpp	(revision 26744)
@@ -21,22 +21,7 @@
 
 	this->nrows=0;
-	this->ncols=0;
 	this->values=NULL;
-	this->dofsymmetrical=false;
-
-	this->row_fsize=0;
-	this->row_flocaldoflist=NULL;
-	this->row_fglobaldoflist=NULL;
-	this->row_ssize=0;
-	this->row_slocaldoflist=NULL;
-	this->row_sglobaldoflist=NULL;
-
-	this->col_fsize=0;
-	this->col_flocaldoflist=NULL;
-	this->col_fglobaldoflist=NULL;
-	this->col_ssize=0;
-	this->col_slocaldoflist=NULL;
-	this->col_sglobaldoflist=NULL;
-
+	this->fglobaldoflist=NULL;
+	this->sglobaldoflist=NULL;
 }
 /*}}}*/
@@ -52,7 +37,4 @@
 	/*intermediaries*/
 	int i,j,counter;
-	int gsize,fsize,ssize;
-	int* P=NULL;
-	bool found;
 
 	/*If one of the two matrix is NULL, we copy the other one*/
@@ -70,13 +52,12 @@
 
 	/*General Case: Ke1 and Ke2 are not empty*/
-	if(!Ke1->dofsymmetrical || !Ke2->dofsymmetrical) _error_("merging 2 non dofsymmetrical matrices not implemented yet");
 
 	/*Initialize itransformation matrix Ke[P[i]] = Ke2[i]*/
-	P=xNew<int>(Ke2->nrows);
+	int* P=xNew<int>(Ke2->nrows);
 
 	/*1: Get the new numbering of Ke2 and get size of the new matrix*/
-	gsize=Ke1->nrows;
+	int gsize=Ke1->nrows;
 	for(i=0;i<Ke2->nrows;i++){
-		found=false;
+		bool found=false;
 		for(j=0;j<Ke1->nrows;j++){
 			if(Ke2->gglobaldoflist[i]==Ke1->gglobaldoflist[j]){
@@ -91,84 +72,26 @@
 	/*2: Initialize static fields*/
 	this->nrows=gsize;
-	this->ncols=gsize;
-	this->dofsymmetrical=true;
 
 	/*Gset and values*/
 	this->gglobaldoflist=xNew<int>(this->nrows);
-	this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols);
+	this->fglobaldoflist=xNew<int>(this->nrows);
+	this->sglobaldoflist=xNew<int>(this->nrows);
+	this->values=xNewZeroInit<IssmDouble>(this->nrows*this->nrows);
 	for(i=0;i<Ke1->nrows;i++){
-		for(j=0;j<Ke1->ncols;j++){
-			this->values[i*this->ncols+j] += Ke1->values[i*Ke1->ncols+j];
+		for(j=0;j<Ke1->nrows;j++){
+			this->values[i*this->nrows+j] += Ke1->values[i*Ke1->nrows+j];
 		}
 		this->gglobaldoflist[i]=Ke1->gglobaldoflist[i];
+		this->fglobaldoflist[i]=Ke1->fglobaldoflist[i];
+		this->sglobaldoflist[i]=Ke1->sglobaldoflist[i];
 	}
 	for(i=0;i<Ke2->nrows;i++){
-		for(j=0;j<Ke2->ncols;j++){
-			this->values[P[i]*this->ncols+P[j]] += Ke2->values[i*Ke2->ncols+j];
+		for(j=0;j<Ke2->nrows;j++){
+			this->values[P[i]*this->nrows+P[j]] += Ke2->values[i*Ke2->nrows+j];
 		}
 		this->gglobaldoflist[P[i]]=Ke2->gglobaldoflist[i];
-	}
-
-	/*Fset*/
-	fsize=Ke1->row_fsize;
-	for(i=0;i<Ke2->row_fsize;i++){
-		if(P[Ke2->row_flocaldoflist[i]] >= Ke1->nrows) fsize++;
-	}
-	this->row_fsize=fsize;
-	if(fsize){
-		this->row_flocaldoflist =xNew<int>(fsize);
-		this->row_fglobaldoflist=xNew<int>(fsize);
-		for(i=0;i<Ke1->row_fsize;i++){
-			this->row_flocaldoflist[i] =Ke1->row_flocaldoflist[i];
-			this->row_fglobaldoflist[i]=Ke1->row_fglobaldoflist[i];
-		}
-		counter=Ke1->row_fsize;
-		for(i=0;i<Ke2->row_fsize;i++){
-			if(P[Ke2->row_flocaldoflist[i]] >= Ke1->nrows){
-				this->row_flocaldoflist[counter] =P[Ke2->row_flocaldoflist[i]];
-				this->row_fglobaldoflist[counter]=Ke2->row_fglobaldoflist[i];
-				counter++;
-			}
-		}
-	}
-	else{
-		this->row_flocaldoflist=NULL;
-		this->row_fglobaldoflist=NULL;
-	}
-
-	/*Sset*/
-	ssize=Ke1->row_ssize;
-	for(i=0;i<Ke2->row_ssize;i++){
-		if(P[Ke2->row_slocaldoflist[i]] >= Ke1->nrows) ssize++;
-	}
-	this->row_ssize=ssize;
-	if(ssize){
-		this->row_slocaldoflist =xNew<int>(ssize);
-		this->row_sglobaldoflist=xNew<int>(ssize);
-		for(i=0;i<Ke1->row_ssize;i++){
-			this->row_slocaldoflist[i] =Ke1->row_slocaldoflist[i];
-			this->row_sglobaldoflist[i]=Ke1->row_sglobaldoflist[i];
-		}
-		counter=Ke1->row_ssize;
-		for(i=0;i<Ke2->row_ssize;i++){
-			if(P[Ke2->row_slocaldoflist[i]] >= Ke1->nrows){
-				this->row_slocaldoflist[counter] =P[Ke2->row_slocaldoflist[i]];
-				this->row_sglobaldoflist[counter]=Ke2->row_sglobaldoflist[i];
-				counter++;
-			}
-		}
-	}
-	else{
-		this->row_slocaldoflist=NULL;
-		this->row_sglobaldoflist=NULL;
-	}
-
-	/*don't do cols, we can pick them up from the rows: */
-	this->col_fsize=0;
-	this->col_flocaldoflist=NULL;
-	this->col_fglobaldoflist=NULL;
-	this->col_ssize=0;
-	this->col_slocaldoflist=NULL;
-	this->col_sglobaldoflist=NULL;
+		this->fglobaldoflist[P[i]]=Ke2->fglobaldoflist[i];
+		this->sglobaldoflist[P[i]]=Ke2->sglobaldoflist[i];
+	}
 
 	/*clean-up*/
@@ -193,29 +116,12 @@
 
 	/*get Matrix size and properties*/
-	this->dofsymmetrical=true;
 	this->nrows=GetNumberOfDofs(nodes,numnodes,GsetEnum,approximation);
-	this->ncols=this->nrows;
 
 	/*fill values with 0: */
-	this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols);
-
-	/*g list*/
+	this->values=xNewZeroInit<IssmDouble>(this->nrows*this->nrows);
+
 	this->gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
-
-	/*get dof lists for f and s set: */
-	this->row_fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
-	this->row_flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
-	this->row_fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
-	this->row_ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);
-	this->row_slocaldoflist =GetLocalDofList( nodes,numnodes,SsetEnum,approximation);
-	this->row_sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
-
-	/*Because this matrix is "dofsymmetrical" don't do cols, we can pick them up from the rows: */
-	this->col_fsize=0;
-	this->col_flocaldoflist=NULL;
-	this->col_fglobaldoflist=NULL;
-	this->col_ssize=0;
-	this->col_slocaldoflist=NULL;
-	this->col_sglobaldoflist=NULL;
+	this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
+	this->sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
 }
 /*}}}*/
@@ -224,12 +130,6 @@
 	xDelete<IssmDouble>(this->values);
 	xDelete<int>(this->gglobaldoflist);
-	xDelete<int>(this->row_flocaldoflist);
-	xDelete<int>(this->row_fglobaldoflist);
-	xDelete<int>(this->row_slocaldoflist);
-	xDelete<int>(this->row_sglobaldoflist);
-	xDelete<int>(this->col_flocaldoflist);
-	xDelete<int>(this->col_fglobaldoflist);
-	xDelete<int>(this->col_slocaldoflist);
-	xDelete<int>(this->col_sglobaldoflist);
+	xDelete<int>(this->fglobaldoflist);
+	xDelete<int>(this->sglobaldoflist);
 }
 /*}}}*/
@@ -246,23 +146,22 @@
 	this->CheckConsistency();
 
-	if(this->dofsymmetrical){
-		/*only use row dofs to add values into global matrices: */
-
-		if(this->row_fsize){
-			/*first, retrieve values that are in the f-set from the g-set values matrix: */
-			localvalues=xNew<IssmDouble>(this->row_fsize);
-			for(int i=0;i<this->row_fsize;i++){
-				localvalues[i] = this->values[this->ncols*this->row_flocaldoflist[i]+ this->row_flocaldoflist[i]];
-			}
-
-			/*add local values into global  matrix, using the fglobaldoflist: */
-			pf->SetValues(this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
-
-			/*Free ressources:*/
-			xDelete<IssmDouble>(localvalues);
-		}
-	}
-	else{
-		_error_("non dofsymmetrical matrix AddToGlobal routine not support yet!");
+	/*do we have any component in the F set?*/
+	int fsize = 0;
+	for(int i=0;i<this->nrows;i++){
+		if(this->fglobaldoflist[i]>=0) fsize++;
+	}
+
+	if(fsize){
+		/*first, retrieve values that are in the f-set from the g-set values matrix: */
+		localvalues=xNew<IssmDouble>(this->nrows);
+		for(int i=0;i<this->nrows;i++){
+			localvalues[i] = this->values[this->nrows*i + i];
+		}
+
+		/*add local values into global  matrix, using the fglobaldoflist: */
+		pf->SetValues(fsize,this->fglobaldoflist,localvalues,ADD_VAL);
+
+		/*Free ressources:*/
+		xDelete<IssmDouble>(localvalues);
 	}
 
@@ -270,7 +169,4 @@
 /*}}}*/
 void ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){/*{{{*/
-
-	int i,j;
-	IssmDouble* localvalues=NULL;
 
 	/*Check that Kff has been alocated in debugging mode*/
@@ -286,48 +182,27 @@
 	this->CheckConsistency();
 
-	if(this->dofsymmetrical){
-		/*only use row dofs to add values into global matrices: */
-
-		if(this->row_fsize){
-			/*first, retrieve values that are in the f-set from the g-set values matrix: */
-			localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize);
-			for(i=0;i<this->row_fsize;i++){
-				for(j=0;j<this->row_fsize;j++){
-					localvalues[this->row_fsize*i+j]=this->values[this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]];
-				}
-			}
-
-			/*add local values into global  matrix, using the fglobaldoflist: */
-			Kff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
-
-			/*Free ressources:*/
-			xDelete<IssmDouble>(localvalues);
-		}
-
-		if((this->row_ssize!=0) && (this->row_fsize!=0)){
-			/*first, retrieve values that are in the f and s-set from the g-set values matrix: */
-			localvalues=xNew<IssmDouble>(this->row_fsize*this->row_ssize);
-			for(i=0;i<this->row_fsize;i++){
-				for(j=0;j<this->row_ssize;j++){
-					localvalues[this->row_ssize*i+j]=this->values[this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]];
-				}
-			}
-			/*add local values into global  matrix, using the fglobaldoflist: */
-			Kfs->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,localvalues,ADD_VAL);
-
-			/*Free ressources:*/
-			xDelete<IssmDouble>(localvalues);
-		}
-	}
-	else{
-		_error_("non dofsymmetrical matrix AddToGlobal routine not support yet!");
-	}
-
+	/*do we have any component in the F or S set?*/
+   bool is_fset= false;
+	bool is_sset= false;
+   for(int i=0;i<this->nrows;i++){
+      if(this->fglobaldoflist[i]>=0){
+         is_fset = true;
+      }
+		else{
+			_assert_(this->sglobaldoflist[i]>=0);
+			is_sset = true;
+		}
+   }
+
+	/*only use row dofs to add values into global matrices: */
+	if(is_fset){
+		Kff->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->fglobaldoflist,this->values,ADD_VAL);
+	}
+	if(is_fset && is_sset){
+		Kfs->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->sglobaldoflist,this->values,ADD_VAL);
+	}
 }
 /*}}}*/
 void ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Jff){/*{{{*/
-
-	int i,j;
-	IssmDouble* localvalues=NULL;
 
 	/*Check that Jff is not NULL*/
@@ -337,27 +212,16 @@
 	this->CheckConsistency();
 
-	if(this->dofsymmetrical){
-		/*only use row dofs to add values into global matrices: */
-
-		if(this->row_fsize){
-			/*first, retrieve values that are in the f-set from the g-set values matrix: */
-			localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize);
-			for(i=0;i<this->row_fsize;i++){
-				for(j=0;j<this->row_fsize;j++){
-					*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
-				}
-			}
-			/*add local values into global  matrix, using the fglobaldoflist: */
-			Jff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
-
-			/*Free ressources:*/
-			xDelete<IssmDouble>(localvalues);
-		}
-
-	}
-	else{
-		_error_("non dofsymmetrical matrix AddToGlobal routine not support yet!");
-	}
-
+	/*do we have any component in the F set?*/
+	bool isfset= false;
+	for(int i=0;i<this->nrows;i++){
+		if(this->fglobaldoflist[i]>=0){
+			isfset = true;
+			break;
+		}
+   }
+
+	if(isfset){
+		Jff->SetValues(this->nrows,this->fglobaldoflist,this->nrows,this->fglobaldoflist,this->values,ADD_VAL);
+	}
 }
 /*}}}*/
@@ -366,8 +230,8 @@
 	#ifdef _ISSM_DEBUG_ 
 	for (int i=0;i<this->nrows;i++){
-		for(int j=0;j<this->ncols;j++){
-			if (xIsNan<IssmDouble>(this->values[i*this->ncols+j])) _error_("NaN found in Element Matrix");
-			if (xIsInf<IssmDouble>(this->values[i*this->ncols+j])) _error_("Inf found in Element Matrix");
-			if (fabs(this->values[i*this->ncols+j])>1.e+50) _error_("Element Matrix values exceeds 1.e+50");
+		for(int j=0;j<this->nrows;j++){
+			if (xIsNan<IssmDouble>(this->values[i*this->nrows+j])) _error_("NaN found in Element Matrix");
+			if (xIsInf<IssmDouble>(this->values[i*this->nrows+j])) _error_("Inf found in Element Matrix");
+			if (fabs(this->values[i*this->nrows+j])>1.e+50) _error_("Element Matrix values exceeds 1.e+50");
 		}
 	}
@@ -380,11 +244,9 @@
 	_printf_("Element Matrix echo:\n");
 	_printf_("   nrows: " << this->nrows << "\n");
-	_printf_("   ncols: " << this->ncols << "\n");
-	_printf_("   dofsymmetrical: " << (dofsymmetrical?"true":"false") << "\n");
 
 	_printf_("   values:\n");
 	for(i=0;i<nrows;i++){
 		_printf_(setw(4) << right << i << ": ");
-		for(j=0;j<ncols;j++) _printf_( " " << setw(11) << setprecision (5) << right << values[i*ncols+j]);
+		for(j=0;j<nrows;j++) _printf_( " " << setw(11) << setprecision (5) << right << values[i*nrows+j]);
 		_printf_("\n");
 	}
@@ -393,29 +255,9 @@
 	if(gglobaldoflist) for(i=0;i<nrows;i++) _printf_(" " << gglobaldoflist[i]); _printf_("\n");
 
-	_printf_("   row_fsize: " << row_fsize << "\n");
-	_printf_("   row_flocaldoflist  (" << row_flocaldoflist << "): ");
-	if(row_flocaldoflist) for(i=0;i<row_fsize;i++) _printf_(" " << row_flocaldoflist[i] ); _printf_(" \n");
-	_printf_("   row_fglobaldoflist  (" << row_fglobaldoflist << "): ");
-	if(row_fglobaldoflist) for(i=0;i<row_fsize;i++)_printf_(" " << row_fglobaldoflist[i]); _printf_(" \n");
-
-	_printf_("   row_ssize: " << row_ssize << "\n");
-	_printf_("   row_slocaldoflist  (" << row_slocaldoflist << "): ");
-	if(row_slocaldoflist) for(i=0;i<row_ssize;i++) _printf_(" " << row_slocaldoflist[i] ); _printf_(" \n");
-	_printf_("   row_sglobaldoflist  (" << row_sglobaldoflist << "): ");
-	if(row_sglobaldoflist) for(i=0;i<row_ssize;i++)_printf_(" " << row_sglobaldoflist[i]); _printf_(" \n");
-
-	if(!dofsymmetrical){
-		_printf_("   col_fsize: " << col_fsize << "\n");
-		_printf_("   col_flocaldoflist  (" << col_flocaldoflist << "): ");
-		if(col_flocaldoflist) for(i=0;i<col_fsize;i++) _printf_(" " << col_flocaldoflist[i] ); _printf_(" \n");
-		_printf_("   col_fglobaldoflist  (" << col_fglobaldoflist << "): ");
-		if(col_fglobaldoflist) for(i=0;i<col_fsize;i++)_printf_(" " << col_fglobaldoflist[i]); _printf_(" \n");
-
-		_printf_("   col_ssize: " << col_ssize << "\n");
-		_printf_("   col_slocaldoflist  (" << col_slocaldoflist << "): ");
-		if(col_slocaldoflist) for(i=0;i<col_ssize;i++) _printf_(" " << col_slocaldoflist[i] ); _printf_(" \n");
-		_printf_("   col_sglobaldoflist  (" << col_sglobaldoflist << "): ");
-		if(col_sglobaldoflist) for(i=0;i<col_ssize;i++)_printf_(" " << col_sglobaldoflist[i]); _printf_(" \n");
-	}
+	_printf_("   fglobaldoflist  (" << fglobaldoflist << "): ");
+	for(i=0;i<nrows;i++)_printf_(" " << fglobaldoflist[i]); _printf_(" \n");
+
+	_printf_("   sglobaldoflist  (" << sglobaldoflist << "): ");
+	for(i=0;i<nrows;i++)_printf_(" " << sglobaldoflist[i]); _printf_(" \n");
 }
 /*}}}*/
@@ -426,71 +268,23 @@
 
 	this->nrows =Ke->nrows;
-	this->ncols =Ke->ncols;
-	this->dofsymmetrical=Ke->dofsymmetrical;
-
-	this->values=xNew<IssmDouble>(this->nrows*this->ncols);
-	xMemCpy<IssmDouble>(this->values,Ke->values,this->nrows*this->ncols);
+
+	this->values=xNew<IssmDouble>(this->nrows*this->nrows);
+	xMemCpy<IssmDouble>(this->values,Ke->values,this->nrows*this->nrows);
 
 	this->gglobaldoflist=xNew<int>(this->nrows);
 	xMemCpy<int>(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows);
-
-	this->row_fsize=Ke->row_fsize;
-	if(this->row_fsize){
-		this->row_flocaldoflist=xNew<int>(this->row_fsize);
-		xMemCpy<int>(this->row_flocaldoflist,Ke->row_flocaldoflist,this->row_fsize);
-		this->row_fglobaldoflist=xNew<int>(this->row_fsize);
-		xMemCpy<int>(this->row_fglobaldoflist,Ke->row_fglobaldoflist,this->row_fsize);
-	}
-	else{
-		this->row_flocaldoflist=NULL;
-		this->row_fglobaldoflist=NULL;
-	}
-
-	this->row_ssize=Ke->row_ssize;
-	if(this->row_ssize){
-		this->row_slocaldoflist=xNew<int>(this->row_ssize);
-		xMemCpy<int>(this->row_slocaldoflist,Ke->row_slocaldoflist,this->row_ssize);
-		this->row_sglobaldoflist=xNew<int>(this->row_ssize);
-		xMemCpy<int>(this->row_sglobaldoflist,Ke->row_sglobaldoflist,this->row_ssize);
-	}
-	else{
-		this->row_slocaldoflist=NULL;
-		this->row_sglobaldoflist=NULL;
-	}
-
-	this->col_fsize=Ke->col_fsize;
-	if(this->col_fsize){
-		this->col_flocaldoflist=xNew<int>(this->col_fsize);
-		xMemCpy<int>(this->col_flocaldoflist,Ke->col_flocaldoflist,this->col_fsize);
-		this->col_fglobaldoflist=xNew<int>(this->col_fsize);
-		xMemCpy<int>(this->col_fglobaldoflist,Ke->col_fglobaldoflist,this->col_fsize);
-	}
-	else{
-		this->col_flocaldoflist=NULL;
-		this->col_fglobaldoflist=NULL;
-	}
-
-	this->col_ssize=Ke->col_ssize;
-	if(this->col_ssize){
-		this->col_slocaldoflist=xNew<int>(this->col_ssize);
-		xMemCpy<int>(this->col_slocaldoflist,Ke->col_slocaldoflist,this->col_ssize);
-		this->col_sglobaldoflist=xNew<int>(this->col_ssize);
-		xMemCpy<int>(this->col_sglobaldoflist,Ke->col_sglobaldoflist,this->col_ssize);
-	}
-	else{
-		this->col_slocaldoflist=NULL;
-		this->col_sglobaldoflist=NULL;
-	}
+	this->fglobaldoflist=xNew<int>(this->nrows);
+	xMemCpy<int>(this->fglobaldoflist,Ke->fglobaldoflist,this->nrows);
+	this->sglobaldoflist=xNew<int>(this->nrows);
+	xMemCpy<int>(this->sglobaldoflist,Ke->sglobaldoflist,this->nrows);
 }
 /*}}}*/
 void ElementMatrix::Lump(void){/*{{{*/
 
-	if(!dofsymmetrical) _error_("not supported yet");
-
 	for(int i=0;i<this->nrows;i++){
-		for(int j=0;j<this->ncols;j++){
+		for(int j=0;j<this->nrows;j++){
 			if(i!=j){
-				this->values[i*this->ncols+i] += this->values[i*this->ncols+j];
-				this->values[i*this->ncols+j]  = 0.;
+				this->values[i*this->nrows+i] += this->values[i*this->nrows+j];
+				this->values[i*this->nrows+j]  = 0.;
 			}
 		}
@@ -505,15 +299,6 @@
 	ElementMatrix* Ke_copy=new ElementMatrix(this);
 
-	/*Update sizes*/
-	this->nrows=Ke_copy->ncols;
-	this->ncols=Ke_copy->nrows;
-
 	/*Transpose values*/
-	for (int i=0;i<this->nrows;i++) for(int j=0;j<this->ncols;j++) this->values[i*this->ncols+j]=Ke_copy->values[j*Ke_copy->ncols+i];
-
-	/*Transpose indices*/
-	if(!dofsymmetrical){
-		_error_("not supported yet");
-	}
+	for (int i=0;i<this->nrows;i++) for(int j=0;j<this->nrows;j++) this->values[i*this->nrows+j]=Ke_copy->values[j*Ke_copy->nrows+i];
 
 	/*Clean up and return*/
@@ -540,5 +325,5 @@
 
 	/*Checks in debugging mode*/
-	_assert_(this->nrows==this->ncols && bsize>0 && bsize<this->ncols && this->values); 
+	_assert_(bsize>0 && bsize<this->nrows && this->values); 
 
 	/*Intermediaries*/
@@ -577,8 +362,8 @@
 	Kbi = xNew<IssmDouble>(bsize*isize);
 	Kbb = xNew<IssmDouble>(bsize*bsize);
-	for(i=0;i<isize;i++) for(j=0;j<isize;j++) Kii[i*isize+j] = this->values[iindices[i]*this->ncols + iindices[j]];
-	for(i=0;i<isize;i++) for(j=0;j<bsize;j++) Kib[i*bsize+j] = this->values[iindices[i]*this->ncols + bindices[j]];
-	for(i=0;i<bsize;i++) for(j=0;j<isize;j++) Kbi[i*isize+j] = this->values[bindices[i]*this->ncols + iindices[j]];
-	for(i=0;i<bsize;i++) for(j=0;j<bsize;j++) Kbb[i*bsize+j] = this->values[bindices[i]*this->ncols + bindices[j]];
+	for(i=0;i<isize;i++) for(j=0;j<isize;j++) Kii[i*isize+j] = this->values[iindices[i]*this->nrows + iindices[j]];
+	for(i=0;i<isize;i++) for(j=0;j<bsize;j++) Kib[i*bsize+j] = this->values[iindices[i]*this->nrows + bindices[j]];
+	for(i=0;i<bsize;i++) for(j=0;j<isize;j++) Kbi[i*isize+j] = this->values[bindices[i]*this->nrows + iindices[j]];
+	for(i=0;i<bsize;i++) for(j=0;j<bsize;j++) Kbb[i*bsize+j] = this->values[bindices[i]*this->nrows + bindices[j]];
 
 	/*Invert Kbb*/
@@ -607,8 +392,8 @@
 
 	/*Update matrix values*/
-	for(i=0;i<this->nrows*this->ncols;i++) this->values[i]=0.;
+	for(i=0;i<this->nrows*this->nrows;i++) this->values[i]=0.;
 	for(i=0;i<isize;i++){
 		for(j=0;j<isize;j++){
-			this->values[iindices[i]*this->ncols + iindices[j]] = Ktemp[i*isize+j];
+			this->values[iindices[i]*this->nrows + iindices[j]] = Ktemp[i*isize+j];
 		}
 	}
Index: issm/trunk/src/c/classes/matrix/ElementMatrix.h
===================================================================
--- issm/trunk/src/c/classes/matrix/ElementMatrix.h	(revision 25994)
+++ issm/trunk/src/c/classes/matrix/ElementMatrix.h	(revision 26744)
@@ -19,33 +19,12 @@
 class ElementMatrix{
 
+	private:
+		int *gglobaldoflist;
+		int *fglobaldoflist;
+		int *sglobaldoflist;
+
 	public:
-
-		int      nrows;
-		int      ncols;
-		bool     dofsymmetrical;
-		IssmDouble*  values;
-
-		//gset
-		int*     gglobaldoflist;
-
-		/*row wise: */
-		//fset
-		int      row_fsize;
-		int*     row_flocaldoflist;
-		int*     row_fglobaldoflist;
-		//sset
-		int      row_ssize;
-		int*     row_slocaldoflist;
-		int*     row_sglobaldoflist;
-
-		/*column wise: */
-		//fset
-		int      col_fsize;
-		int*     col_flocaldoflist;
-		int*     col_fglobaldoflist;
-		//sset
-		int      col_ssize;
-		int*     col_slocaldoflist;
-		int*     col_sglobaldoflist;
+		int         nrows;
+		IssmDouble *values;
 
 		/*ElementMatrix constructors, destructors*/
Index: issm/trunk/src/c/classes/matrix/ElementVector.cpp
===================================================================
--- issm/trunk/src/c/classes/matrix/ElementVector.cpp	(revision 25994)
+++ issm/trunk/src/c/classes/matrix/ElementVector.cpp	(revision 26744)
@@ -22,6 +22,4 @@
 	this->nrows=0;
 	this->values=NULL;
-	this->fsize=0;
-	this->flocaldoflist=NULL;
 	this->fglobaldoflist=NULL;
 
@@ -29,10 +27,4 @@
 /*}}}*/
 ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2){/*{{{*/
-
-	/*intermediaries*/
-	int i,j,counter;
-	int gsize,fsize;
-	int* P=NULL;
-	bool found;
 
 	/*If one of the two matrix is NULL, we copy the other one*/
@@ -50,11 +42,11 @@
 
 	/*Initialize itransformation matrix pe[P[i]] = pe2[i]*/
-	P=xNew<int>(pe2->nrows);
+	int* P=xNew<int>(pe2->nrows);
 
 	/*1: Get the new numbering of pe2 and get size of the new matrix*/
-	gsize=pe1->nrows;
-	for(i=0;i<pe2->nrows;i++){
-		found=false;
-		for(j=0;j<pe1->nrows;j++){
+	int gsize=pe1->nrows;
+	for(int i=0;i<pe2->nrows;i++){
+		bool found=false;
+		for(int j=0;j<pe1->nrows;j++){
 			if(pe2->gglobaldoflist[i]==pe1->gglobaldoflist[j]){
 				found=true; P[i]=j; break;
@@ -71,39 +63,15 @@
 	/*Gset and values*/
 	this->gglobaldoflist=xNew<int>(this->nrows);
+	this->fglobaldoflist=xNew<int>(this->nrows);
 	this->values=xNewZeroInit<IssmDouble>(this->nrows);
-	for(i=0;i<pe1->nrows;i++){
+	for(int i=0;i<pe1->nrows;i++){
 		this->values[i] += pe1->values[i];
 		this->gglobaldoflist[i]=pe1->gglobaldoflist[i];
-	}
-	for(i=0;i<pe2->nrows;i++){
+		this->fglobaldoflist[i]=pe1->fglobaldoflist[i];
+	}
+	for(int i=0;i<pe2->nrows;i++){
 		this->values[P[i]] += pe2->values[i];
 		this->gglobaldoflist[P[i]]=pe2->gglobaldoflist[i];
-	}
-
-	/*Fset*/
-	fsize=pe1->fsize;
-	for(i=0;i<pe2->fsize;i++){
-		if(P[pe2->flocaldoflist[i]] >= pe1->nrows) fsize++;
-	}
-	this->fsize=fsize;
-	if(fsize){
-		this->flocaldoflist =xNew<int>(fsize);
-		this->fglobaldoflist=xNew<int>(fsize);
-		for(i=0;i<pe1->fsize;i++){
-			this->flocaldoflist[i] =pe1->flocaldoflist[i];
-			this->fglobaldoflist[i]=pe1->fglobaldoflist[i];
-		}
-		counter=pe1->fsize;
-		for(i=0;i<pe2->fsize;i++){
-			if(P[pe2->flocaldoflist[i]] >= pe1->nrows){
-				this->flocaldoflist[counter] =P[pe2->flocaldoflist[i]];
-				this->fglobaldoflist[counter]=pe2->fglobaldoflist[i];
-				counter++;
-			}
-		}
-	}
-	else{
-		this->flocaldoflist=NULL;
-		this->fglobaldoflist=NULL;
+		this->fglobaldoflist[P[i]]=pe2->fglobaldoflist[i];
 	}
 
@@ -134,18 +102,12 @@
 	this->values=xNewZeroInit<IssmDouble>(this->nrows);
 
-	/*g list*/
+	/*dof list*/
 	this->gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
-
-	/*Get fsize*/
-	this->fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
-	this->flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
 	this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
 }
 /*}}}*/
 ElementVector::~ElementVector(){/*{{{*/
-
 	xDelete<IssmDouble>(this->values);
 	xDelete<int>(this->gglobaldoflist);
-	xDelete<int>(this->flocaldoflist);
 	xDelete<int>(this->fglobaldoflist);
 }
@@ -155,21 +117,18 @@
 void ElementVector::AddToGlobal(Vector<IssmDouble>* pf){/*{{{*/
 
-	int i;
-	IssmDouble* localvalues=NULL;
-
 	/*In debugging mode, check consistency (no NaN, and values not too big)*/
 	this->CheckConsistency();
 
-	if(this->fsize){
-		/*first, retrieve values that are in the f-set from the g-set values vector: */
-		localvalues=xNew<IssmDouble>(this->fsize);
-		for(i=0;i<this->fsize;i++){
-			localvalues[i]=this->values[this->flocaldoflist[i]];
-		}
-		/*add local values into global  vector, using the fglobaldoflist: */
-		pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,ADD_VAL);
-
-		/*Free ressources:*/
-		xDelete<IssmDouble>(localvalues);
+	/*do we have any component in the F set?*/
+	bool isfset= false;
+	for(int i=0;i<this->nrows;i++){
+		if(this->fglobaldoflist[i]>=0){
+			isfset = true;
+			break;
+		}
+	}
+
+	if(isfset){
+		pf->SetValues(this->nrows,this->fglobaldoflist,this->values,ADD_VAL);
 	}
 
@@ -194,7 +153,5 @@
 	_printf_("   nrows: " << nrows << "\n");
 	_printf_("   values:\n");
-	for(i=0;i<nrows;i++){
-		_printf_(setw(4) << right << i << ": " << setw(10) << values[i] << "\n");
-	}
+	for(i=0;i<nrows;i++) _printf_(setw(4) << right << i << ": " << setw(10) << values[i] << "\n");
 
 	_printf_("   gglobaldoflist (" << gglobaldoflist << "): ");
@@ -202,10 +159,6 @@
 	_printf_(" \n");
 
-	_printf_("   fsize: " << fsize << "\n");
-	_printf_("   flocaldoflist  (" << flocaldoflist << "): ");
-	if(flocaldoflist) for(i=0;i<fsize;i++) _printf_(" " << flocaldoflist[i] );
-	_printf_(" \n");
 	_printf_("   fglobaldoflist (" << fglobaldoflist << "): ");
-	if(fglobaldoflist) for(i=0;i<fsize;i++) _printf_(" " << fglobaldoflist[i] );
+	if(fglobaldoflist) for(i=0;i<nrows;i++) _printf_(" " << fglobaldoflist[i] );
 	_printf_(" \n");
 }
@@ -223,33 +176,22 @@
 	xMemCpy<int>(this->gglobaldoflist,pe->gglobaldoflist,this->nrows);
 
-	this->fsize=pe->fsize;
-	if(this->fsize){
-		this->flocaldoflist=xNew<int>(this->fsize);
-		xMemCpy<int>(this->flocaldoflist,pe->flocaldoflist,this->fsize);
-		this->fglobaldoflist=xNew<int>(this->fsize);
-		xMemCpy<int>(this->fglobaldoflist,pe->fglobaldoflist,this->fsize);
-	}
-	else{
-		this->flocaldoflist=NULL;
-		this->fglobaldoflist=NULL;
-	}
+	this->fglobaldoflist=xNew<int>(this->nrows);
+	xMemCpy<int>(this->fglobaldoflist,pe->fglobaldoflist,this->nrows);
 }
 /*}}}*/
 void ElementVector::InsertIntoGlobal(Vector<IssmDouble>* pf){/*{{{*/
 
-	int i;
-	IssmDouble* localvalues=NULL;
-
-	if(this->fsize){
-		/*first, retrieve values that are in the f-set from the g-set values vector: */
-		localvalues=xNew<IssmDouble>(this->fsize);
-		for(i=0;i<this->fsize;i++){
-			localvalues[i]=this->values[this->flocaldoflist[i]];
-		}
+	/*do we have any component in the F set?*/
+	bool isfset= false;
+	for(int i=0;i<this->nrows;i++){
+		if(this->fglobaldoflist[i]>=0){
+			isfset = true;
+			break;
+		}
+	}
+
+	if(isfset){
 		/*add local values into global  vector, using the fglobaldoflist: */
-		pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,INS_VAL);
-
-		/*Free ressources:*/
-		xDelete<IssmDouble>(localvalues);
+		pf->SetValues(this->nrows,this->fglobaldoflist,this->values,INS_VAL);
 	}
 
@@ -258,7 +200,5 @@
 void ElementVector::SetValue(IssmDouble scalar){/*{{{*/
 
-	int i;
-
-	for(i=0;i<this->nrows;i++)this->values[i]=scalar;
+	for(int i=0;i<this->nrows;i++)this->values[i]=scalar;
 
 }
@@ -283,5 +223,5 @@
 	/*Checks in debugging mode*/
 	_assert_(bsize>0 && bsize<this->nrows && this->values && Ke); 
-	_assert_(Ke->nrows==Ke->ncols && this->nrows==Ke->nrows);
+	_assert_(this->nrows==Ke->nrows);
 
 	/*Intermediaries*/
@@ -320,6 +260,6 @@
 	Fb  = xNew<IssmDouble>(bsize);
 	Fi  = xNew<IssmDouble>(isize);
-	for(i=0;i<isize;i++) for(j=0;j<bsize;j++) Kib[i*bsize+j] = Ke->values[iindices[i]*Ke->ncols + bindices[j]];
-	for(i=0;i<bsize;i++) for(j=0;j<bsize;j++) Kbb[i*bsize+j] = Ke->values[bindices[i]*Ke->ncols + bindices[j]];
+	for(i=0;i<isize;i++) for(j=0;j<bsize;j++) Kib[i*bsize+j] = Ke->values[iindices[i]*Ke->nrows + bindices[j]];
+	for(i=0;i<bsize;i++) for(j=0;j<bsize;j++) Kbb[i*bsize+j] = Ke->values[bindices[i]*Ke->nrows + bindices[j]];
 	for(i=0;i<bsize;i++) Fb[i] = this->values[bindices[i]];
 	for(i=0;i<isize;i++) Fi[i] = this->values[iindices[i]];
Index: issm/trunk/src/c/classes/matrix/ElementVector.h
===================================================================
--- issm/trunk/src/c/classes/matrix/ElementVector.h	(revision 25994)
+++ issm/trunk/src/c/classes/matrix/ElementVector.h	(revision 26744)
@@ -20,15 +20,11 @@
 class ElementVector{
 
+	private:
+		int *gglobaldoflist;
+		int *fglobaldoflist;
+
 	public:
 		int         nrows;
-		IssmDouble* values;
-
-		//gset
-		int* gglobaldoflist;
-
-		//fset
-		int  fsize;
-		int* flocaldoflist;
-		int* fglobaldoflist;
+		IssmDouble *values;
 
 		/*ElementVector constructors, destructors*/
Index: issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp
===================================================================
--- issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 26744)
@@ -1,5 +1,5 @@
 /*!\file:  CorePointerFromSolutionEnum.cpp
  * \brief: return type of analyses, number of analyses and core solution function.
- */ 
+ */
 
 #ifdef HAVE_CONFIG_H
@@ -59,16 +59,9 @@
 			solutioncore=&masstransport_core;
 			break;
-		case SealevelriseSolutionEnum:
-			solutioncore=&sealevelchange_core;
+		case OceantransportSolutionEnum:
+			solutioncore=&oceantransport_core;
 			break;
 		case EsaSolutionEnum:
 			solutioncore=&esa_core;
-			break;
-		case GiaSolutionEnum:
-			#if _HAVE_GIA_
-			solutioncore=&gia_core;
-			#else
-			_error_("ISSM not compiled with Gia capability");
-			#endif
 			break;
 		case DamageEvolutionSolutionEnum:
@@ -82,4 +75,7 @@
 			#endif
 			break;
+		case SamplingSolutionEnum:
+			solutioncore=&sampling_core;
+			break;
 
 		default:
Index: issm/trunk/src/c/cores/WrapperPreCorePointerFromSolutionEnum.cpp
===================================================================
--- issm/trunk/src/c/cores/WrapperPreCorePointerFromSolutionEnum.cpp	(revision 26744)
+++ issm/trunk/src/c/cores/WrapperPreCorePointerFromSolutionEnum.cpp	(revision 26744)
@@ -0,0 +1,34 @@
+/*!\file:  WrapperPreCorePointerFromSolutionEnum.cpp
+ * \brief: return solution core that is carried out once only for Dakota runs.
+ */ 
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+#include "./cores.h"
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+#include "../solutionsequences/solutionsequences.h"
+
+void WrapperPreCorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype){
+
+	/*output: */
+	void (*solutioncore)(FemModel*)=NULL;
+
+	switch(solutiontype){
+
+		case TransientSolutionEnum:
+			solutioncore=&transient_precore;
+			break;
+		default:
+			break;
+	}
+
+	/*Assign output pointer:*/
+	*psolutioncore=solutioncore;
+
+}
Index: issm/trunk/src/c/cores/ad_core.cpp
===================================================================
--- issm/trunk/src/c/cores/ad_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/ad_core.cpp	(revision 26744)
@@ -326,5 +326,12 @@
 
 			/*First, stop tracing: */
+			#if _CODIPACK_MAJOR_==2
+			auto& tape_codi = IssmDouble::getTape();
+			#elif _CODIPACK_MAJOR_==1
 			auto& tape_codi = IssmDouble::getGlobalTape();
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 			tape_codi.setPassive();
 
Index: issm/trunk/src/c/cores/adjointstressbalance_core.cpp
===================================================================
--- issm/trunk/src/c/cores/adjointstressbalance_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/adjointstressbalance_core.cpp	(revision 26744)
@@ -28,5 +28,5 @@
 	if(VerboseSolution()) _printf0_("   computing velocities\n");
 	femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
-	
+
 	bool is_schur_cg_solver = false;
 	#ifdef _HAVE_PETSC_
Index: issm/trunk/src/c/cores/balancethickness_core.cpp
===================================================================
--- issm/trunk/src/c/cores/balancethickness_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/balancethickness_core.cpp	(revision 26744)
@@ -11,5 +11,4 @@
 
 void balancethickness_core(FemModel* femmodel){
-
 
 	/*recover parameters: */
Index: issm/trunk/src/c/cores/control_core.cpp
===================================================================
--- issm/trunk/src/c/cores/control_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/control_core.cpp	(revision 26744)
@@ -143,5 +143,5 @@
 	/*Update control input*/
 	SetControlInputsFromVectorx(femmodel,X);
-	
+
 	/*solve forward: */
 	switch(solution_type){
@@ -152,5 +152,5 @@
 		case StressbalanceSolutionEnum:{
 			femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
-			
+
 			bool is_schur_cg_solver = false;
 			#ifdef _HAVE_PETSC_
@@ -159,5 +159,5 @@
 			if(solver_type==FSSolverEnum) is_schur_cg_solver = true;
 			#endif
-			
+
 			if(is_schur_cg_solver){
 			 solutionsequence_schurcg(femmodel);
@@ -249,8 +249,6 @@
 
 	/*Constrain Gradient*/
-	for(int i=0;i<num_controls;i++){
-		for(int j=0;j<numvertices;j++){
-			G[i*numvertices+j] = scalar*G[i*numvertices+j];
-		}
+	for(int i=0;i<nsize;i++){
+		G[i] = scalar*G[i];
 	}
 
Index: issm/trunk/src/c/cores/controladm1qn3_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controladm1qn3_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/controladm1qn3_core.cpp	(revision 26744)
@@ -14,4 +14,5 @@
 extern CoDi_global codi_global;
 #include <sstream> // for output of the CoDiPack tape
+#include <fenv.h>
 void transient_ad(FemModel* femmodel);
 #endif
@@ -75,5 +76,12 @@
 		 * -> These parameters are not read for the CoDiPack ISSM version!
 		 */
+		#if _CODIPACK_MAJOR_==2
+		auto& tape_codi = IssmDouble::getTape();
+		#elif _CODIPACK_MAJOR_==1
 		auto& tape_codi = IssmDouble::getGlobalTape();
+		#else
+		#error "_CODIPACK_MAJOR_ not supported"
+		#endif
+
 		tape_codi.setActive();
 		#if _AD_TAPE_ALLOC_
@@ -88,5 +96,5 @@
 		/*
 		std::stringstream out_s;
-		IssmDouble::getGlobalTape().printStatistics(out_s);
+		IssmDouble::getTape().printStatistics(out_s);
 		_printf0_("StartTrace::Tape Statistics	   : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str());
 		*/
@@ -153,5 +161,11 @@
 		#endif
 		std::stringstream out_s;
+		#if _CODIPACK_MAJOR_==2
+		IssmDouble::getTape().printStatistics(out_s);
+		#elif _CODIPACK_MAJOR_==1
 		IssmDouble::getGlobalTape().printStatistics(out_s);
+		#else
+		#error "_CODIPACK_MAJOR_ not supported"
+		#endif
 		_printf0_("CoDiPack Profiling::Tape Statistics :\n" << out_s.str());
 		#endif
@@ -159,5 +173,14 @@
 
 	#elif defined(_HAVE_CODIPACK_)
+
+	/*Get Tape*/
+	#if _CODIPACK_MAJOR_==2
+	auto& tape_codi = IssmDouble::getTape();
+	#elif _CODIPACK_MAJOR_==1
 	auto& tape_codi = IssmDouble::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 	tape_codi.setPassive();
 	if(VerboseAutodiff()){
@@ -239,5 +262,14 @@
 	}
 	#elif defined(_HAVE_CODIPACK_)
+
+	/*Get tape*/
+	#if _CODIPACK_MAJOR_==2
+	auto& tape_codi = IssmDouble::getTape();
+	#elif _CODIPACK_MAJOR_==1
 	auto& tape_codi = IssmDouble::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 	codi_global.input_indices.clear();
 	if(my_rank==0){
@@ -245,5 +277,12 @@
 			aX[i]=X[i];
 			tape_codi.registerInput(aX[i]);
+			#if _CODIPACK_MAJOR_==2
+			codi_global.input_indices.push_back(aX[i].getIdentifier());
+			#elif _CODIPACK_MAJOR_==1
 			codi_global.input_indices.push_back(aX[i].getGradientData());
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 		}
 	}
@@ -285,5 +324,11 @@
 			tape_codi.registerOutput(output_value);
 			dependents[i] = output_value.getValue();
+			#if _CODIPACK_MAJOR_==2
+			codi_global.output_indices.push_back(output_value.getIdentifier());
+			#elif _CODIPACK_MAJOR_==1
 			codi_global.output_indices.push_back(output_value.getGradientData());
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
 
 			#elif defined(_HAVE_ADOLC_)
@@ -377,4 +422,6 @@
 			tape_codi.setGradient(codi_global.output_indices[dep_index],1.0);
 		}
+		//feclearexcept(FE_ALL_EXCEPT);
+		//feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
 		tape_codi.evaluate();
 
@@ -446,4 +493,5 @@
 	}
 	Gnorm = sqrt(Gnorm);
+	_assert_(!xIsNan(Gnorm));
 
 	/*Print info*/
@@ -453,4 +501,5 @@
 
 	/*Clean-up and return*/
+	if(solution_type == TransientSolutionEnum) delete femmodel;
 	*Jlisti = (*Jlisti) +1;
 	xDelete<double>(XU);
Index: issm/trunk/src/c/cores/controlvalidation_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controlvalidation_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/controlvalidation_core.cpp	(revision 26744)
@@ -50,5 +50,12 @@
 		 * -> These parameters are not read for the CoDiPack ISSM version!
 		 */
+		#if _CODIPACK_MAJOR_==2
+		auto& tape_codi = IssmDouble::getTape();
+		#elif _CODIPACK_MAJOR_==1
 		auto& tape_codi = IssmDouble::getGlobalTape();
+		#else
+		#error "_CODIPACK_MAJOR_ not supported"
+		#endif
+
 		tape_codi.setActive();
 		#if _AD_TAPE_ALLOC_
@@ -63,5 +70,5 @@
 		/*
 		std::stringstream out_s;
-		IssmDouble::getGlobalTape().printStatistics(out_s);
+		IssmDouble::getTape().printStatistics(out_s);
 		_printf0_("StartTrace::Tape Statistics	   : TapeAlloc count=[" << codi_allocn << "]\n" << out_s.str());
 		*/
@@ -127,5 +134,11 @@
 		#endif
 		std::stringstream out_s;
+		#if _CODIPACK_MAJOR_==2
+		IssmDouble::getTape().printStatistics(out_s);
+		#elif _CODIPACK_MAJOR_==1
 		IssmDouble::getGlobalTape().printStatistics(out_s);
+		#else
+		#error "_CODIPACK_MAJOR_ not supported"
+		#endif
 		_printf0_("CoDiPack Profiling::Tape Statistics :\n" << out_s.str());
 		#endif
@@ -133,5 +146,13 @@
 
 	#elif defined(_HAVE_CODIPACK_)
+
+	#if _CODIPACK_MAJOR_==2
+	auto& tape_codi = IssmDouble::getTape();
+	#elif _CODIPACK_MAJOR_==1
 	auto& tape_codi = IssmDouble::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 	tape_codi.setPassive();
 	if(VerboseAutodiff()){
@@ -188,7 +209,16 @@
 	/*}}}*/
 	#elif defined(_HAVE_CODIPACK_)
+	/*{{{*/
 	simul_starttrace2(femmodel);
 	IssmDouble* aX=xNew<IssmDouble>(n);
+
+	#if _CODIPACK_MAJOR_==2
+	auto& tape_codi = IssmDouble::getTape();
+	#elif _CODIPACK_MAJOR_==1
 	auto& tape_codi = IssmDouble::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 	codi_global.input_indices.clear();
 	if(my_rank==0){
@@ -196,5 +226,12 @@
 			aX[i]=X0[i];
 			tape_codi.registerInput(aX[i]);
+			#if _CODIPACK_MAJOR_==2
+			codi_global.input_indices.push_back(aX[i].getIdentifier());
+			#elif _CODIPACK_MAJOR_==1
 			codi_global.input_indices.push_back(aX[i].getGradientData());
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 		}
 	}
@@ -230,5 +267,12 @@
 			tape_codi.registerOutput(output_value);
 			dependents[i] = output_value.getValue();
+			#if _CODIPACK_MAJOR_==2
+			codi_global.output_indices.push_back(output_value.getIdentifier());
+			#elif _CODIPACK_MAJOR_==1
 			codi_global.output_indices.push_back(output_value.getGradientData());
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 			J+=output_value;
 		}
@@ -252,5 +296,5 @@
 	/*Clear tape*/
 	tape_codi.reset();
-
+/*}}}*/
 	#else
 	/*{{{*/
Index: issm/trunk/src/c/cores/cores.h
===================================================================
--- issm/trunk/src/c/cores/cores.h	(revision 25994)
+++ issm/trunk/src/c/cores/cores.h	(revision 26744)
@@ -1,4 +1,4 @@
 /*
- * cores.h: 
+ * cores.h:
  */
 
@@ -9,5 +9,5 @@
 class FemModel;
 class Parameters;
-class SealevelMasks;
+class SealevelGeometry;
 template <class doubletype> class Matrix;
 template <class doubletype> class Vector;
@@ -35,4 +35,5 @@
 void controlvalidation_core(FemModel* femmodel);
 void masstransport_core(FemModel* femmodel);
+void oceantransport_core(FemModel* femmodel);
 void depthaverage_core(FemModel* femmodel);
 void extrudefrombase_core(FemModel* femmodel);
@@ -44,4 +45,5 @@
 void steadystate_core(FemModel* femmodel);
 void transient_core(FemModel* femmodel);
+void transient_precore(FemModel* femmodel);
 void dakota_core(FemModel* femmodel);
 void ad_core(FemModel* femmodel);
@@ -54,21 +56,21 @@
 void bmb_core(FemModel* femmodel);
 void damage_core(FemModel* femmodel);
+void sampling_core(FemModel* femmodel);
+
+/*sealevel change cores:*/
+#ifdef _HAVE_SEALEVELCHANGE_
 void sealevelchange_core(FemModel* femmodel);
-void grd_core(FemModel* femmodel);
+void sealevelchange_initialgeometry(FemModel* femmodel);
+SealevelGeometry* sealevelchange_geometry(FemModel* femmodel);
+#endif
+void grd_core(FemModel* femmodel,SealevelGeometry* slgeom);
+void solidearthexternal_core(FemModel* femmodel);
 void dynstr_core(FemModel* femmodel);
-void sealevelrise_core_geometry(FemModel* femmodel);
-SealevelMasks* sealevelrise_core_masks(FemModel* femmodel);
-Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel,SealevelMasks* mask, IssmDouble* poceanarea);
-Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,SealevelMasks* masks, Vector<IssmDouble>* RSLg_eustatic,IssmDouble oceanarea);
-void sealevelrise_core_elastic(Vector<IssmDouble>** pU_radial, Vector<IssmDouble>** pU_north,Vector<IssmDouble>** pU_east,FemModel* femmodel,Vector<IssmDouble>* RSLg, SealevelMasks* masks);
-void sealevelrise_core_viscous(Vector<IssmDouble>** pU_gia,Vector<IssmDouble>** pN_gia,FemModel*  femmodel,Vector<IssmDouble>* RSLg);
-void sealevelrise_diagnostics(FemModel* femmodel,Vector<IssmDouble>* RSLg);
-IssmDouble objectivefunction(IssmDouble search_scalar,FemModel* femmodel);
-void GetStericRate(Vector<IssmDouble> ** psteric_rate_g, FemModel* femmodel);
-void GetDynamicRate(Vector<IssmDouble> ** pdynamic_rate_g, FemModel* femmodel);
-void SetBottomPressure(FemModel* femmodel);
+void couplerinput_core(FemModel* femmodel);
+void coupleroutput_core(FemModel* femmodel);
 
 //optimization
 int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step);
+IssmDouble objectivefunction(IssmDouble search_scalar,FemModel* femmodel);
 
 //diverse
@@ -77,12 +79,10 @@
 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type);
 void PrintBanner(void);
-void TransferForcing(FemModel* femmodel,int forcingenum);
-void TransferSealevel(FemModel* femmodel,int forcingenum);
 void EarthMassTransport(FemModel* femmodel);
-void slrconvergence(bool* pconverged, Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs);
 
 //solution configuration
 void CorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype);
 void WrapperCorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype,bool nodakotacore=false);
+void WrapperPreCorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype);
 void AdjointCorePointerFromSolutionEnum(void (**padjointcore)(FemModel*),int solutiontype);
 
Index: issm/trunk/src/c/cores/dakota_core.cpp
===================================================================
--- issm/trunk/src/c/cores/dakota_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/dakota_core.cpp	(revision 26744)
@@ -227,5 +227,5 @@
 	if(VerboseQmu()) _printf0_("outputing results for this core:\n");
 	OutputResultsx(femmodel);
-	
+
 	/*Free ressources:*/
 	DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors);
Index: issm/trunk/src/c/cores/depthaverage_core.cpp
===================================================================
--- issm/trunk/src/c/cores/depthaverage_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/depthaverage_core.cpp	(revision 26744)
@@ -23,5 +23,5 @@
 
 	/*If this is a 2D horizontal domain: no need to do anything, just copy input*/
-	if(domaintype==Domain2DhorizontalEnum){
+	if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DsurfaceEnum){
 		InputDuplicatex(femmodel,inputenum,input_average_enum);
 		return;
Index: issm/trunk/src/c/cores/esa_core.cpp
===================================================================
--- issm/trunk/src/c/cores/esa_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/esa_core.cpp	(revision 26744)
@@ -20,5 +20,6 @@
 	Vector<IssmDouble> *U_x   = NULL; 
 	Vector<IssmDouble> *U_y    = NULL; 
-	bool save_results,isesa,iscoupler;
+	bool save_results,isesa;
+	int iscoupler;
 	int domaintype;
 	int solution_type;
@@ -41,5 +42,5 @@
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&isesa,TransientIsesaEnum);
-	femmodel->parameters->FindParam(&iscoupler,TransientIscouplerEnum);
+	femmodel->parameters->FindParam(&iscoupler,IsSlcCouplingEnum);
 
 	/* recover coordinates of vertices: */
@@ -113,5 +114,5 @@
 		if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
 	}
-	
+
 	/*End profiler*/
 	femmodel->profiler->Stop(ESACORE);
Index: issm/trunk/src/c/cores/extrudefrombase_core.cpp
===================================================================
--- issm/trunk/src/c/cores/extrudefrombase_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/extrudefrombase_core.cpp	(revision 26744)
@@ -21,4 +21,5 @@
 	/*If this is a 2D horizontal domain, return (no need to extrude)*/
 	if(domaintype==Domain2DhorizontalEnum) return;
+	if(domaintype==Domain3DsurfaceEnum) return;
 
 	int inputenum;
Index: issm/trunk/src/c/cores/extrudefromtop_core.cpp
===================================================================
--- issm/trunk/src/c/cores/extrudefromtop_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/extrudefromtop_core.cpp	(revision 26744)
@@ -23,4 +23,5 @@
 	/*If this is a 2D horizontal domain, return (no need to extrude)*/
 	if(domaintype==Domain2DhorizontalEnum) return;
+	if(domaintype==Domain3DsurfaceEnum) return;
 
 	/*Special method for Penta, otherwise call solution sequence*/
Index: issm/trunk/src/c/cores/gia_core.cpp
===================================================================
--- issm/trunk/src/c/cores/gia_core.cpp	(revision 25994)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*!\file: gia_core.cpp
- * \brief: core of the GIA solution 
- */ 
-
-#include "./cores.h"
-#include "../toolkits/toolkits.h"
-#include "../classes/classes.h"
-#include "../classes/Inputs/TriaInput.h"
-#include "../classes/Inputs/DatasetInput.h"
-#include "../shared/shared.h"
-#include "../modules/modules.h"
-#include "../solutionsequences/solutionsequences.h"
-void gia_core(FemModel* femmodel){
-
-	Vector<IssmDouble> *wg    = NULL;
-	Vector<IssmDouble> *dwdtg = NULL;
-	IssmDouble          *x    = NULL;
-	IssmDouble          *y    = NULL;
-	int nummodels,giamodel;
-	IssmDouble modelid; 
-
-	/*parameters: */
-	bool save_results;
-	int  gsize;
-	
-	/*Start profiler*/
-	femmodel->profiler->Start(GIACORE);
-
-	/*Recover some parameters: */
-	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
-
-	if(VerboseSolution()) _printf0_("   computing GIA\n");
-
-	/*Call on core computations: */
-	femmodel->SetCurrentConfiguration(GiaAnalysisEnum);
-
-	/*Figure out type of gia model:*/
-	femmodel->parameters->FindParam(&giamodel,GiaModelEnum);
-
-	if(giamodel==1){ //GiaIvins
-		/*Figure out size of g-set deflection vector and allocate solution vector: */
-		gsize      = femmodel->nodes->NumberOfDofs(GsetEnum);
-		wg = new Vector<IssmDouble>(gsize);
-		dwdtg = new Vector<IssmDouble>(gsize);
-
-		/*first, recover x and y vectors from vertices: */
-		VertexCoordinatesx(&x,&y,NULL,femmodel->vertices); //no need for z coordinate
-
-		/*call the main module: */
-		femmodel->Deflection(wg,dwdtg,x,y);
-
-		/*assemble vector: */
-		wg->Assemble();
-		dwdtg->Assemble();
-
-		InputUpdateFromVectorx(femmodel,wg,UGiaEnum,VertexSIdEnum);
-		InputUpdateFromVectorx(femmodel,dwdtg,UGiaRateEnum,VertexSIdEnum);
-
-		if(save_results){
-			int outputs[2] = {UGiaEnum,UGiaRateEnum};
-			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
-		}
-
-		xDelete<IssmDouble>(x);
-		xDelete<IssmDouble>(y);
-	}
-	else if(giamodel==2){ //GiaCaron
-		/*not implemneted yet*/
-	}
-	else if(giamodel==3){ //GiaMme
-		
-		/*Go grab the values for Ngia and Ugia in the offline GiaMme class:*/ 
-		femmodel->parameters->FindParam(&modelid,GiaModelidEnum); 
-		modelid--; //from matlab
-
-		/*find the Ngia and Ugia dataset:*/
-		DatasetInput* dataset_input_ngia=femmodel->inputs->GetDatasetInput(GiaMmeNgiaEnum);
-		DatasetInput* dataset_input_ugia=femmodel->inputs->GetDatasetInput(GiaMmeUgiaEnum);
-		/*Go find the modelid'th input:*/
-		TriaInput* tria_input_ngia=dataset_input_ngia->GetTriaInputByOffset(modelid);
-		TriaInput* tria_input_ugia=dataset_input_ugia->GetTriaInputByOffset(modelid);
-
-		/*Plug into SealevelUGiaRate and SealevelNGiaRate inputs:*/
-		Input* tria_input_copy_ngia=tria_input_ngia->copy();
-		Input* tria_input_copy_ugia=tria_input_ugia->copy();
-		tria_input_copy_ngia->ChangeEnum(NGiaRateEnum);
-		tria_input_copy_ugia->ChangeEnum(UGiaRateEnum);
-		femmodel->inputs->AddInput(tria_input_copy_ngia);
-		femmodel->inputs->AddInput(tria_input_copy_ugia);
-	}
-	
-	/*End profiler*/
-	femmodel->profiler->Stop(GIACORE);
-}
Index: issm/trunk/src/c/cores/hydrology_core.cpp
===================================================================
--- issm/trunk/src/c/cores/hydrology_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/hydrology_core.cpp	(revision 26744)
@@ -9,6 +9,7 @@
 #include "../modules/modules.h"
 #include "../solutionsequences/solutionsequences.h"
-
-void hydrology_core(FemModel* femmodel){
+void SolidEarthWaterUpdates(FemModel* femmodel);
+
+void hydrology_core(FemModel* femmodel){ /*{{{*/
 
 	/*Start profiler*/
@@ -43,4 +44,27 @@
 		/*transfer water column thickness to old water column thickness: */
 		InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
+		/*solid earth considerations:*/
+		SolidEarthWaterUpdates(femmodel);
+
+	}
+	/*Using the Tws based Model*/
+	if (hydrology_model==HydrologyTwsEnum){
+		if(VerboseSolution()) _printf0_("   computing water column\n");
+
+		femmodel->SetCurrentConfiguration(HydrologyTwsAnalysisEnum);
+
+		/*save current tws  before updating:*/
+		InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
+
+		/*grab tws from the hydrology.spcwatercolumn field input and update 
+		 * the solution with it:*/
+		Vector<IssmDouble>*  ug  = NULL;
+		GetVectorFromInputsx(&ug,femmodel,HydrologyTwsSpcEnum,VertexPIdEnum);
+		InputUpdateFromSolutionx(femmodel,ug); 
+
+		/*solid earth considerations:*/
+		SolidEarthWaterUpdates(femmodel);
+
+		delete ug;
 
 	}
@@ -147,9 +171,28 @@
 	/*Using the SHAKTI model*/
 	else if (hydrology_model==HydrologyshaktiEnum){
+
+		/*Get second derivatives of gap height*/
+		femmodel->SetCurrentConfiguration(L2ProjectionBaseAnalysisEnum);
+		femmodel->parameters->SetParam(HydrologyGapHeightXEnum,InputToL2ProjectEnum);
+		solutionsequence_linear(femmodel);
+		femmodel->parameters->SetParam(HydrologyGapHeightYEnum,InputToL2ProjectEnum);
+		solutionsequence_linear(femmodel);
+		femmodel->parameters->SetParam(HydrologyGapHeightXXEnum,InputToL2ProjectEnum);
+		solutionsequence_linear(femmodel);
+		femmodel->parameters->SetParam(HydrologyGapHeightYYEnum,InputToL2ProjectEnum);
+		solutionsequence_linear(femmodel);
+
+		/*Update Effective pressure*/
+		if(VerboseSolution()) _printf0_("   computing effective pressure\n");
+		HydrologyShaktiAnalysis* analysis = new HydrologyShaktiAnalysis();
+		analysis->UpdateEffectivePressure(femmodel);
+
+		/*Get new head*/
 		femmodel->SetCurrentConfiguration(HydrologyShaktiAnalysisEnum);
 		InputDuplicatex(femmodel,HydrologyHeadEnum,HydrologyHeadOldEnum);
 		solutionsequence_shakti_nonlinear(femmodel);
+
+		/*Update Gap Height*/
 		if(VerboseSolution()) _printf0_("   updating gap height\n");
-		HydrologyShaktiAnalysis* analysis = new HydrologyShaktiAnalysis();
 		analysis->UpdateGapHeight(femmodel);
 		delete analysis;
@@ -202,3 +245,31 @@
 	/*End profiler*/
 	femmodel->profiler->Stop(HYDROLOGYCORE);
-}
+} /*}}}*/
+void SolidEarthWaterUpdates(FemModel* femmodel){ /*{{{*/
+
+	int isgrd;
+	int grdmodel;
+	IssmDouble time;
+	int frequency,count;
+
+	/*retrieve parameters:*/
+	femmodel->parameters->FindParam(&isgrd,SolidearthSettingsGRDEnum);
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	femmodel->parameters->FindParam(&time,TimeEnum);
+	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+	femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum);
+
+	/*early return?:*/
+	if(!isgrd)return;
+
+	/*From old and new thickness, create delta thickness  and accumulate:*/
+	femmodel->inputs->ZAXPY(-1, WaterColumnOldEnum,WatercolumnEnum,DeltaTwsEnum);
+	femmodel->inputs->AXPY(+1, DeltaTwsEnum,AccumulatedDeltaTwsEnum);
+
+	/*compute total water column change between two sea-level solver time steps, ie. every frequency*dt:*/
+	if(count==frequency){
+		femmodel->inputs->ZAXPY(-1, OldAccumulatedDeltaTwsEnum,AccumulatedDeltaTwsEnum,DeltaTwsEnum);
+		femmodel->inputs->DuplicateInput(AccumulatedDeltaTwsEnum,OldAccumulatedDeltaTwsEnum);
+	}
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/cores/love_core.cpp
===================================================================
--- issm/trunk/src/c/cores/love_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/love_core.cpp	(revision 26744)
@@ -9,90 +9,1274 @@
 #include "../modules/modules.h"
 #include "../solutionsequences/solutionsequences.h"
-void love_core(FemModel* femmodel){
-
-	Vector<IssmDouble> *wg    = NULL;
-	Vector<IssmDouble> *dwdtg = NULL;
-	IssmDouble          *x    = NULL;
-	IssmDouble          *y    = NULL;
-
-	/*love parameters: */
+#include "petscblaslapack.h"
+
+/*local definitions:*/
+class LoveVariables{  /*{{{*/
+
+	public: 
+		IssmDouble g0; 
+		IssmDouble r0;
+		IssmDouble* EarthMass; 
+		int nyi; 
+		int starting_layer;
+
+		LoveVariables(){  /*{{{*/
+			g0=0;
+			r0=0;
+			EarthMass=NULL;
+			nyi=0;
+			starting_layer=0;
+		} /*}}}*/
+		LoveVariables(IssmDouble* EarthMassin,IssmDouble g0in,IssmDouble r0in,int nyiin,int starting_layerin){  /*{{{*/
+			EarthMass=EarthMassin;
+			g0=g0in;
+			r0=r0in;
+			nyi=nyiin;
+			starting_layer=starting_layerin;
+		} /*}}}*/
+		~LoveVariables(){};
+}; /*}}}*/
+
+/*self contained support routines used by cores below:*/
+template<typename doubletype> doubletype                 angular_frequency(IssmDouble frequency); //pure declaration
+template <> IssmDouble                     angular_frequency<IssmDouble>(IssmDouble frequency){ /*{{{*/
+	return 2.0*PI*frequency;
+} /*}}}*/
+template <> IssmComplex                    angular_frequency<IssmComplex>(IssmDouble frequency){ /*{{{*/
+	IssmComplex value=reCast<IssmComplex>(complex<double>(0,1))*2.0*PI*reCast<IssmComplex>(frequency);
+	return value;
+} /*}}}*/
+template<typename doubletype> void                       allgesv(int* pnyi, int* pnrhs, doubletype* yilocal, int* plda, int* ipiv, doubletype* rhslocal, int* pldb, int* pinfo);
+template <> void                           allgesv<IssmDouble>(int* pnyi, int* pnrhs, IssmDouble* yilocal, int* plda, int* ipiv, IssmDouble* rhslocal, int* pldb, int* pinfo){ /*{{{*/
+	dgesv_(pnyi, pnrhs, yilocal, plda, ipiv, rhslocal, pldb, pinfo);
+} /*}}}*/
+template <> void                           allgesv<IssmComplex>(int* pnyi, int* pnrhs, IssmComplex* yilocal, int* plda, int* ipiv, IssmComplex* rhslocal, int* pldb, int* pinfo){ /*{{{*/
+	_error_("zgesv_ not linked correctly yet! ");
+	//zgesv_(pnyi, pnrhs, yilocal, plda, ipiv, rhslocal, pldb, pinfo);
+} /*}}}*/
+template<typename doubletype> doubletype   factorial(int n){ /*{{{*/
+	doubletype prod=1;
+	for (int i=2;i<n+1;i++) prod*=i;
+	return prod;
+}/*}}}*/
+template<typename doubletype> doubletype   n_C_r(int n, int r){ /*{{{*/ 
+	//n choose r
+	int primes[169] = 
+	{2,    3,    5,    7,   11,   13,   17,   19,   23,   29,  
+		31,   37,   41,   43,   47,   53,   59,   61,   67,   71,  
+		73,   79,   83,   89,   97,  101,  103,  107,  109,  113,  
+		127,  131,  137,  139,  149,  151,  157,  163,  167,  173,  
+		179,  181,  191,  193,  197,  199,  211,  223,  227,  229,  
+		233,  239,  241,  251,  257,  263,  269,  271,  277,  281,  
+		283,  293,  307,  311,  313,  317,  331,  337,  347,  349,  
+		353,  359,  367,  373,  379,  383,  389,  397,  401,  409,  
+		419,  421,  431,  433,  439,  443,  449,  457,  461,  463,  
+		467,  479,  487,  491,  499,  503,  509,  521,  523,  541,  
+		547,  557,  563,  569,  571,  577,  587,  593,  599,  601,  
+		607,  613,  617,  619,  631,  641,  643,  647,  653,  659,  
+		661,  673,  677,  683,  691,  701,  709,  719,  727,  733,  
+		739,  743,  751,  757,  761,  769,  773,  787,  797,  809,  
+		811,  821,  823,  827,  829,  839,  853,  857,  859,  863,  
+		877,  881,  883,  887,  907,  911,  919,  929,  937,  941,  
+		947,  953,  967,  971,  977,  983,  991,  997, 1009};
+	int num, den;
+	num = 1;
+	den = 1;
+
+	for (int i=0;i<r;i++){
+		num = num*(n-i);
+		den = den*(i+1);
+		if (i>0) {
+			// Divide out common prime factors
+			for (int k=0;k<169;k++){ //169 is the length of the prime vector here
+				if ( i % primes[k] == 0) { // modulo
+					num = num/primes[k];
+					den = den/primes[k];
+				}
+			}
+		}
+	}
+
+	doubletype res;        
+	return res = num/den;
+}/*}}}*/
+template<typename doubletype> doubletype*  postwidder_coef(int NTit){ /*{{{*/
+	//Coefficients of the Post-Widder method through Saltzer summation for inverse Laplace transform:
+	//The Mth iteration estimate will be: f(t)_M = sum_{k=1:2*M}(xi_[M,k] * f(s_k))
+	//The method is based on equations (2), (6), (7) in: 
+	//Valko PP, Abate J. Comparison of sequence accelerators for the Gaver method of numerical Laplace transform inversion. Computational Mathematics and Applications. (2004)
+	//Note that the coefficients xi lack the factor s=k*log(2)/t. 
+	//That is because we are computing the heaviside response of the system rather than its impulse response, 
+	//and Laplace_Transform(Heaviside(t).*f(t)) = f(s)/s. So s cancels out in the sum for f(t)_M.
+
+	doubletype* xi=xNewZeroInit<doubletype>(2*NTit*NTit);
+	int indxi;
+	for (int M=1;M<NTit+1;M++){
+		for (int k=1;k<2*M+1;k++){
+			indxi=(M-1)*(2*NTit)+k-1;
+			for (int j=floor((k+1)/2);j<min(k,M)+1;j++){
+				xi[indxi]+=pow(j,M+1.0)/factorial<doubletype>(M)*n_C_r<doubletype>(M,j)*n_C_r<doubletype>(2*j,j)*n_C_r<doubletype>(j,k-j);
+			}
+			xi[indxi]*=pow(-1.0,k+M)/k;
+		}
+	}
+	return xi;
+}/*}}}*/
+template<typename doubletype> void         postwidder_transform(doubletype* Lovet, doubletype* Lovef,int d, int t, int NTit, doubletype* xi, FemModel* femmodel){ /*{{{*/
+	//Computes Lovet for time step t and degree d from the PW coefficients xi and the corresponding 2*NTit frequency samples in Lovef
+
+	int nfreq, indxi, indf;
+	femmodel->parameters->FindParam(&nfreq,LoveNfreqEnum);
+	int nt=nfreq/2/NTit;
+
+	indf=d*nfreq+t*2*NTit;
+	doubletype* LoveM = xNew<doubletype>(NTit);
+
+	for (int M=1;M<NTit+1;M++){
+		LoveM[M-1]=0.0;
+		for (int k=1;k<2*M+1;k++){
+			indxi=(M-1)*(2*NTit)+k-1;
+			LoveM[M-1]+=xi[indxi]*Lovef[indf+k-1];
+		}
+
+		//Make sure we are not getting into numerical instability
+		//Diverging once: ok, we'll give that the benefit of the doubt, it can be an inflexion point in the convergence series
+		//Diverging twice in a row: we are definitely propagating numerical error: revert to the last stable value and exit
+		if (M>3){ 
+			if ( abs(LoveM[M-1]-LoveM[M-2]) > abs(LoveM[M-2]-LoveM[M-3]) &&
+					abs(LoveM[M-2]-LoveM[M-3]) > abs(LoveM[M-3]-LoveM[M-4]) ){
+				Lovet[d*nt+t]=LoveM[M-3];
+				return;
+			}
+		}
+	}
+	Lovet[d*nt+t]=LoveM[NTit-1];
+}/*}}}*/
+template <typename doubletype> void        GetEarthRheology(doubletype* pla, doubletype* pmu, int layer_index, doubletype omega,  Matlitho* matlitho){ /*{{{*/
+
+	//returns lame parameters (material rigity) lambda and mu for the right frequency and layer
+	doubletype mu,la;
+
+	IssmDouble vi=matlitho->viscosity[layer_index];
+	IssmDouble mu0=matlitho->lame_mu[layer_index];
+	IssmDouble la0=matlitho->lame_lambda[layer_index];
+	int rheo=matlitho->rheologymodel[layer_index];
+
+	if (vi!=0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid
+		IssmDouble ka=la0 + 2.0/3.0*mu0; //Bulk modulus
+		if (rheo==2){//EBM
+			IssmDouble alpha=matlitho->ebm_alpha[layer_index];
+			IssmDouble delta=matlitho->ebm_delta[layer_index];
+			IssmDouble taul=matlitho->ebm_taul[layer_index];
+			IssmDouble tauh=matlitho->ebm_tauh[layer_index];
+			IssmDouble hf1,hf2;
+			doubletype U1,U2;
+			IssmDouble* a=xNew<IssmDouble>(2);
+			IssmDouble* b=xNew<IssmDouble>(1);
+
+			a[0]=1.0;a[1]=1.0+alpha/2.0;
+			b[0]=2.0+alpha/2.0;
+			//hf1=HypergeometricFunctionx(a, b, 2, 1, -pow(omega*tauh,2.0), 0, 0, 15);
+			//hf2=HypergeometricFunctionx(a, b, 2, 1, -pow(omega*taul,2.0), 0, 0, 15);
+			//hf1=hypergeometric_pFq({a[0], a[1]}, {b[0]},-pow(omega*tauh,2.0));
+			//hf2=hypergeometric_pFq_({a[0], a[1]}, {b[0]},-pow(omega*taul,2.0));
+			U1=(pow(tauh,alpha)-pow(taul,alpha))/alpha-pow(omega,2.0)/(2.0+alpha)*(pow(tauh,2.0+alpha)*hf1-pow(taul,2.0+alpha)*hf2);
+
+			a[0]=1.0;a[1]=.5+alpha/2.0;
+			b[0]=1.5+alpha/2.0;
+			//hf1=HypergeometricFunctionx(a, b, 2, 1, -pow(omega*tauh,2.0), 0, 0, 15);
+			//hf2=HypergeometricFunctionx(a, b, 2, 1, -pow(omega*taul,2.0), 0, 0, 15);
+			//hf1=hypergeometric_pFq({a[0], a[1]}, {b[0]},-pow(omega*tauh,2.0));
+			//hf2=hypergeometric_pFq({a[0], a[1]}, {b[0]},-pow(omega*taul,2.0));
+			U2=(pow(tauh,1.0+alpha)*hf1-pow(taul,1.0+alpha)*hf2)/(1.0+alpha);
+
+			mu=mu/(1.0+ alpha*delta/(pow(tauh,alpha)-pow(taul,alpha))*(U1 + omega*U2) -mu/vi/omega);
+			la=ka-2.0/3.0*mu;
+
+			xDelete<IssmDouble>(a);
+			xDelete<IssmDouble>(b);
+		} 
+		else if (rheo==1){//Burgers
+			IssmDouble vi2=matlitho->burgers_viscosity[layer_index];
+			IssmDouble mu2=matlitho->burgers_mu[layer_index];
+
+			mu=mu0*omega*(omega+mu2/vi2)/((omega+mu2/vi2)*(omega+mu0/vi)+mu0/vi2*omega);
+			la=ka-2.0/3.0*mu;
+		}
+		else{//Maxwell
+			la = (la0 + mu0*ka/vi/omega)/(1.0 + mu0/vi/omega);
+			mu = mu0/(1.0+mu0/vi/omega);
+		}
+	}
+	else{//Otherwise return the elastic value
+	la=la0;
+	mu=mu0;
+	}
+	*pla=la;
+	*pmu=mu;
+
+} /*}}}*/
+IssmDouble                                 GetGravity(IssmDouble r2, int layer_index, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars){ /*{{{*/
+	//computes gravity at radius r2
+	IssmDouble* EarthMass;
+	IssmDouble g, GG;
+
+	EarthMass=vars->EarthMass;
+	femmodel->parameters->FindParam(&GG,LoveGravitationalConstantEnum);
+	IssmDouble ro=matlitho->density[layer_index];
+	IssmDouble M=0;
+	IssmDouble r1=0;
+	if (layer_index==0){
+		M=4.0/3.0*PI*ro*pow(r2,3.0);
+	}
+	else{ 
+		r1=matlitho->radius[layer_index];
+		M=EarthMass[layer_index-1]+4.0/3.0*PI*ro*(pow(r2,3.0)-pow(r1,3.0));
+	}
+	return	g= GG*M/pow(r2,2.0);
+}/*}}}*/
+template <typename doubletype> void        fill_yi_prefactor(doubletype* yi_prefactor, int* pdeg, doubletype* pomega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars){ /*{{{*/
+	//precalculates partial derivative factors for function yi_derivatives
+	IssmDouble ra=matlitho->radius[matlitho->numlayers];
+	IssmDouble  g0,r0,mu0, GG;
+	int nstep,nindex, starting_layer;
+
+	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
+	femmodel->parameters->FindParam(&GG,LoveGravitationalConstantEnum);
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum);
+
+	g0=vars->g0;
+	r0=vars->r0;
+	starting_layer=vars->starting_layer;
+
+	doubletype frh,frhg0,fgr0,fgr,fn,rm0,rlm,flm;
+	IssmDouble xmin,xmax,x,dr;
+	IssmDouble g,ro, issolid;
+
+	if (pomega) { //frequency and degree dependent terms /*{{{*/
+		doubletype la,mu;
+		doubletype f[12];
+		int deg=*pdeg;
+		doubletype omega=*pomega;	
+		fn=deg*(deg+1.0);
+
+		for (int layer_index=starting_layer;layer_index<matlitho->numlayers;layer_index++){
+
+			ro=matlitho->density[layer_index];
+			issolid=matlitho->issolid[layer_index];
+			if(issolid==1){
+				GetEarthRheology<doubletype>(&la, &mu,layer_index,omega,matlitho);   
+
+				/*_______Expressions*/
+				flm=(la+2.0*mu);
+				rlm=(3.0*la+2.0*mu)/(la+2.0*mu);
+				rm0=mu/mu0;
+				frh=ro*ra/mu0;
+
+				f[0]=(-2.0*la/flm);
+				f[1]=mu0/flm;
+				f[2]=(la*fn/flm);
+				f[3]=rm0*rlm;
+				f[4]=ro*pow(omega,2.0)*ra/mu0;
+				f[5]=(-4.0*mu/flm);
+				f[6]=fn*frh;
+				f[7]=-(2.0*rm0*rlm)*fn;
+				f[8]=1.0/rm0;
+				f[9]=-2.0*rm0*rlm;
+				f[10]=-la/flm;
+				f[11]=2.0*rm0*(la*(2.0*fn-1.0)+2.0*mu*(fn-1.0))/flm;
+
+				xmin=matlitho->radius[layer_index]/ra;
+				xmax=(matlitho->radius[layer_index+1])/ra;
+				dr = (xmax -xmin)/nstep;
+				x=xmin;
+				for (int n=0;n<nstep;n++){
+					g=GetGravity(x*ra,layer_index,femmodel,matlitho,vars);
+
+					nindex=layer_index*nstep*36+n*36;
+					yi_prefactor[nindex+ 0*6+0]= f[0]/x;                      // in dy[0*6+0]
+					yi_prefactor[nindex+ 0*6+1]= f[1];                        // in dy[0*6+1]
+					yi_prefactor[nindex+ 0*6+2]= f[2]/x;                      // in dy[0*6+2]
+					yi_prefactor[nindex+ 1*6+0]= 4.0*(-frh*g+f[3]/x)/x + f[4];// in dy[1*6+0]
+					yi_prefactor[nindex+ 1*6+1]= f[5]/x;                      // in dy[1*6+1]
+					yi_prefactor[nindex+ 1*6+2]= (f[6]*g+f[7]/x)/x;           // in dy[1*6+2]
+					yi_prefactor[nindex+ 2*6+3]= f[8];                        // in dy[2*6+3]
+					yi_prefactor[nindex+ 3*6+0]= (frh*g+f[9]/x)/x;            // in dy[3*6+0]
+					yi_prefactor[nindex+ 3*6+1]= f[10]/x;                     // in dy[3*6+1]
+					yi_prefactor[nindex+ 3*6+2]= f[11]/(x*x) + f[4];          // in dy[3*6+2]
+					x=x+dr;
+				}
+			}
+		}
+		/*}}}*/
+	} else if (pdeg) { // degree dependent terms /*{{{*/
+		int deg=*pdeg;
+		fn=(deg*(deg+1.0));
+
+		for (int layer_index=starting_layer;layer_index<matlitho->numlayers;layer_index++){
+			ro=matlitho->density[layer_index];
+			issolid=matlitho->issolid[layer_index];
+
+			/*_______Expressions*/
+			fgr=4.0*PI*GG*ro*ra;
+
+			xmin=matlitho->radius[layer_index]/ra;
+			xmax=(matlitho->radius[layer_index+1])/ra;
+			dr = (xmax -xmin)/nstep;
+			x=xmin;
+			for (int n=0;n<nstep;n++){
+				nindex=layer_index*nstep*36+n*36;
+				g=GetGravity(x*ra,layer_index,femmodel,matlitho,vars);
+
+				if(issolid==1){
+					yi_prefactor[nindex+ 1*6+3]= fn/x;                  // in dy[1*6+3]
+					yi_prefactor[nindex+ 5*6+2]= -(fgr/g0*fn)/x;        // in dy[5*6+2]
+					yi_prefactor[nindex+ 5*6+4]= fn/(x*x);		     // in dy[5*6+4]
+				} else {
+					yi_prefactor[nindex+ 1*6+0]= (-4.0*(fgr/g)+fn/x)/x; // in dy[1*6+0] liquid layer
+				}
+				x=x+dr;
+			}
+		}
+		/*}}}*/
+	} else { // static terms /*{{{*/
+		for (int layer_index=starting_layer;layer_index<matlitho->numlayers;layer_index++){
+			ro=matlitho->density[layer_index];
+			issolid=matlitho->issolid[layer_index];
+
+			/*_______Expressions*/
+			frhg0=ro*g0*ra/mu0;
+			fgr=4.0*PI*GG*ro*ra;
+
+			xmin=matlitho->radius[layer_index]/ra;
+			xmax=(matlitho->radius[layer_index+1])/ra;
+			dr = (xmax -xmin)/nstep;
+			x=xmin;
+			for (int n=0;n<nstep;n++){
+				g=GetGravity(x*ra,layer_index,femmodel,matlitho,vars);
+				nindex=layer_index*nstep*36+n*36;
+				if(issolid==1){
+					yi_prefactor[nindex+ 1*6+5]= -frhg0;       // in dy[1*6+5]
+					yi_prefactor[nindex+ 2*6+0]= -1.0/x;       // in dy[2*6+0]
+					yi_prefactor[nindex+ 2*6+2]= 1.0/x;        // in dy[2*6+2]
+					yi_prefactor[nindex+ 3*6+3]= -3.0/x;       // in dy[3*6+3]
+					yi_prefactor[nindex+ 3*6+4]= -frhg0/x;     // in dy[3*6+4]
+					yi_prefactor[nindex+ 4*6+0]= fgr/g0;       // in dy[4*6+0]
+					yi_prefactor[nindex+ 4*6+5]= 1.0;          // in dy[4*6+5]
+					yi_prefactor[nindex+ 5*6+5]= -2.0/x;       // in dy[5*6+5]
+				} else {
+					yi_prefactor[nindex+ 0*6+0]= fgr/g;        // in dy[0*6+0] liquid layer
+					yi_prefactor[nindex+ 0*6+1]= 1.0;          // in dy[0*6+1] liquid layer
+					yi_prefactor[nindex+ 1*6+1]= -2.0/x-fgr/g; // in dy[1*6+1] liquid layer
+				}
+				x=x+dr;
+			}
+		}
+		/*}}}*/
+	}
+}/*}}}*/
+template <typename doubletype> void        yi_derivatives(doubletype* dydx, doubletype* y, int layer_index, int n, doubletype* yi_prefactor, FemModel* femmodel, Matlitho* matlitho){ /*{{{*/
+	//computes yi derivatives at r=radius[layer_index]+ n/nstep*(radius[layer_index+1]-radius[layer_index])
+
+	IssmDouble issolid=matlitho->issolid[layer_index];
+	int iy,id,ny, nindex, nstep;
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum);
+
+	/*{{{*/ /* For reference:
+			   flm=(la+2.0*mu);
+			   rlm=(3.0*la+2.0*mu)/(la+2.0*mu);
+			   rm0=mu/mu0;
+			   rg0=g/g0;
+			   frh=ro*g*ra/mu0;
+			   fgr=4.0*PI*GG*ro*ra/g0;
+			   fn=(deg*(deg+1.0));
+
+			   if(issolid==1){
+			   ny = 6;
+
+			   dy[0*6+0]= (-2.0*la/flm)/x;
+			   dy[0*6+1]= mu0/flm;
+			   dy[0*6+2]= (la*fn/flm)/x;
+			   dy[0*6+3]= 0.0;
+			   dy[0*6+4]= 0.0;
+			   dy[0*6+5]= 0.0;
+
+			   dy[1*6+0]=  4.0*(-frh+rm0*rlm/x)/x + ro*pow(omega,2.0)*ra/mu0;
+			   dy[1*6+1]=(-4.0*mu/flm)/x;
+			   dy[1*6+2]= fn*(frh-2.0*rm0*rlm/x)/x;
+			   dy[1*6+3]= fn/x;
+			   dy[1*6+4]= 0.0;
+			   dy[1*6+5]= -frh/rg0;
+
+			   dy[2*6+0]= -1.0/x;
+			   dy[2*6+1]= 0.0;
+			   dy[2*6+2]= 1.0/x;
+			   dy[2*6+3]= 1/rm0;
+			   dy[2*6+4]= 0.0;
+			   dy[2*6+5]= 0.0;
+
+			   dy[3*6+0]= (frh-2.0*rm0*rlm/x)/x;
+			   dy[3*6+1]= ( -la/flm)/x;
+			   dy[3*6+2]= (2.0*rm0*(la*(2.0*fn-1.0)+2.0*mu*(fn-1.0))/flm)/(x*x) + ro*pow(omega,2.0)*ra/mu0;
+			   dy[3*6+3]= -3.0/x;
+			   dy[3*6+4]= -(frh/rg0)/x;
+			   dy[3*6+5]= 0.0;
+
+			   dy[4*6+0]= fgr;
+			   dy[4*6+1]= 0.0;
+			   dy[4*6+2]= 0.0;
+			   dy[4*6+3]= 0.0;
+			   dy[4*6+4]= 0.0;
+			   dy[4*6+5]= 1.0;
+
+			   dy[5*6+0]= 0.0;
+			   dy[5*6+1]= 0.0;
+			   dy[5*6+2]= -(fgr*fn)/x;
+			   dy[5*6+3]= 0.0;
+			   dy[5*6+4]= fn/(x*x);
+			   dy[5*6+5]= -2.0/x;
+
+			   } else {
+			   ny = 2;
+
+			   dy[0*6+0]= fgr/rg0;
+			   dy[0*6+1]= 1.0;
+			   dy[1*6+0]= (-4.0*(fgr/rg0)+fn/x)/x;
+			   dy[1*6+1]= -2.0/x-fgr/rg0;
+			   }
+	*/ /*}}}*/
+
+	if(issolid==1){
+		ny = 6;
+	} else {
+		ny = 2;
+	}
+
+	for (id=0;id<ny;id++){
+		dydx[id]=0.0;
+		for (iy=0;iy<ny;iy++){
+			nindex=layer_index*nstep*36+n*36;
+			dydx[id]+=yi_prefactor[nindex+id*6+iy]*y[iy];
+		}
+	}
+	return;
+}/*}}}*/
+template <typename doubletype> void        propagate_yi_euler(doubletype* y, IssmDouble xmin, IssmDouble xmax, int layer_index, doubletype* yi_prefactor, FemModel* femmodel, Matlitho* matlitho){ /*{{{*/
+	//yields this: if we have y[j]=1.0 and y[!j]=0.0 at the bottom of the layer, what is y at the top of the layer?
+	//euler method
+	int nstep;
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum); 
+
+	doubletype* dydx=xNewZeroInit<doubletype>(6);
+	IssmDouble dr = (xmax -xmin)/nstep;
+	IssmDouble x=xmin;
+	for(int i = 0;i<nstep;i++){
+		yi_derivatives<doubletype>(dydx,y,layer_index, i,yi_prefactor,femmodel,matlitho);
+		for (int j=0;j<6;j++){
+			y[j]+=dydx[j]*dr;
+		}
+		x = x + dr;
+	}
+	xDelete<doubletype>(dydx);
+}/*}}}*/
+template <typename doubletype> void        propagate_yi_RK2(doubletype* y, IssmDouble xmin, IssmDouble xmax, int layer_index, doubletype* yi_prefactor, FemModel* femmodel, Matlitho* matlitho){ /*{{{*/
+	//yields this: if we have y[j]=1.0 and y[!j]=0.0 at the bottom of the layer, what is y at the top of the layer?
+	//Implements Runge-Kutta 2nd order (midpoint method)
+	int nstep;
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum); 
+
+	doubletype k1[6]={0};
+	doubletype k2[6]={0};
+	doubletype k3[6]={0};
+	doubletype k4[6]={0};
+	doubletype y1[6]={0};
+	doubletype y2[6]={0};
+	doubletype y3[6]={0};
+
+	IssmDouble dr = (xmax -xmin)/nstep;
+	IssmDouble x=xmin;
+
+	for(int i = 0;i<nstep/2;i++){
+		yi_derivatives<doubletype>(k1,y,layer_index, 2*i,yi_prefactor,femmodel,matlitho);
+		for (int j=0;j<6;j++) {y1[j]=y[j]+k1[j]*dr;}
+		yi_derivatives<doubletype>(k2,y1,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);		
+
+		for (int j=0;j<6;j++){
+			y[j]+=k2[j]*2.0*dr;
+		}
+		x = x + 2.0*dr;
+	}
+}/*}}}*/
+template <typename doubletype> void        propagate_yi_RK4(IssmDouble* y, IssmDouble xmin, IssmDouble xmax, int layer_index, IssmDouble* yi_prefactor, FemModel* femmodel, Matlitho* matlitho){ /*{{{*/
+	//yields this: if we have y[j]=1.0 and y[!j]=0.0 at the bottom of the layer, what is y at the top of the layer?
+	//Implements Runge-Kutta 4th order
+	int nstep;
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum); 
+
+	IssmDouble* k1=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* k2=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* k3=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* k4=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* y1=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* y2=xNewZeroInit<IssmDouble>(6);
+	IssmDouble* y3=xNewZeroInit<IssmDouble>(6);
+
+	IssmDouble dr = (xmax -xmin)/nstep;
+	IssmDouble x=xmin;
+	for(int i = 0;i<nstep/2-1;i++){
+		yi_derivatives<doubletype>(k1,y,layer_index, 2*i,yi_prefactor,femmodel,matlitho);
+		for (int j=0;j<6;j++) {y1[j]=y[j]+k1[j]*dr;}
+		yi_derivatives<doubletype>(k2,y1,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);
+		for (int j=0;j<6;j++) {y2[j]=y[j]+k2[j]*dr;}
+		yi_derivatives<doubletype>(k3,y2,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);
+		for (int j=0;j<6;j++) {y3[j]=y[j]+k3[j]*2.0*dr;}
+		yi_derivatives<doubletype>(k4,y3,layer_index, 2*i+2,yi_prefactor,femmodel,matlitho);		
+
+		for (int j=0;j<6;j++){
+			y[j]+=(k1[j]+2.0*k2[j]+2.0*k3[j]+k4[j])/3.0*dr;		
+		}
+		x = x + 2.0*dr;
+	}
+
+	//Last step: we don't know the derivative at xmax, so we will assume the values at xmax-dr
+	int i=nstep/2;
+	yi_derivatives<doubletype>(k1,y,layer_index, 2*i,yi_prefactor,femmodel,matlitho);
+	for (int j=0;j<6;j++) {y1[j]=y[j]+k1[j]*dr;}
+	yi_derivatives<doubletype>(k2,y1,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);
+	for (int j=0;j<6;j++) {y2[j]=y[j]+k2[j]*dr;}
+	yi_derivatives<doubletype>(k3,y2,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);
+	for (int j=0;j<6;j++) {y3[j]=y[j]+k3[j]*2.0*dr;}
+	yi_derivatives<doubletype>(k4,y3,layer_index, 2*i+1,yi_prefactor,femmodel,matlitho);		
+
+	for (int j=0;j<6;j++){
+		y[j]+=(k1[j]+2.0*k2[j]+2.0*k3[j]+k4[j])/3.0*dr;		
+	}
+
+	x = x + 2.0*dr;
+
+	xDelete<IssmDouble>(k1);
+	xDelete<IssmDouble>(k2);
+	xDelete<IssmDouble>(k3);
+	xDelete<IssmDouble>(k4);
+	xDelete<IssmDouble>(y1);
+	xDelete<IssmDouble>(y2);
+	xDelete<IssmDouble>(y3);
+}/*}}}*/
+template <typename doubletype> void        Innersphere_boundaryconditions(doubletype* yi, int layer_index, int deg, doubletype omega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars){ /*{{{*/
+	//fills the boundary conditions at the bottom of layer[layer_index] in yi[0:2][0:5]
+
+	IssmDouble r = matlitho->radius[layer_index];
+	IssmDouble ra=matlitho->radius[matlitho->numlayers];
+	IssmDouble  g0,r0,mu0, GG;
+	int nyi;
+
+	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
+	femmodel->parameters->FindParam(&GG,LoveGravitationalConstantEnum);
+
+	g0=vars->g0;
+	r0=vars->r0;
+	nyi=vars->nyi;
+
+	IssmDouble ro=matlitho->density[layer_index];
+	IssmDouble issolid=matlitho->issolid[layer_index];
+	IssmDouble g=GetGravity(r,layer_index,femmodel,matlitho,vars);
+	doubletype la,mu;
+
+	if (layer_index==0){
+		// radius[0] cannot be 0 for numerical reasons, but below our first interface at radius[0] would in reality be the same material as in the first layer
+		GetEarthRheology<doubletype>(&la, &mu,layer_index,omega,matlitho);   
+	} else {
+		GetEarthRheology<doubletype>(&la, &mu,layer_index-1,omega,matlitho);   
+	}    
+
+	IssmDouble cst = 4.0*PI*GG*ro;
+	IssmDouble r2=pow(r,2.0);
+
+	yi[0+nyi*0]=1.0*r/ra;
+	yi[0+nyi*1]=1.0/(r*ra);
+	yi[0+nyi*2]=0.0;
+
+	yi[1+nyi*0]=(2.0*mu*(deg-1.0-3.0/deg) + cst/3.0*ro*r2)/mu0;
+	yi[1+nyi*1]=(2.0*mu*(deg-1.0)/r2 + cst/3.0*ro)/mu0;
+	yi[1+nyi*2]=-ro/mu0;
+
+	yi[2+nyi*0]=(deg+3.0)/(deg*(deg+1.0))*r/ra;
+	yi[2+nyi*1]=1.0/(deg*r*ra);
+	yi[2+nyi*2]=0.0;
+
+	yi[3+nyi*0]=2.0*mu*(deg+2.0)/((deg+1.0)*mu0);
+	yi[3+nyi*1]=2.0*mu*(deg-1.0)/(deg*r2*mu0);
+	yi[3+nyi*2]=0.0;
+
+	yi[4+nyi*0]=0.0;
+	yi[4+nyi*1]=0.0;
+	yi[4+nyi*2]=1.0/(g0*ra);
+
+	yi[5+nyi*0]=-cst*r/g0;
+	yi[5+nyi*1]=-cst/(r*g0);
+	yi[5+nyi*2]=deg/(r*g0);
+
+}/*}}}*/
+template <typename doubletype> void        build_yi_system(doubletype* yi, int deg, doubletype omega, doubletype* yi_prefactor, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars) { /*{{{*/
+
+	IssmDouble  g0,r0,mu0,x,ro1, GG;
+	int nyi,starting_layer, nstep;
+
+	g0=vars->g0;
+	r0=vars->r0;
+	nyi=vars->nyi;
+	starting_layer=vars->starting_layer;
+
+	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
+	femmodel->parameters->FindParam(&GG,LoveGravitationalConstantEnum);
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum);
+
+	IssmDouble xmin,xmax,one,ro,g;
+	IssmDouble ra=matlitho->radius[matlitho->numlayers];
+
+	for (int i=0;i<6*(matlitho->numlayers+1);i++){
+		for(int j=0;j<6*(matlitho->numlayers+1);j++){
+			yi[i+6*(matlitho->numlayers+1)*j]=0.0;
+		}
+	}
+
+	int ny,is,ii,jj;
+	doubletype ystart[6];
+	for (int k=0;k<6;k++) ystart[k]=0.0;		
+
+	int ici = 0;   // Index of current interface 
+	for (int i = starting_layer; i<matlitho->numlayers;i++){ 
+
+		xmin=matlitho->radius[i]/ra;
+		xmax=(matlitho->radius[i+1])/ra;
+
+		if (matlitho->issolid[i]){
+			ny = 6;
+			is = 0;
+			one= 1.0;
+		} else {	
+			ny = 2;
+			is = 4;
+			one= -1.0;
+		}
+
+		for (int j = 0;j<ny;j++){
+			for (int k=0;k<6;k++){ystart[k]=0.0;}
+			ystart[j]= 1.0;
+
+			// Numerical Integration 
+			//propagate_yi_euler(&ystart[0], xmin, xmax, i, yi_prefactor,femmodel, matlitho);
+			propagate_yi_RK2<doubletype>(&ystart[0], xmin, xmax, i, yi_prefactor,femmodel, matlitho);
+			//propagate_yi_RK4(&ystart[0], xmin, xmax, i, yi_prefactor,femmodel, matlitho);
+			// Boundary Condition matrix - propagation part 
+			ii = 6*(ici+1)+is;
+			jj = 6*(ici+1)+j+is-3;
+			for (int kk=0;kk<ny;kk++){
+				yi[(ii+kk)+nyi*jj] = ystart[kk]*one;
+			}
+		}
+
+		// Boundary Condition matrix - solid regions
+		if (matlitho->issolid[i]){
+			one = -1.0;
+			if (i>0) if (!matlitho->issolid[i-1]) one = 1.0;
+			for (int j=0;j<6;j++){
+				yi[(j+6*ici)+ nyi*(j+6*ici+3)] = one;
+			}
+		} else { // Boundary Condition matrix - liquid regions
+			ro1=matlitho->density[i];
+			g=GetGravity(matlitho->radius[i], i, femmodel,matlitho,vars);
+			ii = 6*ici;
+			yi[ii+nyi*(ii+3)] = -1.0;
+			yi[ii+nyi*(ii+4+3)] = -g0/g;
+			yi[(ii+1)+nyi*(ii+3)]=-ro1*g*ra/mu0;
+			yi[(ii+2)+nyi*(ii+1+3)]=-1.0;
+			yi[(ii+5)+nyi*(ii+3)]= 4.0*PI*GG*ro1*ra/g0;
+			yi[(ii+4)+nyi*(ii+4+3)]=-1.0;
+			yi[(ii+5)+nyi*(ii+5+3)]=-1.0;
+			g=GetGravity(matlitho->radius[i+1], i,femmodel,matlitho,vars);
+			ii = 6*(ici+1);
+			yi[ii+nyi*(ii-1)]=-1.0;
+			yi[ii+nyi*(ii+1)]=yi[(ii+4)+nyi*(ii+1)]*g0/g; // yi(17,14) solution integration 1 of z5 CMB
+			yi[ii+nyi*(ii+2)]=yi[(ii+4)+nyi*(ii+2)]*g0/g; // yi(17,15) solution integration 2 of z5 CMB
+			// yi(13,..) y1 CMB
+			yi[(ii+1)+nyi*(ii-1)]=-ro1*g*ra/mu0;
+			yi[(ii+2)+nyi*(ii)]=-1.0;
+			yi[(ii+5)+nyi*(ii-1)]= 4.0*PI*GG*ro1*ra/g0;
+		}	
+		ici = ici+1;
+	}
+
+	//-- Internal sphere: integration starts here rather than r=0 for numerical reasons
+	Innersphere_boundaryconditions<doubletype>(yi, starting_layer, deg, omega, femmodel, matlitho,vars);
+
+	//-- Surface conditions
+	yi[(nyi-6)+nyi*(nyi-3)]=-1.0;
+	yi[(nyi-4)+nyi*(nyi-2)]=-1.0;
+	yi[(nyi-2)+nyi*(nyi-1)]=-1.0;
+	yi[(nyi-1)+nyi*(nyi-1)]=deg+1.0;
+
+	//-- Degree 1 special case
+	if(deg==1){
+		for (int i=0;i<nyi;i++){
+			yi[(nyi-1)+nyi*i]=0.0;
+		}
+		yi[(nyi-1)+nyi*(nyi-1)]=1.0;
+	}
+
+}/*}}}*/
+template <typename doubletype> void        yi_boundary_conditions(doubletype* yi_righthandside, int deg, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars){ /*{{{*/
+
+	IssmDouble  g0,r0,mu0,ra,rb,rc;
+	int nyi, forcing_type,icb,cmb,starting_layer;
+	IssmDouble* EarthMass;
+
+	g0=vars->g0;
+	r0=vars->r0;
+	nyi=vars->nyi;
+	starting_layer=vars->starting_layer;
+	EarthMass=vars->EarthMass;
+
+	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
+	femmodel->parameters->FindParam(&forcing_type,LoveForcingTypeEnum);
+	femmodel->parameters->FindParam(&icb,LoveInnerCoreBoundaryEnum);
+	femmodel->parameters->FindParam(&cmb,LoveCoreMantleBoundaryEnum);
+
+	// In Case of a Inner Core - Outer Core - Mantle planet and Boundary conditions on these 3 interfaces
+	ra=matlitho->radius[matlitho->numlayers];	
+	rb=0;
+	rc=0;
+	if (forcing_type<=4){
+		rc=matlitho->radius[icb];
+	} 
+	else if (forcing_type<=8){
+		rb=matlitho->radius[cmb];
+	}
+
+	IssmDouble ro_mean=EarthMass[matlitho->numlayers-1]/(4.0/3.0*PI*pow(ra,3.0));
+
+	for (int i=0;i<(matlitho->numlayers+1)*6;i++) yi_righthandside[i]=0.0;
+
+	switch (forcing_type) {
+
+		//-- forcings at the Inner Core Boundary
+		case 1:	//'ICB --Volumetric Potential'
+			yi_righthandside[6*icb+5]=(deg)/(rc*g0);
+			yi_righthandside[6*icb+4]=1.0/(ra*g0);
+			break;
+		case 2: //'ICB --Pressure'
+			yi_righthandside[6*icb+1]=-ro_mean/mu0;
+			break;
+		case 3://'ICB --Loading'
+			yi_righthandside[6*icb+1]=-ro_mean*(2.0*deg+1.0)/(3.0*mu0)*ra/rc;
+			yi_righthandside[6*icb+5]= (2.0*deg+1.0)/(rc*g0);
+			break;
+		case 4://'ICB --Tangential Traction'
+			yi_righthandside[6*icb+3]= ro_mean/mu0;
+			break;
+
+			//--forcings at the Core Mantle Boundary
+		case 5://'CMB --Volumetric Potential'
+			yi_righthandside[6*cmb+1]=-ro_mean/mu0*ra/rb;
+			yi_righthandside[6*cmb+5]= (2.0*deg+1.0)/(rb*g0);
+			break;
+		case 6://'CMB --Pressure'
+			yi_righthandside[6*cmb+1]=-ro_mean/mu0;
+			break;
+		case 7://'CMB --Loading'
+			yi_righthandside[6*cmb+1]=-ro_mean*(2.0*deg+1.0)/(3.0*mu0)*ra/rb;
+			yi_righthandside[6*cmb+5]= (2.0*deg+1.0)/(rb*g0);
+			break;
+		case 8://'CMB --Tangential Traction'
+			yi_righthandside[6*cmb+3]=-ro_mean/mu0;
+			break;
+
+			//--forcings at the surface
+		case 9://'SURF--Volumetric Potential'
+			if (deg>1) yi_righthandside[nyi-1]=(2.0*deg+1.0)/(ra*g0);
+			break;
+		case 10://'SURF--Pressure'
+			yi_righthandside[nyi-5]=-ro_mean/mu0;
+			break;
+		case 11://'SURF--Loading'
+			yi_righthandside[nyi-5]=-ro_mean*(2.0*deg+1.0)/(3.0*mu0);
+			if (deg>1) yi_righthandside[nyi-1]= (2.0*deg+1.0)/(ra*g0);
+			break;
+		case 12://'SURF--Tangential Traction'
+			yi_righthandside[nyi-3]= ro_mean/mu0;
+			break;
+		default:
+			_error_("love core error: forcing_type not supported yet");
+	}
+}/*}}}*/
+template <typename doubletype> void        solve_yi_system(doubletype* loveh, doubletype* lovel, doubletype* lovek, int deg, doubletype omega, doubletype* yi, doubletype* rhs, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars){ /*{{{*/
+
+	IssmDouble  g0,r0,mu0,loveratio,underflow_tol;
+	IssmDouble* frequencies;
+	int nyi,starting_layer, dummy;
+	bool allow_layer_deletion;
+	IssmDouble* EarthMass=NULL;
+
+	g0=vars->g0;
+	r0=vars->r0;
+	nyi=vars->nyi;
+	starting_layer=vars->starting_layer;
+	EarthMass=vars->EarthMass;
+
+	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
+	femmodel->parameters->FindParam(&allow_layer_deletion,LoveAllowLayerDeletionEnum);
+	femmodel->parameters->FindParam(&underflow_tol,LoveUnderflowTolEnum);
+	femmodel->parameters->FindParam(&frequencies,&dummy,LoveFrequenciesEnum);
+	IssmDouble ra=matlitho->radius[matlitho->numlayers];
+	bool exit=false;
+	int lda,ldb;
+
+	for(;!exit;){ //cycles of: attempt to solve the yi system, then delete a layer if necessary
+		lda=nyi;
+		ldb=nyi;
+		doubletype*  yilocal=xNew<doubletype>(nyi*nyi); // we will need to redeclare these inside here as nyi changes
+		doubletype*  rhslocal=xNew<doubletype>(nyi);
+
+		//we need to do a local copy of yi,rhs to send them to LAPACK with the appropriate size and to keep the original matrices in case layers are deleted and we need to try again
+		for (int i=0;i<nyi;i++){ 
+			rhslocal[i]=rhs[i];
+			for (int j=0;j<nyi;j++){
+				yilocal[i+j*nyi]=yi[i+j*nyi];
+			}
+		}
+		//-- Resolution
+		int* ipiv=xNewZeroInit<int>(nyi); //pivot index vector
+		int info = 0;// error checker
+		int nrhs=1; // number of right hand size columns
+
+		allgesv<doubletype>(&nyi, &nrhs, yilocal, &lda, ipiv, rhslocal, &ldb, &info);
+
+		xDelete<int>(ipiv);
+
+		if(VerboseModule() && info!=0){ 
+			_printf0_("love core warning in DGESV : LAPACK linear equation solver couldn't resolve the system");
+			_printf_("i j yi[i+nyi*j] rhs[i]");
+			for (int i=0;i<nyi;i++){
+				for (int j=0;j<nyi;j++){
+					_printf_(i<<" "<<j<<" "<<yi[i+nyi*j]<<" "<<rhs[i]<<"\n");
+				}
+			}
+		}
+
+		*loveh = rhslocal[nyi-3]*ra*g0;
+		*lovel = rhslocal[nyi-2]*ra*g0;
+		*lovek = rhslocal[nyi-1]*ra*g0;
+
+		doubletype loveh1 = rhslocal[3];
+		doubletype lovel1 = rhslocal[5];
+		doubletype lovek1 = rhslocal[7] - pow(matlitho->radius[starting_layer]/ra,deg)/(g0*ra);
+
+		doubletype loveh1s = rhslocal[nyi-3];
+		doubletype lovel1s = rhslocal[nyi-2];
+		doubletype lovek1s = rhslocal[nyi-1] - 1.0/(g0*ra);
+
+		loveratio = abs(loveh1/loveh1s); //ratio of center to surface love numbers, determines if we should remove layers
+		if (abs(lovel1/lovel1s) < loveratio) loveratio = abs(lovel1/lovel1s); 
+		if (abs(lovek1/lovek1s) < loveratio) loveratio = abs(lovek1/lovek1s);
+
+		if (!allow_layer_deletion || nyi<=12 || omega!=angular_frequency<doubletype>(frequencies[0])){ 
+			goto save_results;
+			/*We are not allowed to delete layers, or there is only one layer left. We also don't want to delete 
+			  layers in the middle of a loop on frequencies, as that can lead to a jump that would compromise the 
+			  inverse laplace transform.*/
+		}
+
+		if (loveratio<=underflow_tol || xIsNan(loveratio) || xIsInf(loveratio)){//We need to delete a layer and try again if the ratio between deepest love number to surface love number is too low (risk of underflow) or garbage
+			if(VerboseSolution()){
+				_printf_("\n   Degree: " << deg <<", surface/Depth Love number ratio small: "<<loveratio<<"\n");
+				_printf_("    Changing the interface where the integration starts\n");
+				_printf_("    New start interface: r="<< matlitho->radius[starting_layer+1] <<"m\n\n");
+			}
+			nyi-=6;
+			starting_layer+=1;
+			vars->nyi=nyi;
+			vars->starting_layer=starting_layer;
+
+			for (int i=0;i<nyi;i++){//shift everything down by 1 layer
+				rhs[i]=rhs[i+6];
+				for (int j=0;j<nyi;j++){
+					yi[j+i*nyi]=yi[j+6+(i+6)*(nyi+6)];
+				}
+			}
+
+			Innersphere_boundaryconditions<doubletype>(yi, starting_layer, deg, omega, femmodel, matlitho,vars); //we move the first interface to the new starting layer. yi[0:2,0:5] will be different
+		} else { //we are ready to save the outputs and break the main loop
+
+save_results:
+			for (int i=0;i<nyi;i++){
+				rhs[i]=rhslocal[i];
+				for (int j=0;j<nyi;j++){
+					yi[j+i*nyi]=yilocal[j+i*nyi];
+				}
+			}
+
+			//make sure we can't output numbers from deleted layers
+			for (int i=nyi;i<(matlitho->numlayers+1)*6;i++){ 
+				rhs[i]=0.0;
+				for (int j=0;j<(matlitho->numlayers+1)*6;j++){
+					yi[j+i*(matlitho->numlayers+1)*6]=0.0;
+				}
+			}
+			for (int i=0;i<nyi;i++){
+				for (int j=nyi;j<(matlitho->numlayers+1)*6;j++){
+					yi[j+i*(matlitho->numlayers+1)*6]=0.0;
+				}
+			}
+
+			exit = true;
+		}
+		xDelete<doubletype>(yilocal);
+		xDelete<doubletype>(rhslocal);
+	}
+	xDelete<IssmDouble>(frequencies);	
+
+}/*}}}*/
+template <typename doubletype> void        love_freq_to_temporal(doubletype* LoveHt,doubletype* LoveLt,doubletype* LoveKt,doubletype* LoveHf,doubletype* LoveLf,doubletype* LoveKf, FemModel* femmodel){ /*{{{*/
+	//Transforms all frequency-dependent love numbers into time-dependent love numbers
+	int nfreq,sh_nmax,sh_nmin,indxi,indf, NTit;
+
+	femmodel->parameters->FindParam(&nfreq,LoveNfreqEnum);
+	femmodel->parameters->FindParam(&sh_nmax,LoveShNmaxEnum);
+	femmodel->parameters->FindParam(&sh_nmin,LoveShNminEnum);
+	femmodel->parameters->FindParam(&NTit,LoveNTemporalIterationsEnum);
+
+	int nt=nfreq/2/NTit;
+	doubletype* xi=postwidder_coef<doubletype>(NTit);
+
+	for (int d=sh_nmin;d<sh_nmax+1;d++){
+		for (int t=0;t<nt;t++){
+			postwidder_transform<doubletype>(LoveHt,LoveHf,d,t,NTit,xi,femmodel);
+			postwidder_transform<doubletype>(LoveLt,LoveLf,d,t,NTit,xi,femmodel);
+			postwidder_transform<doubletype>(LoveKt,LoveKf,d,t,NTit,xi,femmodel);
+		}
+	}
+	xDelete<doubletype>(xi);
+}/*}}}*/
+
+/*templated cores:*/
+LoveVariables*                             love_init(FemModel* femmodel, Matlitho* matlitho){/*{{{*/
+
+	/*initialize Planet_Mass(r) for efficient computation of gravity, value of surface gravity and inital size of the yi equation system*/
+
+	bool        verbosemod = (int)VerboseModule();
+	int         numlayers  = matlitho->numlayers;
+	IssmDouble* r          = matlitho->radius;
+	IssmDouble  r1,r2,ro, GG;
+
+	/*outputs:*/
+	IssmDouble* EarthMass=NULL;
+	IssmDouble  g0,r0;
+	int         nyi,starting_layer;
+
+	femmodel->parameters->FindParam(&GG,LoveGravitationalConstantEnum);
+	EarthMass=xNewZeroInit<IssmDouble>(numlayers+1);
+
+	for (int i=0;i<numlayers;i++){
+		r2 = r[i+1];
+		ro = matlitho->density[i];
+		if (i==0){
+			EarthMass[i] = ro*pow(r2,3.0)*4.0*PI/3.0;
+		}else{
+			r1=r[i];
+			EarthMass[i] = EarthMass[i-1] + ro*(pow(r2,3.0)-pow(r1,3.0))*4.0*PI/3.0;;
+		}
+	}
+
+	g0=EarthMass[numlayers-1]*GG/pow(r[numlayers],2.0);
+	r0=r[numlayers];
+	nyi=6*(numlayers+1);
+	starting_layer=0;
+
+	return new LoveVariables(EarthMass,g0,r0,nyi,starting_layer);
+
+} /*}}}*/
+template <typename doubletype> void        love_core_template(FemModel* femmodel){ /*{{{*/
+
+	Matlitho*   matlitho=NULL;
+	int         nfreq,nyi,starting_layer,nstep,forcing_type,dummy;
+	int         sh_nmin,sh_nmax,kernel_index,deleted_layer_offset;
+	bool        allow_layer_deletion,love_kernels, istemporal;
+	bool        verbosemod = (int)VerboseModule();
+	IssmDouble  mu0, underflow_tol;
 	IssmDouble *frequencies = NULL;
-	int         nfreq,dummy;
-	int         sh_nmin,sh_nmax;
-	IssmDouble  g0,r0,mu0;
-	bool        allow_layer_deletion;
-	bool        love_kernels;
-	int         forcing_type;
-	bool        verbosemod = (int)VerboseModule();
-
-	/*parameters: */
-	bool save_results;
+	bool        save_results;
+	bool        complex_computation;
+
+	doubletype  omega;
+	doubletype  lovek, loveh, lovel, loveratio;
+
+	doubletype*  LoveKf = NULL;
+	doubletype*  LoveHf = NULL;
+	doubletype*  LoveLf = NULL;
+
+	doubletype*  LoveKernels= NULL;
+	LoveVariables* vars=NULL;
+	doubletype* yi_prefactor=NULL;
+	doubletype* yi_righthandside=NULL;
+	doubletype* yi=NULL;
 
 	if(VerboseSolution()) _printf0_("   computing LOVE numbers\n");
 
-	/*Recover some parameters: */
+	/*recover materials parameters: there is only one Matlitho, chase it down the hard way:*/
+	for (Object* & object: femmodel->materials->objects){
+		Material* material=xDynamicCast<Material*>(object);
+		if(material->ObjectEnum()==MatlithoEnum){
+			matlitho=xDynamicCast<Matlitho*>(material);
+			break;
+		}
+	}
+	_assert_(matlitho);
+
+	/*recover parameters: */
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
-
-	/*recover love number parameters: */
 	femmodel->parameters->FindParam(&nfreq,LoveNfreqEnum);
 	femmodel->parameters->FindParam(&frequencies,&dummy,LoveFrequenciesEnum); _assert_(nfreq==dummy);
 	femmodel->parameters->FindParam(&sh_nmax,LoveShNmaxEnum);
 	femmodel->parameters->FindParam(&sh_nmin,LoveShNminEnum);
-	femmodel->parameters->FindParam(&g0,LoveG0Enum);
-	femmodel->parameters->FindParam(&r0,LoveR0Enum);
 	femmodel->parameters->FindParam(&mu0,LoveMu0Enum);
 	femmodel->parameters->FindParam(&allow_layer_deletion,LoveAllowLayerDeletionEnum);
 	femmodel->parameters->FindParam(&love_kernels,LoveKernelsEnum);
 	femmodel->parameters->FindParam(&forcing_type,LoveForcingTypeEnum);
-
-	/*recover materials parameters: there is only one Matlitho, chase it down the hard way:*/
-	Matlitho* matlitho=NULL;
-	for (Object* & object: femmodel->materials->objects){
-		Material* material=xDynamicCast<Material*>(object);
-		if (material->ObjectEnum()==MatlithoEnum)matlitho=xDynamicCast<Matlitho*>(material);
-	}
-	_assert_(matlitho);
+	femmodel->parameters->FindParam(&istemporal,LoveIsTemporalEnum);
+	femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum);
+	femmodel->parameters->FindParam(&complex_computation,LoveComplexComputationEnum);
 
 	/*Initialize three love matrices: geoid, vertical and horizontal displacement (real and imaginary parts) */
-	IssmDouble*  LoveKr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
-	IssmDouble*  LoveHr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
-	IssmDouble*  LoveLr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
-	IssmDouble*  LoveKi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
-	IssmDouble*  LoveHi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
-	IssmDouble*  LoveLi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	LoveKf = xNewZeroInit<doubletype>(nfreq*(sh_nmax+1));
+	LoveHf = xNewZeroInit<doubletype>(nfreq*(sh_nmax+1));
+	LoveLf = xNewZeroInit<doubletype>(nfreq*(sh_nmax+1));
 
 	/*Initialize love kernels (real and imaginary parts): */
-	IssmDouble*  LoveKernelsReal = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->numlayers+1)*6);
-	IssmDouble*  LoveKernelsImag = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->numlayers+1)*6);
+	LoveKernels= xNewZeroInit<doubletype>(nfreq*(sh_nmax+1)*(matlitho->numlayers+1)*6);
+
+	vars=love_init(femmodel,matlitho);
+
+	yi_prefactor=xNewZeroInit<doubletype>(6*6*nstep*matlitho->numlayers);
+	yi_righthandside=xNewZeroInit<doubletype>(vars->nyi);
+	yi=xNewZeroInit<doubletype>(vars->nyi*vars->nyi);
+
+	//precalculate yi coefficients that do not depend on degree or frequency
+	fill_yi_prefactor<doubletype>(yi_prefactor, NULL, NULL,femmodel, matlitho,vars); 
+	for(int deg=sh_nmin;deg<sh_nmax+1;deg++){
+
+		//precalculate yi coefficients that depend on degree but not frequency
+		fill_yi_prefactor<doubletype>(yi_prefactor, &deg, NULL,femmodel, matlitho,vars); 
+
+		for (int fr=0;fr<nfreq;fr++){
+			omega=angular_frequency<doubletype>(frequencies[fr]);
+
+			//precalculate yi coefficients that depend on degree and frequency
+			fill_yi_prefactor<doubletype>(yi_prefactor, &deg,&omega,femmodel, matlitho,vars); 
+
+			yi_boundary_conditions<doubletype>(yi_righthandside,deg,femmodel,matlitho,vars); 
+
+			build_yi_system<doubletype>(yi,deg,omega,yi_prefactor,femmodel,matlitho,vars);
+
+			solve_yi_system<doubletype>(&loveh,&lovel,&lovek, deg, omega, yi, yi_righthandside,femmodel, matlitho,vars);
+
+			LoveHf[deg*nfreq+fr]=loveh;
+			LoveKf[deg*nfreq+fr]=lovek-1.0;
+			LoveLf[deg*nfreq+fr]=lovel;
+
+			deleted_layer_offset=(matlitho->numlayers+1)*6-vars->nyi;// =6 per deleted layer
+			kernel_index=deg*nfreq*(matlitho->numlayers+1)*6 + fr*(matlitho->numlayers+1)*6 + deleted_layer_offset;
+			for (int i=0;i<vars->nyi;i++){
+				LoveKernels[kernel_index+i]=yi_righthandside[i];
+			}
+		}
+	}
+
+	xDelete<doubletype>(yi);
+	xDelete<doubletype>(yi_righthandside);
+
+	//Temporal love numbers
+	if (istemporal && !complex_computation){
+
+		IssmDouble*  LoveHtDouble=NULL;
+		IssmDouble*  LoveKtDouble=NULL;
+		IssmDouble*  LoveLtDouble=NULL;
+		doubletype*  LoveHt=NULL;
+		doubletype*  LoveLt=NULL;
+		doubletype*  LoveKt=NULL;
+
+		int NTit;
+		femmodel->parameters->FindParam(&NTit,LoveNTemporalIterationsEnum);
+		int nt = nfreq/2/NTit;
+
+		LoveHt=xNewZeroInit<doubletype>((sh_nmax+1)*nt);
+		LoveLt=xNewZeroInit<doubletype>((sh_nmax+1)*nt);
+		LoveKt=xNewZeroInit<doubletype>((sh_nmax+1)*nt);
+
+		love_freq_to_temporal<doubletype>(LoveHt,LoveLt,LoveKt,LoveHf,LoveLf,LoveKf,femmodel);
+
+		/*Downcast and add into parameters:*/
+		LoveHtDouble=xNew<IssmDouble>((sh_nmax+1)*nt);
+		LoveLtDouble=xNew<IssmDouble>((sh_nmax+1)*nt);
+		LoveKtDouble=xNew<IssmDouble>((sh_nmax+1)*nt);
+		for(int i=0;i<(sh_nmax+1)*nt;i++){
+			LoveHtDouble[i]=std::real(LoveHt[i]);
+			LoveLtDouble[i]=std::real(LoveLt[i]);
+			LoveKtDouble[i]=std::real(LoveKt[i]);
+		}
+		if(forcing_type==9){ //tidal loading
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveHEnum,LoveHtDouble,(sh_nmax+1)*nt,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveKEnum,LoveKtDouble,(sh_nmax+1)*nt,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveLEnum,LoveLtDouble,(sh_nmax+1)*nt,1));
+		}
+		else if(forcing_type==11){ //surface loading
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveHEnum,LoveHtDouble,(sh_nmax+1)*nt,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveKEnum,LoveKtDouble,(sh_nmax+1)*nt,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveLEnum,LoveLtDouble,(sh_nmax+1)*nt,1));
+		}
+		xDelete<IssmDouble>(LoveHtDouble);
+		xDelete<IssmDouble>(LoveKtDouble);
+		xDelete<IssmDouble>(LoveLtDouble);
+
+		/*Add into external results, no need to downcast, we can handle complexes/quad precision: */
+		femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveKrEnum,LoveKt,sh_nmax+1,nt,0,0));
+		femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveHrEnum,LoveHt,sh_nmax+1,nt,0,0));
+		femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveLrEnum,LoveLt,sh_nmax+1,nt,0,0));
+
+		xDelete<doubletype>(LoveHt);
+		xDelete<doubletype>(LoveLt);
+		xDelete<doubletype>(LoveKt);
+	}
+	else{
+
+		IssmDouble*  LoveHfDouble=NULL;
+		IssmDouble*  LoveKfDouble=NULL;
+		IssmDouble*  LoveLfDouble=NULL;
+
+		/*Add into parameters:*/
+		LoveHfDouble=xNew<IssmDouble>((sh_nmax+1)*nfreq);
+		LoveLfDouble=xNew<IssmDouble>((sh_nmax+1)*nfreq);
+		LoveKfDouble=xNew<IssmDouble>((sh_nmax+1)*nfreq);
+		for(int i=0;i<(sh_nmax+1)*nfreq;i++){
+			LoveHfDouble[i]=std::real(LoveHf[i]);
+			LoveLfDouble[i]=std::real(LoveLf[i]);
+			LoveKfDouble[i]=std::real(LoveKf[i]);
+		}
+		if(forcing_type==9){ //tidal loading
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveHEnum,LoveHfDouble,(sh_nmax+1)*nfreq,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveKEnum,LoveKfDouble,(sh_nmax+1)*nfreq,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(TidalLoveLEnum,LoveLfDouble,(sh_nmax+1)*nfreq,1));
+		}
+		else if(forcing_type==11){ //surface loading
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveHEnum,LoveHfDouble,(sh_nmax+1)*nfreq,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveKEnum,LoveKfDouble,(sh_nmax+1)*nfreq,1));
+			femmodel->parameters->AddObject(new DoubleMatParam(LoadLoveLEnum,LoveLfDouble,(sh_nmax+1)*nfreq,1));
+		}
+		xDelete<IssmDouble>(LoveHfDouble);
+		xDelete<IssmDouble>(LoveKfDouble);
+		xDelete<IssmDouble>(LoveLfDouble);
+	}
+
+	/*Add into external results:*/
+	femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveKiEnum,LoveKf,sh_nmax+1,nfreq,0,0));
+	femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveHiEnum,LoveHf,sh_nmax+1,nfreq,0,0));
+	femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveLiEnum,LoveLf,sh_nmax+1,nfreq,0,0));
+
+	/*Only when love_kernels is on*/
+	if (love_kernels==1) {
+		femmodel->results->AddObject(new GenericExternalResult<doubletype*>(femmodel->results->Size()+1,LoveKernelsEnum,LoveKernels,(sh_nmax+1)*(matlitho->numlayers+1)*6,nfreq,0,0));
+	}
+
+	/*Free resources:*/
+	xDelete<IssmDouble>(frequencies);
+	xDelete<doubletype>(LoveKf);
+	xDelete<doubletype>(LoveHf);
+	xDelete<doubletype>(LoveLf);
+	xDelete<doubletype>(LoveKernels);
+
+	/* Legacy for fortran core, to be removed after complete validation */
+
+	//IssmDouble g0,r0;
+	//femmodel->parameters->FindParam(&g0,LoveG0Enum);
+	//femmodel->parameters->FindParam(&r0,LoveR0Enum);
+	//IssmDouble* LoveKr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	//IssmDouble* LoveHr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	//IssmDouble* LoveLr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	//IssmDouble* LoveKi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	//IssmDouble* LoveHi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+	//IssmDouble* LoveLi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
+
+	/*Initialize love kernels (real and imaginary parts): */
+	//IssmDouble* LoveKernelsr= xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->numlayers+1)*6);
+	//IssmDouble* LoveKernelsi= xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->numlayers+1)*6);
 
 	/*call the main module: */
-	FourierLoveCorex(LoveKr,LoveKi,LoveHr,LoveHi,LoveLr,LoveLi,LoveKernelsReal,LoveKernelsImag,  //output
-			nfreq,frequencies,sh_nmax,sh_nmin,g0,r0,mu0,allow_layer_deletion,forcing_type,verbosemod, //parameter inputs
-			matlitho->numlayers, matlitho->radius, matlitho->viscosity, matlitho->lame_lambda, matlitho->lame_mu,
-			matlitho->burgers_viscosity, matlitho->burgers_mu, matlitho->density, matlitho->isburgers, matlitho->issolid //matlitho inputs
-			);
+	//if (false){
+	//FourierLoveCorex(LoveKr,LoveKi,LoveHr,LoveHr,LoveLr,LoveLi,LoveKernelsr,LoveKernelsi,  //output
+	//		nfreq,frequencies,sh_nmax,sh_nmin,g0,r0,mu0,allow_layer_deletion,forcing_type,verbosemod, //parameter inputs
+	//		matlitho->numlayers, matlitho->radius, matlitho->viscosity, matlitho->lame_lambda, matlitho->lame_mu,
+	//		matlitho->burgers_viscosity, matlitho->burgers_mu, matlitho->density, matlitho->rheologymodel, matlitho->issolid //matlitho inputs
+	//		);
+
+	/*Only when love_kernels is on*/
+	//if (love_kernels==1) {
+		//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKernelsEnum,LoveKernelsr,(sh_nmax+1)*(matlitho->numlayers+1)*6,nfreq,0,0));
+		//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKernelsImagEnum,LoveKernelsImag,(sh_nmax+1)*(matlitho->numlayers+1)*6,nfreq,0,0));
+	//}
 
 	/*Add love matrices to results:*/
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKrEnum,LoveKr,sh_nmax+1,nfreq,0,0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveHrEnum,LoveHr,sh_nmax+1,nfreq,0,0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveLrEnum,LoveLr,sh_nmax+1,nfreq,0,0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKiEnum,LoveKi,sh_nmax+1,nfreq,0,0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveHiEnum,LoveHi,sh_nmax+1,nfreq,0,0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveLiEnum,LoveLi,sh_nmax+1,nfreq,0,0));
-	/*Only when love_kernels is set unity*/
-	if (love_kernels==1) {
-		femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKernelsRealEnum,LoveKernelsReal,(sh_nmax+1)*(matlitho->numlayers+1)*6,nfreq,0,0));
-		femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKernelsImagEnum,LoveKernelsImag,(sh_nmax+1)*(matlitho->numlayers+1)*6,nfreq,0,0));
-	}
-
-	/*Free ressources:*/
-	xDelete<IssmDouble>(frequencies);
-	xDelete<IssmDouble>(LoveKr);
-	xDelete<IssmDouble>(LoveHr);
-	xDelete<IssmDouble>(LoveLr);
-	xDelete<IssmDouble>(LoveKi);
-	xDelete<IssmDouble>(LoveHi);
-	xDelete<IssmDouble>(LoveLi);
-	xDelete<IssmDouble>(LoveKernelsReal);
-	xDelete<IssmDouble>(LoveKernelsImag);
-}
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKrEnum,LoveKr,sh_nmax+1,nfreq,0,0));
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveHrEnum,LoveHr,sh_nmax+1,nfreq,0,0));
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveLrEnum,LoveLr,sh_nmax+1,nfreq,0,0));
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveKiEnum,LoveKi,sh_nmax+1,nfreq,0,0));
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveHiEnum,LoveHi,sh_nmax+1,nfreq,0,0));
+	//femmodel->results->AddObject(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,LoveLiEnum,LoveLi,sh_nmax+1,nfreq,0,0));
+
+	//xDelete<IssmDouble>(LoveKr);
+	//xDelete<IssmDouble>(LoveHr);
+	//xDelete<IssmDouble>(LoveLr);
+	//xDelete<IssmDouble>(LoveKernelsr);
+	//xDelete<IssmDouble>(LoveKi);
+	//xDelete<IssmDouble>(LoveHi);
+	//xDelete<IssmDouble>(LoveLi);
+	//xDelete<IssmDouble>(LoveKernelsi);
+
+} /*}}}*/
+
+/*cores and template instantiations:*/
+/*template instantiations :{{{*/
+template void love_core_template<IssmDouble>(FemModel* femmodel);
+template void love_core_template<IssmComplex>(FemModel* femmodel);
+template void        fill_yi_prefactor<IssmDouble>(IssmDouble* yi_prefactor, int* pdeg, IssmDouble* pomega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template void        fill_yi_prefactor<IssmComplex>(IssmComplex* yi_prefactor, int* pdeg, IssmComplex* pomega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template void        GetEarthRheology<IssmDouble>(IssmDouble* pla, IssmDouble* pmu, int layer_index, IssmDouble omega,  Matlitho* matlitho);
+template void        GetEarthRheology<IssmComplex>(IssmComplex* pla, IssmComplex* pmu, int layer_index, IssmComplex omega,  Matlitho* matlitho);
+template void        yi_boundary_conditions<IssmDouble>(IssmDouble* yi_righthandside, int deg, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars);
+template void        yi_boundary_conditions<IssmComplex>(IssmComplex* yi_righthandside, int deg, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars);
+template void        yi_derivatives<IssmDouble>(IssmDouble* dydx, IssmDouble* y, int layer_index, int n, IssmDouble* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        yi_derivatives<IssmComplex>(IssmComplex* dydx, IssmComplex* y, int layer_index, int n, IssmComplex* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        propagate_yi_RK2<IssmDouble>(IssmDouble* y, IssmDouble xmin, IssmDouble xmax, int layer_index, IssmDouble* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        propagate_yi_RK2<IssmComplex>(IssmComplex* y, IssmDouble xmin, IssmDouble xmax, int layer_index, IssmComplex* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        propagate_yi_euler<IssmDouble>(IssmDouble* y, IssmDouble xmin, IssmDouble xmax, int layer_index, IssmDouble* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        propagate_yi_euler<IssmComplex>(IssmComplex* y, IssmDouble xmin, IssmDouble xmax, int layer_index, IssmComplex* yi_prefactor, FemModel* femmodel, Matlitho* matlitho);
+template void        Innersphere_boundaryconditions<IssmDouble>(IssmDouble* yi, int layer_index, int deg, IssmDouble omega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template void        Innersphere_boundaryconditions<IssmComplex>(IssmComplex* yi, int layer_index, int deg, IssmComplex omega, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template void        build_yi_system<IssmDouble>(IssmDouble* yi, int deg, IssmDouble omega, IssmDouble* yi_prefactor, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars);
+template void        build_yi_system<IssmComplex>(IssmComplex* yi, int deg, IssmComplex omega, IssmComplex* yi_prefactor, FemModel* femmodel, Matlitho* matlitho,LoveVariables* vars);
+template void        solve_yi_system<IssmDouble>(IssmDouble* loveh, IssmDouble* lovel, IssmDouble* lovek, int deg, IssmDouble omega, IssmDouble* yi, IssmDouble* rhs, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template void        solve_yi_system<IssmComplex>(IssmComplex* loveh, IssmComplex* lovel, IssmComplex* lovek, int deg, IssmComplex omega, IssmComplex* yi, IssmComplex* rhs, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars);
+template IssmDouble  factorial<IssmDouble>(int n);
+template IssmDouble* postwidder_coef<IssmDouble>(int NTit);
+template IssmDouble  n_C_r<IssmDouble>(int n, int r);
+template void         postwidder_transform<IssmDouble>(IssmDouble* Lovet, IssmDouble* Lovef,int d, int t, int NTit, IssmDouble* xi, FemModel* femmodel);
+
+/*}}}*/
+void           love_core(FemModel* femmodel){ /*{{{*/
+
+	bool        complex_computation;
+
+	femmodel->parameters->FindParam(&complex_computation,LoveComplexComputationEnum);
+
+	if(complex_computation) love_core_template<IssmComplex>(femmodel);
+	else                    love_core_template<IssmDouble>(femmodel);
+
+} /*}}}*/
Index: issm/trunk/src/c/cores/masstransport_core.cpp
===================================================================
--- issm/trunk/src/c/cores/masstransport_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/masstransport_core.cpp	(revision 26744)
@@ -9,6 +9,7 @@
 #include "../modules/modules.h"
 #include "../solutionsequences/solutionsequences.h"
-
-void masstransport_core(FemModel* femmodel){
+#include "../classes/Inputs/TransientInput.h"
+void SolidEarthIceUpdates(FemModel* femmodel);
+void masstransport_core(FemModel* femmodel){ /*{{{*/
 
 	/*Start profiler*/
@@ -64,5 +65,4 @@
 		InputDuplicatex(femmodel,BaseEnum,BaseOldEnum);
 		InputDuplicatex(femmodel,SurfaceEnum,SurfaceOldEnum);
-		InputDuplicatex(femmodel,SealevelriseCumDeltathicknessEnum,SealevelriseCumDeltathicknessOldEnum);
 		if(stabilization==4){
 			solutionsequence_fct(femmodel);
@@ -76,4 +76,6 @@
 			//}
 		}
+		SolidEarthIceUpdates(femmodel);
+
 		femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
 		extrudefrombase_core(femmodel);
@@ -82,4 +84,5 @@
 		femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
 		extrudefrombase_core(femmodel);
+
 	}
 
@@ -95,3 +98,62 @@
 	/*profiler*/
 	femmodel->profiler->Stop(MASSTRANSPORTCORE);
-}
+} /*}}}*/
+void SolidEarthIceUpdates(FemModel* femmodel){ /*{{{*/
+
+	int isgrd;
+	int grdmodel;
+	IssmDouble time;
+	int frequency,count;
+
+	/*retrieve parameters:*/
+	femmodel->parameters->FindParam(&isgrd,SolidearthSettingsGRDEnum);
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	femmodel->parameters->FindParam(&time,TimeEnum);
+	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+	femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum);
+
+	/*early return?:*/
+	if(!isgrd)return;
+
+	/*From old and new thickness, create delta thickness  and accumulate:*/
+	femmodel->inputs->ZAXPY(-1, ThicknessOldEnum,ThicknessEnum,DeltaIceThicknessEnum);
+	femmodel->inputs->AXPY(+1, DeltaIceThicknessEnum,AccumulatedDeltaIceThicknessEnum);
+
+	/*for Ivins deformation model, keep history of ice thickness changes inside TransientAccumulatedDeltaIceThicknessEnum:*/
+	if(grdmodel==IvinsEnum){
+
+		TransientInput* transientinput = femmodel->inputs->GetTransientInput(TransientAccumulatedDeltaIceThicknessEnum);
+
+		for(Object* & object : femmodel->elements->objects){
+			int *vertexlids = NULL;
+			int *vertexsids= NULL;
+			Element*   element=xDynamicCast<Element*>(object);
+			const int numvertices = element->GetNumberOfVertices();
+			IssmDouble* cumdeltathickness=NULL;
+
+			/*Get values and lid list and recover vertices ids needed to initialize inputs*/
+			vertexlids      = xNew<int>(numvertices);
+			vertexsids      = xNew<int>(numvertices);
+			cumdeltathickness=xNew<IssmDouble>(numvertices);
+			element->GetVerticesLidList(&vertexlids[0]);
+			element->GetVerticesSidList(&vertexsids[0]);
+			element->GetInputListOnVertices(&cumdeltathickness[0],AccumulatedDeltaIceThicknessEnum);
+
+			/*Add the current time cumdeltathickness to the existing time series: */
+			switch(element->ObjectEnum()){
+				case TriaEnum:  transientinput->AddTriaTimeInput( time,numvertices,vertexlids,cumdeltathickness,P1Enum); break;
+				default: _error_("Not implemented yet");
+			}
+			xDelete<int>(vertexlids);
+			xDelete<int>(vertexsids);
+			xDelete<IssmDouble>(cumdeltathickness);
+		}
+	}	
+
+	/*compute total ice thickness change between two sea-level solver time steps, ie. every frequency*dt:*/
+	if(count==frequency){
+		femmodel->inputs->ZAXPY(-1, OldAccumulatedDeltaIceThicknessEnum,AccumulatedDeltaIceThicknessEnum,DeltaIceThicknessEnum);
+		femmodel->inputs->DuplicateInput(AccumulatedDeltaIceThicknessEnum,OldAccumulatedDeltaIceThicknessEnum);
+	}
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/cores/movingfront_core.cpp
===================================================================
--- issm/trunk/src/c/cores/movingfront_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/movingfront_core.cpp	(revision 26744)
@@ -11,5 +11,5 @@
 
 void movingfront_core(FemModel* femmodel){
-	
+
 	/*Start profiler*/
 	femmodel->profiler->Start(MOVINGFRONTCORE);
@@ -47,5 +47,4 @@
 		}
 	}
-
 
 	/* start the work from here */
@@ -111,4 +110,6 @@
 	}
 
+	/* Calculate the frontal velocity for levelset function */
+	MovingFrontalVelx(femmodel);
 
 	/* solve level set equation */
@@ -132,10 +133,4 @@
 	GetMaskOfIceVerticesLSMx(femmodel);
 
-	/* add computation domain mask to outputs */
-	if(save_results){
-		int outputs[1] = {IceMaskNodeActivationEnum};
-		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
-	}
-	
 	/*End profiler*/
 	femmodel->profiler->Stop(MOVINGFRONTCORE);
Index: issm/trunk/src/c/cores/oceantransport_core.cpp
===================================================================
--- issm/trunk/src/c/cores/oceantransport_core.cpp	(revision 26744)
+++ issm/trunk/src/c/cores/oceantransport_core.cpp	(revision 26744)
@@ -0,0 +1,89 @@
+/*!\file: oceantransport_core.cpp
+ * \brief: core of the oceantransport solution 
+ */ 
+
+#include "./cores.h"
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+#include "../solutionsequences/solutionsequences.h"
+
+void SolidEarthOceanUpdates(FemModel* femmodel);
+void oceantransport_core(FemModel* femmodel){ /*{{{*/
+
+	/*Start profiler*/
+	femmodel->profiler->Start(OCEANTRANSPORTCORE);
+
+	/*parameters: */
+	int    numoutputs;
+	bool   save_results;
+	bool   dakota_analysis;
+	int    solution_type;
+	Vector<IssmDouble>*  ug  = NULL;
+
+	/*activate configuration*/
+	femmodel->SetCurrentConfiguration(OceantransportAnalysisEnum);
+
+	/*recover parameters: */
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+
+	if(VerboseSolution()) _printf0_("   computing ocean mass transport\n");
+
+	femmodel->SetCurrentConfiguration(OceantransportAnalysisEnum);
+
+	/*save current bottom pressures before updating:*/
+	InputDuplicatex(femmodel,BottomPressureEnum,BottomPressureOldEnum);
+	InputDuplicatex(femmodel,DslEnum,DslOldEnum);
+	InputDuplicatex(femmodel,StrEnum,StrOldEnum);
+
+	/*grab bottom pressures, dsl and str from OceantransportSpcbottompressure, OceantransportSpcdslEnum 
+	 * and OceantransportSpcstrEnum  inputs in each element, assemble into a vector and feed to 
+	 * InputUpdateFromSolutionx which will deal with accumulating such inputs:*/
+	GetSolutionFromInputsx(&ug,femmodel); 
+	InputUpdateFromSolutionx(femmodel,ug); 
+
+	SolidEarthOceanUpdates(femmodel);
+
+	if(solution_type==OceantransportSolutionEnum)femmodel->RequestedDependentsx();
+
+	/*profiler*/
+	femmodel->profiler->Stop(OCEANTRANSPORTCORE);
+
+	/*free ressources:*/
+	delete ug;
+
+} /*}}}*/
+void SolidEarthOceanUpdates(FemModel* femmodel){ /*{{{*/
+
+	int isgrd;
+	int grdmodel;
+	IssmDouble time;
+	int frequency,count;
+
+	/*retrieve parameters:*/
+	femmodel->parameters->FindParam(&isgrd,SolidearthSettingsGRDEnum);
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	femmodel->parameters->FindParam(&time,TimeEnum);
+	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+	femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum);
+
+	/*early return?:*/
+	if(!isgrd)return;
+
+	/* From old and new bottom pressures, create delta bottom pressure, delta dsl and delta str. 
+	 * Accumulate delta bottom pressure: */
+	femmodel->inputs->ZAXPY(-1, BottomPressureOldEnum,BottomPressureEnum,DeltaBottomPressureEnum);
+	femmodel->inputs->AXPY(+1, DeltaBottomPressureEnum,AccumulatedDeltaBottomPressureEnum);
+
+	femmodel->inputs->ZAXPY(-1, DslOldEnum,DslEnum,DeltaDslEnum);
+	femmodel->inputs->ZAXPY(-1, StrOldEnum,StrEnum,DeltaStrEnum);
+
+	/* Compute total bottom pressure change between two sea-level solver time steps, ie. every frequency*dt. */
+	if(count==frequency){
+		femmodel->inputs->ZAXPY(-1, OldAccumulatedDeltaBottomPressureEnum,AccumulatedDeltaBottomPressureEnum,DeltaBottomPressureEnum);
+		femmodel->inputs->DuplicateInput(AccumulatedDeltaBottomPressureEnum,OldAccumulatedDeltaBottomPressureEnum);
+	}
+	return;
+}/*}}}*/
Index: issm/trunk/src/c/cores/sampling_core.cpp
===================================================================
--- issm/trunk/src/c/cores/sampling_core.cpp	(revision 26744)
+++ issm/trunk/src/c/cores/sampling_core.cpp	(revision 26744)
@@ -0,0 +1,48 @@
+/*!\file: sampling_core.cpp
+ * \brief: core of the sampling solution
+ */
+
+#include "../classes/classes.h"
+#include "../solutionsequences/solutionsequences.h"
+
+void sampling_core(FemModel* femmodel){
+
+	/*Start profiler*/
+	femmodel->profiler->Start(SAMPLINGCORE);
+
+	/*parameters: */
+	int    numoutputs;
+	bool   save_results;
+	int    solution_type;
+	char** requested_outputs = NULL;
+
+	/*activate configuration*/
+	femmodel->SetCurrentConfiguration(SamplingAnalysisEnum);
+
+	/*recover parameters: */
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&numoutputs,SamplingNumRequestedOutputsEnum);
+	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SamplingRequestedOutputsEnum);
+
+	if(VerboseSolution()) _printf0_("   Generating random samples\n");
+
+	/*Generate random sample*/
+	if(VerboseSolution()) _printf0_("   call computational core\n");
+	femmodel->SetCurrentConfiguration(SamplingAnalysisEnum);
+	solutionsequence_sampling(femmodel);
+
+	if(save_results){
+		if(VerboseSolution()) _printf0_("   saving results\n");
+		int outputs = SampleEnum;
+		femmodel->RequestedOutputsx(&femmodel->results,&outputs,1);
+	}
+
+	if(solution_type==SamplingSolutionEnum)femmodel->RequestedDependentsx();
+
+	/*Free ressources:*/
+	if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
+
+	/*profiler*/
+	femmodel->profiler->Stop(SAMPLINGCORE);
+}
Index: issm/trunk/src/c/cores/sealevelchange_core.cpp
===================================================================
--- issm/trunk/src/c/cores/sealevelchange_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/sealevelchange_core.cpp	(revision 26744)
@@ -2,4 +2,10 @@
  * \brief: core of the sea-level change solution 
  */ 
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
 
 #include "./cores.h"
@@ -13,7 +19,19 @@
 #include "../solutionsequences/solutionsequences.h"
 
+/*support routines local definitions:{{{*/
+void TransferForcing(FemModel* femmodel,int forcingenum);
+void TransferSealevel(FemModel* femmodel,int forcingenum);
+bool slcconvergence(Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs);
+IssmDouble  SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* subelementoceanareas, IssmDouble totaloceanarea);
+void PolarMotion(IssmDouble* m, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom);
+void ConserveOceanMass(FemModel* femmodel,GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom);
+void ivins_deformation_core(FemModel* femmodel);
+IssmDouble* CombineLoads(IssmDouble* load,IssmDouble* subload,FemModel* femmodel, SealevelGeometry* slgeom,int loadtype,int nel);
+/*}}}*/
 
 /*main cores:*/
-void sealevelchange_core(FemModel* femmodel){ /*{{{*/
+void              sealevelchange_core(FemModel* femmodel){ /*{{{*/
+
+	SealevelGeometry* slgeom=NULL;
 
 	/*Start profiler*/
@@ -22,47 +40,31 @@
 	/*Parameters, variables:*/
 	bool save_results;
-	bool isslr=0;
-	bool isgia=0;
-	int  grd=0;
-	int solution_type;
 
 	/*Retrieve parameters:*/
-	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
-	femmodel->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 
-
-	/*in case we are running SealevelriseSolutionEnum, then bypass transient settings:*/
-	if(solution_type==SealevelriseSolutionEnum){
-		isslr=1;
-		isgia=1;
-	}
-
-	/*Should we be here?:*/
-	if(!isslr)return;
 
 	/*Verbose: */
-	if(VerboseSolution()) _printf0_("   computing sea level rise\n");
-
-	/*Run gia core: */
-	if(isgia){
-		#ifdef _HAVE_GIA_
-		gia_core(femmodel);
-		#else
-		_error_("ISSM was not compiled with gia capabilities. Exiting");
-		#endif
-	}
+	if(VerboseSolution()) _printf0_("   computing sea level change\n");
 
 	/*set SLR configuration: */
-	femmodel->SetCurrentConfiguration(SealevelriseAnalysisEnum);
+	femmodel->SetCurrentConfiguration(SealevelchangeAnalysisEnum);
 
 	/*run geometry core: */
-	sealevelrise_core_geometry(femmodel);
+	slgeom=sealevelchange_geometry(femmodel);
+
+	/*any external forcings?:*/
+	solidearthexternal_core(femmodel);
+
+	/*Run coupler input transfer:*/
+	couplerinput_core(femmodel);
 
 	/*Run geodetic:*/
-	if(grd)grd_core(femmodel);
+	grd_core(femmodel,slgeom);
 
 	/*Run steric core for sure:*/
 	dynstr_core(femmodel);
+
+	/*Run coupler output transfer: */
+	coupleroutput_core(femmodel);
 
 	/*Save results: */
@@ -71,64 +73,101 @@
 		char **requested_outputs = NULL;
 		if(VerboseSolution()) _printf0_("   saving results\n");
-		femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SealevelriseRequestedOutputsEnum);
+		femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SealevelchangeRequestedOutputsEnum);
 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);
 		if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
 	}
 
-	/*requested dependents: */
-	if(solution_type==SealevelriseSolutionEnum)femmodel->RequestedDependentsx();
-	
 	/*End profiler*/
 	femmodel->profiler->Stop(SLRCORE);
 }
 /*}}}*/
-void grd_core(FemModel* femmodel){ /*{{{*/
-
-	/*Gravity rotation deformation core GRD: */
+void              solidearthexternal_core(FemModel* femmodel){ /*{{{*/
 
 	/*variables:*/
-	Vector<IssmDouble> *RSLg    = NULL;
-	Vector<IssmDouble> *BPg    = NULL;
-	Vector<IssmDouble> *RSLg_rate    = NULL;
-	Vector<IssmDouble> *RSLg_eustatic  = NULL; 
-	Vector<IssmDouble> *U_esa  = NULL; 
-	Vector<IssmDouble> *U_esa_rate  = NULL; 
-	Vector<IssmDouble> *N_esa  = NULL; 
-	Vector<IssmDouble> *N_esa_rate  = NULL; 
-	Vector<IssmDouble> *U_north_esa   = NULL; 
-	Vector<IssmDouble> *U_east_esa    = NULL; 
-	Vector<IssmDouble> *N_gia= NULL; 
-	Vector<IssmDouble> *U_gia= NULL; 
-	Vector<IssmDouble> *N_gia_rate= NULL; 
-	Vector<IssmDouble> *U_gia_rate= NULL; 
-	SealevelMasks* masks=NULL;
-
-	/*parameters:*/
-	bool iscoupler;
-	int  solution_type;
-	int  modelid,earthid;
-	bool istransientmasstransport;
-	int  frequency,count;
-	int  horiz;
-	IssmDouble dt;
-	IssmDouble oceanarea;
-	int        bp_compute_fingerprints=0;
-
-	
-	/*Verbose: */
-	if(VerboseSolution()) _printf0_("	  computing GRD sea level patterns\n");
-
-	/*retrieve more parameters:*/
-	femmodel->parameters->FindParam(&iscoupler,TransientIscouplerEnum);
-	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
-	femmodel->parameters->FindParam(&count,SealevelriseRunCountEnum);
+	Vector<IssmDouble> *bedrock  = NULL; 
+	Vector<IssmDouble> *bedrock_rate = NULL;
+	Vector<IssmDouble> *bedrockeast  = NULL; 
+	Vector<IssmDouble> *bedrockeast_rate = NULL;
+	Vector<IssmDouble> *bedrocknorth  = NULL; 
+	Vector<IssmDouble> *bedrocknorth_rate = NULL;
+	Vector<IssmDouble> *geoid= NULL; 
+	Vector<IssmDouble> *geoid_rate= NULL; 
+	int horiz=0;
+	int modelid=-1;
+	int  isexternal=0;
+
+	/*parameters: */
+	IssmDouble          dt;
+
+	/*Retrieve parameters:*/
 	femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
-
-	if(iscoupler){
+	femmodel->parameters->FindParam(&isexternal,SolidearthIsExternalEnum); 
+
+	/*Early return:*/
+	if (!isexternal)return;
+
+	/*Verbose: */
+	if(VerboseSolution()) _printf0_("	  computing external solid earth contributions\n");
+
+	/*Retrieve geoid viscous and elastic rates, bedrock uplift viscous and elastic rates + steric rate, as vectors:*/
+	GetVectorFromInputsx(&bedrock,femmodel,BedEnum,VertexSIdEnum);
+	GetVectorFromInputsx(&geoid,femmodel,SealevelEnum,VertexSIdEnum); //In ISSM, Sealevel is absolute.
+	if(horiz){
+		GetVectorFromInputsx(&bedrockeast,femmodel,BedEastEnum,VertexSIdEnum);
+		GetVectorFromInputsx(&bedrocknorth,femmodel,BedNorthEnum,VertexSIdEnum);
+	}
+
+	GetVectorFromInputsx(&geoid_rate,femmodel,SolidearthExternalGeoidRateEnum,VertexSIdEnum);
+	GetVectorFromInputsx(&bedrock_rate,femmodel,SolidearthExternalDisplacementUpRateEnum,VertexSIdEnum);
+	if(horiz){
+		GetVectorFromInputsx(&bedrockeast_rate,femmodel,SolidearthExternalDisplacementEastRateEnum,VertexSIdEnum);
+		GetVectorFromInputsx(&bedrocknorth_rate,femmodel,SolidearthExternalDisplacementNorthRateEnum,VertexSIdEnum);
+	}
+
+	/*compute: sea level change = initial sea level + (N_gia_rate+N_esa_rate)  * dt + steric_rate + dynamic_rate dt*/
+	geoid->AXPY(geoid_rate,dt);
+	bedrock->AXPY(bedrock_rate,dt);
+	if(horiz){
+		bedrockeast->AXPY(bedrockeast_rate,dt);
+		bedrocknorth->AXPY(bedrocknorth_rate,dt);
+	}
+
+	/*update element inputs:*/
+	InputUpdateFromVectorx(femmodel,bedrock,BedEnum,VertexSIdEnum);	
+	InputUpdateFromVectorx(femmodel,geoid,SealevelEnum,VertexSIdEnum);	
+	if(horiz){
+		InputUpdateFromVectorx(femmodel,bedrockeast,BedEastEnum,VertexSIdEnum);	
+		InputUpdateFromVectorx(femmodel,bedrocknorth,BedNorthEnum,VertexSIdEnum);	
+	}
+
+	/*Free ressources:*/	
+	delete bedrock; delete bedrock_rate;
+	delete geoid; delete geoid_rate;
+	if(horiz){
+		delete bedrockeast; delete bedrockeast_rate;
+		delete bedrocknorth; delete bedrocknorth_rate;
+	}
+}
+/*}}}*/
+void              couplerinput_core(FemModel* femmodel){  /*{{{*/
+
+	/*Be very careful here, everything is well thought through, do not remove 
+	 * without taking big risks:*/
+
+	/*parameters:*/
+	int  iscoupling;
+	int  modelid,earthid;
+	int  count,frequency;
+	int  horiz;
+
+	/*retrieve more parameters:*/
+	femmodel->parameters->FindParam(&iscoupling,IsSlcCouplingEnum);
+	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+	femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum);
+
+	if(iscoupling){
 		femmodel->parameters->FindParam(&modelid,ModelIdEnum);
 		femmodel->parameters->FindParam(&earthid,EarthIdEnum);
-		femmodel->parameters->FindParam(&istransientmasstransport,TransientIsmasstransportEnum);
 	}
 	else{
@@ -136,706 +175,665 @@
 		 * so make sure we are identified as being the Earth.:*/
 		modelid=1; earthid=1; 
-		/* in addition, if we are running solution_type SealevelriseSolutionEnum, make sure we 
-		 * run, irresepective of the time settings:*/
-		count=frequency;
-	}
-
-	/*If we are running in coupled mode, the Earth model needs to run its own mass transport (if 
-	 * not already done by the mass trasnport module. For ice caps, they rely on the transient mass 
-	 * transport module exclusively:*/
-	if(iscoupler) if(modelid==earthid) if(!istransientmasstransport) EarthMassTransport(femmodel);
-
-	/*increment counter, or call solution core if count==frequency:*/
+	}
+
+	/*if we are carrying loads but are not yet computing grd core, accumulate them and skip 
+	 * the rest: */
 	if (count<frequency){
-		count++; femmodel->parameters->SetParam(count,SealevelriseRunCountEnum); 
+		count++; 
+		femmodel->parameters->SetParam(count,SealevelchangeRunCountEnum); 
 		return;
 	}
 
-	/*call sea-level rise sub cores:*/
-	if(iscoupler){
-		/*transfer cumulated deltathickness forcing from ice caps to earth model: */
-		TransferForcing(femmodel,SealevelriseCumDeltathicknessEnum);
-
-		/*we have accumulated thicknesses, dump them in deltathcikness: */
-		if(modelid==earthid)InputDuplicatex(femmodel,SealevelriseCumDeltathicknessEnum,SurfaceloadIceThicknessChangeEnum);
-	}
-
-	/*run cores:*/
-	if(modelid==earthid){
-
-		/*call masks core: */
-		masks=sealevelrise_core_masks(femmodel);
-
-		/*set bottom pressures:*/
-		SetBottomPressure(femmodel);
-
-
-		/*call eustatic core  (generalized eustatic - Farrel and Clark, Eq 4, 1st, 3rd and 4rd terms on the RHS) */
-		RSLg_eustatic=sealevelrise_core_eustatic(femmodel,masks,&oceanarea); 
-
-		/*call non-eustatic core (ocean loading tems  - 2nd and 5th terms on the RHS of Farrel and Clark) */
-		RSLg=sealevelrise_core_noneustatic(femmodel,masks,RSLg_eustatic,oceanarea); 
-
-		/*compute other elastic signatures, such as components of 3-D crustal motion: */
-		sealevelrise_core_elastic(&U_esa,&U_north_esa,&U_east_esa,femmodel,RSLg,masks);
-
-		/*compute viscosus (GIA) signatures:*/
-		sealevelrise_core_viscous(&U_gia,&N_gia,femmodel,RSLg);
-
-		/*compute sea-level rise (low-order spherical harmonics coefficients) diagnostics:*/
-		sealevelrise_diagnostics(femmodel,RSLg);
-
-		/*recover N_esa  = U_esa + RSLg:*/
-		N_esa=U_esa->Duplicate(); U_esa->Copy(N_esa); N_esa->AXPY(RSLg,1);
-
-		/*transform these values into rates (as we only run this once each frequency turn:*/
-		N_esa_rate=N_esa->Duplicate(); N_esa->Copy(N_esa_rate); N_esa_rate->Scale(1/(dt*frequency));
-		U_esa_rate=U_esa->Duplicate(); U_esa->Copy(U_esa_rate); U_esa_rate->Scale(1/(dt*frequency));
-		N_gia_rate=N_gia->Duplicate(); N_gia->Copy(N_gia_rate); N_gia_rate->Scale(1/(dt*frequency));
-		U_gia_rate=U_gia->Duplicate(); U_gia->Copy(U_gia_rate); U_gia_rate->Scale(1/(dt*frequency));
-		RSLg_rate=RSLg->Duplicate(); RSLg->Copy(RSLg_rate); RSLg_rate->Scale(1/(dt*frequency));
-
-		/*get some results into elements:{{{*/
-		InputUpdateFromVectorx(femmodel,U_esa_rate,SealevelUEsaRateEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,N_esa_rate,SealevelNEsaRateEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,U_gia_rate,UGiaRateEnum,VertexSIdEnum);
-		InputUpdateFromVectorx(femmodel,N_gia_rate,NGiaRateEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,RSLg_rate,SealevelRSLRateEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,U_esa,SealevelUEsaEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,N_esa,SealevelNEsaEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,U_gia,UGiaEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,N_gia,NGiaEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,RSLg,SealevelRSLEnum,VertexSIdEnum); 
-		InputUpdateFromVectorx(femmodel,RSLg_eustatic,SealevelRSLEustaticEnum,VertexSIdEnum); 
-
-		if (horiz){
-			InputUpdateFromVectorx(femmodel,U_north_esa,SealevelUNorthEsaEnum,VertexSIdEnum);	// north motion 
-			InputUpdateFromVectorx(femmodel,U_east_esa,SealevelUEastEsaEnum,VertexSIdEnum);		// east motion 
-		} /*}}}*/
-	}
-
-	if(iscoupler){
-		/*transfer sea level back to ice caps:*/
-		TransferSealevel(femmodel,SealevelNEsaRateEnum);
-		TransferSealevel(femmodel,NGiaRateEnum);
-		TransferSealevel(femmodel,SealevelUEsaRateEnum);
-		TransferSealevel(femmodel,UGiaRateEnum);
-
-		//reset cumdeltathickness  to 0: 
-		InputUpdateFromConstantx(femmodel->inputs,femmodel->elements,0.,SealevelriseCumDeltathicknessEnum);
-	}
-
-	/*reset counter to 1:*/
-	femmodel->parameters->SetParam(1,SealevelriseRunCountEnum); //reset counter.
-
-	/*free ressources:{{{*/
-	delete RSLg;
-	delete RSLg_rate;
-	delete RSLg_eustatic;
-	delete U_esa;
-	delete U_esa_rate;
-	delete N_esa;
-	delete N_esa_rate;
-	delete BPg;
-
-	if(horiz){
-		delete U_north_esa;
-		delete U_east_esa;
-	}
-	delete N_gia;
-	delete U_gia;
-	delete N_gia_rate;
-	delete U_gia_rate;
-	//delete masks;
+	/*Basins are supposed to accumulate loads and hand them over to the Earth
+	  for slr computations every "frequency" time steps. If we are here, we
+	  have reached the "frequency"'th time step, and we are going to pick up
+	  the old loads, the current loads, and send them to the Earth for slr
+	  computations.  So the Earth is never supposed to compute loads. Except,
+	  when we are running the Earth as a giant basin (ex: running a
+	  Peltier-style GIA model, or running a "Snow Ball" Earth) which only
+	  happens when we are not coupled, at which point we are sending these
+	  loads to ourselves (hence the convoluted condition).
+	  */
+
+	/*transer loads from basins to Earth for grd core computations. :*/
+	if(iscoupling){
+
+		/*transfer ice thickness change load from basins to earth: */
+		TransferForcing(femmodel,DeltaIceThicknessEnum);
+		TransferForcing(femmodel,DeltaBottomPressureEnum);
+		TransferForcing(femmodel,DeltaTwsEnum);
+
+		/*transfer external forcings back to Earth:*/
+		TransferSealevel(femmodel,BedEnum);
+		TransferSealevel(femmodel,SealevelEnum);
+		if(horiz){
+			TransferSealevel(femmodel,BedEastEnum);
+			TransferSealevel(femmodel,BedNorthEnum);
+		}
+	}
+
+}; /*}}}*/
+void              grd_core(FemModel* femmodel, SealevelGeometry* slgeom) { /*{{{*/
+
+	/*variables:{{{*/
+	int nel;
+	BarystaticContributions* barycontrib=NULL;
+	GenericParam<BarystaticContributions*>* barycontribparam=NULL;
+	IssmDouble polarmotionvector[3]={0};
+
+	GrdLoads*              loads=NULL;
+	Vector<IssmDouble>*    oldsealevelloads=NULL;
+	Vector<IssmDouble>*    oceanareas=NULL;
+	IssmDouble             totaloceanarea;
+	Vector<IssmDouble>*    subelementoceanareas=NULL;
+	IssmDouble             oceanaverage;
+	bool                   scaleoceanarea=false;
+	IssmDouble             rho_water;
+
+	IssmDouble           eps_rel;
+	IssmDouble           eps_abs;
+	int                  max_nonlinear_iterations;
+	int                  iterations=0;
+	int                  step;
+	IssmDouble           time; 
+
+	int  modelid,earthid;
+	int  horiz;
+	int  count,frequency,iscoupling;
+	int  grd=0;
+	int  grdmodel; 
+	int  sealevelloading=0;
+	bool viscous=false;
+	bool rotation=false;
+	bool planethasocean=false;
+	IssmDouble*           sealevelpercpu=NULL;
+
 	/*}}}*/
 
-} 
-/*}}}*/
-void dynstr_core(FemModel* femmodel){ /*{{{*/
-
-	/*variables:*/
-	Vector<IssmDouble> *bedrock  = NULL; 
-	Vector<IssmDouble> *SL  = NULL; 
-	Vector<IssmDouble> *steric_rate_g  = NULL; 
-	Vector<IssmDouble> *dynamic_rate_g = NULL;
-	Vector<IssmDouble> *U_esa_rate= NULL;
-	Vector<IssmDouble> *N_esa_rate= NULL;
-	Vector<IssmDouble> *U_gia_rate= NULL;
-	Vector<IssmDouble> *N_gia_rate= NULL;
-
-	/*parameters: */
-	bool isslr=0;
-	int  solution_type;
-	IssmDouble          dt;
-	int  grd=0;
-	int  step;
-	IssmDouble time;
-	IssmDouble cumgmtslr=0;
-	IssmDouble cumbslr=0;
-	IssmDouble cumgmslr=0;
-	IssmDouble gmtslr=0;
-
-	/*Retrieve parameters:*/
-	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
-	femmodel->parameters->FindParam(&grd,SolidearthSettingsGRDEnum);
-	femmodel->parameters->FindParam(&cumgmtslr,CumGmtslrEnum); 
-	femmodel->parameters->FindParam(&cumbslr,CumBslrEnum); 
+	/*Verbose: */
+	if(VerboseSolution()) _printf0_("	  computing GRD patterns\n");
+
+	/*retrieve parameters:{{{*/
+	femmodel->parameters->FindParam(&grd,SolidearthSettingsGRDEnum); 
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
+	femmodel->parameters->FindParam(&count,SealevelchangeRunCountEnum);
 	femmodel->parameters->FindParam(&step,StepEnum);
 	femmodel->parameters->FindParam(&time,TimeEnum);
-
-	/*in case we are running SealevelriseSolutionEnum, then bypass transient settings:*/
-	if(solution_type==SealevelriseSolutionEnum)isslr=1;
-
-	/*Should we be here?:*/
-	if(!isslr)return;
-
-	/*Verbose: */
-	if(VerboseSolution()) _printf0_("	  computing steric sea level rise\n");
-
-	/*Retrieve geoid viscous and elastic rates, bedrock uplift viscous and elastic rates + steric rate, as vectors:*/
-	GetVectorFromInputsx(&bedrock,femmodel,BedEnum,VertexSIdEnum);
-	GetVectorFromInputsx(&SL,femmodel,SealevelEnum,VertexSIdEnum);
-	GetStericRate(&steric_rate_g,femmodel);
-	GetDynamicRate(&dynamic_rate_g,femmodel);
-	if(grd){
-		GetVectorFromInputsx(&U_esa_rate,femmodel,SealevelUEsaRateEnum,VertexSIdEnum);
-		GetVectorFromInputsx(&U_gia_rate,femmodel,UGiaRateEnum,VertexSIdEnum);
-		GetVectorFromInputsx(&N_esa_rate,femmodel,SealevelNEsaRateEnum,VertexSIdEnum);
-		GetVectorFromInputsx(&N_gia_rate,femmodel,NGiaRateEnum,VertexSIdEnum);
-	}
-
-	/*Save steric rate, and cumulate it through time, cumulate with barystatic sea level rise, and cumulate through time:*/
-	gmtslr=steric_rate_g->Max()*dt;
-	cumgmtslr+=gmtslr;
-	cumgmslr=cumbslr+cumgmtslr;
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,GmtslrEnum,gmtslr,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumGmtslrEnum,cumgmtslr,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumGmslrEnum,cumgmslr,step,time));
-	femmodel->parameters->SetParam(cumgmtslr,CumGmtslrEnum);
-
-	/*compute: sea level change = initial sea level + (N_gia_rate+N_esa_rate)  * dt + steric_rate + dynamic_rate dt*/
-	if(grd){
-		SL->AXPY(N_gia_rate,dt);
-		SL->AXPY(N_esa_rate,dt);
-	}
-	SL->AXPY(steric_rate_g,dt);
-	SL->AXPY(dynamic_rate_g,dt);
-
-	/*compute new bedrock position: */
-	if(grd){
-		bedrock->AXPY(U_esa_rate,dt);
-		bedrock->AXPY(U_gia_rate,dt);
-	}
-
-	/*update element inputs:*/
-	InputUpdateFromVectorx(femmodel,bedrock,BedEnum,VertexSIdEnum);	
-	InputUpdateFromVectorx(femmodel,SL,SealevelEnum,VertexSIdEnum);	
-
-	/*Free ressources:*/	
-	delete bedrock;
-	delete SL;
-	delete steric_rate_g;
-	delete dynamic_rate_g;
-	if(grd){
-		delete U_esa_rate;
-		delete U_gia_rate;
-		delete N_esa_rate;
-		delete N_gia_rate;
-	}
+	femmodel->parameters->FindParam(&sealevelloading,SolidearthSettingsSealevelLoadingEnum);
+	femmodel->parameters->FindParam(&max_nonlinear_iterations,SolidearthSettingsMaxiterEnum);
+	femmodel->parameters->FindParam(&viscous,SolidearthSettingsViscousEnum);
+	femmodel->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum);
+	femmodel->parameters->FindParam(&planethasocean,SolidearthSettingsGrdOceanEnum);
+	/*}}}*/
+
+	/*only run if grd was requested, if we are the earth, and we have reached
+	 * the necessary number of time steps dictated by :*/
+	if(!grd)            return;
+	if(count!=frequency)return;
+	femmodel->parameters->FindParam(&iscoupling,IsSlcCouplingEnum);
+	if(iscoupling){
+		femmodel->parameters->FindParam(&modelid,ModelIdEnum);
+		femmodel->parameters->FindParam(&earthid,EarthIdEnum);
+		if(modelid!=earthid)return;
+	}
+	/*branch directly to Ivins deformation core if requested:*/
+	if(grdmodel==IvinsEnum){
+		ivins_deformation_core(femmodel);
+		return;
+	}
+
+	/*retrieve parameters: {{{*/ 
+	femmodel->parameters->FindParam(&scaleoceanarea,SolidearthSettingsOceanAreaScalingEnum);
+	barycontribparam = xDynamicCast<GenericParam<BarystaticContributions*>*>(femmodel->parameters->FindParamObject(BarystaticContributionsEnum));
+	barycontrib=barycontribparam->GetParameterValue();
+	femmodel->parameters->FindParam(&rho_water,MaterialsRhoSeawaterEnum);
+	femmodel->parameters->FindParam(&eps_rel,SolidearthSettingsReltolEnum);
+	femmodel->parameters->FindParam(&eps_abs,SolidearthSettingsAbstolEnum);
+	femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
+	/*}}}*/
+
+	/*initialize loads and sea level loads:*/
+	femmodel->parameters->FindParam(&nel,MeshNumberofelementsEnum);
+
+	loads=new GrdLoads(nel,slgeom);
+	subelementoceanareas=new Vector<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]);
+	oceanareas=new Vector<IssmDouble>(nel);
+	sealevelpercpu=xNewZeroInit<IssmDouble>(femmodel->vertices->Size());
+
+	if(VerboseSolution()) _printf0_("	  starting  GRD convolutions\n");
+
+	/*update viscous RSL:*/
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+		element->SealevelchangeUpdateViscousFields();
+	}
+
+	/*buildup loads: */
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+		element->SealevelchangeBarystaticLoads(loads, barycontrib,slgeom); 
+	}
+
+	//broadcast loads 
+	loads->BroadcastLoads();
+
+	//compute polar motion:
+	PolarMotion(&polarmotionvector[0],femmodel,loads,slgeom);
+
+	/*skip computation of sea level equation if requested, which means sea level loads should be zeroed */
+	if(!sealevelloading){
+		loads->sealevelloads=xNewZeroInit<IssmDouble>(nel);
+		loads->subsealevelloads=xNewZeroInit<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]);
+
+		goto deformation;
+	}
+
+	if(VerboseSolution()) _printf0_("	  converging GRD convolutions\n");
+	for(;;){
+
+		oldsealevelloads=loads->vsealevelloads->Duplicate(); loads->vsealevelloads->Copy(oldsealevelloads);
+
+		/*convolve load and sealevel loads on oceans:*/
+		for(Object* & object : femmodel->elements->objects){
+			Element* element = xDynamicCast<Element*>(object);
+			element->SealevelchangeConvolution(sealevelpercpu, loads , polarmotionvector,slgeom);
+		}
+
+		/*retrieve sea level average  and ocean area:*/
+		for(Object* & object : femmodel->elements->objects){
+			Element* element = xDynamicCast<Element*>(object);
+			element->SealevelchangeOceanAverage(loads, oceanareas, subelementoceanareas, sealevelpercpu, slgeom);
+		}
+
+		loads->AssembleSealevelLoads();
+
+		/*compute ocean areas:*/
+		if(!loads->sealevelloads){ //first time in the loop
+			oceanareas->Assemble(); 
+			subelementoceanareas->Assemble();
+			oceanareas->Sum(&totaloceanarea); _assert_(totaloceanarea>0.);
+			if(scaleoceanarea) totaloceanarea=3.619e+14; // use true ocean area, m^2
+		}
+
+		//Conserve ocean mass: 
+		oceanaverage=SealevelloadsOceanAverage(loads, oceanareas,subelementoceanareas, totaloceanarea);
+		ConserveOceanMass(femmodel,loads,barycontrib->Total()/totaloceanarea - oceanaverage,slgeom);
+
+		//broadcast sea level loads 
+		loads->BroadcastSealevelLoads();
+
+		//compute polar motion:
+		PolarMotion(&polarmotionvector[0],femmodel,loads, slgeom);
+
+		//convergence?
+		if(slcconvergence(loads->vsealevelloads,oldsealevelloads,eps_rel,eps_abs))break;
+
+		//early return?
+		if(iterations>=max_nonlinear_iterations)break;
+		iterations++;
+	}
+
+	deformation:
+
+	if(VerboseSolution()) _printf0_("	  deformation GRD convolutions\n");
+
+	/*convolve loads and sea level loads to get the deformation:*/
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+		element->SealevelchangeDeformationConvolution(sealevelpercpu, loads, polarmotionvector,slgeom);
+	}
+
+	if(VerboseSolution()) _printf0_("	  updating GRD fields\n");
+
+	if(planethasocean){
+		if (!sealevelloading){ //we haven't done so before, so we need to compute the ocean average and area
+			loads->sealevelloads=NULL; //needed to trigger the calculation of areas
+			/*retrieve sea level average  and ocean area:*/
+			for(Object* & object : femmodel->elements->objects){
+				Element* element = xDynamicCast<Element*>(object);
+				element->SealevelchangeOceanAverage(loads, oceanareas, subelementoceanareas, sealevelpercpu, slgeom);
+			}
+			loads->sealevelloads=xNewZeroInit<IssmDouble>(nel);
+			loads->AssembleSealevelLoads();
+			/*compute ocean areas:*/
+			oceanareas->Assemble(); 
+			subelementoceanareas->Assemble();
+			oceanareas->Sum(&totaloceanarea); _assert_(totaloceanarea>0.);
+			if(scaleoceanarea) totaloceanarea=3.619e+14; // use true ocean area, m^2
+
+			//Conserve ocean mass
+			//Note that here we create sea-level loads but they will not generate GRD as we have already run all the convolutions
+			oceanaverage=SealevelloadsOceanAverage(loads, oceanareas,subelementoceanareas, totaloceanarea);
+			ConserveOceanMass(femmodel,loads,barycontrib->Total()/totaloceanarea - oceanaverage,slgeom);
+		}
+
+		femmodel->inputs->Shift(SealevelGRDEnum,barycontrib->Total()/rho_water/totaloceanarea- oceanaverage/rho_water);
+
+		//cumulate barystatic contributions and save to results: 
+		barycontrib->Cumulate(femmodel->parameters);
+		barycontrib->Save(femmodel->results,femmodel->parameters,totaloceanarea);
+		barycontrib->Reset();
+	}
+
+	if (rotation) {
+		femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorXZEnum,polarmotionvector[0],step,time));
+		femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorYZEnum,polarmotionvector[1],step,time));
+		femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorZZEnum,polarmotionvector[2],step,time));
+	}
+
+	/*Update bedrock motion and geoid:*/
+	femmodel->inputs->AXPY(1,SealevelGRDEnum,SealevelEnum);
+	femmodel->inputs->AXPY(1,BedGRDEnum,BedEnum);
+	if(horiz){
+		femmodel->inputs->AXPY(1,BedEastGRDEnum,BedEastEnum);
+		femmodel->inputs->AXPY(1,BedNorthGRDEnum, BedNorthEnum);
+	}
+
 }
 /*}}}*/
-
-SealevelMasks* sealevelrise_core_masks(FemModel* femmodel) {  /*{{{*/
-
-	if(VerboseSolution()) _printf0_("	  computing sea level masks\n");
-	
-	/*initialize SealevelMasks structure: */
-	SealevelMasks* masks=new SealevelMasks(femmodel->elements->Size());
-
-	/*go through elements and fill the masks: */
+void              dynstr_core(FemModel* femmodel){ /*{{{*/
+
+	/*variables:*/
+	Vector<IssmDouble> *sealevel  = NULL; 
+	Vector<IssmDouble> *deltadsl  = NULL; 
+	Vector<IssmDouble> *deltastr = NULL;
+
+	/*parameters: */
+	int  step;
+	bool isocean=false;
+	IssmDouble time;
+
+	IssmDouble cumgmtslc=0;
+	IssmDouble cumbslc=0;
+	IssmDouble cumgmslc=0;
+	IssmDouble gmtslc=0;
+
+	/*early return if we have no ocean transport:*/
+	femmodel->parameters->FindParam(&isocean,TransientIsoceantransportEnum);
+	if(!isocean)return;
+
+	/*Verbose: */
+	if(VerboseSolution()) _printf0_("	  computing steric and dynamic sea level change\n");
+
+	/*Retrieve sealevel and add steric + dynamic rates:*/
+	GetVectorFromInputsx(&sealevel,femmodel,SealevelEnum,VertexSIdEnum);
+	GetVectorFromInputsx(&deltadsl,femmodel,DeltaDslEnum,VertexSIdEnum);
+	GetVectorFromInputsx(&deltastr,femmodel,DeltaStrEnum,VertexSIdEnum);
+
+	/*compute: sea level change = initial sea level + steric + dynamic*/
+	sealevel->AXPY(deltadsl,1);
+	sealevel->AXPY(deltastr,1);
+
+	/*cumulate thermal steric rate:*/
+	femmodel->parameters->FindParam(&cumgmtslc,CumGmtslcEnum); 
+	femmodel->parameters->FindParam(&cumbslc,CumBslcEnum); 
+
+	gmtslc=deltastr->Norm(NORM_TWO);
+	cumgmtslc+=gmtslc;
+	cumgmslc=cumbslc+cumgmtslc;
+
+	femmodel->parameters->SetParam(cumgmtslc,CumGmtslcEnum);
+	femmodel->parameters->SetParam(cumgmslc,CumGmslcEnum);
+
+	/*Outputs some metrics:*/
+	femmodel->parameters->FindParam(&step,StepEnum);
+	femmodel->parameters->FindParam(&time,TimeEnum);
+
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,GmtslcEnum,gmtslc,step,time));
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumGmtslcEnum,cumgmtslc,step,time));
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumGmslcEnum,cumgmslc,step,time));
+
+	/*update element inputs:*/
+	InputUpdateFromVectorx(femmodel,sealevel,SealevelEnum,VertexSIdEnum);	
+
+	/*Free ressources:*/	
+	delete sealevel;
+	delete deltadsl;
+	delete deltastr;
+}
+/*}}}*/
+void              coupleroutput_core(FemModel* femmodel){  /*{{{*/
+
+	/*parameters:*/
+	int iscoupling;
+	int horiz=0;
+
+	/*retrieve more parameters:*/
+	femmodel->parameters->FindParam(&iscoupling,IsSlcCouplingEnum);
+	femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
+
+	if(iscoupling){
+		/*transfer sea level back to ice caps:*/
+		TransferSealevel(femmodel,SealevelEnum);
+		TransferSealevel(femmodel,BedEnum);
+		if(horiz){
+			TransferSealevel(femmodel,BedNorthEnum);
+			TransferSealevel(femmodel,BedEastEnum);
+		}
+	}
+}; /*}}}*/
+void              ivins_deformation_core(FemModel* femmodel){ /*{{{*/
+
+	int  gsize;
+	Vector<IssmDouble> *bedup  = NULL; 
+	Vector<IssmDouble> *beduprate= NULL; 
+	IssmDouble          *xx     = NULL;
+	IssmDouble          *yy     = NULL;
+
+	if(VerboseSolution()) _printf0_("	  computing vertical deformation using Ivins model. \n");
+
+	/*find size of vectors:*/
+	gsize      = femmodel->nodes->NumberOfDofs(GsetEnum);
+
+	/*Find the litho material to be used by all the elements:*/
+	Matlitho* matlitho=NULL;
+	for (Object* & object: femmodel->materials->objects){
+		Material* material=xDynamicCast<Material*>(object);
+		if(material->ObjectEnum()==MatlithoEnum){
+			matlitho=xDynamicCast<Matlitho*>(material);
+			break;
+		}
+	}
+
+	/*initialize vectors:*/
+	bedup = new Vector<IssmDouble>(gsize);
+	beduprate = new Vector<IssmDouble>(gsize);
+
+	/*retrieve geometric information: */
+	VertexCoordinatesx(&xx,&yy,NULL,femmodel->vertices); 
+
+	/*Go through elements, and add contribution from each element to the deflection vector wg:*/
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+		element->GiaDeflection(bedup,beduprate, matlitho, xx,yy);
+	}
+
+	/*Assemble parallel vector:*/
+	beduprate->Assemble();
+	bedup->Assemble();
+
+	/*Save results:*/
+	InputUpdateFromVectorx(femmodel,bedup,BedGRDEnum,VertexSIdEnum);
+	femmodel->inputs->AXPY(1,BedGRDEnum,BedEnum);
+
+	/*Free ressources: */
+	xDelete<IssmDouble>(xx);
+	xDelete<IssmDouble>(yy);
+	delete beduprate;
+	delete bedup;
+}
+/*}}}*/
+void              sealevelchange_initialgeometry(FemModel* femmodel) {  /*{{{*/
+
+	/*Geometry core where we compute geometrical kernels and weights:*/
+
+	/*parameters: */
+	IssmDouble *xxe    = NULL;
+	IssmDouble *yye    = NULL;
+	IssmDouble *zze    = NULL;
+	IssmDouble* areae  = NULL;
+	int  nel;
+	int  grdmodel=0;
+
+	/*retrieve parameters:*/
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	nel=femmodel->elements->NumberOfElements();
+
+	/*early return?:*/
+	if(grdmodel==IvinsEnum) return;
+
+	/*Verbose: */
+	if(VerboseSolution()) _printf0_("	  computing initial sea level geometrical kernels and weights.\n");
+
+	/*recover x,y,z and areas from elements: */
+	ElementCoordinatesx(&xxe,&yye,&zze,&areae,femmodel->elements);
+
+	/*Run sealevel geometry routine in elements:*/
 	for(Object* & object : femmodel->elements->objects){
 		Element*   element=xDynamicCast<Element*>(object);
-		element->SetSealevelMasks(masks);
-	}
-
-	return masks;
+		element->SealevelchangeGeometryInitial(xxe,yye,zze,areae);
+	}
+
+	femmodel->parameters->AddObject(new DoubleVecParam(XxeEnum,xxe,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(YyeEnum,yye,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(ZzeEnum,zze,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel));
+
+	#ifdef _ISSM_DEBUG_
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,XxeEnum,xxe,nel,1,1,1));
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,YyeEnum,yye,nel,1,1,1));
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,ZzeEnum,zze,nel,1,1,1));
+	femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,AreaeEnum,areae,nel,1,1,1));
+	#endif
+
+	return;
+
 }/*}}}*/
-void sealevelrise_core_geometry(FemModel* femmodel) {  /*{{{*/
-
-	/*Geometry core where we compute indices into tables pre computed in the SealevelRiseAnalysis: */
+SealevelGeometry* sealevelchange_geometry(FemModel* femmodel) {  /*{{{*/
+
+	/*Geometry core where we compute updates to the Green function kernels and weights, dependent 
+	 * on the evolution of levelsets: */
 
 	/*parameters: */
-	bool spherical=true;
-	IssmDouble *latitude  = NULL;
-	IssmDouble *longitude = NULL;
-	IssmDouble *radius    = NULL;
-	IssmDouble *xx    = NULL;
-	IssmDouble *yy    = NULL;
-	IssmDouble *zz    = NULL;
-	int  horiz;
-	bool geometrydone = false;
-
-		
+	IssmDouble *xxe    = NULL;
+	IssmDouble *yye    = NULL;
+	IssmDouble *zze    = NULL;
+	IssmDouble* areae  = NULL;
+
+	int nel;
+	int  grdmodel=0;
+	SealevelGeometry* slgeom=NULL;
+
+	/*early return?:*/
+	femmodel->parameters->FindParam(&grdmodel,GrdModelEnum);
+	if(grdmodel==IvinsEnum) return NULL;
+
 	/*retrieve parameters:*/
-	femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
-	femmodel->parameters->FindParam(&geometrydone,SealevelriseGeometryDoneEnum);
-
-	if(geometrydone){
-		if(VerboseSolution()) _printf0_("	  geometrical offsets have already been computed, skipping \n");
-		return; //don't need to run this again.
-	}
+	femmodel->parameters->FindParam(&xxe,&nel,XxeEnum);
+	femmodel->parameters->FindParam(&yye,&nel,YyeEnum);
+	femmodel->parameters->FindParam(&zze,&nel,ZzeEnum);
+	femmodel->parameters->FindParam(&areae,&nel,AreaeEnum);
+
+	/*initialize SealevelloadMasks structure: */
+	slgeom=new SealevelGeometry(femmodel->elements->Size(),femmodel->vertices->Size());
 
 	/*Verbose: */
-	if(VerboseSolution()) _printf0_("	  computing geometrical offsets into precomputed Green tables \n");
-
-	/*first, recover lat,long and radius vectors from vertices: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); 
-	if(horiz) VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices); 
-
-
-	/*Run sealevelrise geometry routine in elements:*/
+	if(VerboseSolution()) _printf0_("	  computing sea level geometrical kernel and weight updates.\n");
+
+	/*Run sealevel geometry routine for elements with full loading:*/
 	for(Object* & object : femmodel->elements->objects){
 		Element*   element=xDynamicCast<Element*>(object);
-		element->SealevelriseGeometry(latitude,longitude,radius,xx,yy,zz);
-	}
-
-	/*Free ressources:*/
-	if(horiz){
-		xDelete<IssmDouble>(xx);
-		xDelete<IssmDouble>(yy);
-		xDelete<IssmDouble>(zz);
-	}
-	xDelete<IssmDouble>(latitude);
-	xDelete<IssmDouble>(longitude);
-	xDelete<IssmDouble>(radius);
-
-	/*Record the fact that we ran this module already: */
-	femmodel->parameters->SetParam(true,SealevelriseGeometryDoneEnum); 
-
+		element->SealevelchangeGeometryCentroidLoads(slgeom,xxe,yye,zze,areae);
+	}
+
+	/*Initialize fractional loading mapping: */
+	slgeom->InitializeMappingsAndBarycentres();
+
+	/*Run sealevel geometry routine for elements with fractional loading:*/
+	for(Object* & object : femmodel->elements->objects){
+		Element*   element=xDynamicCast<Element*>(object);
+		element->SealevelchangeGeometrySubElementLoads(slgeom,areae);
+	}
+
+	/*Assemble barycentres of fraction loading elements:*/
+	slgeom->Assemble();
+
+	/*Create fractional green function kernels: */
+	for(Object* & object : femmodel->elements->objects){
+		Element*   element=xDynamicCast<Element*>(object);
+		element->SealevelchangeGeometrySubElementKernel(slgeom);
+	}
+
+	femmodel->parameters->AddObject(new DoubleVecParam(XxeEnum,xxe,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(YyeEnum,yye,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(ZzeEnum,zze,nel));
+	femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel));
+
+	return slgeom;
 
 }/*}}}*/
-Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel,SealevelMasks* masks, IssmDouble* poceanarea){ /*{{{*/
-
-	/*Eustatic core of the SLR solution (terms that are constant with respect to sea-level)*/
-
-	Vector<IssmDouble> *RSLgi    = NULL;
-	IssmDouble          RSLgi_oceanaverage   = 0;
-
-	/*parameters: */
-	int  gsize;
-	IssmDouble oceanarea;
-	int        step;
-	IssmDouble time;
-
-	/*barystatic contribution:*/
-	IssmDouble bslr;
-	IssmDouble bslrice;
-	IssmDouble* bslrice_partition=NULL;
-	IssmDouble bslrhydro;
-	IssmDouble* bslrhydro_partition=NULL;
-	IssmDouble cumbslr;
-	IssmDouble cumbslrice;
-	IssmDouble cumbslrhydro;
-	IssmDouble* cumbslrice_partition=NULL;
-	int npartice;
-	IssmDouble* cumbslrhydro_partition=NULL;
-	int nparthydro;
-	
-	if(VerboseSolution()) _printf0_("	  computing bslr components on ice\n");
-
-	/*Figure out size of g-set deflection vector and allocate solution vector: */
-	gsize = femmodel->nodes->NumberOfDofs(GsetEnum);
-
-	/*some parameters:*/
-	femmodel->parameters->FindParam(&step,StepEnum);
-	femmodel->parameters->FindParam(&time,TimeEnum);
-	femmodel->parameters->FindParam(&cumbslr,CumBslrEnum);
-	femmodel->parameters->FindParam(&cumbslrice,CumBslrIceEnum);
-	femmodel->parameters->FindParam(&cumbslrhydro,CumBslrHydroEnum);
-	femmodel->parameters->FindParam(&npartice,SolidearthNpartIceEnum);
-	femmodel->parameters->FindParam(&nparthydro,SolidearthNpartHydroEnum);
-	if(npartice) femmodel->parameters->FindParam(&cumbslrice_partition,&npartice,NULL,CumBslrIcePartitionEnum);
-	if(nparthydro) femmodel->parameters->FindParam(&cumbslrhydro_partition,&nparthydro,NULL,CumBslrHydroPartitionEnum);
-
-	/*Initialize:*/
-	RSLgi = new Vector<IssmDouble>(gsize);
-
-	/*call the bslr main module: */
-	femmodel->SealevelriseEustatic(RSLgi,&oceanarea,&bslr, &bslrice, &bslrhydro, &bslrice_partition, &bslrhydro_partition,masks); //this computes 
-
-	/*we need to average RSLgi over the ocean: RHS term  4 in Eq.4 of Farrel and clarke. Only the elements can do that: */
-	RSLgi_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgi,masks, oceanarea);
-
-	/*RSLg is the sum of the pure bslr component (term 3) and the contribution from the perturbation to the graviation potential due to the 
-	 * presence of ice (terms 1 and 4 in Eq.4 of Farrel and Clarke):*/
-	RSLgi->Shift(-bslr-RSLgi_oceanaverage);
-
-	/*save bslr and cumulated bslr value for results:{{{ */
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,BslrEnum,-bslr,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,BslrIceEnum,-bslrice,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,BslrHydroEnum,-bslrhydro,step,time));
-
-	//cumulative barystatic contribution: 
-	cumbslr=cumbslr-bslr;
-	cumbslrice=cumbslrice-bslrice;
-	cumbslrhydro=cumbslrhydro-bslrhydro;
-
-	femmodel->parameters->SetParam(cumbslr,CumBslrEnum);
-	femmodel->parameters->SetParam(cumbslrice,CumBslrIceEnum);
-	femmodel->parameters->SetParam(cumbslrhydro,CumBslrHydroEnum);
-
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumBslrEnum,cumbslr,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumBslrIceEnum,cumbslrice,step,time));
-	femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,CumBslrHydroEnum,cumbslrhydro,step,time));
-
-	//cumulative barystatic contributions by partition:
-	if(npartice){
-		for(int i=0;i<npartice;i++) cumbslrice_partition[i] -= bslrice_partition[i];
-		femmodel->parameters->SetParam(cumbslrice_partition,npartice,1,CumBslrIcePartitionEnum);
-		femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,CumBslrIcePartitionEnum,cumbslrice_partition,npartice,1,step,time));
-	}
-
-	if(nparthydro){
-		for(int i=0;i<nparthydro;i++) cumbslrhydro_partition[i] -= bslrhydro_partition[i];
-		femmodel->parameters->SetParam(cumbslrhydro_partition,nparthydro,1,CumBslrHydroPartitionEnum);
-		femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,CumBslrHydroPartitionEnum,cumbslrhydro_partition,nparthydro,1,step,time));
-	}
-	/*}}}*/
-	
-	/*Assign output pointers and return: */
-	*poceanarea=oceanarea;
-	return RSLgi;
-}/*}}}*/
-Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel, SealevelMasks* masks, Vector<IssmDouble>* RSLg_eustatic,IssmDouble oceanarea){ /*{{{*/
-
-	/*sealevelrise_core_noneustatic.cpp //this computes the contributions from Eq.4 of Farrel and Clarke, rhs terms 2 and 5.
-	  non eustatic core of the SLR solution */
-
-	Vector<IssmDouble> *RSLg    = NULL;
-	Vector<IssmDouble> *RSLg_old    = NULL;
-
-	Vector<IssmDouble> *RSLgo    = NULL; //ocean convolution of the perturbation to gravity potential.
-	Vector<IssmDouble> *RSLgo_rot= NULL; // rotational feedback 
-	IssmDouble          RSLgo_oceanaverage = 0;  //average of RSLgo over the ocean.
-
-	/*parameters: */
-	int count;
-	bool save_results;
-	int  gsize;
+
+/*subroutines:*/
+bool slcconvergence(Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs){ /*{{{*/
+
 	bool converged=true;
-	bool rotation=true;
-	bool verboseconvolution=true;
-	int max_nonlinear_iterations;
-	IssmDouble           eps_rel;
-	IssmDouble           eps_abs;
-	IssmDouble			Ixz, Iyz, Izz; 
-	
-	if(VerboseSolution()) _printf0_("	  converging on ocean components\n");
-
-	/*Recover some parameters: */
-	femmodel->parameters->FindParam(&max_nonlinear_iterations,SolidearthSettingsMaxiterEnum);
-	femmodel->parameters->FindParam(&eps_rel,SolidearthSettingsReltolEnum);
-	femmodel->parameters->FindParam(&eps_abs,SolidearthSettingsAbstolEnum);
-
-	/*computational flag: */
+	IssmDouble ndS,nS; 
+	Vector<IssmDouble> *dRSLg    = NULL;
+
+	//compute norm(du) and norm(u) if requested
+	dRSLg=RSLg_old->Duplicate(); RSLg_old->Copy(dRSLg); dRSLg->AYPX(RSLg,-1.0);
+	ndS=dRSLg->Norm(NORM_TWO); 
+
+	if (xIsNan<IssmDouble>(ndS)){
+		_error_("convergence criterion is NaN (RSL_old=" << RSLg_old->Norm(NORM_TWO) << " RSL=" << RSLg->Norm(NORM_TWO) << ")");
+	}
+
+	if(!xIsNan<IssmDouble>(eps_rel)){
+		nS=RSLg_old->Norm(NORM_TWO);
+		if (xIsNan<IssmDouble>(nS)) _error_("convergence criterion is NaN! (check the initial RSL)");
+	}
+
+	//clean up
+	delete dRSLg;
+
+	//print
+	if(!xIsNan<IssmDouble>(eps_rel)){
+		if((ndS/nS)<eps_rel){
+			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 << " < " << eps_rel*100 << " %\n");
+		}
+		else{ 
+			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 << " > " << eps_rel*100 << " %\n");
+			converged=false;
+		}
+	}
+	if(!xIsNan<IssmDouble>(eps_abs)){
+		if(ndS<eps_abs){
+			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)" << ndS << " < " << eps_abs << " \n");
+		}
+		else{ 
+			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)" << ndS << " > " << eps_abs << " \n");
+			converged=false;
+		}
+	}
+
+	/*assign output*/
+	return converged;
+
+} /*}}}*/
+IssmDouble  SealevelloadsOceanAverage(GrdLoads* loads, Vector<IssmDouble>* oceanareas, Vector<IssmDouble>* suboceanareas, IssmDouble totaloceanarea){ /*{{{*/
+
+	IssmDouble sealevelloadsaverage;	
+	IssmDouble subsealevelloadsaverage;	
+
+	Vector<IssmDouble>* vsealevelloadsvolume=loads->vsealevelloads->Duplicate();
+	Vector<IssmDouble>* vsubsealevelloadsvolume=loads->vsubsealevelloads->Duplicate();
+
+	vsealevelloadsvolume->PointwiseMult(loads->vsealevelloads,oceanareas);
+	vsubsealevelloadsvolume->PointwiseMult(loads->vsubsealevelloads,suboceanareas);
+
+	vsealevelloadsvolume->Sum(&sealevelloadsaverage);
+	vsubsealevelloadsvolume->Sum(&subsealevelloadsaverage);
+	delete vsealevelloadsvolume; 
+	delete vsubsealevelloadsvolume; 
+
+	return (sealevelloadsaverage+subsealevelloadsaverage)/totaloceanarea;
+} /*}}}*/
+void PolarMotion(IssmDouble* polarmotionvector, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom){ /*{{{*/
+
+	IssmDouble  moi_list[3]={0,0,0};
+	IssmDouble  moi_list_sub[3]={0,0,0};
+	IssmDouble  moi_list_cpu[3]={0,0,0};
+	IssmDouble*	tide_love_h  = NULL;
+	IssmDouble*	tide_love_k  = NULL;
+	IssmDouble*	load_love_k  = NULL;
+	IssmDouble  tide_love_k2secular;
+	IssmDouble  moi_e, moi_p;
+	IssmDouble	m1, m2, m3;
+	bool rotation=false;
+
+	/*early return?:*/
 	femmodel->parameters->FindParam(&rotation,SolidearthSettingsRotationEnum);
-
-	/*Figure out size of g-set deflection vector and allocate solution vector: */
-	gsize = femmodel->nodes->NumberOfDofs(GsetEnum);
-
-	/*Initialize:*/
-	RSLg = new Vector<IssmDouble>(gsize);
-	RSLg->Assemble();
-	RSLg_eustatic->Copy(RSLg);  //first initialize RSLg with the eustatic component computed in sealevelrise_core_eustatic.
-
-	RSLg_old = new Vector<IssmDouble>(gsize);
-	RSLg_old->Assemble();
-
-	count=1;
-	converged=false;
-
-	/*Start loop: */
-	for(;;){
-
-		//save pointer to old sea level rise
-		delete RSLg_old; RSLg_old=RSLg; 
-
-		/*Initialize solution vector: */
-		RSLg  = new Vector<IssmDouble>(gsize); RSLg->Assemble();
-		RSLgo = new Vector<IssmDouble>(gsize); RSLgo->Assemble();
-
-		/*call the non eustatic module: */
-		femmodel->SealevelriseNonEustatic(RSLgo, RSLg_old,  masks, verboseconvolution);
-
-		/*assemble solution vector: */
-		RSLgo->Assemble(); 
-
-		if(rotation){
-
-			/*call rotational feedback  module: */
-			RSLgo_rot = new Vector<IssmDouble>(gsize); RSLgo_rot->Assemble();
-			femmodel->SealevelriseRotationalFeedback(RSLgo_rot,RSLg_old,&Ixz,&Iyz,&Izz, masks); 
-			RSLgo_rot->Assemble(); 
-
-			/*save changes in inertia tensor as results: */
-			femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorXZEnum,Ixz));
-			femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorYZEnum,Iyz));
-			femmodel->results->AddResult(new GenericExternalResult<IssmDouble>(femmodel->results->Size()+1,SealevelInertiaTensorZZEnum,Izz));
-
-			RSLgo->AXPY(RSLgo_rot,1); 
-		}
-
-		/*we need to average RSLgo over the ocean: RHS term  5 in Eq.4 of Farrel and clarke. Only the elements can do that: */
-		RSLgo_oceanaverage=femmodel->SealevelriseOceanAverage(RSLgo,masks, oceanarea);
-
-		/*RSLg is the sum of the eustatic term, and the ocean terms: */
-		RSLg_eustatic->Copy(RSLg); RSLg->AXPY(RSLgo,1); 
-		RSLg->Shift(-RSLgo_oceanaverage);
-
-		/*convergence criterion:*/
-		slrconvergence(&converged,RSLg,RSLg_old,eps_rel,eps_abs);
-		
-	
-		/*free ressources: */
-		delete RSLgo;
-		delete RSLgo_rot;
-
-		/*Increase count: */
-		count++;
-		if(converged==true){
-			break;
-		}
-		if(count>=max_nonlinear_iterations){
-			_printf0_("   maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded\n"); 
-			converged=true;
-			break;
-		}	
-
-		/*some minor verbosing adjustment:*/
-		if(count>1)verboseconvolution=false;
-
-	}
-	if(VerboseConvergence()) _printf0_("\n              total number of iterations: " << count-1 << "\n");
-	
-	
-	delete RSLg_old;
-
-	return RSLg;
+	if(!rotation)return;
+
+	/*retrieve parameters: */
+	femmodel->parameters->FindParam(&load_love_k,NULL,NULL,LoadLoveKEnum);
+	femmodel->parameters->FindParam(&tide_love_h,NULL,NULL,TidalLoveHEnum);
+	femmodel->parameters->FindParam(&tide_love_k,NULL,NULL,TidalLoveKEnum);
+	femmodel->parameters->FindParam(&tide_love_k2secular,TidalLoveK2SecularEnum);
+	femmodel->parameters->FindParam(&moi_e,RotationalEquatorialMoiEnum);
+	femmodel->parameters->FindParam(&moi_p,RotationalPolarMoiEnum);
+
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+
+		element->SealevelchangeMomentOfInertiaCentroid(&moi_list[0],loads,slgeom);
+		element->SealevelchangeMomentOfInertiaSubElement(&moi_list_sub[0],loads, slgeom);
+
+		moi_list_cpu[0] += moi_list[0]+moi_list_sub[0];
+		moi_list_cpu[1] += moi_list[1]+moi_list_sub[1];
+		moi_list_cpu[2] += moi_list[2]+moi_list_sub[2];
+	}
+
+	for (int i=0;i<3;i++) moi_list[i]=0;
+
+	ISSM_MPI_Reduce (&moi_list_cpu[0],&moi_list[0],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&moi_list[0],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	ISSM_MPI_Reduce (&moi_list_cpu[1],&moi_list[1],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&moi_list[1],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	ISSM_MPI_Reduce (&moi_list_cpu[2],&moi_list[2],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&moi_list[2],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*compute perturbation terms for angular velocity vector: */
+	m1 = 1/(1-tide_love_k[2]/tide_love_k2secular) * (1+load_love_k[2])/(moi_p-moi_e) * moi_list[0];
+	m2 = 1/(1-tide_love_k[2]/tide_love_k2secular) * (1+load_love_k[2])/(moi_p-moi_e) * moi_list[1];
+	m3 = -(1+load_love_k[2])/moi_p * moi_list[2];	// term associated with fluid number (3-order-of-magnitude smaller) is negelected
+
+	/*Assign output pointers:*/
+	polarmotionvector[0]=m1;
+	polarmotionvector[1]=m2;
+	polarmotionvector[2]=m3;
 } /*}}}*/
-void sealevelrise_core_elastic(Vector<IssmDouble>** pU_esa, Vector<IssmDouble>** pU_north_esa,Vector<IssmDouble>** pU_east_esa,FemModel* femmodel,Vector<IssmDouble>* RSLg, SealevelMasks* masks){ /*{{{*/
-
-	Vector<IssmDouble> *U_esa  = NULL; 
-	Vector<IssmDouble> *U_north_esa   = NULL; 
-	Vector<IssmDouble> *U_east_esa    = NULL; 
-
-	/*parameters: */
-	int  gsize;
-	bool spherical=true;
-
-	IssmDouble          *latitude   = NULL;
-	IssmDouble          *longitude  = NULL;
-	IssmDouble          *radius     = NULL;
-	IssmDouble          *xx     = NULL;
-	IssmDouble          *yy     = NULL;
-	IssmDouble          *zz     = NULL;
-	int  horiz;
-	
-	if(VerboseSolution()) _printf0_("	  computing vertical and horizontal geodetic signatures\n");
-
-	/*retrieve some parameters:*/
-	femmodel->parameters->FindParam(&horiz,SolidearthSettingsHorizEnum);
-
-	/*find size of vectors:*/
-	gsize      = femmodel->nodes->NumberOfDofs(GsetEnum);
-
-	/*intialize vectors:*/
-	U_esa = new Vector<IssmDouble>(gsize);
-	if (horiz){
-		U_north_esa = new Vector<IssmDouble>(gsize);
-		U_east_esa = new Vector<IssmDouble>(gsize);
-	}
-
-	/*retrieve geometric information: */
-	VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical); 
-	VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices); 
-
-	/*call the elastic main modlule:*/ 
-	femmodel->SealevelriseElastic(U_esa,U_north_esa,U_east_esa,RSLg, masks);
-
-	/*Assign output pointers:*/
-	*pU_esa=U_esa;
-	if(horiz){
-		*pU_east_esa=U_east_esa;
-		*pU_north_esa=U_north_esa;
-	}
-
-	/*Free ressources: */
-	xDelete<IssmDouble>(longitude);
-	xDelete<IssmDouble>(latitude);
-	xDelete<IssmDouble>(xx);
-	xDelete<IssmDouble>(yy);
-	xDelete<IssmDouble>(zz);
-	xDelete<IssmDouble>(radius);
-}
-/*}}}*/
-void sealevelrise_core_viscous(Vector<IssmDouble>** pU_gia, Vector<IssmDouble>** pN_gia,FemModel* femmodel,Vector<IssmDouble>* RSLg){ /*{{{*/
-
-	/*variables:*/
-	Vector<IssmDouble> *U_gia  = NULL; 
-	Vector<IssmDouble> *N_gia  = NULL; 
-
-	/*parameters:*/
-	int					frequency;
-	IssmDouble          dt;
-	
-	if(VerboseSolution()) _printf0_("	  computing viscous components\n");
-
-	/*retrieve some parameters:*/
-	femmodel->parameters->FindParam(&frequency,SolidearthSettingsRunFrequencyEnum);
-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-
-	/*recover GIA rates:*/
-	GetVectorFromInputsx(&U_gia,femmodel,UGiaRateEnum,VertexSIdEnum);
-	GetVectorFromInputsx(&N_gia,femmodel,NGiaRateEnum,VertexSIdEnum);
-
-	/*we just loaded rates, that's not what's being asked, scale by time:*/ 
-	U_gia->Scale(frequency*dt);
-	N_gia->Scale(frequency*dt);
-
-	/*Assign output pointers:*/
-	*pU_gia=U_gia;
-	*pN_gia=N_gia;
-
-}
-/*}}}*/
-void sealevelrise_diagnostics(FemModel* femmodel,Vector<IssmDouble>* RSLg){ /*{{{*/
-
-	/*compute spherical harmonics deg 1 and deg 2 coefficeints:*/
-
-}
-/*}}}*/
-void GetDynamicRate(Vector<IssmDouble> ** pdynamic_rate_g, FemModel* femmodel){ /*{{{*/
-
-	int dslmodel=-1;
-	IssmDouble time;
-
-	/*variables:*/
-	Vector<IssmDouble> *dynamic_rate_g  = NULL; 
-
-	/*Update steric rates before retrieving them on Vertex SID set:*/
-	femmodel->parameters->FindParam(&dslmodel,DslModelEnum);
-	femmodel->parameters->FindParam(&time,TimeEnum);
-	if(dslmodel==1){
-		TransientInput* transient_input  = femmodel->inputs->GetTransientInput(DslSeaSurfaceHeightChangeAboveGeoidEnum);
-		TriaInput* tria_input=transient_input->GetTriaInput(time);
-		Input* tria_input_copy=tria_input->copy();
-		tria_input_copy->ChangeEnum(DslDynamicRateEnum);
-		femmodel->inputs->AddInput(tria_input_copy);
-	}
-	else if(dslmodel==2){
-	
-		IssmDouble modelid;
-		
-		/*Recover modelid:*/
-		femmodel->parameters->FindParam(&modelid,DslModelidEnum);
-		modelid--; //from matlab. 
-		
-		/*find the DslSeaSurfaceHeightChangeAboveGeoidEnum dataset of transient inputs:*/
-		DatasetInput* dataset_input=femmodel->inputs->GetDatasetInput(DslSeaSurfaceHeightChangeAboveGeoidEnum);
-		
-		/*Go find the modelid'th transient input:*/
-		TriaInput* tria_input=dataset_input->GetTriaInputByOffset(reCast<int, IssmDouble>(modelid));
-		
-		/*Plug into DslDynamicRate input: */
-		Input* tria_input_copy=tria_input->copy();
-		tria_input_copy->ChangeEnum(DslDynamicRateEnum);
-		femmodel->inputs->AddInput(tria_input_copy);
-	}
-	else _error_("not implemented yet");
-
-	GetVectorFromInputsx(&dynamic_rate_g,femmodel,DslDynamicRateEnum,VertexSIdEnum);
-	*pdynamic_rate_g=dynamic_rate_g;
-}
-/*}}}*/
-void GetStericRate(Vector<IssmDouble> ** psteric_rate_g, FemModel* femmodel){ /*{{{*/
-
-	int dslmodel=-1;
-	IssmDouble time;
-
-	/*variables:*/
-	Vector<IssmDouble> *steric_rate_g  = NULL; 
-
-	/*Update steric rates before retrieving them on Vertex SID set:*/
-	femmodel->parameters->FindParam(&dslmodel,DslModelEnum);
-	femmodel->parameters->FindParam(&time,TimeEnum);
-	if(dslmodel==1){
-		TransientInput* transient_input  = femmodel->inputs->GetTransientInput(DslGlobalAverageThermostericSeaLevelChangeEnum);
-		TriaInput* tria_input=transient_input->GetTriaInput(time);
-		Input* tria_input_copy=tria_input->copy();
-		tria_input_copy->ChangeEnum(DslStericRateEnum);
-		femmodel->inputs->AddInput(tria_input_copy);
-	}
-	else if (dslmodel==2){
-		IssmDouble modelid;
-		
-		/*Recover modelid:*/
-		femmodel->parameters->FindParam(&modelid,DslModelidEnum);
-		
-		modelid--; //from matlab. 
-		
-		/*find the DslGlobalAverageThermostericSeaLevelChangeEnum dataset of transient inputs:*/
-		DatasetInput* dataset_input=femmodel->inputs->GetDatasetInput(DslGlobalAverageThermostericSeaLevelChangeEnum);
-		
-		/*Go find the modelid'th transient input:*/
-		TriaInput* tria_input=dataset_input->GetTriaInputByOffset(reCast<int, IssmDouble>(modelid));
-		
-		/*Plug into DslStericRate input: */
-		Input* tria_input_copy=tria_input->copy();
-		tria_input_copy->ChangeEnum(DslStericRateEnum);
-		femmodel->inputs->AddInput(tria_input_copy);
-	}
-	else _error_("not implemented yet");
-
-	GetVectorFromInputsx(&steric_rate_g,femmodel,DslStericRateEnum,VertexSIdEnum);
-	*psteric_rate_g=steric_rate_g;
-}
-/*}}}*/
-void SetBottomPressure(FemModel* femmodel){ /*{{{*/
-
-	int dslmodel=-1;
-	int type;
-
-	/*If we are running a dsl mme model, we need to update the bottom pressure first: */
-	femmodel->parameters->FindParam(&dslmodel,DslModelEnum);
-	if(dslmodel==2){
-	
-		IssmDouble modelid;
-		/*figure out the type of DslSeaWaterPressureChangeAtSeaFloor input:*/
-		type=femmodel->inputs->GetInputObjectEnum(DslSeaWaterPressureChangeAtSeaFloorEnum);
-
-		if(type==DatasetInputEnum){
-		
-			/*find the DslSeaWaterPressureChangeAtSeaFloor dataset of transient inputs:*/
-			DatasetInput* dataset_input=femmodel->inputs->GetDatasetInput(DslSeaWaterPressureChangeAtSeaFloorEnum);
-		
-			/*Recover modelid:*/
-			femmodel->parameters->FindParam(&modelid,DslModelidEnum);
-			modelid--; //from matlab. 
-		
-			/*Go find the modelid'th transient input:*/
-			TransientInput* transient_input=dataset_input->GetTransientInputByOffset(reCast<int, IssmDouble>(modelid));
-
-			/*Plug into DslSeaWaterPressureChangeAtSeaFloor input: */
-			Input* transient_input_copy=transient_input->copy();
-			transient_input_copy->ChangeEnum(DslSeaWaterPressureChangeAtSeaFloorEnum);
-			femmodel->inputs->AddInput(transient_input_copy);
-		}
-	}
-}
-/*}}}*/
-
-/*support routines:*/
+void        ConserveOceanMass(FemModel* femmodel,GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){ /*{{{*/
+
+	/*Shift sealevel loads by ocean average, only on ocean! :*/
+	for(Object* & object : femmodel->elements->objects){
+		Element* element = xDynamicCast<Element*>(object);
+		element->SealevelchangeShift(loads, offset,slgeom);
+	}
+	loads->AssembleSealevelLoads();
+
+} /*}}}*/
+IssmDouble* CombineLoads(IssmDouble* load,IssmDouble* subload,FemModel* femmodel, SealevelGeometry* slgeom,int loadtype,int nel){ /*{{{*/
+
+	int* indices=xNew<int>(nel);
+	for(int i=0;i<nel;i++)indices[i]=i;
+
+	Vector<IssmDouble>* vloadcopy=new Vector<IssmDouble>(nel);
+	IssmDouble* loadcopy=xNew<IssmDouble>(nel);
+
+	vloadcopy->SetValues(nel,indices,load,INS_VAL);
+	vloadcopy->Assemble();
+
+	if(subload){
+		for (int i=0;i<femmodel->elements->Size();i++){
+			if (slgeom->issubelement[loadtype][i]){
+				int se= slgeom->subelementmapping[loadtype][i];
+				IssmDouble subloadi=subload[se];
+				Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+				vloadcopy->SetValue(element->Sid(),subloadi,ADD_VAL);
+			}
+		}
+	}
+	vloadcopy->Assemble();
+	loadcopy=vloadcopy->ToMPISerial();
+
+	return loadcopy;
+
+} /*}}}*/
+
+/*Coupling routines:*/
 void TransferForcing(FemModel* femmodel,int forcingenum){ /*{{{*/
 
@@ -852,4 +850,5 @@
 	int*         transitions_n=NULL;
 	int          nv;
+	int          existforcing=0;         
 
 	/*communicators:*/
@@ -882,5 +881,6 @@
 	if(modelid!=earthid){
 		nv=femmodel->vertices->NumberOfVertices();
-		GetVectorFromInputsx(&forcing,femmodel,forcingenum,VertexSIdEnum);
+		existforcing=reCast<int>(femmodel->inputs->Exist(forcingenum));
+		if(existforcing)GetVectorFromInputsx(&forcing,femmodel,forcingenum,VertexSIdEnum);
 	}
 
@@ -891,13 +891,22 @@
 			nvs=xNew<int>(nummodels-1);
 			for(int i=0;i<earthid;i++){
-				ISSM_MPI_Recv(nvs+i, 1, ISSM_MPI_INT, 0,i, fromcomms[i], &status);
-				forcings[i]=xNew<IssmDouble>(nvs[i]);
-				ISSM_MPI_Recv(forcings[i], nvs[i], ISSM_MPI_DOUBLE, 0,i, fromcomms[i], &status);
+				ISSM_MPI_Recv(&existforcing, 1, ISSM_MPI_INT, 0,i, fromcomms[i], &status);
+				if(existforcing){
+					ISSM_MPI_Recv(nvs+i, 1, ISSM_MPI_INT, 0,i, fromcomms[i], &status);
+					forcings[i]=xNew<IssmDouble>(nvs[i]);
+					ISSM_MPI_Recv(forcings[i], nvs[i], ISSM_MPI_DOUBLE, 0,i, fromcomms[i], &status);
+				}
+				else{
+					forcings[i]=NULL;
+				}
 			}
 
 		}
 		else{
-			ISSM_MPI_Send(&nv, 1, ISSM_MPI_INT, 0, modelid, tocomm);
-			ISSM_MPI_Send(forcing, nv, ISSM_MPI_DOUBLE, 0, modelid, tocomm);
+			ISSM_MPI_Send(&existforcing, 1, ISSM_MPI_INT, 0, modelid, tocomm);
+			if(existforcing){
+				ISSM_MPI_Send(&nv, 1, ISSM_MPI_INT, 0, modelid, tocomm);
+				ISSM_MPI_Send(forcing, nv, ISSM_MPI_DOUBLE, 0, modelid, tocomm);
+			}
 		}
 	}
@@ -913,5 +922,5 @@
 
 		/*Retrieve transition vectors, used to plug from each ice cap into the global forcing:*/
-		femmodel->parameters->FindParam(&transitions,&ntransitions,&transitions_m,&transitions_n,SealevelriseTransitionsEnum);
+		femmodel->parameters->FindParam(&transitions,&ntransitions,&transitions_m,&transitions_n,SealevelchangeTransitionsEnum);
 
 		if(ntransitions!=earthid)_error_("TransferForcing error message: number of transition vectors is not equal to the number of icecaps!");
@@ -922,14 +931,16 @@
 
 				IssmDouble* forcingfromcap= forcings[i]; //careful, this only exists on rank 0 of the earth model!
-				IssmDouble* transition=transitions[i];
-				int         M=transitions_m[i];
-
-				/*build index to plug values: */
-				int*        index=xNew<int>(M); for(int i=0;i<M;i++)index[i]=reCast<int>(transition[i])-1; //matlab indexing!
-
-				/*We are going to plug this vector into the earth model, at the right vertices corresponding to this particular 
-				 * ice cap: */
-				forcingglobal->SetValues(M,index,forcingfromcap,ADD_VAL);
-				xDelete<int>(index);
+				if(forcingfromcap){
+					IssmDouble* transition=transitions[i];
+					int         M=transitions_m[i];
+
+					/*build index to plug values: */
+					int*        index=xNew<int>(M); for(int i=0;i<M;i++)index[i]=reCast<int>(transition[i])-1; //matlab indexing!
+
+					/*We are going to plug this vector into the earth model, at the right vertices corresponding to this particular 
+					 * ice cap: */
+					forcingglobal->SetValues(M,index,forcingfromcap,ADD_VAL);
+					xDelete<int>(index);
+				}
 			}
 		}
@@ -946,5 +957,6 @@
 	if(forcings){
 		for(int i=0;i<nummodels-1;i++){
-			IssmDouble* temp=forcings[i]; xDelete<IssmDouble>(temp);
+			IssmDouble* temp=forcings[i]; 
+			if(temp)xDelete<IssmDouble>(temp);
 		}
 		xDelete<IssmDouble*>(forcings);
@@ -1019,7 +1031,7 @@
 
 			/*Retrieve transition vectors, used to figure out global forcing contribution to each ice cap's own elements: */
-			femmodel->parameters->FindParam(&transitions,&ntransitions,&transitions_m,&transitions_n,SealevelriseTransitionsEnum);
-
-			if(ntransitions!=earthid)_error_("TransferSeaLevel error message: number of transition vectors is not equal to the number of icecaps!");
+			femmodel->parameters->FindParam(&transitions,&ntransitions,&transitions_m,&transitions_n,SealevelchangeTransitionsEnum);
+
+			if(ntransitions!=earthid)_error_("TransferSealevel error message: number of transition vectors is not equal to the number of icecaps!");
 
 			for(int i=0;i<earthid;i++){
@@ -1069,94 +1081,2 @@
 
 } /*}}}*/
-void EarthMassTransport(FemModel* femmodel){ /*{{{*/
-
-	IssmDouble time,dt;
-	Vector<IssmDouble> *oldthickness    = NULL;
-	Vector<IssmDouble> *newthickness    = NULL;
-	Vector<IssmDouble> *deltathickness    = NULL;
-	Vector<IssmDouble> *cumdeltathickness    = NULL;
-	int nv;
-
-	if(VerboseSolution()) _printf0_("              computing earth mass transport\n");
-
-	/*This module has to be recoded! We do not grab spc thicknesses from an earth model 
-	 * anymore! Thicknesses come from a mass transport module applied to each basin! 
-	 * Commeting out for now:*/
-	_error_("EarthMassTransport error message: not supported anymore!");
-
-	/*This mass transport module for the Earth is because we might have thickness variations as spcs 
-	 * specified in the md.slr class, outside of what we will get from the icecaps. That's why we get t
-	 * the thickness variations from SealevelriseSpcthicknessEnum.*/
-
-	/*No mass transport module was called, so we are just going to retrieve the geometry thickness 
-	 * at this time step, at prior time step, and plug the difference as deltathickness: */
-	/*femmodel->parameters->FindParam(&time,TimeEnum);
-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	nv=femmodel->vertices->NumberOfVertices();
-
-	GetVectorFromInputsx(&newthickness,femmodel,SealevelriseSpcthicknessEnum,VertexSIdEnum);
-	GetVectorFromInputsx(&oldthickness,femmodel,SealevelriseSpcthicknessEnum,VertexSIdEnum,time-dt);*/
-
-	/*compute deltathickness: */
-	/*deltathickness = new Vector<IssmDouble>(nv); 
-	newthickness->Copy(deltathickness); deltathickness->AXPY(oldthickness,-1); */
-
-	/*plug into elements:*/
-//	InputUpdateFromVectorx(femmodel,deltathickness,SurfaceloadIceThicknessChangeEnum,VertexSIdEnum);
-
-	/*add to cumulated delta thickness: */
-	/*GetVectorFromInputsx(&cumdeltathickness,femmodel,SealevelriseCumDeltathicknessEnum,VertexSIdEnum);
-	cumdeltathickness->AXPY(deltathickness,1); 
-	InputUpdateFromVectorx(femmodel,cumdeltathickness,SealevelriseCumDeltathicknessEnum,VertexSIdEnum);*/
-
-	/*free ressources:*/
-	/*delete oldthickness;
-	delete newthickness;
-	delete deltathickness;
-	delete cumdeltathickness;*/
-
-} /*}}}*/
-void slrconvergence(bool* pconverged, Vector<IssmDouble>* RSLg,Vector<IssmDouble>* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs){ /*{{{*/
-
-	bool converged=true;
-	IssmDouble ndS,nS; 
-	Vector<IssmDouble> *dRSLg    = NULL;
-
-	//compute norm(du) and norm(u) if requested
-	dRSLg=RSLg_old->Duplicate(); RSLg_old->Copy(dRSLg); dRSLg->AYPX(RSLg,-1.0);
-	ndS=dRSLg->Norm(NORM_TWO); 
-
-	if (xIsNan<IssmDouble>(ndS)) _error_("convergence criterion is NaN!");
-
-	if(!xIsNan<IssmDouble>(eps_rel)){
-		nS=RSLg_old->Norm(NORM_TWO);
-		if (xIsNan<IssmDouble>(nS)) _error_("convergence criterion is NaN!");
-	}
-
-	//clean up
-	delete dRSLg;
-
-	//print
-	if(!xIsNan<IssmDouble>(eps_rel)){
-		if((ndS/nS)<eps_rel){
-			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 << " < " << eps_rel*100 << " %\n");
-		}
-		else{ 
-			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 << " > " << eps_rel*100 << " %\n");
-			converged=false;
-		}
-	}
-	if(!xIsNan<IssmDouble>(eps_abs)){
-		if(ndS<eps_abs){
-			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)" << ndS << " < " << eps_abs << " \n");
-		}
-		else{ 
-			if(VerboseConvergence()) _printf0_(setw(50) << left << "              convergence criterion: norm(dS)" << ndS << " > " << eps_abs << " \n");
-			converged=false;
-		}
-	}
-
-	/*assign output*/
-	*pconverged=converged;
-
-} /*}}}*/
Index: issm/trunk/src/c/cores/stressbalance_core.cpp
===================================================================
--- issm/trunk/src/c/cores/stressbalance_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/stressbalance_core.cpp	(revision 26744)
@@ -19,5 +19,5 @@
 	bool       dakota_analysis,control_analysis;
 	int        domaintype;
-	bool       isSIA,isSSA,isL1L2,isHO,isFS,isNitsche;
+	bool       isSIA,isSSA,isL1L2,isMLHO,isHO,isFS,isNitsche;
 	bool       save_results;
 	int        solution_type;
@@ -31,4 +31,5 @@
 	femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
 	femmodel->parameters->FindParam(&isL1L2,FlowequationIsL1L2Enum);
+	femmodel->parameters->FindParam(&isMLHO,FlowequationIsMLHOEnum);
 	femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum);
 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
@@ -47,7 +48,5 @@
 		bedslope_core(femmodel);
 		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
-		if (!isNitsche) {
-			ResetFSBasalBoundaryConditionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
-		}
+		ResetFSBasalBoundaryConditionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
 
 		/*We need basal melt rates for the shelf dampening*/
@@ -76,5 +75,5 @@
 
 	/*Compute stressbalance for SSA L1L2 HO and FS*/
-	if(isSSA || isL1L2 || isHO || isFS){
+	if(isSSA || isL1L2 || isMLHO || isHO || isFS){
 		analysis = new StressbalanceAnalysis();
 		analysis->Core(femmodel);
@@ -83,5 +82,5 @@
 
 	/*Compute vertical velocities*/
-	if (domaintype==Domain3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
+	if (domaintype==Domain3DEnum && (isSIA || isSSA || isL1L2 || isMLHO || isHO)){
 
 		/*We need basal melt rates for vertical velocity*/
Index: issm/trunk/src/c/cores/transient_core.cpp
===================================================================
--- issm/trunk/src/c/cores/transient_core.cpp	(revision 25994)
+++ issm/trunk/src/c/cores/transient_core.cpp	(revision 26744)
@@ -24,8 +24,8 @@
 	/*parameters: */
 	IssmDouble finaltime,dt,yts;
-	bool       isoceancoupling,iscontrol,isautodiff,isslr;
+	bool       iscontrol,isautodiff;
 	int        timestepping;
 	int        output_frequency,checkpoint_frequency;
-	int        amr_frequency,amr_restart;
+	int        amr_frequency;
 	char     **requested_outputs = NULL;
 
@@ -45,22 +45,10 @@
 	femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);
 	femmodel->parameters->FindParam(&timestepping,TimesteppingTypeEnum);
-	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
-	femmodel->parameters->FindParam(&isoceancoupling,TransientIsoceancouplingEnum);
 	femmodel->parameters->FindParam(&amr_frequency,TransientAmrFrequencyEnum);
 	femmodel->parameters->FindParam(&iscontrol,InversionIscontrolEnum);
 	femmodel->parameters->FindParam(&isautodiff,AutodiffIsautodiffEnum);
 
-	#if defined(_HAVE_BAMG_) && !defined(_HAVE_AD_)
-	if(amr_frequency){
-		femmodel->parameters->FindParam(&amr_restart,AmrRestartEnum);
-		if(amr_restart) femmodel->ReMesh();
-	}
-	#endif
-
-	#if defined(_HAVE_OCEAN_ )
-	if(isoceancoupling) OceanExchangeDatax(femmodel,true);
-	#endif
-
-	if(isslr) sealevelrise_core_geometry(femmodel);
+	/*call modules that are not dependent on time stepping:*/
+	transient_precore(femmodel);
 
 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
@@ -138,6 +126,6 @@
 
 	/*parameters: */
-	bool isstressbalance,ismasstransport,issmb,isthermal,isgroundingline,isgia,isesa;
-	bool isslr,ismovingfront,isdamageevolution,ishydrology,isoceancoupling,save_results;
+	bool isstressbalance,ismasstransport,isoceantransport,issmb,isthermal,isgroundingline,isesa,issampling;;
+	bool isslc,ismovingfront,isdamageevolution,ishydrology,isoceancoupling,isstochasticforcing,save_results;
 	int  step,sb_coupling_frequency;
 	int  domaintype,numoutputs;
@@ -150,9 +138,9 @@
 	femmodel->parameters->FindParam(&isstressbalance,TransientIsstressbalanceEnum);
 	femmodel->parameters->FindParam(&ismasstransport,TransientIsmasstransportEnum);
+	femmodel->parameters->FindParam(&isoceantransport,TransientIsoceantransportEnum);
 	femmodel->parameters->FindParam(&issmb,TransientIssmbEnum);
 	femmodel->parameters->FindParam(&isthermal,TransientIsthermalEnum);
-	femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum);
 	femmodel->parameters->FindParam(&isesa,TransientIsesaEnum);
-	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
+	femmodel->parameters->FindParam(&isslc,TransientIsslcEnum);
 	femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
 	femmodel->parameters->FindParam(&ismovingfront,TransientIsmovingfrontEnum);
@@ -160,9 +148,15 @@
 	femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum);
 	femmodel->parameters->FindParam(&ishydrology,TransientIshydrologyEnum);
+	femmodel->parameters->FindParam(&issampling,TransientIssamplingEnum);
 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
+	femmodel->parameters->FindParam(&isstochasticforcing,StochasticForcingIsStochasticForcingEnum);	
 
 	#if defined(_HAVE_OCEAN_ )
 	if(isoceancoupling) OceanExchangeDatax(femmodel,false);
 	#endif
+
+	if(isstochasticforcing){
+		StochasticForcingx(femmodel);
+	}
 
 	if(isthermal && domaintype==Domain3DEnum){
@@ -194,8 +188,5 @@
 
 	if(ishydrology){
-		int hydrology_model;
 		hydrology_core(femmodel);
-		femmodel->parameters->FindParam(&hydrology_model,HydrologyModelEnum);
-		if(hydrology_model!=HydrologydcEnum && issmb) smb_core(femmodel);
 	}
 
@@ -220,23 +211,28 @@
 	}
 
+	if(isoceantransport){
+		oceantransport_core(femmodel);
+	}
+
 	if(isgroundingline){
 		groundingline_core(femmodel);
 	}
 
-	if(isgia){
-		#ifdef _HAVE_GIA_
-		gia_core(femmodel);
-		#else
-		_error_("ISSM was not compiled with gia capabilities. Exiting");
-		#endif
-	}
-
 	/*esa: */
 	if(isesa) esa_core(femmodel);
 
-	/*Sea level rise: */
-	if(isslr){
-		if(VerboseSolution()) _printf0_("   computing sea level rise\n");
+	/*Sea level change: */
+	if(isslc){
+		#ifdef _HAVE_SEALEVELCHANGE_
 		sealevelchange_core(femmodel);
+		#else
+		_error_("Compiled with SeaLevelChange capability");
+		#endif
+	}
+
+	/*Sampling: */
+	if(issampling){
+		if(VerboseSolution()) _printf0_("   computing Gaussian random field\n");
+		sampling_core(femmodel);
 	}
 
@@ -253,4 +249,28 @@
 	}
 }/*}}}*/
+void transient_precore(FemModel* femmodel){/*{{{*/
+
+	bool       isoceancoupling,isslc;
+	int        amr_frequency,amr_restart;
+
+	femmodel->parameters->FindParam(&isoceancoupling,TransientIsoceancouplingEnum);
+	femmodel->parameters->FindParam(&amr_frequency,TransientAmrFrequencyEnum);
+	femmodel->parameters->FindParam(&isslc,TransientIsslcEnum);
+
+	#if defined(_HAVE_BAMG_) && !defined(_HAVE_AD_)
+	if(amr_frequency){
+		femmodel->parameters->FindParam(&amr_restart,AmrRestartEnum);
+		if(amr_restart) femmodel->ReMesh();
+	}
+	#endif
+
+	#if defined(_HAVE_OCEAN_ )
+	if(isoceancoupling) OceanExchangeDatax(femmodel,true);
+	#endif
+
+	#if defined(_HAVE_SEALEVELCHANGE_)
+	if(isslc) sealevelchange_initialgeometry(femmodel);
+	#endif
+}/*}}}*/
 
 #ifdef _HAVE_CODIPACK_
@@ -260,5 +280,5 @@
 	IssmDouble output_value;
 	IssmDouble finaltime,dt,yts,time;
-	bool       isoceancoupling,isslr;
+	bool       isoceancoupling;
 	int        step,timestepping;
 	int        checkpoint_frequency;
@@ -273,7 +293,5 @@
 	femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
 	femmodel->parameters->FindParam(&timestepping,TimesteppingTypeEnum);
-	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
 	femmodel->parameters->FindParam(&checkpoint_frequency,SettingsCheckpointFrequencyEnum); _assert_(checkpoint_frequency>0);
-	if(isslr) sealevelrise_core_geometry(femmodel);
 
 	std::vector<IssmDouble> time_all;
@@ -361,5 +379,11 @@
 
 	/*Start tracing*/
+	#if _CODIPACK_MAJOR_==2
+	auto& tape_codi = IssmDouble::getTape();
+	#elif _CODIPACK_MAJOR_==1
 	auto& tape_codi = IssmDouble::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
 	tape_codi.setActive();
 
Index: issm/trunk/src/c/datastructures/DataSet.cpp
===================================================================
--- issm/trunk/src/c/datastructures/DataSet.cpp	(revision 25994)
+++ issm/trunk/src/c/datastructures/DataSet.cpp	(revision 26744)
@@ -251,4 +251,19 @@
 				this->AddObject(res);
 			}
+			else if(obj_enum==CflevelsetmisfitEnum){
+				Cflevelsetmisfit* Cflevelset=new Cflevelsetmisfit();
+				Cflevelset->Marshall(marshallhandle);
+				this->AddObject(Cflevelset);
+			}
+			else if(obj_enum==CfsurfacesquareEnum){
+				Cfsurfacesquare* cfsurf=new Cfsurfacesquare();
+				cfsurf->Marshall(marshallhandle);
+				this->AddObject(cfsurf);
+			}
+			else if(obj_enum==MassfluxatgateEnum){
+				Massfluxatgate<IssmDouble>* massfluxgate=new Massfluxatgate<IssmDouble>();
+				massfluxgate->Marshall(marshallhandle);
+				this->AddObject(massfluxgate);
+			}
 			else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) ); 
 		}
Index: issm/trunk/src/c/main/esmfbinders.cpp
===================================================================
--- issm/trunk/src/c/main/esmfbinders.cpp	(revision 25994)
+++ issm/trunk/src/c/main/esmfbinders.cpp	(revision 26744)
@@ -115,5 +115,5 @@
 						Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
 						surface_input->GetInputAverage(&surface);
-			
+
 						*(issmoutputs+f*numberofelements+i) = surface;
 
@@ -153,4 +153,8 @@
 	} /*}}}*/
 
+	/*TODO: we need 2 initialize routines, the second one will be empty for now
+	 * In: ESMF config, ESMF Field bundle
+	 */
+
 	/*FISOC*/
 	void InitializeISSM_FISOC(int argc, char** argv,ISSM_MPI_Comm comm_init){ /*{{{*/
@@ -165,5 +169,5 @@
 		/*Initialize ESMC Mesh*/
 		int pdim;        /*parametric dimension is the same as the domain dimensions */
-		int sdim = 3;    /*coordinates of each vertex is always 2  (just x,y for now) */
+		int sdim = 2;    /*coordinates of each vertex is always 2  (just x,y for now) */
 		ESMC_CoordSys_Flag coordsys = ESMC_COORDSYS_CART; /*Cartesian coordinate system by default */
 		femmodel->parameters->FindParam(&pdim,DomainDimensionEnum);
@@ -171,9 +175,7 @@
 		if(rc!=ESMF_SUCCESS) _error_("could not create EMSC_Mesh");
 
-		/*How to install ESMG with lib/libesmf.so
-		 * do indices need to be 1 based?
-		 * ESMF installation, how can we get everything in /lib
+		/*
 		 * What do we do with vertices at the boundary, declare twice?
-		 * Do we need a restart file or save femmodel somewhere?*/
+		 * */
 
 		/*Add nodes (which are ISSM Vertices)*/
@@ -182,5 +184,5 @@
 		int        *nodeOwner = xNew<int>(numnodes);
 		IssmDouble *nodeCoord = xNew<IssmDouble>(sdim*numnodes);
-		for (int i=0;i<femmodel->elements->Size();i++){
+		for (int i=0;i<femmodel->vertices->Size();i++){
 			Vertex* vertex = xDynamicCast<Vertex*>(femmodel->vertices->GetObjectByOffset(i));
 			nodeId[i]           = vertex->Sid()+1;
@@ -213,11 +215,4 @@
 		xDelete<int>(elemConn);
 
-		/*DO we need to create fields here? https://earthsystemmodeling.org/docs/nightly/develop/ESMC_crefdoc/node5.html#SECTION05024400000000000000*/
-		//ESMC_InterArrayInt *gridToFieldMap,       // in
-		//ESMC_InterArrayInt *ungriddedLBound,      // in
-		//ESMC_InterArrayInt *ungriddedUBound,      // in
-		//ESMC_Field esmf_shelfbase = ESMC_FieldCreateMeshTypeKind(mesh,ESMC_TYPEKIND_R8,???,gridToFieldMap,ungriddedLBound,ungriddedUBound,"ShelfTopography",&rc);
-		if(rc!=ESMF_SUCCESS) _error_("could not create EMSC_Field");
-
 		/*Create restart file for later */
 		femmodel->Restart();
Index: issm/trunk/src/c/main/issm.cpp
===================================================================
--- issm/trunk/src/c/main/issm.cpp	(revision 25994)
+++ issm/trunk/src/c/main/issm.cpp	(revision 26744)
@@ -15,4 +15,7 @@
 	/*Initialize femmodel from arguments provided command line: */
 	FemModel *femmodel = new FemModel(argc,argv,comm_init);
+
+	/*Need to know we are firing up from ISSM main, not a coupler driver like issm_slcp or issm_ocean:*/
+	femmodel->parameters->AddObject(new IntParam(IsSlcCouplingEnum,0));
 
 	/*Solve: */
Index: issm/trunk/src/c/main/issm_slc.cpp
===================================================================
--- issm/trunk/src/c/main/issm_slc.cpp	(revision 26744)
+++ issm/trunk/src/c/main/issm_slc.cpp	(revision 26744)
@@ -0,0 +1,136 @@
+/*!\file:  issm_slc.cpp
+ * \brief: ISSM SLR main program. 
+ */ 
+
+#include "./issm.h"
+#include <stdlib.h>
+
+int main(int argc,char **argv){
+
+	/*diverse:*/
+	int    nummodels;
+	int*   commsizes=NULL;
+	int*   rankzeros=NULL;
+	char** dirnames=NULL;
+	char** modelnames=NULL;
+	int    modelid; 
+	int    earthid; 
+	int    my_rank;
+	int    count=0;
+	ISSM_MPI_Comm worldcomm;
+	ISSM_MPI_Comm modelcomm;
+	ISSM_MPI_Comm toearthcomm;
+	ISSM_MPI_Comm* fromicecomms=NULL;
+
+	/*Initialize exception trapping: */
+	ExceptionTrapBegin();
+
+	/*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/
+	worldcomm=EnvironmentInit(argc,argv);
+
+	/*What is my rank?:*/
+	ISSM_MPI_Comm_rank(worldcomm,&my_rank);
+
+	/*How many models are we going to run (along with description and number of dedicated cores):{{{*/
+	nummodels=(int) strtol(argv[4], (char **)NULL, 10);
+	commsizes=xNew<int>(nummodels);
+	dirnames=xNew<char*>(nummodels);
+	modelnames=xNew<char*>(nummodels);
+	rankzeros=xNew<int>(nummodels);
+	for(int i=0;i<nummodels;i++){
+		char* string=NULL;
+
+		string=xNew<char>(strlen(argv[5+3*i])+1);
+		xMemCpy<char>(string,argv[5+3*i],strlen(argv[5+3*i])+1);
+		dirnames[i]=string;
+
+		string=xNew<char>(strlen(argv[5+3*i+1])+1);
+		xMemCpy<char>(string,argv[5+3*i+1],strlen(argv[5+3*i+1])+1);
+		modelnames[i]=string;
+
+		commsizes[i]=(int) strtol(argv[5+3*i+2], (char **)NULL, 10);
+	}
+
+	/*Figure out which model each cpu will belong to: */
+	count=0;
+	for(int i=0;i<nummodels;i++){
+		if(my_rank>=count && my_rank<(count+commsizes[i])){
+			modelid=i;
+			break;
+		}
+		count+=commsizes[i];
+	} 
+	/*Buil array of who is rank 0 of their own group:*/
+	count=0;
+	for(int i=0;i<nummodels;i++){
+		rankzeros[i]=count;
+		count+=commsizes[i];
+	}
+	/*}}}*/
+
+	/*Split world into sub-communicators for each and every model:*/
+	ISSM_MPI_Comm_split(worldcomm,modelid, my_rank, &modelcomm);
+
+	/*Build inter communicators:*/
+	earthid=nummodels-1; //last model to be provided in the argument list if the earth model.
+	if(modelid==earthid){
+		fromicecomms=xNew<ISSM_MPI_Comm>(nummodels-1);
+		for(int i=0;i<earthid;i++){
+			ISSM_MPI_Intercomm_create( modelcomm, 0, worldcomm, rankzeros[i], i, fromicecomms+i); //communicate from local erth comm 9rank 0) to ice comm (rank 0) using modelid tag.
+		}
+	}
+	else{
+		ISSM_MPI_Intercomm_create( modelcomm, 0, worldcomm, rankzeros[earthid], modelid, &toearthcomm); //communicate from local ice comm (rank 0) to earth comm (rank 0) using modelid tag.
+	}
+
+	/*Supply specific argc and argv for each sub-communicator (corresponding to each  model specificatiions):{{{*/
+	char** arguments=xNew<char*>(4);
+	arguments[0]=xNew<char>(strlen(argv[0])+1); xMemCpy<char>(arguments[0],argv[0],strlen(argv[0])+1); //executable name
+	arguments[1]=xNew<char>(strlen(argv[1])+1); xMemCpy<char>(arguments[1],argv[1],strlen(argv[1])+1); //solution name
+	arguments[2]=xNew<char>(strlen(argv[5+3*modelid])+1); xMemCpy<char>(arguments[2],argv[5+3*modelid],strlen(argv[5+3*modelid])+1); //directory name
+	arguments[3]=xNew<char>(strlen(argv[5+3*modelid+1])+1); xMemCpy<char>(arguments[3],argv[5+3*modelid+1],strlen(argv[5+3*modelid+1])+1); //model name
+	/*}}}*/
+
+	/*Initialize femmodel from arguments provided command line: */
+	FemModel *femmodel = new FemModel(4,arguments,modelcomm);
+
+	/*Now that the models are initialized, keep communicator information in the parameters datasets of each model: */
+	femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(worldcomm,WorldCommEnum));
+	femmodel->parameters->AddObject(new IntParam(NumModelsEnum,nummodels));
+	femmodel->parameters->AddObject(new IntParam(ModelIdEnum,modelid));
+	femmodel->parameters->AddObject(new IntParam(EarthIdEnum,earthid));
+	femmodel->parameters->AddObject(new IntParam(IsSlcCouplingEnum,1));
+	if(modelid==earthid) femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm*>(fromicecomms,IcecapToEarthCommEnum));
+	else femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(toearthcomm,IcecapToEarthCommEnum));
+
+	/*Solve: */
+	femmodel->Solve();
+
+	/*Output results: */
+	OutputResultsx(femmodel);
+
+	/*Wrap up: */
+	femmodel->CleanUp();
+
+	/*Delete Model: */
+	delete femmodel;
+
+	/*Finalize environment:*/
+	EnvironmentFinalize();
+
+	/*Finalize exception trapping: */
+	ExceptionTrapEnd();
+
+	/*Free ressources:*/
+	xDelete<int>(commsizes);
+	for(int i=0;i<nummodels;i++){
+		char* string=NULL;
+		string=dirnames[i]; xDelete<char>(string);
+		string=modelnames[i]; xDelete<char>(string);
+	}
+	xDelete<char*>(dirnames);
+	xDelete<char*>(modelnames);
+
+	/*Return unix success: */
+	return 0; 
+}
Index: issm/trunk/src/c/main/issm_slr.cpp
===================================================================
--- issm/trunk/src/c/main/issm_slr.cpp	(revision 25994)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*!\file:  issm_slr.cpp
- * \brief: ISSM SLR main program. 
- */ 
-
-#include "./issm.h"
-#include <stdlib.h>
-
-int main(int argc,char **argv){
-
-	/*diverse:*/
-	int    nummodels;
-	int*   commsizes=NULL;
-	int*   rankzeros=NULL;
-	char** dirnames=NULL;
-	char** modelnames=NULL;
-	int    modelid; 
-	int    earthid; 
-	int    my_rank;
-	int    count=0;
-	ISSM_MPI_Comm worldcomm;
-	ISSM_MPI_Comm modelcomm;
-	ISSM_MPI_Comm toearthcomm;
-	ISSM_MPI_Comm* fromicecomms=NULL;
-
-	/*Initialize exception trapping: */
-	ExceptionTrapBegin();
-
-	/*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/
-	worldcomm=EnvironmentInit(argc,argv);
-
-	/*What is my rank?:*/
-	ISSM_MPI_Comm_rank(worldcomm,&my_rank);
-
-	/*How many models are we going to run (along with description and number of dedicated cores):{{{*/
-	nummodels=(int) strtol(argv[4], (char **)NULL, 10);
-	commsizes=xNew<int>(nummodels);
-	dirnames=xNew<char*>(nummodels);
-	modelnames=xNew<char*>(nummodels);
-	rankzeros=xNew<int>(nummodels);
-	for(int i=0;i<nummodels;i++){
-		char* string=NULL;
-
-		string=xNew<char>(strlen(argv[5+3*i])+1);
-		xMemCpy<char>(string,argv[5+3*i],strlen(argv[5+3*i])+1);
-		dirnames[i]=string;
-
-		string=xNew<char>(strlen(argv[5+3*i+1])+1);
-		xMemCpy<char>(string,argv[5+3*i+1],strlen(argv[5+3*i+1])+1);
-		modelnames[i]=string;
-
-		commsizes[i]=(int) strtol(argv[5+3*i+2], (char **)NULL, 10);
-	}
-
-	/*Figure out which model each cpu will belong to: */
-	count=0;
-	for(int i=0;i<nummodels;i++){
-		if(my_rank>=count && my_rank<(count+commsizes[i])){
-			modelid=i;
-			break;
-		}
-		count+=commsizes[i];
-	} 
-	/*Buil array of who is rank 0 of their own group:*/
-	count=0;
-	for(int i=0;i<nummodels;i++){
-		rankzeros[i]=count;
-		count+=commsizes[i];
-	}
-	/*}}}*/
-
-	/*Split world into sub-communicators for each and every model:*/
-	ISSM_MPI_Comm_split(worldcomm,modelid, my_rank, &modelcomm);
-
-	/*Build inter communicators:*/
-	earthid=nummodels-1; //last model to be provided in the argument list if the earth model.
-	if(modelid==earthid){
-		fromicecomms=xNew<ISSM_MPI_Comm>(nummodels-1);
-		for(int i=0;i<earthid;i++){
-			ISSM_MPI_Intercomm_create( modelcomm, 0, worldcomm, rankzeros[i], i, fromicecomms+i); //communicate from local erth comm 9rank 0) to ice comm (rank 0) using modelid tag.
-		}
-	}
-	else{
-		ISSM_MPI_Intercomm_create( modelcomm, 0, worldcomm, rankzeros[earthid], modelid, &toearthcomm); //communicate from local ice comm (rank 0) to earth comm (rank 0) using modelid tag.
-	}
-
-	/*Supply specific argc and argv for each sub-communicator (corresponding to each  model specificatiions):{{{*/
-	char** arguments=xNew<char*>(4);
-	arguments[0]=xNew<char>(strlen(argv[0])+1); xMemCpy<char>(arguments[0],argv[0],strlen(argv[0])+1); //executable name
-	arguments[1]=xNew<char>(strlen(argv[1])+1); xMemCpy<char>(arguments[1],argv[1],strlen(argv[1])+1); //solution name
-	arguments[2]=xNew<char>(strlen(argv[5+3*modelid])+1); xMemCpy<char>(arguments[2],argv[5+3*modelid],strlen(argv[5+3*modelid])+1); //directory name
-	arguments[3]=xNew<char>(strlen(argv[5+3*modelid+1])+1); xMemCpy<char>(arguments[3],argv[5+3*modelid+1],strlen(argv[5+3*modelid+1])+1); //model name
-	/*}}}*/
-
-	/*Initialize femmodel from arguments provided command line: */
-	FemModel *femmodel = new FemModel(4,arguments,modelcomm);
-
-	/*Now that the models are initialized, keep communicator information in the parameters datasets of each model: */
-	femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(worldcomm,WorldCommEnum));
-	femmodel->parameters->AddObject(new IntParam(NumModelsEnum,nummodels));
-	femmodel->parameters->AddObject(new IntParam(ModelIdEnum,modelid));
-	femmodel->parameters->AddObject(new IntParam(EarthIdEnum,earthid));
-	if(modelid==earthid) femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm*>(fromicecomms,IcecapToEarthCommEnum));
-	else femmodel->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(toearthcomm,IcecapToEarthCommEnum));
-
-	/*Solve: */
-	femmodel->Solve();
-
-	/*Output results: */
-	OutputResultsx(femmodel);
-
-	/*Wrap up: */
-	femmodel->CleanUp();
-
-	/*Delete Model: */
-	delete femmodel;
-
-	/*Finalize environment:*/
-	EnvironmentFinalize();
-
-	/*Finalize exception trapping: */
-	ExceptionTrapEnd();
-
-	/*Free ressources:*/
-	xDelete<int>(commsizes);
-	for(int i=0;i<nummodels;i++){
-		char* string=NULL;
-		string=dirnames[i]; xDelete<char>(string);
-		string=modelnames[i]; xDelete<char>(string);
-	}
-	xDelete<char*>(dirnames);
-	xDelete<char*>(modelnames);
-
-	/*Return unix success: */
-	return 0; 
-}
Index: issm/trunk/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp
===================================================================
--- issm/trunk/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp	(revision 26744)
@@ -256,5 +256,6 @@
 			int   lid = node->Lid();
 			if(!node->IsClone()){
-				for(j=0;j<node->fsize;j++){
+				int node_fsize = node->FSize();
+				for(j=0;j<node_fsize;j++){
 					_assert_(count<m);
 					d_nnz[count]=numberofdofspernode*(d_connectivity[lid] + reCast<int>(serial_connectivity_clone[lid]));
Index: issm/trunk/src/c/modules/Calvingx/Calvingx.cpp
===================================================================
--- issm/trunk/src/c/modules/Calvingx/Calvingx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/Calvingx/Calvingx.cpp	(revision 26744)
@@ -39,2 +39,6 @@
 	}
 }
+
+void MovingFrontalVelx(FemModel* femmodel){
+	femmodel->ElementOperationx(&Element::MovingFrontalVelocity);
+}
Index: issm/trunk/src/c/modules/Calvingx/Calvingx.h
===================================================================
--- issm/trunk/src/c/modules/Calvingx/Calvingx.h	(revision 25994)
+++ issm/trunk/src/c/modules/Calvingx/Calvingx.h	(revision 26744)
@@ -7,4 +7,5 @@
 /* local prototypes: */
 void Calvingx(FemModel* femmodel);
+void MovingFrontalVelx(FemModel* femmodel);
 
 #endif
Index: issm/trunk/src/c/modules/Chacox/chaco_seconds.cpp
===================================================================
--- issm/trunk/src/c/modules/Chacox/chaco_seconds.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/Chacox/chaco_seconds.cpp	(revision 26744)
@@ -1,5 +1,5 @@
 /*This is needed, because the chaco library defines a "C" function seconds that conflicts with the Metis version.: */
 
-#ifdef _INTEL_WIN_
+#if defined(_INTEL_WIN_) || defined(_MSYS2_)
 #include   <time.h>
 #else
Index: issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
===================================================================
--- issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 26744)
@@ -10,8 +10,4 @@
 
 int	ConfigureObjectsx( Elements* elements, Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters,Inputs* inputs){
-
-	/*Get analysis type: */
-	int configuration_type;
-	parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
 
 	if(VerboseMProcessor()) _printf0_("      Configuring elements...\n");
Index: issm/trunk/src/c/modules/ConstraintsStatex/ConstraintsStateLocal.h
===================================================================
--- issm/trunk/src/c/modules/ConstraintsStatex/ConstraintsStateLocal.h	(revision 25994)
+++ issm/trunk/src/c/modules/ConstraintsStatex/ConstraintsStateLocal.h	(revision 26744)
@@ -5,5 +5,4 @@
 #ifndef _CONSTRAINTSSTATELOCAL_H
 #define _CONSTRAINTSSTATELOCAL_H
-
 
 #ifdef HAVE_CONFIG_H
Index: issm/trunk/src/c/modules/CoordinateSystemTransformx/CoordinateSystemTransformx.cpp
===================================================================
--- issm/trunk/src/c/modules/CoordinateSystemTransformx/CoordinateSystemTransformx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/CoordinateSystemTransformx/CoordinateSystemTransformx.cpp	(revision 26744)
@@ -7,12 +7,31 @@
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
-#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
-#include <proj_api.h>
+#include <proj.h>
 
 void CoordinateSystemTransformx(double** px_dest,double** py_dest,double* x_src,double* y_src,int size,const char* str_src,const char* str_dst){
 
-#if !defined(_HAVE_PROJ_)
-	_error_("proj not installed");
-#else
+/*
+NOTE:
+- Compilation of this module is fenced in Makefile.am, so we do not have to 
+check again if _HAVE_PROJ_ is defined
+*/
+#if defined(PROJ_VERSION_MAJOR) && PROJ_VERSION_MAJOR >= 6
+	/*
+	Converts an array of longitude (x_src) and array of latitude (y_src) in the 
+	projection described by str_src to the projection described by str_dest.
+
+	NOTE:
+	- API types and calls have been migrated from PROJ 4 to PROJ 6. See SVN 
+	revision history for changes.
+
+	Sources:
+	- https://proj.org/development/migration.html
+	- https://www.gaia-gis.it/fossil/libspatialite/wiki?name=PROJ.6
+
+	TODO:
+	- Because transformations are done in place, we could save memory and time 
+	by simply passing in x_src and y_src and removing the px_dest and py_dest 
+	parameters entirely?
+	*/
 
 	/*Allocate output and initialize values as src*/
@@ -20,4 +39,5 @@
 	double* x_dest = xNew<double>(size);
 	double* y_dest = xNew<double>(size);
+
 	for(int i=0;i<size;i++){
 		x_dest[i] = x_src[i];
@@ -25,17 +45,31 @@
 	}
 
-	/*Create proj.4 projection objects for src and dst*/
-	projPJ pj_src  = pj_init_plus(str_src);
-	projPJ pj_dst  = pj_init_plus(str_dst);
-	if(!pj_src) _error_("Failed to initialize PROJ with source projection \""    <<str_src<<"\"\n");
-	if(!pj_dst) _error_("Failed to initialize PROJ with destination projection\""<<str_dst<<"\"\n");
+	PJ *P;
+	size_t sx = sizeof(double);
+	size_t sy = sizeof(double);
+	size_t nx = size;
+	size_t ny = size;
 
-	/*Perform transformation*/
-	int p = pj_transform(pj_src,pj_dst,size,1,x_dest,y_dest,NULL);
-	if(p!=0) _error_("Reprojection failed, PROJ error code: "<<p<<"\n");
+	P = proj_create_crs_to_crs(PJ_DEFAULT_CTX,str_src,str_dst,NULL);
+
+	if ( 0 == P ) {
+		proj_destroy(P);
+		_error_("failed to initialize CRS transformation object");
+	}
+
+	int p = proj_trans_generic(P, PJ_FWD, x_dest, sx, nx, y_dest, sy, ny, 0, 0, 0, 0, 0, 0);
+
+	if ( 0 == p ){
+		proj_destroy(P);
+		_error_("no successful transformations");
+	}
+
+	proj_destroy(P);
 
 	/*Output : */
 	*px_dest=x_dest;
 	*py_dest=y_dest;
+#else
+	_error_("PROJ version >= 6 required");
 #endif
 }
Index: issm/trunk/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp
===================================================================
--- issm/trunk/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 26744)
@@ -93,5 +93,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.cpp
===================================================================
--- issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.cpp	(revision 26744)
+++ issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.cpp	(revision 26744)
@@ -0,0 +1,94 @@
+/*!\file ElementCoordinatesx
+ * \brief: compute a vector xe,ye and ze of element centroid coordinates by
+ * marching through all our elements.
+ */
+
+#include "./ElementCoordinatesx.h"
+
+#include "../../shared/shared.h"
+#include "../../toolkits/toolkits.h"
+
+void ElementCoordinatesx( IssmDouble** pxe, IssmDouble** pye, IssmDouble** pze, IssmDouble** pareae, Elements* elements,bool spherical) { /*{{{*/
+
+	/*figure out how many vertices we have: */
+	int numberofelements=elements->NumberOfElements();
+
+	Vector<IssmDouble>* vxe=new Vector<IssmDouble>(numberofelements);
+	Vector<IssmDouble>* vye=new Vector<IssmDouble>(numberofelements);
+	Vector<IssmDouble>* vze=new Vector<IssmDouble>(numberofelements);
+	Vector<IssmDouble>* vareae=new Vector<IssmDouble>(numberofelements);
+
+	/*march through our elements: */
+	for(Object* & object : elements->objects){
+		Element* element=(Element*)object;
+		element->ElementCoordinates(vxe,vye,vze,vareae,spherical);
+	}
+
+	/*Assemble*/
+	vxe->Assemble();
+	vye->Assemble();
+	vze->Assemble();
+	vareae->Assemble();
+
+	/*serialize: */
+	IssmDouble* xe=vxe->ToMPISerial();
+	IssmDouble* ye=vye->ToMPISerial();
+	IssmDouble* ze=vze->ToMPISerial();
+	IssmDouble* areae=vareae->ToMPISerial();
+
+	/*Free ressources: */
+	delete vxe;
+	delete vye;
+	delete vze;
+	delete vareae;
+
+	/*output: */
+	if(pxe) *pxe=xe;
+	else xDelete<IssmDouble>(xe);
+	if(pye) *pye=ye;
+	else xDelete<IssmDouble>(ye);
+	if(pze) *pze=ze;
+	else xDelete<IssmDouble>(ze);
+	if(pareae) *pareae=areae;
+	else xDelete<IssmDouble>(areae);
+
+} /*}}}*/
+void ElementCoordinatesx( IssmDouble** plonge, IssmDouble** plate, IssmDouble** pareae, Elements* elements) { /*{{{*/
+
+	/*figure out how many vertices we have: */
+	int numberofelements=elements->NumberOfElements();
+
+	Vector<IssmDouble>* vlonge=new Vector<IssmDouble>(numberofelements);
+	Vector<IssmDouble>* vlate=new Vector<IssmDouble>(numberofelements);
+	Vector<IssmDouble>* vareae=new Vector<IssmDouble>(numberofelements);
+
+	/*march through our elements: */
+	for(Object* & object : elements->objects){
+		Element* element=(Element*)object;
+		element->ElementCoordinates(vlonge,vlate,vareae);
+	}
+
+	/*Assemble*/
+	vlonge->Assemble();
+	vlate->Assemble();
+	vareae->Assemble();
+
+	/*serialize: */
+	IssmDouble* longe=vlonge->ToMPISerial();
+	IssmDouble* late=vlate->ToMPISerial();
+	IssmDouble* areae=vareae->ToMPISerial();
+
+	/*Free ressources: */
+	delete vlonge;
+	delete vlate;
+	delete vareae;
+
+	/*output: */
+	if(plonge) *plonge=longe;
+	else xDelete<IssmDouble>(longe);
+	if(plate) *plate=late;
+	else xDelete<IssmDouble>(late);
+	if(pareae) *pareae=areae;
+	else xDelete<IssmDouble>(areae);
+
+} /*}}}*/
Index: issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.h
===================================================================
--- issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.h	(revision 26744)
+++ issm/trunk/src/c/modules/ElementCoordinatesx/ElementCoordinatesx.h	(revision 26744)
@@ -0,0 +1,13 @@
+/*!\file:  ElementCoordinatesx.h
+ */ 
+
+#ifndef _ELEMENT_COORDINATESX_H
+#define _ELEMENT_COORDINATESX_H
+
+#include "../../classes/classes.h"
+
+/* local prototypes: */
+void ElementCoordinatesx( IssmDouble** pxe, IssmDouble** pye, IssmDouble** pze,IssmDouble** pareae, Elements* elements,bool spherical=false);
+void ElementCoordinatesx( IssmDouble** plonge, IssmDouble** plate, IssmDouble** pareae, Elements* elements);
+
+#endif  /* _ELEMENT_COORDINATESX_H */
Index: issm/trunk/src/c/modules/FloatingiceMeltingRatePicox/FloatingiceMeltingRatePicox.cpp
===================================================================
--- issm/trunk/src/c/modules/FloatingiceMeltingRatePicox/FloatingiceMeltingRatePicox.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/FloatingiceMeltingRatePicox/FloatingiceMeltingRatePicox.cpp	(revision 26744)
@@ -57,5 +57,5 @@
 	for(Object* & object : femmodel->elements->objects){
 		Element* element=xDynamicCast<Element*>(object);
-		if(!element->IsIceInElement() || !element->IsFloating()) continue;
+		if(!element->IsIceInElement() || !element->IsAllFloating()) continue;
 		numvertices = element->GetNumberOfVertices();
 		distances=xNew<IssmDouble>(numvertices);
@@ -116,10 +116,12 @@
 		if(!element->IsOnBase()) continue;
 		Element* basalelement = element->SpawnBasalElement();
-		if(!basalelement->IsIceInElement() || !basalelement->IsFloating()) continue;
+		if(!basalelement->IsIceInElement() || !basalelement->IsAllFloating()){
+			if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
+			continue;
+		}
 		basalelement->GetInputValue(&boxid,BasalforcingsPicoBoxIdEnum);
 		basalelement->GetInputValue(&basinid,BasalforcingsPicoBasinIdEnum);
 		boxareas[basinid*maxbox+boxid]+=basalelement->GetHorizontalSurfaceArea();
-		basalelement->FindParam(&domaintype,DomainTypeEnum);
-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	}
 
@@ -162,10 +164,13 @@
 	for(Object* & object : femmodel->elements->objects){
 		Element* element=xDynamicCast<Element*>(object);
+
+		/*Check whether we should continue*/
 		if(!element->IsOnBase()) continue;
+		if(!element->IsIceInElement() || !element->IsAllFloating()) continue;
+		int el_boxid;
+		element->GetInputValue(&el_boxid,BasalforcingsPicoBoxIdEnum);
+		if(el_boxid!=boxid) continue;
+
 		Element* basalelement = element->SpawnBasalElement();
-		if(!basalelement->IsIceInElement() || !basalelement->IsFloating()) continue;
-		int el_boxid;
-		basalelement->GetInputValue(&el_boxid,BasalforcingsPicoBoxIdEnum);
-		if(el_boxid!=boxid) continue;
 
 		Input* tocs_input=basalelement->GetInput(BasalforcingsPicoSubShelfOceanTempEnum); _assert_(tocs_input); 
@@ -180,6 +185,6 @@
 		toc_weighted_avg[basinid]+=toc*area;
 		soc_weighted_avg[basinid]+=soc*area;
-		basalelement->FindParam(&domaintype,DomainTypeEnum);
-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+
+		if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	}
 
@@ -203,11 +208,13 @@
 		for(Object* & object : femmodel->elements->objects){
 			Element* element=xDynamicCast<Element*>(object);
+
+			/*Check whether we should continue or not*/
 			if(!element->IsOnBase()) continue;
+			if(!element->IsIceInElement() || !element->IsAllFloating()) continue;
+			int el_boxid;
+			element->GetInputValue(&el_boxid,BasalforcingsPicoBoxIdEnum);
+			if(el_boxid!=boxid) continue;
+
 			Element* basalelement = element->SpawnBasalElement();
-			if(!basalelement->IsIceInElement() || !basalelement->IsFloating()) continue;
-			int el_boxid;
-			basalelement->GetInputValue(&el_boxid,BasalforcingsPicoBoxIdEnum);
-			if(el_boxid!=boxid) continue;
-
 	     	Input* overturnings_input=basalelement->GetInput(BasalforcingsPicoSubShelfOceanOverturningEnum); _assert_(overturnings_input);
 
@@ -219,5 +226,6 @@
 			overturning_weighted_avg[basinid]+=overturning*area;
 			basalelement->FindParam(&domaintype,DomainTypeEnum);
-			if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+
+			if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		}
 
Index: issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp
===================================================================
--- issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp	(revision 26744)
@@ -101,5 +101,5 @@
 
 		/*Set melt to 0 if non floating*/
-		if(!element->IsIceInElement() || !element->IsFloating() || !element->IsOnBase()){
+		if(!element->IsIceInElement() || !element->IsAllFloating() || !element->IsOnBase()){
 			IssmDouble* values = xNewZeroInit<IssmDouble>(numvertices);
 			element->AddInput(BasalforcingsFloatingiceMeltingRateEnum,values,P1DGEnum);
@@ -159,5 +159,5 @@
 		for(Object* & object : femmodel->elements->objects){
 			Element* element = xDynamicCast<Element*>(object);
-			if(!element->IsOnBase() || !element->IsIceInElement() || !element->IsFloating()) continue;
+			if(!element->IsOnBase() || !element->IsIceInElement() || !element->IsAllFloating()) continue;
 			/*Spawn basal element if on base to compute element area*/
 			Element* basalelement = element->SpawnBasalElement();
@@ -172,5 +172,5 @@
 			/*Delete spawned element if we are in 3D*/
 			basalelement->FindParam(&domaintype,DomainTypeEnum);
-			if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+			if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 		}
 
Index: issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.cpp
===================================================================
--- issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.cpp	(revision 26744)
@@ -6,15 +6,19 @@
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
+#include "../../shared/Random/random.h"
 
-void FrontalForcingsx(FemModel* femmodel){
+void FrontalForcingsx(FemModel* femmodel){/*{{{*/
 
 	/*Recover melt_parameterization*/
 	int melt_parameterization;
 	femmodel->parameters->FindParam(&melt_parameterization,FrontalForcingsParamEnum);
-	
+
 	/*Calculate melting rate*/
 	switch(melt_parameterization){
 		case FrontalForcingsDefaultEnum:
 			break;
+		case FrontalForcingsRignotAutoregressionEnum:
+			Thermalforcingautoregressionx(femmodel);
+			/*Do not break here, call IcefrontAreax(),RignotMeltParameterizationx()*/
 		case FrontalForcingsRignotEnum:
 			femmodel->IcefrontAreax();
@@ -24,3 +28,93 @@
 			_error_("Frontal forcings "<<EnumToStringx(melt_parameterization)<<" not supported yet");
 	}
-}
+}/*}}}*/
+void ThermalforcingautoregressionInitx(FemModel* femmodel){/*{{{*/
+
+   /*Initialization step of Thermalforcingautoregressionx*/
+   int M,N,Nphi,arorder,numbasins,my_rank;
+   IssmDouble starttime,tstep_ar,tinit_ar;
+   femmodel->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
+   femmodel->parameters->FindParam(&arorder,FrontalForcingsAutoregressiveOrderEnum);
+   IssmDouble* beta0    = NULL;
+   IssmDouble* beta1    = NULL;
+   IssmDouble* phi      = NULL;
+   femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+   femmodel->parameters->FindParam(&tstep_ar,FrontalForcingsAutoregressionTimestepEnum);
+   femmodel->parameters->FindParam(&tinit_ar,FrontalForcingsAutoregressionInitialTimeEnum);
+   femmodel->parameters->FindParam(&beta0,&M,FrontalForcingsBeta0Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&beta1,&M,FrontalForcingsBeta1Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&phi,&M,&Nphi,FrontalForcingsPhiEnum);  _assert_(M==numbasins); _assert_(Nphi==arorder);
+
+   /*AR model spin-up with 0 noise to initialize ThermalforcingValuesAutoregressionEnum*/
+	int nspin{2*arorder+5};
+   for(Object* &object:femmodel->elements->objects){
+      Element* element      = xDynamicCast<Element*>(object); //generate element object
+      element->AutoregressionInit(numbasins,arorder,nspin,starttime,tstep_ar,tinit_ar,beta0,beta1,phi,FrontalForcingsRignotAutoregressionEnum);
+   }
+
+   /*Cleanup*/
+   xDelete<IssmDouble>(beta0);
+   xDelete<IssmDouble>(beta1);
+   xDelete<IssmDouble>(phi);
+}/*}}}*/
+void Thermalforcingautoregressionx(FemModel* femmodel){/*{{{*/
+
+   /*Get time parameters*/
+   IssmDouble time,dt,starttime,tstep_ar;
+   femmodel->parameters->FindParam(&time,TimeEnum);
+   femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+   femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+   femmodel->parameters->FindParam(&tstep_ar,FrontalForcingsAutoregressionTimestepEnum);
+
+   /*Initialize module at first time step*/
+   if(time<=starttime+dt){ThermalforcingautoregressionInitx(femmodel);}
+   /*Determine if this is a time step for the AR model*/
+   bool isstepforar = false;
+
+   #ifndef _HAVE_AD_
+   if((fmod(time,tstep_ar)<fmod((time-dt),tstep_ar)) || (time<=starttime+dt) || tstep_ar==dt) isstepforar = true;
+   #else
+   _error_("not implemented yet");
+   #endif
+
+   /*Load parameters*/
+	bool isstochastic;
+   bool istfstochastic = false;
+	int M,N,Nphi,arorder,numbasins,my_rank;
+   femmodel->parameters->FindParam(&numbasins,FrontalForcingsNumberofBasinsEnum);
+   femmodel->parameters->FindParam(&arorder,FrontalForcingsAutoregressiveOrderEnum);
+   IssmDouble tinit_ar;
+   IssmDouble* beta0      = NULL;
+   IssmDouble* beta1      = NULL;
+   IssmDouble* phi        = NULL;
+
+	femmodel->parameters->FindParam(&tinit_ar,FrontalForcingsAutoregressionInitialTimeEnum);
+   femmodel->parameters->FindParam(&beta0,&M,FrontalForcingsBeta0Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&beta1,&M,FrontalForcingsBeta1Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&phi,&M,&Nphi,FrontalForcingsPhiEnum);  _assert_(M==numbasins); _assert_(Nphi==arorder);
+
+	femmodel->parameters->FindParam(&isstochastic,StochasticForcingIsStochasticForcingEnum);
+	if(isstochastic){
+		int  numstochasticfields;
+		int* stochasticfields;
+		femmodel->parameters->FindParam(&numstochasticfields,StochasticForcingNumFieldsEnum);
+		femmodel->parameters->FindParam(&stochasticfields,&N,StochasticForcingFieldsEnum); _assert_(N==numstochasticfields);
+		for(int i=0;i<numstochasticfields;i++){
+			if(stochasticfields[i]==FrontalForcingsRignotAutoregressionEnum) istfstochastic = true;
+		}
+		xDelete<int>(stochasticfields);
+	}
+   /*Time elapsed with respect to AR model initial time*/
+   IssmDouble telapsed_ar = time-tinit_ar;
+
+   /*Loop over each element to compute Thermal Forcing at vertices*/
+   for(Object* &object:femmodel->elements->objects){
+      Element* element = xDynamicCast<Element*>(object);
+      element->Autoregression(isstepforar,arorder,telapsed_ar,beta0,beta1,phi,istfstochastic,FrontalForcingsRignotAutoregressionEnum);
+   }
+
+   /*Cleanup*/
+   xDelete<IssmDouble>(beta0);
+   xDelete<IssmDouble>(beta1);
+   xDelete<IssmDouble>(phi);
+}/*}}}*/
Index: issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.h
===================================================================
--- issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.h	(revision 25994)
+++ issm/trunk/src/c/modules/FrontalForcingsx/FrontalForcingsx.h	(revision 26744)
@@ -7,4 +7,6 @@
 /* local prototypes: */
 void FrontalForcingsx(FemModel* femmodel);
+void ThermalforcingautoregressionInitx(FemModel* femmodel);
+void Thermalforcingautoregressionx(FemModel* femmodel);
 
 #endif
Index: issm/trunk/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h
===================================================================
--- issm/trunk/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h	(revision 25994)
+++ issm/trunk/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h	(revision 26744)
@@ -15,4 +15,3 @@
 void  GetVectorFromInputsx(IssmDouble** pvector,int* pvector_size, FemModel* femmodel,int name);
 
-
 #endif  /* _GETVECTORFROMINPUTSXX_H */
Index: issm/trunk/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp
===================================================================
--- issm/trunk/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp	(revision 26744)
@@ -44,110 +44,55 @@
 void GiaDeflectionCorex( IssmDouble* pwi, IssmDouble* pdwidt, GiaDeflectionCoreArgs* arguments){
 
-	/*intermediary: */
-	int i;
-
-	/*output: */
-	IssmDouble wi=0;
-	IssmDouble dwidt=0;
-
-	/*inputs: {{{*/
-	/*constant: */
-	int idisk=1; // disk #
-	IssmDouble yts;
-
-	/*coming from the model structure, runtime configurable:*/
-	/*gia solution parameters: */
-	int iedge=0; 
-
-	/*gia inputs: */
-	IssmDouble ri; //radial distance from center of disk to vertex  i
-	IssmDouble re; //radius of disk
-	IssmDouble* hes; //loading history (in ice thickness)
-	IssmDouble* times; //loading history times
-	int numtimes; //loading history length
-	IssmDouble currenttime;
-	int Ntime; // number of times with load history 
-	int Ntimm; // Ntime-1 : for slope/y-cept of load segments 
-	int Ntimp; // Ntime+1 : for evaluation time  
-	IssmDouble* blockt_time=NULL;
-	IssmDouble* blockt_bi=NULL;
-	IssmDouble* blockt_dmi=NULL;
-	IssmDouble* blocky_zhload=NULL;
-
-	/*gia material parameters: */
-	IssmDouble lithosphere_shear_modulus;
-	IssmDouble lithosphere_density;
-	IssmDouble mantle_shear_modulus;
-	IssmDouble mantle_viscosity;
-	IssmDouble mantle_density;
-	IssmDouble lithosphere_thickness;
-
-	/*ice properties: */
-	IssmDouble rho_ice;
-
-	/*some debug info: */
-	int disk_id;
-
-/*}}}*/
-
 	/*Recover material parameters and loading history: see GiaDeflectionCoreArgs for more details {{{*/
-	ri                        = arguments->ri;
-	re                        = arguments->re;
-	hes                       = arguments->hes;
-	times                     = arguments->times;
-	numtimes                  = arguments->numtimes;
-	currenttime               = arguments->currenttime;
-	lithosphere_shear_modulus = arguments->lithosphere_shear_modulus;
-	lithosphere_density       = arguments->lithosphere_density;
-	mantle_shear_modulus      = arguments->mantle_shear_modulus;
-	mantle_viscosity          = arguments->mantle_viscosity;
-	mantle_density            = arguments->mantle_density;
-	lithosphere_thickness     = arguments->lithosphere_thickness;
-	rho_ice                   = arguments->rho_ice;
-	disk_id                   = arguments->idisk;
-	iedge                     = arguments->iedge;
-	yts                       = arguments->yts;
+	IssmDouble  ri                        = arguments->ri;                        //radial distance from center of disk to vertex i
+	IssmDouble  re                        = arguments->re;                        //radius of disk
+	IssmDouble *hes                       = arguments->hes;                       //loading history (in ice thickness)
+	IssmDouble *times                     = arguments->times;                     //loading history times
+	int         numtimes                  = arguments->numtimes;                  //loading history length
+	IssmDouble  currenttime               = arguments->currenttime;
+	IssmDouble  lithosphere_shear_modulus = arguments->lithosphere_shear_modulus;
+	IssmDouble  lithosphere_density       = arguments->lithosphere_density;
+	IssmDouble  mantle_shear_modulus      = arguments->mantle_shear_modulus;
+	IssmDouble  mantle_viscosity          = arguments->mantle_viscosity;
+	IssmDouble  mantle_density            = arguments->mantle_density;
+	IssmDouble  lithosphere_thickness     = arguments->lithosphere_thickness;
+	IssmDouble  rho_ice                   = arguments->rho_ice;
+	int         disk_id                   = arguments->idisk;
+	int         iedge                     = arguments->iedge;
+	IssmDouble  yts                       = arguments->yts;
 
 	/*}}}*/
 
 	/*Modify inputs to match naruse code: */
-	Ntime=numtimes;
-	Ntimm=Ntime-1;
-	Ntimp=Ntime+1;
+	int Ntime=numtimes; // number of times with load history
+	int Ntimm=Ntime-1; // Ntime-1 : for slope/y-cept of load segments
+	int Ntimp=Ntime+1; // Ntime+1 : for evaluation time
 
 	/*Prepare block inputs for fortran distme and what0 routines of the naruse code: {{{*/
 	/*Now, let's set pset from the data that we got in input to GiaDeflectionCorex: */
-	blockp_.pset[0]=lithosphere_thickness;
-	blockp_.pset[1]=mantle_viscosity;
-	blockp_.pset[2]=lithosphere_shear_modulus;
-	blockp_.pset[3]=mantle_shear_modulus;
-	blockp_.pset[4]=lithosphere_density;
-	blockp_.pset[5]=mantle_density;
-	blockp_.pset[6]=re;
-	blocko_.rhoi=rho_ice; 
+	blockp_.pset[0]=reCast<IssmPDouble>(lithosphere_thickness);
+	blockp_.pset[1]=reCast<IssmPDouble>(mantle_viscosity);
+	blockp_.pset[2]=reCast<IssmPDouble>(lithosphere_shear_modulus);
+	blockp_.pset[3]=reCast<IssmPDouble>(mantle_shear_modulus);
+	blockp_.pset[4]=reCast<IssmPDouble>(lithosphere_density);
+	blockp_.pset[5]=reCast<IssmPDouble>(mantle_density);
+	blockp_.pset[6]=reCast<IssmPDouble>(re);
+	blocko_.rhoi=reCast<IssmPDouble>(rho_ice); 
+   blockrad_.distrad=reCast<IssmPDouble>(ri)/1000.0; // in km
 
 	/*loading history: */
-	blocky_zhload=xNew<IssmDouble>(Ntime);
-	for(i=0;i<Ntime;i++){
-	blocky_zhload[i]=hes[i];
+	IssmPDouble* blocky_zhload=xNew<IssmPDouble>(Ntime);
+	for(int i=0;i<Ntime;i++) blocky_zhload[i]=reCast<IssmPDouble>(hes[i]);
+
+	/*times in kyr: */
+	IssmPDouble* blockt_time=xNew<IssmPDouble>(Ntimp);
+	for(int i=0;i<Ntimp;i++){
+		blockt_time[i]=times[i]/1000.0/yts; 
+		if(i==numtimes-1) blockt_time[i]=reCast<IssmPDouble>(times[numtimes-1])/1000.0/yts; // final loading time, same as evaluation time
+		if(i==numtimes)   blockt_time[i]=reCast<IssmPDouble>(times[numtimes-1])/1000.0/yts;   // evaluation time
 	}
 
-	/*times in kyr: */
-	blockt_time=xNew<IssmDouble>(Ntimp);
-	for (i=0;i<Ntimp;i++){
-		blockt_time[i]=times[i]/1000.0/yts; 
-		if(i==numtimes-1)blockt_time[i]=times[numtimes-1]/1000.0/yts; // final loading time, same as evaluation time
-		if(i==numtimes)blockt_time[i]=times[numtimes-1]/1000.0/yts;   // evaluation time
-	}
-
-	/*bi: */
-	blockt_bi=xNew<IssmDouble>(Ntimm);
-
-	/*dmi: */
-	blockt_dmi=xNew<IssmDouble>(Ntimm);
-
-	/*radial distance of i-th element: */
-	blockrad_.distrad=ri/1000.0; // in km
-	/*}}}*/
+	IssmPDouble* blockt_bi=xNew<IssmPDouble>(Ntimm);
+	IssmPDouble* blockt_dmi=xNew<IssmPDouble>(Ntimm);
 
 	/*Call distme driver: */
@@ -158,14 +103,12 @@
 
 	/*output solution: */
-	wi = blocks_.aswokm_w;
-	dwidt = blocks_.aswokm_dwdt;
-	*pwi=wi;
-	*pdwidt=dwidt;
+	*pwi=reCast<IssmDouble>(blocks_.aswokm_w);
+	*pdwidt=reCast<IssmDouble>(blocks_.aswokm_dwdt);
 
 	/*Free ressources: */
-	xDelete<IssmDouble>(blockt_time);
-	xDelete<IssmDouble>(blockt_bi);
-	xDelete<IssmDouble>(blockt_dmi);
-	xDelete<IssmDouble>(blocky_zhload);
+	xDelete<IssmPDouble>(blockt_time);
+	xDelete<IssmPDouble>(blockt_bi);
+	xDelete<IssmPDouble>(blockt_dmi);
+	xDelete<IssmPDouble>(blocky_zhload);
 
 }
Index: issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp
===================================================================
--- issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp	(revision 26744)
@@ -27,4 +27,5 @@
 	}
 }
+
 void InputUpdateFromConstantx(FemModel* femmodel,IssmDouble constant, int name){
 
@@ -60,4 +61,26 @@
 	}
 }
+
+void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant, int name,int type){
+
+	if(type==P0Enum) InputUpdateFromConstantx(inputs, elements, constant,name);
+	else if(type==P1Enum){
+
+		if(VerboseModule()) _printf0_("   Input updates from constant (P1 version)\n");
+
+		/*Elements and loads drive the update: */
+		if(IsInputEnum(name)){
+			for(Object* & object : elements->objects){
+				Element* element = xDynamicCast<Element*>(object);
+				element->InputUpdateFromConstant(constant,name,P1Enum);
+			}
+		}
+		else{
+			_error_("not supported yet");
+		}
+	}
+	else _error_("InputUpdateFromConstantx error message: type not supported yet!");
+
+}
 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,bool constant, int name){
 
Index: issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h
===================================================================
--- issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h	(revision 25994)
+++ issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h	(revision 26744)
@@ -17,4 +17,5 @@
 #endif
 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant,int name);
+void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,IssmDouble constant,int name, int type);
 void InputUpdateFromConstantx(Inputs* inputs,Elements* elements,bool       constant,int name);
 
Index: issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
===================================================================
--- issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp	(revision 26744)
@@ -38,5 +38,4 @@
 	femmodel->parameters->FindParam(&variable_partitions_nt,NULL,NULL,QmuVariablePartitionsNtEnum);
 
-
 	/*Go through all dakota descriptors, ex: "rho_ice","thermal_conductivity","thickness1","thickness2", etc ..., and
 	 * for each descriptor, take the variable value and plug it into the inputs (more or less :)):
@@ -50,5 +49,4 @@
 		descriptor=variables_descriptors[i];
 
-
 		/*From descriptor, figure out if the variable is scaled, indexed, distributed or just a simple variable: */
 		if (strncmp(descriptor,"scaled_",7)==0){
@@ -160,5 +158,5 @@
 
 	/*Here, we put all the code that cannot be handled any other place: */
-	if (strncmp(root,"SurfaceloadModelid",18)==0){
+	if (strncmp(root,"SurfaceloadModelid",18)==0){ //surface load in solid earth class {{{
 
 		if(VerboseQmu()){
@@ -168,7 +166,6 @@
 		}
 
-
-		if (femmodel->inputs->GetInputObjectEnum(SurfaceloadIceThicknessChangeEnum)==DatasetInputEnum)
-			MmeToInput(femmodel,distributed_values,variable_partition,npart,SurfaceloadIceThicknessChangeEnum, P0Enum);
+		if (femmodel->inputs->GetInputObjectEnum(MasstransportSpcthicknessEnum)==DatasetInputEnum)
+			MmeToInput(femmodel,distributed_values,variable_partition,npart,MasstransportSpcthicknessEnum, P0Enum);
 
 		if (femmodel->inputs->GetInputObjectEnum(MaskIceLevelsetEnum)==DatasetInputEnum)
@@ -178,5 +175,29 @@
 			MmeToInput(femmodel,distributed_values,variable_partition,npart,MaskOceanLevelsetEnum, P1Enum);
 
-	}
+	} /*}}}*/
+	if (strncmp(root,"SolidearthExternalModelid",18)==0){ //external solid earth solution in solid earth class {{{
+
+		if(VerboseQmu()){
+			_printf0_("      SolidearthExternalModelid MME, with ids: ");
+			for (int i=0;i<npart;i++)_printf0_((int)distributed_values[i] << " ");
+			_printf0_("\n");
+		}
+
+		if (femmodel->inputs->GetInputObjectEnum(SolidearthExternalDisplacementEastRateEnum)==DatasetInputEnum)
+			MmeToInput(femmodel,distributed_values,variable_partition,npart,SolidearthExternalDisplacementEastRateEnum, P1Enum);
+
+		if (femmodel->inputs->GetInputObjectEnum(SolidearthExternalDisplacementUpRateEnum)==DatasetInputEnum)
+			MmeToInput(femmodel,distributed_values,variable_partition,npart,SolidearthExternalDisplacementUpRateEnum, P1Enum);
+
+		if (femmodel->inputs->GetInputObjectEnum(SolidearthExternalDisplacementNorthRateEnum)==DatasetInputEnum)
+			MmeToInput(femmodel,distributed_values,variable_partition,npart,SolidearthExternalDisplacementNorthRateEnum, P1Enum);
+
+		if (femmodel->inputs->GetInputObjectEnum(SolidearthExternalGeoidRateEnum)==DatasetInputEnum)
+			MmeToInput(femmodel,distributed_values,variable_partition,npart,SolidearthExternalGeoidRateEnum, P1Enum);
+
+		//if (femmodel->inputs->GetInputObjectEnum(SolidearthExternalBarystaticSeaLevelRateEnum)==DatasetInputEnum)
+		//	MmeToInput(femmodel,distributed_values,variable_partition,npart,SolidearthExternalBarystaticSeaLevelRateEnum, P1Enum);
+	} /*}}}*/
+
 	else _error_("InputUpdateSpecialtyCode error message: " << root << " not supported yet!");
 
@@ -235,5 +256,5 @@
 	}
 
-	/*wipe out existing SurfaceloadIceThicknessChangeEnum dataset:*/
+	/*wipe out existing SurfaceloadIceThicknessRateEnum dataset:*/
 	femmodel->inputs->ChangeEnum(DummyEnum,rootenum);
 
@@ -263,4 +284,3 @@
 	}
 
-
 } /*}}}*/
Index: issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h
===================================================================
--- issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h	(revision 25994)
+++ issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.h	(revision 26744)
@@ -13,4 +13,3 @@
 void InputScaleFromDakotax(FemModel* femmodel,IssmDouble* distributed_values,IssmDouble* partition, int npart, int nt, int name);
 
-
 #endif  /* _INPUTUPDATEFROMDAKOTAXX_H */
Index: issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h
===================================================================
--- issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h	(revision 25994)
+++ issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h	(revision 26744)
@@ -9,5 +9,5 @@
 
 int InterpFromMeshToMesh2dx(double** pdata_interp,int* index_data,double* x_data,double* y_data,int nods_data,int nels_data,
-			double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options);
+			double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options=NULL);
 
 #endif
Index: issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
===================================================================
--- issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 26744)
@@ -666,5 +666,5 @@
 					if((iomodel->my_vertices[i])){
 						if (!xIsNan<IssmDouble>(spcdata[i])){
-							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,analysis_type));
+							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,spcdata[i],analysis_type));
 							count++;
 						}
@@ -676,19 +676,16 @@
 					if((iomodel->my_vertices[i])){
 						if (!xIsNan<IssmDouble>(spcdata[i])){
-							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,analysis_type));
-							count++;
-						}
-					}
-				}
-				for(i=0;i<iomodel->numberofedges;i++){
-					if(iomodel->edges[i*3+2]==2){
-						if(iomodel->my_edges[i]){
-							v1 = iomodel->edges[3*i+0]-1;
-							v2 = iomodel->edges[3*i+1]-1;
-							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
-								constraints->AddObject(new SpcDynamic(count+1,iomodel->numberofvertices+i+1,
-												dof,analysis_type));
-								count++;
-							}
+							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,spcdata[i],analysis_type));
+							count++;
+						}
+					}
+				}
+				for(i=0;i<iomodel->numberofverticaledges;i++){
+					if(iomodel->my_vedges[i]){
+						v1 = iomodel->verticaledges[2*i+0]-1;
+						v2 = iomodel->verticaledges[2*i+1]-1;
+						if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+							constraints->AddObject(new SpcDynamic(count+1,iomodel->numberofvertices+i+1,dof,(spcdata[v1]+spcdata[v2])/2.,analysis_type));
+							count++;
 						}
 					}
@@ -699,19 +696,19 @@
 					if((iomodel->my_vertices[i])){
 						if (!xIsNan<IssmDouble>(spcdata[i])){
-							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,analysis_type));
-							count++;
-						}
-					}
-				}
-				for(i=0;i<iomodel->numberofedges;i++){
-					if(iomodel->edges[i*3+2]==2){
-						if(iomodel->my_edges[i]){
-							v1 = iomodel->edges[3*i+0]-1;
-							v2 = iomodel->edges[3*i+1]-1;
-							if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
-								constraints->AddObject(new SpcDynamic(count+1,iomodel->numberofvertices+2*i+1,dof,analysis_type));
-								constraints->AddObject(new SpcDynamic(count+2,iomodel->numberofvertices+2*i+2,dof,analysis_type));
-								count=count+2;
-							}
+							constraints->AddObject(new SpcDynamic(count+1,i+1,dof,spcdata[i],analysis_type));
+							count++;
+						}
+					}
+				}
+				for(i=0;i<iomodel->numberofverticaledges;i++){
+					if(iomodel->my_vedges[i]){
+						v1 = iomodel->verticaledges[2*i+0]-1;
+						v2 = iomodel->verticaledges[2*i+1]-1;
+						if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+							constraints->AddObject(new SpcDynamic(count+1,iomodel->numberofvertices+2*i+1,
+											dof,2./3.*spcdata[v1]+1./3.*spcdata[v2],analysis_type));
+							constraints->AddObject(new SpcDynamic(count+2,iomodel->numberofvertices+2*i+2,
+											dof,1./3.*spcdata[v1]+2./3.*spcdata[v2],analysis_type));
+							count=count+2;
 						}
 					}
Index: issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h
===================================================================
--- issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 25994)
+++ issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 26744)
@@ -25,5 +25,4 @@
 	int* index2d=NULL;
 	int  count=0;
-
 
 	switch(meshelementtype){
Index: issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.cpp
===================================================================
--- issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.cpp	(revision 26744)
+++ issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.cpp	(revision 26744)
@@ -0,0 +1,70 @@
+/*!\file MmeToInputFromId
+ * \brief: compute damage
+ */
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../../shared/shared.h"
+#include "../../toolkits/toolkits.h"
+#include "../../classes/classes.h"
+#include "../../classes/Inputs/DatasetInput.h"
+#include "../../classes/Inputs/TransientInput.h"
+#include "../../classes/Inputs/TriaInput.h"
+#include "./MmeToInputFromIdx.h"
+
+void MmeToInputFromIdx(Inputs* inputs, Elements* elements, int id, int rootenum, int interpolationenum){
+
+	TransientInput* transientinput  = NULL;
+	TransientInput* transientinput2 = NULL;
+	Tria* element                    = NULL;
+	IssmDouble value;
+	IssmDouble* values               = NULL;
+	IssmDouble* times                = NULL;
+	int N;
+
+	/*find thickness dataset: */
+	DatasetInput* datasetinput = inputs->GetDatasetInput(rootenum);
+
+	/*Initialize new transient input: */
+	transientinput = datasetinput->GetTransientInputByOffset(0); _assert_(transientinput);
+	transientinput->GetAllTimes(&times,&N);
+	inputs->SetTransientInput(DummyEnum,times,N);
+	transientinput2 = inputs->GetTransientInput(DummyEnum);
+
+	for(Object* & object : elements->objects){
+		Tria*   element=xDynamicCast<Tria*>(object);
+
+		/*recover the right field from the mme: */
+		transientinput = datasetinput->GetTransientInputByOffset(id); _assert_(transientinput);
+
+		/*copy values from the transientinput to the final transientinput2: */
+		for (int j=0;j<N;j++){
+			TriaInput* tria_input=transientinput->GetTriaInput(j);
+			element->InputServe(tria_input);
+			if(interpolationenum==P0Enum){
+				value=tria_input->element_values[0];
+				transientinput2->AddTriaTimeInput( j,1,&(element->lid),&value,P0Enum);
+			}
+			else if(interpolationenum==P1Enum){
+
+				/*Get values and lid list*/
+				const int   numvertices     = element->GetNumberOfVertices();
+				int        *vertexlids      = xNew<int>(numvertices);
+				int        *vertexsids      = xNew<int>(numvertices);
+
+				/*Recover vertices ids needed to initialize inputs*/
+				element->GetVerticesLidList(&vertexlids[0]);
+				element->GetVerticesSidList(&vertexsids[0]);
+				values=tria_input->element_values;
+				transientinput2->AddTriaTimeInput( j,numvertices,vertexlids,values,P1Enum);
+			}
+		}
+	}
+
+	/*wipe out existing SurfaceloadIceThicknessChangeEnum dataset:*/
+	inputs->ChangeEnum(DummyEnum,rootenum);
+
+}
Index: issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.h
===================================================================
--- issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.h	(revision 26744)
+++ issm/trunk/src/c/modules/MmeToInputFromIdx/MmeToInputFromIdx.h	(revision 26744)
@@ -0,0 +1,11 @@
+#ifndef _MMETOINPUTFROMIDX_H
+#define _MMETOINPUTFROMIDX_H
+
+class Inputs; 
+class Elements; 
+class Parameters;
+
+/* local prototypes: */
+void  MmeToInputFromIdx(Inputs* inputs, Elements* elements, int id, int rootenum, int interpolationenum);
+
+#endif
Index: issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 26744)
@@ -289,5 +289,4 @@
 			N_all[i] = N;
 
-
 			for(Object* & object : elements->objects){
 				Element* element=xDynamicCast<Element*>(object);
Index: issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 26744)
@@ -179,28 +179,29 @@
 
 			//go through list of materials, and create them: 
-			for(int i=0;i<nnat;i++){ 
-				switch(IoCodeToEnumNature(nature[i])){ //{{{
-					case MaticeEnum:
-						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_B",MaterialsRheologyBEnum);
-						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_n",MaterialsRheologyNEnum);
-						for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
-						switch(iomodel->domaindim){
-							case 2:
-								inputs->DuplicateInput(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
-								break;
-							case 3:
-								break;
-							default:
-								_error_("Mesh not supported yet");
+			for(int nat=0;nat<nnat;nat++){
+				switch(IoCodeToEnumNature(nature[nat])){ 
+					case MaticeEnum:{ /*{{{*/
+							iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_B",MaterialsRheologyBEnum);
+							iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_n",MaterialsRheologyNEnum);
+							for (int k=0;k<iomodel->numberofelements;k++) if(iomodel->my_elements[k]) materials->AddObject(new Matice(k+1,k,MaticeEnum));
+							switch(iomodel->domaindim){
+								case 2:
+									inputs->DuplicateInput(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum);
+									break;
+								case 3:
+									break;
+								default:
+									_error_("Mesh not supported yet");
+							}
+						} /*}}}*/
+						break;
+					case MatlithoEnum: { /*{{{*/
+							iomodel->FetchData(13,"md.materials.radius","md.materials.viscosity","md.materials.lame_lambda","md.materials.lame_mu","md.materials.burgers_viscosity","md.materials.burgers_mu","md.materials.ebm_alpha","md.materials.ebm_delta","md.materials.ebm_taul","md.materials.ebm_tauh","md.materials.rheologymodel","md.materials.issolid","md.materials.density");
+							materials->AddObject(new Matlitho(iomodel->numberofelements+1,iomodel));
+							iomodel->DeleteData(13,"md.materials.radius","md.materials.viscosity","md.materials.lame_lambda","md.materials.lame_mu","md.materials.burgers_viscosity","md.materials.burgers_mu","md.materials.ebm_alpha","md.materials.ebm_delta","md.materials.ebm_taul","md.materials.ebm_tauh","md.materials.rheologymodel","md.materials.issolid","md.materials.density");
 						}
+						/*}}}*/
 						break;
-					case MatlithoEnum:
-						iomodel->FetchData(9,"md.materials.radius","md.materials.viscosity","md.materials.lame_lambda","md.materials.lame_mu","md.materials.burgers_viscosity","md.materials.burgers_mu","md.materials.isburgers","md.materials.issolid","md.materials.density");
-						materials->AddObject(new Matlitho(materials->Size()+1,iomodel));
-						iomodel->DeleteData(9,"md.materials.radius","md.materials.viscosity","md.materials.lame_lambda","md.materials.lame_mu","md.materials.burgers_viscosity","md.materials.burgers_mu","md.materials.isburgers","md.materials.issolid","md.materials.density");
-						break;
-
-					case MathydroEnum:
-						{
+					case MathydroEnum: {/*{{{*/
 							/*If we don't have any materials pointed to by elements (meaning, if we are running only litho or hydro), 
 							 * then we need to zero out the hmaterial pointers inside the elements dataset so that it won't error out 
@@ -208,8 +209,8 @@
 							bool isice=false;
 							for (int j=0;j<nnat;j++){
-								if((IoCodeToEnumNature(nature[i])==MaticeEnum)||
-										(IoCodeToEnumNature(nature[i])==MatenhancediceEnum)||
-										(IoCodeToEnumNature(nature[i])==MatestarEnum)||
-										(IoCodeToEnumNature(nature[i])==MatdamageiceEnum)){
+								if((IoCodeToEnumNature(nature[j])==MaticeEnum)||
+										(IoCodeToEnumNature(nature[j])==MatenhancediceEnum)||
+										(IoCodeToEnumNature(nature[j])==MatestarEnum)||
+										(IoCodeToEnumNature(nature[j])==MatdamageiceEnum)){
 									isice=true; break; }
 							}
@@ -230,12 +231,11 @@
 								}
 							}
-						}
+						} /*}}}*/
 						break;
-
-					case MatenhancediceEnum:
+					case MatenhancediceEnum: /*{{{*/
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_B",MaterialsRheologyBEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_n",MaterialsRheologyNEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_E",MaterialsRheologyEEnum);
-						for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+						for(int j=0;j<iomodel->numberofelements;j++) if(iomodel->my_elements[j]) materials->AddObject(new Matice(j+1,j,MatenhancediceEnum));
 						switch(iomodel->domaindim){
 							case 2:
@@ -248,10 +248,11 @@
 								_error_("Mesh not supported yet");
 						}
+						/*}}}*/
 						break;
-					case MatdamageiceEnum:
+					case MatdamageiceEnum: /*{{{*/
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_B",MaterialsRheologyBEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_n",MaterialsRheologyNEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.damage.D",DamageDEnum);
-						for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel));
+						for (int j=0;j<iomodel->numberofelements;j++) if(iomodel->my_elements[j]) materials->AddObject(new Matice(j+1,j,MatdamageiceEnum));
 						switch(iomodel->domaindim){
 							case 2:
@@ -264,10 +265,11 @@
 								_error_("Mesh not supported yet");
 						}
+						/*}}}*/
 						break;
-					case MatestarEnum:
+					case MatestarEnum: /*{{{*/
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_B",MaterialsRheologyBEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_Ec",MaterialsRheologyEcEnum);
 						iomodel->FetchDataToInput(inputs,elements,"md.materials.rheology_Es",MaterialsRheologyEsEnum);
-						for(i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matestar(i+1,i,iomodel));
+						for(int j=0;j<iomodel->numberofelements;j++) if(iomodel->my_elements[j]) materials->AddObject(new Matestar(j+1,j,iomodel));
 						switch(iomodel->domaindim){
 							case 2:
@@ -280,11 +282,11 @@
 							default:
 								_error_("Mesh not supported yet");
-						}
+						} 
+						/*}}}*/
+						break; 
+					default:
+						_error_("Materials nature type "<<EnumToStringx(IoCodeToEnumNature(nature[nat]))<<" not supported");
 						break;
-
-					default:
-						_error_("Materials nature type "<<EnumToStringx(IoCodeToEnumNature(nature[i]))<<" not supported");
-
-				} //}}}
+				}
 			}
 			//Free ressources:
Index: issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 26744)
@@ -170,5 +170,5 @@
 				int*         cfsurfacesquare_weights_N_s				= NULL;
 				char**       cfsurfacesquare_weights_string_s		= NULL;
-				int*	 cfsurfacesquare_datatime_s				= NULL;
+				IssmDouble*	 cfsurfacesquare_datatime_s				= NULL;
 
 				/*Fetch name, model_string, observation, observation_string, etc ... (see src/m/classes/cfsurfacesquare.m): */
@@ -241,5 +241,5 @@
 				xDelete<int>(cfsurfacesquare_weights_N_s);
 				xDelete<char*>(cfsurfacesquare_weights_string_s);
-				xDelete<int>(cfsurfacesquare_datatime_s);
+				xDelete<IssmDouble>(cfsurfacesquare_datatime_s);
 				/*}}}*/
 			}
@@ -323,5 +323,5 @@
 				int*         cfsurfacelogvel_weights_N				= NULL;
 				char**       cfsurfacelogvel_weightstring		= NULL;
-				int*				cfsurfacelogvel_datatime				= NULL;
+				IssmDouble*  cfsurfacelogvel_datatime				= NULL;
 
 				/*Fetch name, modeltring, observation, observationtring, etc ... (see src/m/classes/cfsurfacelogvel.m): */
@@ -399,5 +399,92 @@
 				xDelete<int>(cfsurfacelogvel_weights_N);
 				xDelete<char*>(cfsurfacelogvel_weightstring);
-				xDelete<int>(cfsurfacelogvel_datatime);
+				xDelete<IssmDouble>(cfsurfacelogvel_datatime);
+				/*}}}*/
+			}
+			else if (output_definition_enums[i]==CflevelsetmisfitEnum){
+				/*Deal with cflevelsetmisfit: {{{*/
+
+				/*cflevelsetmisfit variables: */
+				int          num_cflevelsetmisfits;
+				char**       cflevelsetmisfit_name_s						= NULL;    
+				char**		 cflevelsetmisfit_definitionstring_s		= NULL;    
+				char**       cflevelsetmisfit_model_string_s			= NULL;
+				IssmDouble** cflevelsetmisfit_observation_s			= NULL;
+				char**		 cflevelsetmisfit_observation_string_s	= NULL;
+				int*         cflevelsetmisfit_observation_M_s			= NULL;
+				int*         cflevelsetmisfit_observation_N_s			= NULL;
+				IssmDouble** cflevelsetmisfit_weights_s					= NULL;
+				int*         cflevelsetmisfit_weights_M_s				= NULL;
+				int*         cflevelsetmisfit_weights_N_s				= NULL;
+				char**       cflevelsetmisfit_weights_string_s		= NULL;
+				IssmDouble*	 cflevelsetmisfit_datatime_s				= NULL;
+
+				/*Fetch name, model_string, observation, observation_string, etc ... (see src/m/classes/cflevelsetmisfit.m): */
+				iomodel->FetchMultipleData(&cflevelsetmisfit_name_s,&num_cflevelsetmisfits,                                                        "md.cflevelsetmisfit.name");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_definitionstring_s,&num_cflevelsetmisfits,                                            "md.cflevelsetmisfit.definitionstring");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_model_string_s,&num_cflevelsetmisfits,                                                "md.cflevelsetmisfit.model_string");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_observation_s,&cflevelsetmisfit_observation_M_s,&cflevelsetmisfit_observation_N_s,&num_cflevelsetmisfits, "md.cflevelsetmisfit.observation");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_observation_string_s,&num_cflevelsetmisfits,                                          "md.cflevelsetmisfit.observation_string");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_weights_s,&cflevelsetmisfit_weights_M_s,&cflevelsetmisfit_weights_N_s,&num_cflevelsetmisfits,             "md.cflevelsetmisfit.weights");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_weights_string_s,&num_cflevelsetmisfits,                                              "md.cflevelsetmisfit.weights_string");
+				iomodel->FetchMultipleData(&cflevelsetmisfit_datatime_s,&num_cflevelsetmisfits,																	 "md.cflevelsetmisfit.datatime");
+
+				for(j=0;j<num_cflevelsetmisfits;j++){
+					int obs_vector_type=0;
+					if ((cflevelsetmisfit_observation_M_s[j]==iomodel->numberofvertices) || (cflevelsetmisfit_observation_M_s[j]==iomodel->numberofvertices+1)){
+						obs_vector_type=1;
+					}
+					else if ((cflevelsetmisfit_observation_M_s[j]==iomodel->numberofelements) || (cflevelsetmisfit_observation_M_s[j]==iomodel->numberofelements+1)){
+						obs_vector_type=2;
+					}
+					else
+					 _error_("cflevelsetmisfit observation size not supported yet");
+
+					int weight_vector_type=0;
+					if ((cflevelsetmisfit_weights_M_s[j]==iomodel->numberofvertices) || (cflevelsetmisfit_weights_M_s[j]==iomodel->numberofvertices+1)){
+						weight_vector_type=1;
+					}
+					else if ((cflevelsetmisfit_weights_M_s[j]==iomodel->numberofelements) || (cflevelsetmisfit_weights_M_s[j]==iomodel->numberofelements+1)){
+						weight_vector_type=2;
+					}
+					else
+					 _error_("cflevelsetmisfit weight size not supported yet");
+
+					/*First create a cflevelsetmisfit object for that specific string (cflevelsetmisfit_model_string_s[j]):*/
+					output_definitions->AddObject(new Cflevelsetmisfit(cflevelsetmisfit_name_s[j],StringToEnumx(cflevelsetmisfit_definitionstring_s[j]),StringToEnumx(cflevelsetmisfit_model_string_s[j]),StringToEnumx(cflevelsetmisfit_observation_string_s[j]),StringToEnumx(cflevelsetmisfit_weights_string_s[j]),cflevelsetmisfit_datatime_s[j],false));
+
+					/*Now, for this particular cflevelsetmisfit object, make sure we plug into the elements: the observation, and the weights.*/
+					for(Object* & object : elements->objects){
+						Element* element=xDynamicCast<Element*>(object);
+						element->DatasetInputAdd(StringToEnumx(cflevelsetmisfit_definitionstring_s[j]),cflevelsetmisfit_observation_s[j],inputs,iomodel,cflevelsetmisfit_observation_M_s[j],cflevelsetmisfit_observation_N_s[j],obs_vector_type,StringToEnumx(cflevelsetmisfit_observation_string_s[j]),7,LevelsetObservationEnum);
+						element->DatasetInputAdd(StringToEnumx(cflevelsetmisfit_definitionstring_s[j]),cflevelsetmisfit_weights_s[j],inputs,iomodel,cflevelsetmisfit_weights_M_s[j],cflevelsetmisfit_weights_N_s[j],weight_vector_type,StringToEnumx(cflevelsetmisfit_weights_string_s[j]),7,WeightsLevelsetObservationEnum);
+					}
+				}
+
+				  /*Free ressources:*/
+				for(j=0;j<num_cflevelsetmisfits;j++){
+					char* string=NULL;
+					IssmDouble* matrix = NULL;
+
+					string = cflevelsetmisfit_definitionstring_s[j];		xDelete<char>(string);
+					string = cflevelsetmisfit_observation_string_s[j];	xDelete<char>(string);
+					string = cflevelsetmisfit_model_string_s[j];			xDelete<char>(string);
+					string = cflevelsetmisfit_weights_string_s[j];		xDelete<char>(string);
+					string = cflevelsetmisfit_name_s[j];    xDelete<char>(string);
+					matrix = cflevelsetmisfit_observation_s[j]; xDelete<IssmDouble>(matrix);
+					matrix = cflevelsetmisfit_weights_s[j]; xDelete<IssmDouble>(matrix);
+				}
+				xDelete<char*>(cflevelsetmisfit_name_s);
+				xDelete<char*>(cflevelsetmisfit_model_string_s);
+				xDelete<char*>(cflevelsetmisfit_definitionstring_s);
+				xDelete<IssmDouble*>(cflevelsetmisfit_observation_s);
+				xDelete<char*>(cflevelsetmisfit_observation_string_s);
+				xDelete<int>(cflevelsetmisfit_observation_M_s);
+				xDelete<int>(cflevelsetmisfit_observation_N_s);
+				xDelete<IssmDouble*>(cflevelsetmisfit_weights_s);
+				xDelete<int>(cflevelsetmisfit_weights_M_s);
+				xDelete<int>(cflevelsetmisfit_weights_N_s);
+				xDelete<char*>(cflevelsetmisfit_weights_string_s);
+				xDelete<IssmDouble>(cflevelsetmisfit_datatime_s);
 				/*}}}*/
 			}
@@ -630,5 +717,5 @@
 				xDelete<int>(cost_functions_weights_N);
 				xDelete<IssmDouble*>(cost_functions_weights);
-			
+
 			/*}}}*/
 			}
Index: issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 26744)
@@ -30,5 +30,5 @@
 	bool         autodiff_mass_flux_present = false;
 	bool         mass_flux_present          = false;
-	bool         interp;
+	bool         interp,cycle;
 	IssmDouble **array                      = NULL;
 	int         *mdims_array                = NULL;
@@ -55,4 +55,5 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.settings.waitonlock",SettingsWaitonlockEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.mesh.numberofvertices",MeshNumberofverticesEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.mesh.numberofelements",MeshNumberofelementsEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.settings.io_gather",SettingsIoGatherEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.settings.solver_residue_threshold",SettingsSolverResidueThresholdEnum));
@@ -63,5 +64,8 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.calving.law",CalvingLawEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.frontalforcings.parameterization",FrontalForcingsParamEnum));
-	parameters->AddObject(new IntParam(SealevelriseRunCountEnum,1));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.isgrd",SolidearthSettingsGRDEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.grdmodel",GrdModelEnum));
+	parameters->AddObject(iomodel->CopyConstantObject("md.solidearth.settings.runfrequency",SolidearthSettingsRunFrequencyEnum));
+	parameters->AddObject(new IntParam(SealevelchangeRunCountEnum,1));
 
 	  {/*This is specific to ice...*/
@@ -74,16 +78,17 @@
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isstressbalance",TransientIsstressbalanceEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismasstransport",TransientIsmasstransportEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isoceantransport",TransientIsoceantransportEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.issmb",TransientIssmbEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isthermal",TransientIsthermalEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isgroundingline",TransientIsgroundinglineEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isgia",TransientIsgiaEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isesa",TransientIsesaEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isdamageevolution",TransientIsdamageevolutionEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.ishydrology",TransientIshydrologyEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.ismovingfront",TransientIsmovingfrontEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isslr",TransientIsslrEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.transient.iscoupler",TransientIscouplerEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isslc",TransientIsslcEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.isoceancoupling",TransientIsoceancouplingEnum));
 		parameters->AddObject(iomodel->CopyConstantObject("md.transient.amr_frequency",TransientAmrFrequencyEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.transient.issampling",TransientIssamplingEnum));
+		parameters->AddObject(iomodel->CopyConstantObject("md.stochasticforcing.isstochasticforcing",StochasticForcingIsStochasticForcingEnum));
 
 		/*For stress balance only*/
@@ -155,5 +160,6 @@
 			break;
 		case LinearFloatingMeltRateEnum:
-			iomodel->FindConstant(&interp,"md.timestepping.interp_forcings");
+			iomodel->FindConstant(&interp,"md.timestepping.interp_forcing");
+			iomodel->FindConstant(&cycle,"md.timestepping.cycle_forcing");
 			iomodel->FetchData(&transparam,&N,&M,"md.basalforcings.deepwater_melting_rate");
 			if(N==1){
@@ -163,5 +169,5 @@
 			else{
 				_assert_(N==2);
-				parameters->AddObject(new TransientParam(BasalforcingsDeepwaterMeltingRateEnum,&transparam[0],&transparam[M],interp,M));
+				parameters->AddObject(new TransientParam(BasalforcingsDeepwaterMeltingRateEnum,&transparam[0],&transparam[M],interp,cycle,M));
 			}
 			xDelete<IssmDouble>(transparam);
@@ -173,5 +179,5 @@
 			else{
 				_assert_(N==2);
-				parameters->AddObject(new TransientParam(BasalforcingsUpperwaterMeltingRateEnum,&transparam[0],&transparam[M],interp,M));
+				parameters->AddObject(new TransientParam(BasalforcingsUpperwaterMeltingRateEnum,&transparam[0],&transparam[M],interp,cycle,M));
 			}
 			xDelete<IssmDouble>(transparam);
@@ -183,5 +189,5 @@
 			else{
 				_assert_(N==2);
-				parameters->AddObject(new TransientParam(BasalforcingsDeepwaterElevationEnum,&transparam[0],&transparam[M],interp,M));
+				parameters->AddObject(new TransientParam(BasalforcingsDeepwaterElevationEnum,&transparam[0],&transparam[M],interp,cycle,M));
 			}
 			xDelete<IssmDouble>(transparam);
@@ -193,5 +199,5 @@
 			else{
 				_assert_(N==2);
-				parameters->AddObject(new TransientParam(BasalforcingsUpperwaterElevationEnum,&transparam[0],&transparam[M],interp,M));
+				parameters->AddObject(new TransientParam(BasalforcingsUpperwaterElevationEnum,&transparam[0],&transparam[M],interp,cycle,M));
 			}
 			xDelete<IssmDouble>(transparam);
@@ -219,5 +225,6 @@
 			break;
 		case BasalforcingsPicoEnum:
-			iomodel->FindConstant(&interp,"md.timestepping.interp_forcings");
+			iomodel->FindConstant(&interp,"md.timestepping.interp_forcing");
+			iomodel->FindConstant(&cycle,"md.timestepping.cycle_forcing");
 			parameters->AddObject(iomodel->CopyConstantObject("md.basalforcings.num_basins",BasalforcingsPicoNumBasinsEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.basalforcings.maxboxcount",BasalforcingsPicoMaxboxcountEnum));
@@ -226,9 +233,9 @@
 			iomodel->FetchData(&transparam,&M,&N,"md.basalforcings.farocean_temperature");
 			_assert_(M>=1 && N>=1);
-			parameters->AddObject(new TransientArrayParam(BasalforcingsPicoFarOceantemperatureEnum,transparam,&transparam[N*(M-1)],interp,N,M));
+			parameters->AddObject(new TransientArrayParam(BasalforcingsPicoFarOceantemperatureEnum,transparam,&transparam[N*(M-1)],interp,cycle,N,M));
 			xDelete<IssmDouble>(transparam);
 			iomodel->FetchData(&transparam,&M,&N,"md.basalforcings.farocean_salinity");
 			_assert_(M>=1 && N>=1);
-			parameters->AddObject(new TransientArrayParam(BasalforcingsPicoFarOceansalinityEnum,transparam,&transparam[N*(M-1)],interp,N,M));
+			parameters->AddObject(new TransientArrayParam(BasalforcingsPicoFarOceansalinityEnum,transparam,&transparam[N*(M-1)],interp,cycle,N,M));
 			xDelete<IssmDouble>(transparam);
 			break;
@@ -261,5 +268,6 @@
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.final_time",TimesteppingFinalTimeEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.time_step",TimesteppingTimeStepEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.interp_forcings",TimesteppingInterpForcingsEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.interp_forcing",TimesteppingInterpForcingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.cycle_forcing",TimesteppingCycleForcingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.coupling_time",TimesteppingCouplingTimeEnum));
 			break;
@@ -270,5 +278,6 @@
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.time_step_max",TimesteppingTimeStepMaxEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.cfl_coefficient",TimesteppingCflCoefficientEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.interp_forcings",TimesteppingInterpForcingsEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.interp_forcing",TimesteppingInterpForcingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.cycle_forcing",TimesteppingCycleForcingEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.timestepping.coupling_time",TimesteppingCouplingTimeEnum));
 			break;
@@ -323,4 +332,5 @@
 			parameters->AddObject(iomodel->CopyConstantObject("md.materials.thermal_exchange_velocity",MaterialsThermalExchangeVelocityEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.constants.g",ConstantsGEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.constants.gravitational_constant",ConstantsNewtonGravityEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.materials.rheology_law",MaterialsRheologyLawEnum));
 			parameters->AddObject(iomodel->CopyConstantObject("md.materials.earth_density",MaterialsEarthDensityEnum));
@@ -355,16 +365,15 @@
 						parameters->AddObject(iomodel->CopyConstantObject("md.constants.g",ConstantsGEnum));
 						parameters->AddObject(iomodel->CopyConstantObject("md.materials.rheology_law",MaterialsRheologyLawEnum));
-
-						/*slr:*/
-						parameters->AddObject(iomodel->CopyConstantObject("md.materials.earth_density",MaterialsEarthDensityEnum));
+						/*slc:*/
 						break;
 					case MathydroEnum:
 						parameters->AddObject(iomodel->CopyConstantObject("md.materials.rho_ice",MaterialsRhoIceEnum));
 						parameters->AddObject(iomodel->CopyConstantObject("md.materials.rho_water",MaterialsRhoSeawaterEnum));
-						parameters->AddObject(iomodel->CopyConstantObject("md.materials.earth_density",MaterialsEarthDensityEnum));
 						parameters->AddObject(iomodel->CopyConstantObject("md.materials.rho_freshwater",MaterialsRhoFreshwaterEnum));
 						break;
 				}
 			}
+			parameters->AddObject(iomodel->CopyConstantObject("md.materials.earth_density",MaterialsEarthDensityEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.constants.gravitational_constant",ConstantsNewtonGravityEnum));
 			/*Free rssources:*/
 			xDelete<int>(nature);
@@ -388,4 +397,20 @@
 			/*Nothing to add*/
 			break;
+		case SMBautoregressionEnum:
+         /*Add parameters that are not in standard nbvertices format*/
+         parameters->AddObject(iomodel->CopyConstantObject("md.smb.num_basins",SmbNumBasinsEnum));
+         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ar_order",SmbAutoregressiveOrderEnum));
+         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ar_initialtime",SmbAutoregressionInitialTimeEnum));
+         parameters->AddObject(iomodel->CopyConstantObject("md.smb.ar_timestep",SmbAutoregressionTimestepEnum));
+         iomodel->FetchData(&transparam,&M,&N,"md.smb.beta0");
+         parameters->AddObject(new DoubleVecParam(SmbBeta0Enum,transparam,N));
+         xDelete<IssmDouble>(transparam);
+         iomodel->FetchData(&transparam,&M,&N,"md.smb.beta1");
+         parameters->AddObject(new DoubleVecParam(SmbBeta1Enum,transparam,N));
+         xDelete<IssmDouble>(transparam);
+         iomodel->FetchData(&transparam,&M,&N,"md.smb.phi");
+         parameters->AddObject(new DoubleMatParam(SmbPhiEnum,transparam,M,N));
+         xDelete<IssmDouble>(transparam);
+         break;
 		case SMBgembEnum:
 			parameters->AddObject(iomodel->CopyConstantObject("md.smb.aIce",SmbAIceEnum));
@@ -473,4 +498,32 @@
 		iomodel->DeleteData(&requestedoutputs,numoutputs,"md.damage.requested_outputs");
 	}
+
+	bool isstochasticforcing;
+   parameters->FindParam(&isstochasticforcing,StochasticForcingIsStochasticForcingEnum);
+	/*Stochastic Effective Pressure false by default*/
+	parameters->AddObject(new BoolParam(StochasticForcingIsWaterPressureEnum,false));
+   if(isstochasticforcing){
+      int num_fields,stochastic_dim;
+      char** fields;
+      parameters->AddObject(iomodel->CopyConstantObject("md.stochasticforcing.num_fields",StochasticForcingNumFieldsEnum));
+      parameters->AddObject(iomodel->CopyConstantObject("md.stochasticforcing.defaultdimension",StochasticForcingDefaultDimensionEnum));
+      iomodel->FindConstant(&fields,&num_fields,"md.stochasticforcing.fields");
+      if(num_fields<1) _error_("no stochasticforcing fields found");
+      int* stochasticforcing_enums = xNew<int>(num_fields);
+      for(int i=0;i<num_fields;i++){
+         stochasticforcing_enums[i] = StringToEnumx(fields[i]);
+         xDelete<char>(fields[i]);
+      }
+      xDelete<char*>(fields);
+      parameters->AddObject(new IntVecParam(StochasticForcingFieldsEnum,stochasticforcing_enums,num_fields));
+      xDelete<int>(stochasticforcing_enums);
+      parameters->AddObject(iomodel->CopyConstantObject("md.stochasticforcing.randomflag",StochasticForcingRandomflagEnum));
+      iomodel->FetchData(&transparam,&M,&N,"md.stochasticforcing.dimensions");
+      parameters->AddObject(new IntVecParam(StochasticForcingDimensionsEnum,transparam,N));
+      xDelete<IssmDouble>(transparam);
+      iomodel->FetchData(&transparam,&M,&N,"md.stochasticforcing.covariance");
+      parameters->AddObject(new DoubleMatParam(StochasticForcingCovarianceEnum,transparam,M,N));
+      xDelete<IssmDouble>(transparam);
+   }
 
 	/*Deal with mass flux segments: {{{*/
Index: issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 26744)
@@ -111,9 +111,14 @@
 
 	/*Start figuring out, out of the partition, which elements belong to this cpu: */
+	bool check = false;
 	for(int i=0;i<iomodel->numberofelements;i++){
 
 		/*!All elements have been partitioned above, only deal with elements for this cpu: */
-		if(my_rank==epart[i]) my_elements[i]=true;
+		if(my_rank==epart[i]){
+			my_elements[i]=true;
+			check = true;
+		}
 	}
+	if(!check) _error_("partition "<<my_rank<<" does not have any element! Try reducing md.cluster.np");
 
 	/*Assign pointers to iomodel*/
Index: issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 26744)
@@ -36,5 +36,5 @@
 
 	/*Partition Elements and Nodes*/
-	ElementsAndVerticesPartitioning(iomodel);
+	if (iomodel->numberofelements > 0) ElementsAndVerticesPartitioning(iomodel);
 
 	/*Create elements, vertices and materials, independent of analysis_enum: */
Index: issm/trunk/src/c/modules/OceanExchangeDatax/OceanExchangeDatax.cpp
===================================================================
--- issm/trunk/src/c/modules/OceanExchangeDatax/OceanExchangeDatax.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/OceanExchangeDatax/OceanExchangeDatax.cpp	(revision 26744)
@@ -60,8 +60,8 @@
 		femmodel->parameters->SetParam(oceangridnxsize,OceanGridNxEnum);
 		femmodel->parameters->SetParam(oceangridnysize,OceanGridNyEnum);
+		oceangridx=xNew<IssmDouble>(ngrids_ocean);
+		oceangridy=xNew<IssmDouble>(ngrids_ocean);
 		if(my_rank==0){
-			oceangridx = xNew<IssmDouble>(ngrids_ocean);
 			ISSM_MPI_Recv(oceangridx,ngrids_ocean,ISSM_MPI_DOUBLE,0,10001005,tomitgcmcomm,&status);
-			oceangridy = xNew<IssmDouble>(ngrids_ocean);
 			ISSM_MPI_Recv(oceangridy,ngrids_ocean,ISSM_MPI_DOUBLE,0,10001006,tomitgcmcomm,&status);
 
@@ -70,8 +70,5 @@
 			ISSM_MPI_Recv(&oceantime,1,ISSM_MPI_DOUBLE,0,10001002,tomitgcmcomm,&status);
 		}
-		if(my_rank!=0){
-			oceangridx=xNew<IssmDouble>(ngrids_ocean);
-			oceangridy=xNew<IssmDouble>(ngrids_ocean);
-		}
+		
 		ISSM_MPI_Bcast(oceangridx,ngrids_ocean,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
 		ISSM_MPI_Bcast(oceangridy,ngrids_ocean,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
Index: issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 26744)
@@ -24,5 +24,4 @@
 	int         solutiontype;
 	char*       solutiontypestring      = NULL;
-
 
 	/*recover my_rank:*/
@@ -71,5 +70,5 @@
 				char* root=NULL;
 				char* modelname=NULL;
-				
+
 				femmodel->parameters->FindParam(&currEvalId,QmuCurrEvalIdEnum);
 				femmodel->parameters->FindParam(&statistics,QmuStatisticsEnum);
Index: issm/trunk/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp
===================================================================
--- issm/trunk/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/QmuStatisticsx/QmuStatisticsx.cpp	(revision 26744)
@@ -20,5 +20,5 @@
 	IssmDouble* dmatfield = NULL; 
 	int*        imatfield = NULL; 
-			
+
 	//type of the returned field: 
 	int type;
@@ -109,5 +109,5 @@
 	int range,lower_row,upper_row;
 	int nfilesperdirectory;
-	
+
 	/*intermediary:*/
 	IssmDouble* doublemat=NULL;
@@ -237,5 +237,5 @@
 			char* field=fields[f];
 			meanxtype[f]=readdata(&doublemat, &doublematsize, &scalar, fid,field,steps[0]);
-			
+
 			if(meanxtype[f]==1){
 				meanxsize[f]=1;
@@ -246,5 +246,5 @@
 					timemean+=scalar/nsteps;
 				}
-					
+
 				/*Figure out max and min of time means: */
 				if(i==(lower_row+1)){
@@ -334,5 +334,5 @@
 				IssmDouble*  allmax=xNew<IssmDouble>(size);
 				IssmDouble*  allmin=xNew<IssmDouble>(size);
-				
+
 				ISSM_MPI_Allreduce(maxx,allmax,size,ISSM_MPI_PDOUBLE,ISSM_MPI_MAX,IssmComm::GetComm());
 				ISSM_MPI_Allreduce(minx,allmin,size,ISSM_MPI_PDOUBLE,ISSM_MPI_MIN,IssmComm::GetComm());
@@ -344,5 +344,5 @@
 		} /*}}}*/
 	}
-	
+
 	/*Now do the same for the time mean fields:*/
 	for (int f=0;f<nfields;f++){
@@ -377,5 +377,4 @@
 			ISSM_MPI_Allreduce(minx,allmin,size,ISSM_MPI_PDOUBLE,ISSM_MPI_MIN,IssmComm::GetComm());
 
-			
 			/*Store for later use in histogram computation:*/
 			maxmeans[f]=allmax;
@@ -488,5 +487,5 @@
 			char* field=fields[f];
 			meanxtype[f]=readdata(&doublemat, &doublematsize, &scalar, fid,field,steps[0]);
-			
+
 			if(meanxtype[f]==1){
 				IssmDouble timemean=0;
@@ -496,5 +495,5 @@
 					timemean+=scalar/nsteps;
 				}
-					
+
 				/*Figure out max and min of time means: */
 				if(i==(lower_row+1)){
@@ -531,5 +530,5 @@
 					IssmDouble* ma=maxmeans[f];
 					IssmDouble* mi=minmeans[f];
-					
+
 					for (int k=0;k<doublematsize;k++){
 						IssmDouble scalar=timemean[k];
@@ -541,9 +540,9 @@
 				}
 				else{
-					
+
 					IssmDouble* localhistogram=timehistogram[f];
 					IssmDouble* ma=maxmeans[f];
 					IssmDouble* mi=minmeans[f];
-					
+
 					for (int k=0;k<doublematsize;k++){
 						IssmDouble scalar=timemean[k];
@@ -600,5 +599,5 @@
 				IssmDouble* histo=histogram[counter];
 				IssmDouble* allhisto=xNew<IssmDouble>(size*nbins);
-				
+
 				ISSM_MPI_Allreduce(histo,allhisto,size*nbins,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
 				xDelete<IssmDouble>(histo);
@@ -620,5 +619,5 @@
 	}
 	_printf0_("Start aggregating time mean histogram:\n");
-	
+
 	/*Now do the same for the time mean fields:*/
 	for (int f=0;f<nfields;f++){
@@ -684,5 +683,5 @@
 	int range,lower_row,upper_row;
 	int nfilesperdirectory;
-	
+
 	/*intermediary:*/
 	IssmDouble* doublemat=NULL;
@@ -806,5 +805,5 @@
 			}
 		}
-		
+
 		/*Deal with time mean: */
 		for (int f=0;f<nfields;f++){
@@ -917,5 +916,5 @@
 				IssmDouble*  sumx=xNew<IssmDouble>(size);
 				IssmDouble*  sumx2=xNew<IssmDouble>(size);
-				
+
 				ISSM_MPI_Reduce(x,sumx,size,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
 				ISSM_MPI_Reduce(x2,sumx2,size,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
@@ -980,5 +979,5 @@
 			IssmDouble*  sumx=xNew<IssmDouble>(size);
 			IssmDouble*  sumx2=xNew<IssmDouble>(size);
-				
+
 			ISSM_MPI_Reduce(x,sumx,size,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
 			ISSM_MPI_Reduce(x2,sumx2,size,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm());
@@ -1021,5 +1020,5 @@
 	int* indices=NULL;
 	int  nindices;
-	
+
 	/*intermediary:*/
 	IssmDouble* doublemat=NULL;
@@ -1143,5 +1142,5 @@
 				if(my_rank==0){
 					char fieldname[1000];
-					
+
 					sprintf(fieldname,"%s%s",fields[f],"Samples");
 					results->AddResult(new GenericExternalResult<IssmPDouble*>(results->Size()+1,fieldname,allx,nsamples,1,j+1,0));
@@ -1152,7 +1151,7 @@
 				x=xs[counter];
 				allx=xNew<IssmDouble>(nsamples*nindices);
-				
+
 				MPI_Gather(x, range*nindices, ISSM_MPI_PDOUBLE,allx, range*nindices, ISSM_MPI_PDOUBLE, 0, IssmComm::GetComm());
-				
+
 				/*add to results:*/
 				if(my_rank==0){
@@ -1183,5 +1182,5 @@
 
 	FemModel* femmodel=new FemModel();
-	
+
 	/*Some parameters that will allow us to use the OutputResultsx module:*/
 	parameters->AddObject(new BoolParam(QmuIsdakotaEnum,false));
@@ -1327,8 +1326,8 @@
 		results   = new Results();
 		parameters=new Parameters();
-		
+
 		//solution type: 
 		parameters->AddObject(new IntParam(SolutionTypeEnum,StatisticsSolutionEnum));
-	
+
 		//root  directory
 		directory=xNew<char>(strlen(argv[2])+1);
@@ -1359,5 +1358,4 @@
 		ISSM_MPI_Comm_split(ISSM_MPI_COMM_WORLD,color, my_rank, &statcomm);
 
-
 		iomodel->FindConstant(&numstatistics,"md.qmu.statistics.numstatistics");
 		for (int i=1;i<=numstatistics;i++){
@@ -1367,5 +1365,5 @@
 			int   nsamples;
 			_printf0_("Dealing with qmu statistical computation #" << i << "\n");
-		
+
 			sprintf(string,"md.qmu.statistics.method(%i).name",i);
 			iomodel->FindConstant(&name,string);
@@ -1391,5 +1389,5 @@
 				iomodel->FetchData(&indices,&dummy,&nindices,string);
 				parameters->AddObject(new IntVecParam(IndicesEnum,indices,nindices));
-		
+
 				ComputeSampleSeries(parameters,results,color,statcomm);
 			}
@@ -1410,5 +1408,5 @@
 	/*output results:*/
 	OutputStatistics(parameters,results,color,statcomm);
-	
+
 	/*all meet here: */
 	ISSM_MPI_Barrier(ISSM_MPI_COMM_WORLD); _printf0_("Output file.\n");
Index: issm/trunk/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp
===================================================================
--- issm/trunk/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp	(revision 26744)
@@ -79,5 +79,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(basalelement->IsSpawnedElement()){basalelement->DeleteMaterials(); delete basalelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
===================================================================
--- issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	(revision 26744)
@@ -63,5 +63,7 @@
 	int numvertices=femmodel->vertices->NumberOfVertices();
 	if(numvertices==0)  return;
-	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices);
+
+	int numvert_local = femmodel->vertices->NumberOfVerticesLocal();
+	Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvert_local,numvertices);
 
 	/*Fill vector with values: */
@@ -71,5 +73,5 @@
 			int nbv = element->GetNumberOfVertices();
 			for(int iv=0;iv<nbv;iv++){
-				vec_mask_ice->SetValue(element->vertices[iv]->Sid(),1.,INS_VAL);
+				vec_mask_ice->SetValue(element->vertices[iv]->Pid(),1.,INS_VAL);
 			}
 		}
@@ -78,5 +80,5 @@
 	/*Assemble vector and serialize */
 	vec_mask_ice->Assemble();
-	InputUpdateFromVectorx(femmodel,vec_mask_ice,IceMaskNodeActivationEnum,VertexSIdEnum);
+	InputUpdateFromVectorx(femmodel,vec_mask_ice,IceMaskNodeActivationEnum,VertexPIdEnum);
 	delete vec_mask_ice;
 }/*}}}*/
Index: issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.cpp
===================================================================
--- issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.cpp	(revision 26744)
+++ issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.cpp	(revision 26744)
@@ -0,0 +1,203 @@
+/*!\file StochasticForcingx
+ * \brief: compute noise terms for the StochasticForcing fields
+ */
+
+#include "./StochasticForcingx.h"
+#include "../../classes/Loads/Friction.h"
+#include "../../shared/shared.h"
+#include "../../toolkits/toolkits.h"
+#include "../../shared/Random/random.h"
+
+void StochasticForcingx(FemModel* femmodel){/*{{{*/
+
+
+	//VV testing (12Nov)
+	/*
+	IssmDouble timeVV,dtVV,starttimeVV;
+	femmodel->parameters->FindParam(&timeVV,TimeEnum);
+   femmodel->parameters->FindParam(&dtVV,TimesteppingTimeStepEnum);
+   femmodel->parameters->FindParam(&starttimeVV,TimesteppingStartTimeEnum);
+	IssmDouble valMean = 0;
+	IssmDouble valSdev = 0.5;
+	int seed;
+	//seed = reCast<int,IssmDouble>((timeVV-starttimeVV)/dtVV);
+	seed = -1;
+	IssmDouble rdmVV;
+	univariateNormal_test0(&rdmVV,valMean,valSdev,seed);
+	_printf_("VV rdmVV: "<<rdmVV<<'\n');
+	*/
+
+   /*Retrieve parameters*/
+   bool randomflag;
+   int M,N,numfields,my_rank;
+   int* fields            = NULL;
+   int* dimensions        = NULL;
+   IssmDouble* covariance = NULL;
+   femmodel->parameters->FindParam(&randomflag,StochasticForcingRandomflagEnum);
+   femmodel->parameters->FindParam(&numfields,StochasticForcingNumFieldsEnum);
+   femmodel->parameters->FindParam(&fields,&N,StochasticForcingFieldsEnum);    _assert_(N==numfields);
+   femmodel->parameters->FindParam(&dimensions,&N,StochasticForcingDimensionsEnum);    _assert_(N==numfields);
+   int dimtot=0;
+   for(int i=0;i<numfields;i++) dimtot = dimtot+dimensions[i];
+   femmodel->parameters->FindParam(&covariance,&M,&N,StochasticForcingCovarianceEnum); _assert_(M==dimtot); _assert_(N==dimtot);
+
+   /*Compute noise terms*/
+   IssmDouble* noiseterms = xNew<IssmDouble>(dimtot);
+   my_rank=IssmComm::GetRank();
+   if(my_rank==0){
+      int fixedseed;
+      IssmDouble time,dt,starttime;
+      femmodel->parameters->FindParam(&time,TimeEnum);
+      femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+      femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+		/*Determine whether random seed is fixed to time step (randomflag==false) or random seed truly random (randomflag==true)*/
+      if(randomflag) fixedseed=-1;
+      else fixedseed = reCast<int,IssmDouble>((time-starttime)/dt);
+		/*multivariateNormal needs to be passed a NULL pointer to avoid memory leak issues*/
+      IssmDouble* temparray = NULL;
+      multivariateNormal(&temparray,dimtot,0.0,covariance,fixedseed);
+      for(int i=0;i<dimtot;i++) noiseterms[i]=temparray[i];
+      xDelete<IssmDouble>(temparray);
+   }
+   ISSM_MPI_Bcast(noiseterms,dimtot,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+   
+	int i=0;
+   for(int j=0;j<numfields;j++){
+      int dimenum_type,noiseenum_type;
+      IssmDouble* noisefield = xNew<IssmDouble>(dimensions[j]);
+      for(int k=0;k<dimensions[j];k++){
+         noisefield[k]=noiseterms[i+k];
+      }
+     
+		int dimensionid;
+
+		/*Deal with the autoregressive models*/
+		if(fields[j]==SMBautoregressionEnum || fields[j]==FrontalForcingsRignotAutoregressionEnum){
+			switch(fields[j]){
+				case SMBautoregressionEnum:
+					dimenum_type   = SmbBasinsIdEnum;
+					noiseenum_type = SmbAutoregressionNoiseEnum;
+					break;
+				case FrontalForcingsRignotAutoregressionEnum:
+					dimenum_type   = FrontalForcingsBasinIdEnum;
+					noiseenum_type = ThermalforcingAutoregressionNoiseEnum;
+					break;
+			}
+			for(Object* &object:femmodel->elements->objects){
+            Element* element = xDynamicCast<Element*>(object);
+            int numvertices  = element->GetNumberOfVertices();
+            IssmDouble* noise_element = xNew<IssmDouble>(numvertices);
+            element->GetInputValue(&dimensionid,dimenum_type);
+            for(int i=0;i<numvertices;i++) noise_element[i] = noisefield[dimensionid];
+            element->AddInput(noiseenum_type,noise_element,P0Enum);
+            xDelete<IssmDouble>(noise_element);
+			}
+		}
+		else{
+			switch(fields[j]){
+				case SMBautoregressionEnum:
+				case FrontalForcingsRignotAutoregressionEnum:
+					/*Already done above*/
+					break;
+				case DefaultCalvingEnum:
+					/*Delete CalvingCalvingrateEnum at previous time step (required if it is transient)*/
+					femmodel->inputs->DeleteInput(CalvingCalvingrateEnum);
+					for(Object* &object:femmodel->elements->objects){
+						Element* element = xDynamicCast<Element*>(object);
+						int numvertices  = element->GetNumberOfVertices();
+						IssmDouble baselinecalvingrate;
+						IssmDouble calvingrate_tot[numvertices];
+						Input* baselinecalvingrate_input  = NULL;
+						baselinecalvingrate_input = element->GetInput(BaselineCalvingCalvingrateEnum); _assert_(baselinecalvingrate_input);
+						element->GetInputValue(&dimensionid,StochasticForcingDefaultIdEnum);
+						Gauss* gauss = element->NewGauss();
+						for(int i=0;i<numvertices;i++){
+							gauss->GaussVertex(i);
+							baselinecalvingrate_input->GetInputValue(&baselinecalvingrate,gauss);
+							calvingrate_tot[i] = max(0.0,baselinecalvingrate+noisefield[dimensionid]);
+						}
+						element->AddInput(CalvingCalvingrateEnum,&calvingrate_tot[0],P1DGEnum);
+						delete gauss;
+					}
+					break;
+				case FloatingMeltRateEnum:
+					/*Delete BasalforcingsFloatingiceMeltingRateEnum at previous time step (required if it is transient)*/
+					femmodel->inputs->DeleteInput(BasalforcingsFloatingiceMeltingRateEnum);
+					for(Object* &object:femmodel->elements->objects){
+						Element* element = xDynamicCast<Element*>(object);
+						int numvertices  = element->GetNumberOfVertices();
+						IssmDouble baselinefloatingicemeltrate;
+						IssmDouble floatingicemeltrate_tot[numvertices];
+						Input* baselinefloatingicemeltrate_input  = NULL;
+						baselinefloatingicemeltrate_input = element->GetInput(BaselineBasalforcingsFloatingiceMeltingRateEnum); _assert_(baselinefloatingicemeltrate_input);
+						element->GetInputValue(&dimensionid,StochasticForcingDefaultIdEnum);
+						Gauss* gauss = element->NewGauss();
+						for(int i=0;i<numvertices;i++){
+							gauss->GaussVertex(i);
+							baselinefloatingicemeltrate_input->GetInputValue(&baselinefloatingicemeltrate,gauss);
+							floatingicemeltrate_tot[i] = max(0.0,baselinefloatingicemeltrate+noisefield[dimensionid]);
+						}
+						element->AddInput(BasalforcingsFloatingiceMeltingRateEnum,&floatingicemeltrate_tot[0],P1DGEnum);
+						delete gauss;
+					}
+					break;
+				//VV working(29Nov2021)
+				case FrictionWaterPressureEnum:
+					/*Specify that WaterPressure is stochastic*/ 
+					femmodel->parameters->SetParam(true,StochasticForcingIsWaterPressureEnum);
+					for(Object* &object:femmodel->elements->objects){
+                  Element* element = xDynamicCast<Element*>(object);
+                  int numvertices  = element->GetNumberOfVertices();
+                  IssmDouble p_water_deterministic[numvertices];
+                  IssmDouble p_water[numvertices];
+						element->GetInputValue(&dimensionid,StochasticForcingDefaultIdEnum);
+						Gauss* gauss=element->NewGauss();
+						Friction* friction = new Friction(element);
+						for(int i=0;i<numvertices;i++){
+							gauss->GaussVertex(i);
+							p_water_deterministic[i] = friction->SubglacialWaterPressure(gauss);
+							p_water[i]               = p_water_deterministic[i] + noisefield[dimensionid]; //make sure positive (29Nov2021)
+							p_water[i]               = max(0.0,p_water[i]);
+						}
+						element->AddInput(FrictionWaterPressureEnum,p_water,P1DGEnum);
+						delete gauss;
+						delete friction;
+					}
+					break;
+
+				/*
+				case FrictionEffectivePressureEnum:
+					femmodel->parameters->SetParam(true,StochasticForcingIsEffectivePressureEnum);
+					for(Object* &object:femmodel->elements->objects){
+                  Element* element = xDynamicCast<Element*>(object);
+                  int numvertices  = element->GetNumberOfVertices();
+                  IssmDouble Neff[numvertices];
+						element->GetInputValue(&dimensionid,StochasticForcingDefaultIdEnum);
+						Gauss* gauss=element->NewGauss();
+						Friction* friction = new Friction(element);
+						for(int i=0;i<numvertices;i++){
+							gauss->GaussVertex(i);
+							Neff[i] = friction->EffectivePressure(gauss);
+							Neff[i] = Neff[i]+noisefield[dimensionid];
+						}
+						element->AddInput(FrictionEffectivePressureEnum,Neff,P1DGEnum);
+						delete gauss;
+						delete friction;
+					}
+					break;
+				*/
+
+				default:
+					_error_("Field "<<EnumToStringx(fields[j])<<" does not support stochasticity yet.");
+			}
+		}
+		i=i+dimensions[j];
+      xDelete<IssmDouble>(noisefield);
+   }
+
+	/*Cleanup*/
+   xDelete<int>(fields);
+   xDelete<int>(dimensions);
+   xDelete<IssmDouble>(covariance);
+   xDelete<IssmDouble>(noiseterms);
+}/*}}}*/
Index: issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.h
===================================================================
--- issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.h	(revision 26744)
+++ issm/trunk/src/c/modules/StochasticForcingx/StochasticForcingx.h	(revision 26744)
@@ -0,0 +1,10 @@
+#ifndef _STOCHASTICFORCINGX_H
+#define _STOCHASTICFORCINGX_H
+
+#include "../../classes/classes.h"
+#include "../../analyses/analyses.h"
+
+/* local prototypes: */
+void StochasticForcingx(FemModel* femmodel);
+
+#endif
Index: issm/trunk/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 26744)
@@ -61,11 +61,23 @@
 	/*Retrieve all inputs we will be needing: */
 	DatasetInput* weights_input=topelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
-	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
-	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
+	Input* vx_input     = NULL;
+	Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum);	_assert_(vxobs_input);
 	Input* vy_input     = NULL;
 	Input* vyobs_input  = NULL;
-	if(numcomponents==2){
-		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
-		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+
+	/*Read SurfaceEnum from 2D models:SSA, L1L2, MLHO*/
+	if (domaintype == Domain2DhorizontalEnum) {
+		vx_input = topelement->GetInput(VxSurfaceEnum);					_assert_(vx_input);
+		if(numcomponents==2){
+			vy_input    =topelement->GetInput(VySurfaceEnum);        _assert_(vy_input);
+			vyobs_input =topelement->GetInput(InversionVyObsEnum);	_assert_(vyobs_input);
+		}
+	}
+	else {
+		vx_input = topelement->GetInput(VxEnum);							_assert_(vx_input);
+		if(numcomponents==2){
+			vy_input    =topelement->GetInput(VyEnum);					_assert_(vy_input);
+			vyobs_input =topelement->GetInput(InversionVyObsEnum);	_assert_(vyobs_input);
+		}
 	}
 
@@ -101,5 +113,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp	(revision 26744)
@@ -69,12 +69,24 @@
 	DatasetInput* weights_input=topelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
 	Input* S_input      = topelement->GetInput(SurfaceAreaEnum);     _assert_(S_input);
-	Input* vx_input     = topelement->GetInput(VxEnum);              _assert_(vx_input);
-	Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum);  _assert_(vxobs_input);
-	Input* vy_input     = NULL;
-	Input* vyobs_input  = NULL;
-	if(numcomponents==2){
-		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
-		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+   Input* vx_input     = NULL;
+   Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum); _assert_(vxobs_input);
+   Input* vy_input     = NULL;
+   Input* vyobs_input  = NULL;
+
+   /*Read SurfaceEnum from 2D models:SSA, L1L2, MLHO*/
+   if (domaintype == Domain2DhorizontalEnum) {
+      vx_input = topelement->GetInput(VxSurfaceEnum);             _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VySurfaceEnum);        _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
 	}
+   else {
+      vx_input = topelement->GetInput(VxEnum);                    _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VyEnum);               _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
+   }
 
 	/* Start  looping on the number of gaussian points: */
@@ -113,5 +125,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 26744)
@@ -63,12 +63,24 @@
 	/*Retrieve all inputs we will be needing: */
 	DatasetInput* weights_input=topelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
-	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
-	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
-	Input* vy_input     = NULL;
-	Input* vyobs_input  = NULL;
-	if(numcomponents==2){
-		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
-		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+   Input* vx_input     = NULL;
+   Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum);   _assert_(vxobs_input);
+   Input* vy_input     = NULL;
+   Input* vyobs_input  = NULL;
+
+   /*Read SurfaceEnum from 2D models:SSA, L1L2, MLHO*/
+   if (domaintype == Domain2DhorizontalEnum) {
+      vx_input = topelement->GetInput(VxSurfaceEnum);             _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VySurfaceEnum);        _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
 	}
+   else {
+      vx_input = topelement->GetInput(VxEnum);                    _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VyEnum);               _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
+   }
 
 	/* Start  looping on the number of gaussian points: */
@@ -110,5 +122,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp	(revision 26744)
@@ -63,12 +63,24 @@
 	/*Retrieve all inputs we will be needing: */
 	DatasetInput* weights_input=topelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
-	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
-	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
-	Input* vy_input     = NULL;
-	Input* vyobs_input  = NULL;
-	if(numcomponents==2){
-		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
-		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+   Input* vx_input     = NULL;
+   Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum);   _assert_(vxobs_input);
+   Input* vy_input     = NULL;
+   Input* vyobs_input  = NULL;
+
+   /*Read SurfaceEnum from 2D models:SSA, L1L2, MLHO*/
+   if (domaintype == Domain2DhorizontalEnum) {
+      vx_input = topelement->GetInput(VxSurfaceEnum);             _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VySurfaceEnum);        _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
 	}
+   else {
+      vx_input = topelement->GetInput(VxEnum);                    _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VyEnum);               _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
+   }
 
 	/* Start  looping on the number of gaussian points: */
@@ -110,5 +122,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/SurfaceMassBalancex/Gembx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceMassBalancex/Gembx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceMassBalancex/Gembx.cpp	(revision 26744)
@@ -39,13 +39,11 @@
 	IssmDouble t,smb_dt;
    IssmDouble delta;
-	bool       isclimatology=false;
 	bool       linear_interp=true;
 
-	femmodel->parameters->FindParam(&linear_interp,TimesteppingInterpForcingsEnum); /*is interpolation requested*/
+	femmodel->parameters->FindParam(&linear_interp,TimesteppingInterpForcingEnum); /*is interpolation requested*/
 	femmodel->parameters->FindParam(&time,TimeEnum);                        /*transient core time at which we run the smb core*/
    femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);          /*transient core time step*/
 	femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
    femmodel->parameters->FindParam(&smb_dt,SmbDtEnum);                     /*time period for the smb solution,  usually smaller than the glaciological dt*/
-	femmodel->parameters->FindParam(&isclimatology,SmbIsclimatologyEnum);
 
 	//before starting loop, realize that the transient core runs this smb_core at time = time +deltaT.
@@ -63,18 +61,4 @@
 
 			timeclim=time;
-			if (isclimatology){
-				//If this is a climatology, we need to repeat the forcing after the final time
-				TransientInput* Ta_input_tr  = element->inputs->GetTransientInput(SmbTaEnum);    _assert_(Ta_input_tr);
-
-				/*Get temperature climatology value*/
-				int offsetend = Ta_input_tr->GetTimeInputOffset(finaltime);
-				IssmDouble time0     = Ta_input_tr->GetTimeByOffset(-1);
-				IssmDouble timeend   = Ta_input_tr->GetTimeByOffset(offsetend);
-				timeend   = ceil(timeend/dt)*dt;
-				if (time>time0 & timeend>time0){
-					delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-					timeclim=time0+delta;
-				}
-			}
 			if (linear_interp) timeinputs = t-time+timeclim;
 			else timeinputs = t-time+timeclim+smb_dt/2;
@@ -197,4 +181,80 @@
 
 } /*}}}*/
+IssmDouble gardnerAlb(IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble dPHC, int m){ /*{{{*/
+	//gardnerAlb(S1, c1, SZA, t, z1, S2, c2)
+	//This is an implementation of the snow and ice broadband albedo
+	//  parameterization developed by Alex Gardner.
+	//Created By: Alex S. Gardner, Jet Propulsion Laboratory [alex.s.gardner@jpl.nasa.gov]
+	//  Last Modified: June, 2014
+	//Full Reference: Gardner, A. S., and Sharp, M. J.: A review of snow and
+	//  ice albedo and the development of a new physically based broadband albedo
+	//  parameterization, J. Geophys. Res., 115, F01009, 10.1029/2009jf001444,
+	//  2010.
+
+	//INPUTS
+	// ONE LAYER
+	//  - S1    : specific surface area of the snow or ice [cm^2 g-1]
+	//  - c1    : concentration of light absorbing carbon  [ppm1]
+	//  - SZA   : solar zenith angle of the incident radiation [deg]
+	//  - t     : cloud optical thickness
+	// TWO LAYER
+	//  - z1    : depth of snow suface layer [mm w.e.]
+	//  - S2    : specific surface area of bottom ice layer [cm^2 g-1]
+	//  - c2    : concentration of light absorbing carbon of bottom ice
+	//             layer [ppm1]
+	IssmDouble c1=clabSnow;
+	IssmDouble c2=clabIce;
+	IssmDouble t=COT;
+	IssmDouble a=0.0;
+
+	//Single layer albedo parameterization
+	//convert effective radius to specific surface area [cm2 g-1]
+	IssmDouble S1 = 3.0 / (0.091 * re[0]);
+
+	//effective solar zenith angle
+	IssmDouble x = min(pow(t/(3*cos(Pi*SZA/180.0)),0.5), 1.0);
+	IssmDouble u = 0.64*x + (1-x)*cos(Pi*SZA/180.0);
+
+	// pure snow albedo
+	IssmDouble as = 1.48 - pow(S1,-0.07);
+
+	//change in pure snow albedo due to soot loading
+	IssmDouble dac = max(0.04 - as, pow(-c1,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c1,0.6))*pow(S1,-0.25)));
+
+	//Two layer albedo parameterization
+	//  do two layer calculation if there is more than 1 layer
+	IssmDouble z1=0.0;
+	int lice=0;
+	for(int l=0;(l<m & d[l]<dPHC-Dtol);l++){
+		z1=z1+dz[l]*d[l]; //mm
+		lice=l+1;
+	}
+	if (m>0 & lice<m & z1 > Dtol){
+		// determine albedo values for bottom layer
+		IssmDouble S2 = 3.0 / (0.091 * re[lice]);
+
+		// pure snow albedo
+		IssmDouble as2 = 1.48 - pow(S2,-0.07);
+
+		// change in pure snow albedo due to soot loading
+		IssmDouble dac2 = max(0.04 - as2, pow(-c2,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c2,0.6))*pow(S2,-0.25)));
+
+		// determine the effective change due to finite depth and soot loading
+		IssmDouble A = min(1.0, (2.1 * pow(z1,1.35*(1-as) - 0.1*c1 - 0.13)));
+
+		dac =  (as2 + dac2 - as) + A*((as + dac) - (as2 + dac2));
+	}
+
+	// change in albedo due to solar zenith angle
+	IssmDouble dasz = 0.53*as*(1 - (as + dac))*pow(1 - u,1.2);
+
+	// change in albedo due to cloud (apart from change in diffuse fraction)
+	IssmDouble dat = (0.1*t*pow(as + dac,1.3)) / (pow(1 + 1.5*t,as));
+
+	// Broadband albedo
+	a = as + dac + dasz + dat;
+
+	return a;
+}   /*}}}*/
 void grainGrowth(IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* T,IssmDouble* dz,IssmDouble* d, IssmDouble* W,IssmDouble smb_dt,int m,int aIdx,int sid){ /*{{{*/
 
@@ -333,8 +393,8 @@
 			}
 			// dendricity and sphericity can not be > 1 or < 0
-         if (gdn[i]<0.0+Gdntol)gdn[i]=0.0;
-         if (gsp[i]<0.0+Gdntol)gsp[i]=0.0;
-         if (gdn[i]>1.0-Gdntol)gdn[i]=1.0;
-         if (gsp[i]>1.0-Gdntol)gsp[i]=1.0;
+         if (gdn[i]<=0.0+Gdntol)gdn[i]=0.0;
+         if (gsp[i]<=0.0+Gdntol)gsp[i]=0.0;
+         if (gdn[i]>=1.0-Gdntol)gdn[i]=1.0;
+         if (gsp[i]>=1.0-Gdntol)gsp[i]=1.0;
 
          // determine new grain size (mm)
@@ -344,7 +404,4 @@
 		else{
 
-			//When the state of "faceted crystals" (gsp==0) is fully reached,
-			// snow evolves towards depth hoar if the gradient is
-			// higher than 15 degC m-1 (Brun et al., 1992)
 			//When wet-snow grains (class 6) are submitted to a
 			// temperature gradient higher than 5 degC m-1, their sphericity
@@ -352,15 +409,26 @@
 			// reaches 0, their size increases according to the functions
 			// determined by Marbouty. (Brun et al., 1992)
-			if(gsp[i]>0.0+Gdntol && gsp[i]<1.0-Gdntol && (dT[i]>15.0+Ttol || (dT[i]>5.0+Ttol && W[i]>0.0+Wtol)) ){
-				//determine coefficients
-				IssmDouble C = (-2e8 * exp(-6e3 / T[i]) * dt) * pow(dT[i],.4);
-				gsp[i] +=C;
-				if (gsp[i]<0.0+Gdntol)gsp[i]=0.0;
-				//determine new grain size (mm)
-				gsz[i] = 0.35 + (0.5-gsp[i])*0.1;
-			}
+			if(gsp[i]>0.0+Gdntol && gsp[i]<1.0-Gdntol){
+
+				IssmDouble F = 0.0;
+
+				if (dT[i]>5.0+Ttol){
+					F = (-2e8 * exp(-6e3 / T[i]) * dt) * pow(dT[i],.4);
+				}
+				else if (W[i]>0.0+Wtol){
+					F = (1.0/16.0) * pow(lwc[i],3.0) * dt;
+				}
+				else{
+					F = 1e9 * exp(-6e3 / T[i]) * dt;
+				}
+				gsp[i] +=F;
+
+			}
+			if (gsp[i]<=0.0+Gdntol)gsp[i]=0.0;
+			if (gsp[i]>=1.0-Gdntol)gsp[i]=1.0;
+
 			/*Dry snow metamorphism (Marbouty, 1980) grouped model coefficents
 			 *from Marbouty, 1980: Figure 9*/
-			else if(W[i]<=0.0+Wtol || (gsp[i]<=0.0+Gdntol && dT[i]>15.0+Ttol) || (gsp[i]<=0.0+Gdntol && dT[i]>5.0+Ttol && W[i]>0.0+Wtol)){
+			if(W[i]<=0.0+Wtol || (gsp[i]<=0.0+Gdntol && dT[i]>5.0+Ttol)){
 				//_printf_("Nondendritic snow metamorphism\n");
 				Q = Marbouty(T[i],d[i],dT[i]);
@@ -402,5 +470,5 @@
 
 }  /*}}}*/
-void albedo(IssmDouble** pa, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/
+void albedo(IssmDouble** pa, IssmDouble** padiff, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/
 
 	//// Calculates Snow, firn and ice albedo as a function of:
@@ -424,6 +492,12 @@
 	// Methods 1 & 2
 	//   re      = surface effective grain radius [mm]
-
-	// Methods 3
+	// Method 1, optional
+	//  clabSnow = concentration of light absorbing carbon  [ppm1], default 0
+	//  SZA      = solar zenith angle of the incident radiation [deg], default 0
+	//  COT      = cloud optical thickness, default 0
+	//  For TWO LAYER
+	//  clabIce  = concentration of light absorbing carbon of first ice layer [ppm1], default 0
+
+	// Method 3
 	//   d       = snow surface density [kg m-3]
 	//   n       = cloud amount
@@ -431,5 +505,5 @@
 	//   aSnow   = albedo of fresh snow
 
-	// Methods 4
+	// Method 4
 	//   aIce    = albedo of ice
 	//   aSnow   = albedo of fresh snow
@@ -457,4 +531,5 @@
 	/*output: */
 	IssmDouble* a=NULL;
+	IssmDouble* adiff=NULL;
 
 	if(VerboseSmb() && sid==0 && IssmComm::GetRank()==0)_printf0_("   albedo module\n");
@@ -462,4 +537,5 @@
 	/*Recover pointers: */
 	a=*pa;
+	adiff=*padiff;
 
 	//some constants:
@@ -476,10 +552,7 @@
 		if(aIdx==1){ 
 			//function of effective grain radius
-
-			//convert effective radius to specific surface area [cm2 g-1]
-			IssmDouble S = 3.0 / (0.091 * re[0]);
-
-			//determine broadband albedo
-			a[0]= 1.48 - pow(S,-0.07);
+			// clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, int m
+			a[0]=gardnerAlb(re, dz, d, clabSnow, clabIce, SZA, COT, dPHC, m);
+			adiff[0]=gardnerAlb(re, dz, d, clabSnow, clabIce, 50, COT, dPHC, m);
 		}
 		else if(aIdx==2){
@@ -572,5 +645,5 @@
 		//If we do not have fresh snow
 		if (aIdx<3 && aIdx>0 && (adThresh - d[0])>=Dtol){
-			// In a layer < 10cm, account for mix of ice and snow,
+			// In a snow layer < 10cm, account for mix of ice and snow,
 			// after P. Alexander et al., 2014
 			IssmDouble depthsnow=0.0;
@@ -618,7 +691,8 @@
 	/*Assign output pointers:*/
 	*pa=a;
+	*padiff=adiff;
 
 }  /*}}}*/
-void thermo(IssmDouble* pEC, IssmDouble** pT, IssmDouble* pulwrf, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlwrf, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble teValue, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT) { /*{{{*/
+void thermo(IssmDouble* pEC, IssmDouble** pT, IssmDouble* pulwrf, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlwrf, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble eIdx, IssmDouble teValue, IssmDouble dulwrfValue, IssmDouble teThresh, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT, bool isdeltaLWup) { /*{{{*/
 
 	/* ENGLACIAL THERMODYNAMICS*/
@@ -936,7 +1010,12 @@
 
 		// upward longwave contribution
-		//ulw = - (SB * pow(Ts,4.0)* teValue) * dt; // - deltatest here
-		IssmDouble deltatest=0;
-		ulw = - (SB * pow(Ts,4.0)* teValue - deltatest) * dt; // - deltatest here
+		IssmDouble deltaULW=0.0;
+		IssmDouble emissivity=1.0;
+		//If user wants to set a upward long wave bias
+		if(isdeltaLWup) deltaULW = dulwrfValue;
+		//If user wants to directly set emissivity, or grain radius is larger than the
+		// threshold, or eIdx is 2 and we have wet snow or ice, use prescribed emissivity
+		if(eIdx==0 || (teThresh - re[0])<Gdntol || (eIdx==2 && z0>0.001)) emissivity = teValue;
+		ulw = - (SB * pow(Ts,4.0)* emissivity + deltaULW) * dt; 
 		ulwrf = ulwrf - ulw/dt0;
 
@@ -998,5 +1077,5 @@
 
 }  /*}}}*/
-void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid){ /*{{{*/
+void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble dswdiff, IssmDouble as, IssmDouble asdiff, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid){ /*{{{*/
 
 	// DISTRIBUTES ABSORBED SHORTWAVE RADIATION WITHIN SNOW/ICE
@@ -1005,5 +1084,5 @@
 
 	// swIdx = 1 : absorbed SW is distributed with depth as a function of:
-	//   default   : snow density (taken from Bassford, 2004)
+	//   default   : snow density (taken from Bassford, 2002)
 	//   if aIdx=2 : grain size in 3 spectral bands (Brun et al., 1992)
 
@@ -1012,5 +1091,7 @@
 	//   aIdx    = method for calculating albedo (1-4)
 	//   dsw     = downward shortwave radiative flux [w m-2]
+	//   dswdiff  = downward shortwave diffuse radiative flux [w m-2]
 	//   as      = surface albedo
+	//   asdiff  = surface albedo for diffuse radiation
 	//   d       = grid cell density [kg m-3]
 	//   dz      = grid cell depth [m]
@@ -1033,5 +1114,10 @@
 
 		// calculate surface shortwave radiation fluxes [W m-2]
-		swf[0] = (1.0 - as) * dsw;
+		if (aIdx == 1){
+			swf[0] = (1.0 - as) * max(0.0,(dsw - dswdiff)) +  (1.0 - asdiff) * dswdiff;
+		}
+		else{
+			swf[0] = (1.0 - as) * dsw;
+		}
 	}
 	else{ // sw radation is absorbed at depth within the glacier
@@ -1080,5 +1166,5 @@
 			swfS[2] = (sF[2] * dsw) * (1.0 - a2);
 
-			// absorption coeficient for spectral range:
+			// absorption coefficient for spectral range:
 			h =xNew<IssmDouble>(m);
 			B1 =xNew<IssmDouble>(m);
@@ -1197,5 +1283,5 @@
 
 } /*}}}*/ 
-void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid){ /*{{{*/
+void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* pRa, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid){ /*{{{*/
 
 	// Adds precipitation and deposition to the model grid
@@ -1213,8 +1299,9 @@
 	   dz = topgrid cell length [m]
 	   d = density of top grid gell [kg m-3]
-	   P = precipitation [mm w.e.] or [kg m-3]
-	   re = effective grain radius [mm]
-	   gdn = grain dentricity
-	   gsp = grain sphericity*/
+		P = precipitation [mm w.e.] or [kg m-3]
+		Ra = rainfall [mm w.e.] or [kg m-3]
+		re = effective grain radius [mm]
+		gdn = grain dentricity
+		gsp = grain sphericity*/
 
 	// MAIN FUNCTION
@@ -1238,7 +1325,9 @@
 	IssmDouble* W=NULL;
 	IssmDouble* a=NULL;
+	IssmDouble* adiff=NULL;
 	IssmDouble* re=NULL;
 	IssmDouble* gdn=NULL;
 	IssmDouble* gsp=NULL;
+	IssmDouble  ra=0.0;
 	int         m=0;
 
@@ -1251,8 +1340,10 @@
 	W=*pW;
 	a=*pa;
+	adiff=*padiff;
 	re=*pre;
 	gdn=*pgdn;
 	gsp=*pgsp;
 	m=*pm;
+	ra=*pRa;
 
 	//Density of fresh snow [kg m-3]
@@ -1266,5 +1357,5 @@
 			break;
 
-		case 2: // Density of Greenland snow, Fausto et al., 2008
+		case 2: // Density of Greenland snow, Fausto et al., 2018
 			dSnow = 315;
 			break;
@@ -1309,4 +1400,5 @@
 				newcell(&W,0.0,top,m); //new cell W
 				newcell(&a,aSnow,top,m); //new cell a
+				newcell(&adiff,aSnow,top,m); //new cell a
 				newcell(&re,refall,top,m); //new cell grain size
 				newcell(&gdn,dfall,top,m); //new cell grain dendricity
@@ -1355,4 +1447,6 @@
 				dz[0] = mass / d[0];    // dz is adjusted to conserve mass
 			}
+
+			ra=P;
 		}
 
@@ -1377,10 +1471,12 @@
 	*pW=W;
 	*pa=a;
+	*padiff=adiff;
 	*pre=re;
 	*pgdn=gdn;
 	*pgsp=gsp;
 	*pm=m;
+	*pRa=ra;
 } /*}}}*/
-void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid){ /*{{{*/
+void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pF, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble Ra, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid){ /*{{{*/
 
 	//// MELT ROUTINE
@@ -1403,5 +1499,5 @@
 	IssmDouble* EW=NULL;
 	IssmDouble* M=NULL;
-	int*       D=NULL;
+	int*        D=NULL;
 
 	IssmDouble sumM=0.0;
@@ -1424,4 +1520,5 @@
 	IssmDouble W_bot=0.0;
 	IssmDouble a_bot=0.0;
+	IssmDouble adiff_bot=0.0;
 	IssmDouble re_bot=0.0;
 	IssmDouble gdn_bot=0.0;
@@ -1446,6 +1543,7 @@
 	IssmDouble  surplusE = 0.0;
 	IssmDouble  surplusT = 0.0;
-	IssmDouble dz_add = 0.0;
+	IssmDouble  dz_add = 0.0;
 	IssmDouble  Rsum = 0.0;
+	IssmDouble  Fsum = 0.0;
 	IssmDouble* T=*pT;
 	IssmDouble* d=*pd;
@@ -1453,4 +1551,5 @@
 	IssmDouble* W=*pW;
 	IssmDouble* a=*pa;
+	IssmDouble* adiff=*padiff;
 	IssmDouble* re=*pre;
 	IssmDouble* gdn=*pgdn;
@@ -1478,4 +1577,5 @@
 	// initialize melt and runoff scalars
 	Rsum = 0.0;       // runoff [kg]
+	Fsum = 0.0;       // refreeze [kg]
 	sumM = 0.0;       // total melt [kg]
 	mAdd = 0.0;       // mass added/removed to/from base of model [kg]
@@ -1523,4 +1623,13 @@
 
 	//// MELT, PERCOLATION AND REFREEZE
+
+	// initialize refreeze, runoff, flxDn and dW vectors [kg]
+	IssmDouble* F = xNewZeroInit<IssmDouble>(n);
+
+	// Add previous refreeze to F and reset dW
+	for(int i=0;i<n;i++){
+		F[i]=F[i]+dW[i];
+		dW[i] = 0.0;
+	}
 
 	// run melt algorithm if there is melt water or excess pore water
@@ -1573,5 +1682,5 @@
 		}
 		Msurf = M[0];
-		sumM = cellsum(M,n);                                                       // total melt [kg]
+		sumM = max(0.0,cellsum(M,n)-Ra);  // total melt [kg] minus the liquid rain that had been added
 
 		// calculate maximum refreeze amount, maxF [kg]
@@ -1579,8 +1688,6 @@
 
 		// initialize refreeze, runoff, flxDn and dW vectors [kg]
- 		IssmDouble* F = xNewZeroInit<IssmDouble>(n);
 		IssmDouble* R = xNewZeroInit<IssmDouble>(n);
 
-		for(int i=0;i<n;i++)dW[i] = 0.0;
 		flxDn=xNewZeroInit<IssmDouble>(n+1);
 
@@ -1595,4 +1702,5 @@
 
 		IssmDouble depthice=0.0;
+		int Xi=0;
 		//// meltwater percolation
 		for(int i=0;i<n;i++){
@@ -1620,5 +1728,4 @@
 				dW[i] = max(min(inM, Wi - W[i]),-1*W[i]);            // change in pore water
 				R[i] = max(0.0, inM - dW[i]);             // runoff
-				F[i] = 0.0;
 			}
 			// check if no energy to refreeze meltwater
@@ -1633,5 +1740,4 @@
 				flxDn[i+1] = max(0.0, inM - dW[i]);         // meltwater out
 				R[i] = 0.0;
-				F[i] = 0.0;                               // no freeze 
 			}
 			// some or all meltwater refreezes
@@ -1649,8 +1755,5 @@
 				//-----------------------pore water-----------------------------
 				Wi = (dIce-d[i])* Swi * dz_0;            // irreducible water 
-				dW[i] = min(inM - F1, Wi-W[i]);         // change in pore water
-				if (dW[i] < 0.0-Wtol && -1*dW[i]> W[i]-Wtol ){
-					dW[i]= -1*W[i];
-				}
+				dW[i] = max(min(inM - F1, Wi-W[i]),-1*W[i]);         // change in pore water
 				IssmDouble F2 = 0.0;                                 
 
@@ -1661,10 +1764,9 @@
 					m[i] = m[i] + F2;                   // mass after refreeze
 					d[i] = m[i]/dz_0;
-					dW[i] = dW[i] - F2;
 				}
 
-				F[i] = F1 + F2;
-
-				flxDn[i+1] = inM - F1 - dW[i];     // meltwater out        
+				F[i] = F[i] + F1 + F2;
+
+				flxDn[i+1] = max(0.0,inM - F1 - dW[i]);     // meltwater out        
 				if (m[i]>Wtol){
 					T[i] = T[i] + ((F1+F2)*(LF+(CtoK - T[i])*CI)/(m[i]*CI));// change in temperature
@@ -1680,4 +1782,5 @@
 				}
 			}
+			Xi=Xi+1;
 		}
 
@@ -1690,5 +1793,5 @@
 
 		//calculate Rsum:
-		Rsum=cellsum(R,n) + flxDn[n];
+		Rsum=cellsum(R,n) + flxDn[Xi];
 
 		// delete all cells with zero mass
@@ -1703,4 +1806,5 @@
 		celldelete(&T,n,D,D_size);
 		celldelete(&a,n,D,D_size);
+		celldelete(&adiff,n,D,D_size);
 		celldelete(&re,n,D,D_size);
 		celldelete(&gdn,n,D,D_size);
@@ -1715,7 +1819,12 @@
 
 		/*Free resources:*/
-		xDelete<IssmDouble>(F);
 		xDelete<IssmDouble>(R);
 	}
+
+	//calculate Fsum:
+	Fsum=cellsum(F,n);
+
+	/*Free resources:*/
+	xDelete<IssmDouble>(F);
 
 	//Merging of cells as they are burried under snow.
@@ -1765,4 +1874,5 @@
 			T[X1] = (T[X2]*m[X2] + T[X1]*m[X1]) / m_new;
 			a[X1] = (a[X2]*m[X2] + a[X1]*m[X1]) / m_new;
+			adiff[X1] = (adiff[X2]*m[X2] + adiff[X1]*m[X1]) / m_new;
 			re[X1] = (re[X2]*m[X2] + re[X1]*m[X1]) / m_new;
 			gdn[X1] = (gdn[X2]*m[X2] + gdn[X1]*m[X1]) / m_new;
@@ -1791,4 +1901,5 @@
 	celldelete(&T,n,D,D_size);
 	celldelete(&a,n,D,D_size);
+	celldelete(&adiff,n,D,D_size);
 	celldelete(&re,n,D,D_size);
 	celldelete(&gdn,n,D,D_size);
@@ -1828,4 +1939,5 @@
 			cellsplit(&d, n, j,1.0);
 			cellsplit(&a, n, j,1.0);
+			cellsplit(&adiff, n, j,1.0);
 			cellsplit(&EI, n, j,.5);
 			cellsplit(&EW, n, j,.5);
@@ -1856,4 +1968,5 @@
 		d_bot=d[n-1];
 		a_bot=a[n-1];
+		adiff_bot=adiff[n-1];
 		re_bot=re[n-1];
 		gdn_bot=gdn[n-1];
@@ -1870,4 +1983,5 @@
 		newcell(&d,d_bot,top,n);
 		newcell(&a,a_bot,top,n);
+		newcell(&adiff,adiff_bot,top,n);
 		newcell(&re,re_bot,top,n);
 		newcell(&gdn,gdn_bot,top,n);
@@ -1895,4 +2009,5 @@
 		celldelete(&d,n,D,D_size);
 		celldelete(&a,n,D,D_size);
+		celldelete(&adiff,n,D,D_size);
 		celldelete(&re,n,D,D_size);
 		celldelete(&gdn,n,D,D_size);
@@ -1946,4 +2061,5 @@
 	*pM=sumM;
 	*pR=Rsum;
+	*pF=Fsum;
 	*pmAdd=mAdd;
 	*pdz_add=dz_add;
@@ -1954,4 +2070,5 @@
 	*pW=W;
 	*pa=a;
+	*padiff=adiff;
 	*pre=re;
 	*pgdn=gdn;
@@ -2090,6 +2207,9 @@
 					if (fabs(adThresh - 820) < Dtol){
 						// ERA5 new aIdx=1, swIdx=0, MODIS 820
-						M0 = max(1.8230 - (0.1645 * log(C)),0.25);
-						M1 = max(2.5134 - (0.3244 * log(C)),0.25);
+						//M0 = max(1.8230 - (0.1645 * log(C)),0.25);
+						//M1 = max(2.5134 - (0.3244 * log(C)),0.25);
+						// ERA5 new aIdx=1, swIdx=0, MODIS 820, p90 new (ERA5, 40 and e97)
+						M0 = max(1.3045 - (0.0988 * log(C)),0.25);
+						M1 = max(1.3694 - (0.1354 * log(C)),0.25);
 					}
 					else{
@@ -2134,6 +2254,9 @@
 					if (fabs(adThresh - 820) < Dtol){
 						// ERA5 new aIdx=1, swIdx=0, MODIS 820
-						M0 = max(1.4174 - (0.1037 * log(C)),0.25);
-						M1 = max(2.2010 - (0.2460 * log(C)),0.25);
+						//M0 = max(1.4174 - (0.1037 * log(C)),0.25);
+						//M1 = max(2.2010 - (0.2460 * log(C)),0.25);
+						// ERA5 new aIdx=1, swIdx=0, MODIS 820, p90 new (ERA5 lwt, 40 and e97)
+						M0 = max(1.2138 - (0.1057 * log(C)),0.25);
+						M1 = max(1.4946 - (0.1607 * log(C)),0.25);
 					}
 					else{
Index: issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	(revision 26744)
@@ -3,4 +3,5 @@
  */
 
+#include <config.h>
 #include "./SurfaceMassBalancex.h"
 #include "../../shared/shared.h"
@@ -8,4 +9,5 @@
 #include "../modules.h"
 #include "../../classes/Inputs/TransientInput.h"
+#include "../../shared/Random/random.h"
 
 void SmbForcingx(FemModel* femmodel){/*{{{*/
@@ -14,56 +16,4 @@
 	//    INPUT parameters: ni: working size of arrays
 	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
-	bool isclimatology;
-	femmodel->parameters->FindParam(&isclimatology,SmbIsclimatologyEnum);
-
-	if (isclimatology){
-
-		/*Get time parameters*/
-		IssmDouble time,dt,starttime,finaltime;
-		femmodel->parameters->FindParam(&time,TimeEnum);
-		femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-		femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
-		femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
-
-		if(time<=starttime+dt){
-			/*FIXME: this is wrong, should be done at the ElementUpdate step of analysis, not here!*/
-			InputDuplicatex(femmodel,SmbMassBalanceEnum,SmbMassBalanceClimateEnum);
-			femmodel->inputs->DeleteInput(SmbMassBalanceEnum);
-		}
-
-		/*If this is a climatology, we need to repeat the forcing after the final time*/
-		TransientInput* smb_input=femmodel->inputs->GetTransientInput(SmbMassBalanceClimateEnum); _assert_(smb_input);
-
-		/*Get accumulation climatology value*/
-		int offsetend = smb_input->GetTimeInputOffset(finaltime);
-		IssmDouble time0     = smb_input->GetTimeByOffset(-1);
-		IssmDouble timeend   = smb_input->GetTimeByOffset(offsetend);
-
-		_assert_(timeend>time0);
-		IssmDouble timeclim  = time;
-
-		if(time>time0 && timeend>time0){
-			IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-			if(delta==0.){
-				timeclim=timeend;
-			}
-			else{
-				timeclim=time0+delta;
-			}
-		}
-
-		/*Loop over all the elements of this partition*/
-		for(Object* & object : femmodel->elements->objects){
-			Element* element=xDynamicCast<Element*>(object);
-
-			int         numvertices = element->GetNumberOfVertices();
-			IssmDouble* smb         = xNew<IssmDouble>(numvertices);
-			element->GetInputListOnVerticesAtTime(smb,SmbMassBalanceClimateEnum,timeclim);
-
-			/*Add input to element and Free memory*/
-			element->AddInput(SmbMassBalanceEnum,smb,P1Enum);
-			xDelete<IssmDouble>(smb);
-		}
-	}
 
 }/*}}}*/
@@ -196,4 +146,93 @@
 	}
 
+}/*}}}*/
+void SmbautoregressionInitx(FemModel* femmodel){/*{{{*/
+	
+	/*Initialization step of Smbautoregressionx*/
+	int M,N,Nphi,arorder,numbasins,my_rank;
+	IssmDouble starttime,tstep_ar,tinit_ar;
+	femmodel->parameters->FindParam(&numbasins,SmbNumBasinsEnum);
+	femmodel->parameters->FindParam(&arorder,SmbAutoregressiveOrderEnum);
+	IssmDouble* beta0    = NULL; 
+	IssmDouble* beta1    = NULL;
+	IssmDouble* phi      = NULL;
+	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+   femmodel->parameters->FindParam(&tstep_ar,SmbAutoregressionTimestepEnum);
+	femmodel->parameters->FindParam(&tinit_ar,SmbAutoregressionInitialTimeEnum);
+	femmodel->parameters->FindParam(&beta0,&M,SmbBeta0Enum);    _assert_(M==numbasins);
+	femmodel->parameters->FindParam(&beta1,&M,SmbBeta1Enum);    _assert_(M==numbasins);
+	femmodel->parameters->FindParam(&phi,&M,&Nphi,SmbPhiEnum);  _assert_(M==numbasins); _assert_(Nphi==arorder);
+	
+	/*AR model spin-up with 0 noise to initialize SmbValuesAutoregressionEnum*/
+	int nspin{2*arorder+5};
+	for(Object* &object:femmodel->elements->objects){
+      Element* element      = xDynamicCast<Element*>(object); //generate element object
+		element->AutoregressionInit(numbasins,arorder,nspin,starttime,tstep_ar,tinit_ar,beta0,beta1,phi,SMBautoregressionEnum);
+	}
+	/*Cleanup*/
+	xDelete<IssmDouble>(beta0);
+	xDelete<IssmDouble>(beta1);
+	xDelete<IssmDouble>(phi);
+}/*}}}*/
+void Smbautoregressionx(FemModel* femmodel){/*{{{*/
+
+   /*Get time parameters*/
+   IssmDouble time,dt,starttime,tstep_ar;
+   femmodel->parameters->FindParam(&time,TimeEnum);
+   femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
+   femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
+   femmodel->parameters->FindParam(&tstep_ar,SmbAutoregressionTimestepEnum);
+
+   /*Initialize module at first time step*/
+   if(time<=starttime+dt){SmbautoregressionInitx(femmodel);}
+   /*Determine if this is a time step for the AR model*/
+   bool isstepforar = false;
+
+   #ifndef _HAVE_AD_
+   if((fmod(time,tstep_ar)<fmod((time-dt),tstep_ar)) || (time<=starttime+dt) || tstep_ar==dt) isstepforar = true;
+   #else
+   _error_("not implemented yet");
+   #endif
+
+   /*Load parameters*/
+   bool isstochastic;
+   bool issmbstochastic = false;
+   int M,N,Nphi,arorder,numbasins,my_rank;
+   femmodel->parameters->FindParam(&numbasins,SmbNumBasinsEnum);
+   femmodel->parameters->FindParam(&arorder,SmbAutoregressiveOrderEnum);
+   IssmDouble tinit_ar;
+   IssmDouble* beta0      = NULL; 
+   IssmDouble* beta1      = NULL;
+   IssmDouble* phi        = NULL;
+
+   femmodel->parameters->FindParam(&tinit_ar,SmbAutoregressionInitialTimeEnum);
+   femmodel->parameters->FindParam(&beta0,&M,SmbBeta0Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&beta1,&M,SmbBeta1Enum);    _assert_(M==numbasins);
+   femmodel->parameters->FindParam(&phi,&M,&Nphi,SmbPhiEnum);  _assert_(M==numbasins); _assert_(Nphi==arorder);
+
+   femmodel->parameters->FindParam(&isstochastic,StochasticForcingIsStochasticForcingEnum);
+   if(isstochastic){
+      int  numstochasticfields;
+      int* stochasticfields;
+      femmodel->parameters->FindParam(&numstochasticfields,StochasticForcingNumFieldsEnum);
+      femmodel->parameters->FindParam(&stochasticfields,&N,StochasticForcingFieldsEnum); _assert_(N==numstochasticfields);
+      for(int i=0;i<numstochasticfields;i++){
+         if(stochasticfields[i]==SMBautoregressionEnum) issmbstochastic = true;
+      }
+      xDelete<int>(stochasticfields);
+   }
+   /*Time elapsed with respect to AR model initial time*/
+   IssmDouble telapsed_ar = time-tinit_ar;
+
+   /*Loop over each element to compute SMB at vertices*/
+   for(Object* &object:femmodel->elements->objects){
+      Element* element = xDynamicCast<Element*>(object);
+      element->Autoregression(isstepforar,arorder,telapsed_ar,beta0,beta1,phi,issmbstochastic,SMBautoregressionEnum);
+   }
+
+   /*Cleanup*/
+   xDelete<IssmDouble>(beta0);
+   xDelete<IssmDouble>(beta1);
+   xDelete<IssmDouble>(phi);
 }/*}}}*/
 void Delta18oParameterizationx(FemModel* femmodel){/*{{{*/
@@ -410,6 +449,4 @@
 	//    surface runoff (m/yr water equivalent): runoff
 	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
-	bool isclimatology;
-	femmodel->parameters->FindParam(&isclimatology,SmbIsclimatologyEnum);
 
 	/*Loop over all the elements of this partition*/
@@ -425,67 +462,7 @@
 
 		/*Recover Smb Components*/
-		if(isclimatology){
-
-			int offsetend;
-			IssmDouble time0,timeend,timeclim;
-			IssmDouble time,starttime,finaltime;
-
-			/*Get time parameters*/
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
-			femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
-
-			//If this is a climatology, we need to repeat the forcing after the final time
-			TransientInput* acc_input    = element->inputs->GetTransientInput(SmbAccumulationEnum); _assert_(acc_input);
-			TransientInput* evap_input   = element->inputs->GetTransientInput(SmbEvaporationEnum);  _assert_(evap_input);
-			TransientInput* runoff_input = element->inputs->GetTransientInput(SmbRunoffEnum);       _assert_(runoff_input);
-
-			//Get accumulation climatology value
-			offsetend = acc_input->GetTimeInputOffset(finaltime);
-			time0     = acc_input->GetTimeByOffset(-1);
-			timeend   = acc_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(acc,SmbAccumulationEnum,timeclim);
-
-			//Get evaporation climatology value
-			offsetend = evap_input->GetTimeInputOffset(finaltime);
-			time0     = evap_input->GetTimeByOffset(-1);
-			timeend   = evap_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(evap,SmbEvaporationEnum,timeclim);
-
-			//Get runoff climatology value
-			offsetend = runoff_input->GetTimeInputOffset(finaltime);
-			time0     = runoff_input->GetTimeByOffset(-1);
-			timeend   = runoff_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(runoff,SmbRunoffEnum,timeclim);
-		}
-		else{
-			element->GetInputListOnVertices(acc,SmbAccumulationEnum);
-			element->GetInputListOnVertices(evap,SmbEvaporationEnum);
-			element->GetInputListOnVertices(runoff,SmbRunoffEnum);
-		}
+		element->GetInputListOnVertices(acc,SmbAccumulationEnum);
+		element->GetInputListOnVertices(evap,SmbEvaporationEnum);
+		element->GetInputListOnVertices(runoff,SmbRunoffEnum);
 
 		// loop over all vertices
@@ -510,6 +487,4 @@
 	//    refreeze of surface melt (m/yr water equivalent): refreeze
 	//    OUTPUT: mass-balance (m/yr ice): agd(NA)
-	bool isclimatology;
-	femmodel->parameters->FindParam(&isclimatology,SmbIsclimatologyEnum);
 
 	/*Loop over all the elements of this partition*/
@@ -526,82 +501,8 @@
 
 		/*Recover Smb Components*/
-		if (isclimatology){
-
-			int offsetend;
-			IssmDouble time0,timeend,timeclim;
-			IssmDouble time,starttime,finaltime;
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
-			femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
-
-
-			//If this is a climatology, we need to repeat the forcing after the final time
-			TransientInput* acc_input      = element->inputs->GetTransientInput(SmbAccumulationEnum); _assert_(acc_input);
-			TransientInput* evap_input     = element->inputs->GetTransientInput(SmbEvaporationEnum);  _assert_(evap_input);
-			TransientInput* melt_input     = element->inputs->GetTransientInput(SmbMeltEnum);         _assert_(melt_input);
-			TransientInput* refreeze_input = element->inputs->GetTransientInput(SmbRefreezeEnum);     _assert_(refreeze_input);
-
-			//Get accumulation climatology value
-			offsetend = acc_input->GetTimeInputOffset(finaltime);
-			time0     = acc_input->GetTimeByOffset(-1);
-			timeend   = acc_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(acc,SmbAccumulationEnum,timeclim);
-
-			//Get evaporation climatology value
-			offsetend = evap_input->GetTimeInputOffset(finaltime);
-			time0     = evap_input->GetTimeByOffset(-1);
-			timeend   = evap_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(evap,SmbEvaporationEnum,timeclim);
-
-			//Get melt climatology value
-			offsetend = melt_input->GetTimeInputOffset(finaltime);
-			time0     = melt_input->GetTimeByOffset(-1);
-			timeend   = melt_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(melt,SmbMeltEnum,timeclim);
-
-			//Get refreeze climatology value
-			offsetend = refreeze_input->GetTimeInputOffset(finaltime);
-			time0     = refreeze_input->GetTimeByOffset(-1);
-			timeend   = refreeze_input->GetTimeByOffset(offsetend);
-			timeclim  = time;
-			if(time>time0 & timeend>time0){
-				IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
-				if(delta==0.)
-				 timeclim=timeend;
-				else
-				 timeclim=time0+delta;
-			}
-			element->GetInputListOnVerticesAtTime(refreeze,SmbRefreezeEnum,timeclim);
-		}
-		else{
-			element->GetInputListOnVertices(acc,SmbAccumulationEnum);
-			element->GetInputListOnVertices(evap,SmbEvaporationEnum);
-			element->GetInputListOnVertices(melt,SmbMeltEnum);
-			element->GetInputListOnVertices(refreeze,SmbRefreezeEnum);
-		}
+		element->GetInputListOnVertices(acc,SmbAccumulationEnum);
+		element->GetInputListOnVertices(evap,SmbEvaporationEnum);
+		element->GetInputListOnVertices(melt,SmbMeltEnum);
+		element->GetInputListOnVertices(refreeze,SmbRefreezeEnum);
 
 		// loop over all vertices
Index: issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
===================================================================
--- issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	(revision 26744)
@@ -13,4 +13,6 @@
 void SmbGradientsx(FemModel* femmodel);
 void SmbGradientsElax(FemModel* femmodel);
+void SmbautoregressionInitx(FemModel* femmodel);
+void Smbautoregressionx(FemModel* femmodel);
 void Delta18oParameterizationx(FemModel* femmodel);
 void MungsmtpParameterizationx(FemModel* femmodel);
@@ -28,10 +30,11 @@
 void       GembgridInitialize(IssmDouble** pdz, int* psize, IssmDouble zTop, IssmDouble dzTop, IssmDouble zMax, IssmDouble zY);
 IssmDouble Marbouty(IssmDouble T, IssmDouble d, IssmDouble dT);
+IssmDouble gardnerAlb(IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble dPHC, int m);
 void grainGrowth(IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* T,IssmDouble* dz,IssmDouble* d, IssmDouble* W,IssmDouble smb_dt,int m,int aIdx, int sid);
-void albedo(IssmDouble** a,int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid);
-void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid);
-void thermo(IssmDouble* pEC, IssmDouble** T, IssmDouble* pulwrf, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble teValue, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT);
-void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid);
-void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid);
+void albedo(IssmDouble** a, IssmDouble** adiff, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid);
+void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble dswdiff, IssmDouble as, IssmDouble asdiff, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid);
+void thermo(IssmDouble* pEC, IssmDouble** T, IssmDouble* pulwrf, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble eIdx, IssmDouble teValue, IssmDouble dulwrfValue, IssmDouble teThresh, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT, bool isdeltaLWup);
+void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* pRa, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid);
+void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pF, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble Ra, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid);
 void densification(IssmDouble** pd,IssmDouble** pdz, IssmDouble* T, IssmDouble* re, int denIdx, int aIdx, int swIdx, IssmDouble adThresh, IssmDouble C, IssmDouble dt, IssmDouble Tmean, IssmDouble dIce, int m, int sid);
 void turbulentFlux(IssmDouble* pshf, IssmDouble* plhf, IssmDouble* pEC, IssmDouble Ta, IssmDouble Ts, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble ds, IssmDouble Ws, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid);
Index: issm/trunk/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 25994)
+++ issm/trunk/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 26744)
@@ -63,12 +63,24 @@
 	/*Retrieve all inputs we will be needing: */
 	DatasetInput* weights_input=topelement->GetDatasetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
-	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
-	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
-	Input* vy_input     = NULL;
-	Input* vyobs_input  = NULL;
-	if(numcomponents==2){
-		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
-		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+   Input* vx_input     = NULL;
+   Input* vxobs_input  = topelement->GetInput(InversionVxObsEnum);   _assert_(vxobs_input);
+   Input* vy_input     = NULL;
+   Input* vyobs_input  = NULL;
+
+   /*Read SurfaceEnum from 2D models:SSA, L1L2, MLHO*/
+   if (domaintype == Domain2DhorizontalEnum) {
+      vx_input = topelement->GetInput(VxSurfaceEnum);             _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VySurfaceEnum);        _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
 	}
+   else {
+      vx_input = topelement->GetInput(VxEnum);                    _assert_(vx_input);
+      if(numcomponents==2){
+         vy_input    =topelement->GetInput(VyEnum);               _assert_(vy_input);
+         vyobs_input =topelement->GetInput(InversionVyObsEnum);   _assert_(vyobs_input);
+      }
+   }
 
 	/* Start  looping on the number of gaussian points: */
@@ -111,5 +123,5 @@
 
 	/*clean up and Return: */
-	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
+	if(topelement->IsSpawnedElement()){topelement->DeleteMaterials(); delete topelement;};
 	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
Index: issm/trunk/src/c/modules/modules.h
===================================================================
--- issm/trunk/src/c/modules/modules.h	(revision 25994)
+++ issm/trunk/src/c/modules/modules.h	(revision 26744)
@@ -72,4 +72,5 @@
 #include "./SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h"
 #include "./ModelProcessorx/ModelProcessorx.h"
+#include "./MmeToInputFromIdx/MmeToInputFromIdx.h"
 #include "./ParseToolkitsOptionsx/ParseToolkitsOptionsx.h"
 #include "./NodalValuex/NodalValuex.h"
@@ -90,4 +91,5 @@
 #include "./Scotchx/Scotchx.h"
 #include "./Shp2Kmlx/Shp2Kmlx.h"
+#include "./StochasticForcingx/StochasticForcingx.h"
 #include "./SurfaceMassBalancex/SurfaceMassBalancex.h"
 #include "./Solverx/Solverx.h"
@@ -102,4 +104,5 @@
 #include "./UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h"
 #include "./VertexCoordinatesx/VertexCoordinatesx.h"
+#include "./ElementCoordinatesx/ElementCoordinatesx.h"
 
 #ifdef _HAVE_OCEAN_
Index: issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	(revision 26744)
@@ -166,6 +166,6 @@
     smf=icefac*0.001;
   }
-  snwmf=0.95*snwmf;
-  smf=0.95*smf;
+  //snwmf=0.95*snwmf;
+  //smf=0.95*smf;
 
   /*****  compute PDD ablation and refreezing *****/
Index: issm/trunk/src/c/shared/Elements/PddSurfaceMassBalanceSicopolis.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/PddSurfaceMassBalanceSicopolis.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/Elements/PddSurfaceMassBalanceSicopolis.cpp	(revision 26744)
@@ -32,5 +32,5 @@
   IssmDouble Pmax = 0.6;
   IssmDouble inv_twelve=1./12.; 
-  
+
   sconv=(rho_water/rho_ice);		//rhow_rain/rhoi
 
@@ -91,5 +91,5 @@
 	 IssmDouble coeff5=3.8e-05;		// polynomial
 	 IssmDouble coeff6=6.0e-07;		// fit
-   
+
 	 if(tstar>=temp_rain)
 	  frac_solid = 0.0;
@@ -100,5 +100,5 @@
 					 +tstar*(coeff3+tstar*(coeff4+tstar*(coeff5+tstar*coeff6))));
 	 }
-	 
+
 	 snowfall=snowfall+precip_star*frac_solid*inv_twelve;
   } 
@@ -108,5 +108,5 @@
   if(snowfall<0.0) snowfall=0.0;   // correction of
   if(rainfall<0.0) rainfall=0.0;   // negative values
-   
+
   if(rainfall<=(Pmax*snowfall)){
 	  if((rainfall+beta1*pdd)<=(Pmax*snowfall)) {
@@ -126,5 +126,5 @@
 	  runoff     = smelt+rainfall-Pmax*snowfall;
   }
-   
+
   saccu = precip;	
 
Index: issm/trunk/src/c/shared/Enum/Enum.vim
===================================================================
--- issm/trunk/src/c/shared/Enum/Enum.vim	(revision 25994)
+++ issm/trunk/src/c/shared/Enum/Enum.vim	(revision 26744)
@@ -63,4 +63,5 @@
 syn keyword cConstant AutodiffXpEnum
 syn keyword cConstant BalancethicknessStabilizationEnum
+syn keyword cConstant BarystaticContributionsEnum
 syn keyword cConstant BasalforcingsBottomplumedepthEnum
 syn keyword cConstant BasalforcingsCrustthicknessEnum
@@ -100,4 +101,5 @@
 syn keyword cConstant BasalforcingsUpperwaterMeltingRateEnum
 syn keyword cConstant CalvingCrevasseDepthEnum
+syn keyword cConstant CalvingCrevasseThresholdEnum
 syn keyword cConstant CalvingHeightAboveFloatationEnum
 syn keyword cConstant CalvingLawEnum
@@ -105,4 +107,5 @@
 syn keyword cConstant ConfigurationTypeEnum
 syn keyword cConstant ConstantsGEnum
+syn keyword cConstant ConstantsNewtonGravityEnum
 syn keyword cConstant ConstantsReferencetemperatureEnum
 syn keyword cConstant ConstantsYtsEnum
@@ -110,11 +113,13 @@
 syn keyword cConstant ControlInputSizeNEnum
 syn keyword cConstant ControlInputInterpolationEnum
-syn keyword cConstant CumBslrEnum
-syn keyword cConstant CumBslrIceEnum
-syn keyword cConstant CumBslrHydroEnum
-syn keyword cConstant CumBslrIcePartitionEnum
-syn keyword cConstant CumBslrHydroPartitionEnum
-syn keyword cConstant CumGmtslrEnum
-syn keyword cConstant CumGmslrEnum
+syn keyword cConstant CumBslcEnum
+syn keyword cConstant CumBslcIceEnum
+syn keyword cConstant CumBslcHydroEnum
+syn keyword cConstant CumBslcOceanEnum
+syn keyword cConstant CumBslcIcePartitionEnum
+syn keyword cConstant CumBslcHydroPartitionEnum
+syn keyword cConstant CumBslcOceanPartitionEnum
+syn keyword cConstant CumGmtslcEnum
+syn keyword cConstant CumGmslcEnum
 syn keyword cConstant DamageC1Enum
 syn keyword cConstant DamageC2Enum
@@ -138,6 +143,11 @@
 syn keyword cConstant DslModelidEnum
 syn keyword cConstant DslNummodelsEnum
-syn keyword cConstant DslComputeFingerprintsEnum
+syn keyword cConstant SolidearthIsExternalEnum
+syn keyword cConstant SolidearthExternalNatureEnum
+syn keyword cConstant SolidearthExternalModelidEnum
+syn keyword cConstant SolidearthExternalNummodelsEnum
+syn keyword cConstant SolidearthSettingsComputeBpGrdEnum
 syn keyword cConstant EarthIdEnum
+syn keyword cConstant ElasticEnum
 syn keyword cConstant EplZigZagCounterEnum
 syn keyword cConstant EsaHElasticEnum
@@ -167,10 +177,13 @@
 syn keyword cConstant FrictionVoidRatioEnum
 syn keyword cConstant FrontalForcingsBasinIcefrontAreaEnum
+syn keyword cConstant FrontalForcingsAutoregressionInitialTimeEnum
+syn keyword cConstant FrontalForcingsAutoregressionTimestepEnum
+syn keyword cConstant FrontalForcingsAutoregressiveOrderEnum
+syn keyword cConstant FrontalForcingsBeta0Enum
+syn keyword cConstant FrontalForcingsBeta1Enum
 syn keyword cConstant FrontalForcingsNumberofBasinsEnum
 syn keyword cConstant FrontalForcingsParamEnum
-syn keyword cConstant GiaModelEnum
-syn keyword cConstant GiaModelidEnum
-syn keyword cConstant GiaNummodelsEnum
-syn keyword cConstant GiaCrossSectionShapeEnum
+syn keyword cConstant FrontalForcingsPhiEnum
+syn keyword cConstant GrdModelEnum
 syn keyword cConstant GroundinglineFrictionInterpolationEnum
 syn keyword cConstant GroundinglineMeltInterpolationEnum
@@ -243,4 +256,6 @@
 syn keyword cConstant InversionStepThresholdEnum
 syn keyword cConstant InversionTypeEnum
+syn keyword cConstant IvinsEnum
+syn keyword cConstant IsSlcCouplingEnum
 syn keyword cConstant LevelsetKillIcebergsEnum
 syn keyword cConstant LevelsetReinitFrequencyEnum
@@ -248,13 +263,24 @@
 syn keyword cConstant LockFileNameEnum
 syn keyword cConstant LoveAllowLayerDeletionEnum
+syn keyword cConstant LoveCoreMantleBoundaryEnum
+syn keyword cConstant LoveEarthMassEnum
 syn keyword cConstant LoveForcingTypeEnum
 syn keyword cConstant LoveFrequenciesEnum
+syn keyword cConstant LoveIsTemporalEnum
 syn keyword cConstant LoveG0Enum
+syn keyword cConstant LoveGravitationalConstantEnum
+syn keyword cConstant LoveInnerCoreBoundaryEnum
+syn keyword cConstant LoveComplexComputationEnum
+syn keyword cConstant LoveIntStepsPerLayerEnum
 syn keyword cConstant LoveKernelsEnum
 syn keyword cConstant LoveMu0Enum
 syn keyword cConstant LoveNfreqEnum
+syn keyword cConstant LoveNTemporalIterationsEnum
+syn keyword cConstant LoveNYiEquationsEnum
 syn keyword cConstant LoveR0Enum
 syn keyword cConstant LoveShNmaxEnum
 syn keyword cConstant LoveShNminEnum
+syn keyword cConstant LoveStartingLayerEnum
+syn keyword cConstant LoveUnderflowTolEnum
 syn keyword cConstant MassFluxSegmentsEnum
 syn keyword cConstant MassFluxSegmentsPresentEnum
@@ -271,8 +297,4 @@
 syn keyword cConstant MaterialsHeatcapacityEnum
 syn keyword cConstant MaterialsLatentheatEnum
-syn keyword cConstant MaterialsLithosphereDensityEnum
-syn keyword cConstant MaterialsLithosphereShearModulusEnum
-syn keyword cConstant MaterialsMantleDensityEnum
-syn keyword cConstant MaterialsMantleShearModulusEnum
 syn keyword cConstant MaterialsMeltingpointEnum
 syn keyword cConstant MaterialsMixedLayerCapacityEnum
@@ -290,4 +312,5 @@
 syn keyword cConstant MeshNumberoflayersEnum
 syn keyword cConstant MeshNumberofverticesEnum
+syn keyword cConstant MeshNumberofelementsEnum
 syn keyword cConstant MigrationMaxEnum
 syn keyword cConstant ModelIdEnum
@@ -328,15 +351,29 @@
 syn keyword cConstant RootPathEnum
 syn keyword cConstant ModelnameEnum
+syn keyword cConstant SamplingAlphaEnum
+syn keyword cConstant SamplingPhiEnum
+syn keyword cConstant SamplingNumRequestedOutputsEnum
+syn keyword cConstant SamplingRequestedOutputsEnum
+syn keyword cConstant SamplingRobinEnum
+syn keyword cConstant SamplingSeedEnum
+syn keyword cConstant SamplingTauEnum
 syn keyword cConstant SaveResultsEnum
 syn keyword cConstant SolidearthPartitionIceEnum
 syn keyword cConstant SolidearthPartitionHydroEnum
+syn keyword cConstant SolidearthPartitionOceanEnum
 syn keyword cConstant SolidearthNpartIceEnum
+syn keyword cConstant SolidearthNpartOceanEnum
 syn keyword cConstant SolidearthNpartHydroEnum
 syn keyword cConstant SolidearthPlanetRadiusEnum
 syn keyword cConstant SolidearthPlanetAreaEnum
 syn keyword cConstant SolidearthSettingsAbstolEnum
+syn keyword cConstant SolidearthSettingsCrossSectionShapeEnum
 syn keyword cConstant RotationalAngularVelocityEnum
 syn keyword cConstant SolidearthSettingsElasticEnum
-syn keyword cConstant SealevelriseGeometryDoneEnum
+syn keyword cConstant SolidearthSettingsViscousEnum
+syn keyword cConstant SealevelchangeGeometryDoneEnum
+syn keyword cConstant SealevelchangeViscousNumStepsEnum
+syn keyword cConstant SealevelchangeViscousTimesEnum
+syn keyword cConstant SealevelchangeViscousIndexEnum
 syn keyword cConstant RotationalEquatorialMoiEnum
 syn keyword cConstant TidalLoveHEnum
@@ -347,22 +384,35 @@
 syn keyword cConstant LoadLoveKEnum
 syn keyword cConstant LoadLoveLEnum
-syn keyword cConstant SealevelriseGRigidEnum
-syn keyword cConstant SealevelriseGElasticEnum
-syn keyword cConstant SolidearthSettingsComputesealevelchangeEnum
+syn keyword cConstant LoveTimeFreqEnum
+syn keyword cConstant LoveIsTimeEnum
+syn keyword cConstant SealevelchangeGSelfAttractionEnum
+syn keyword cConstant SealevelchangeGViscoElasticEnum
+syn keyword cConstant SolidearthSettingsSealevelLoadingEnum
 syn keyword cConstant SolidearthSettingsGRDEnum
-syn keyword cConstant SolidearthSettingsGlfractionEnum
 syn keyword cConstant SolidearthSettingsRunFrequencyEnum
-syn keyword cConstant SealevelriseHElasticEnum
+syn keyword cConstant SolidearthSettingsTimeAccEnum
+syn keyword cConstant SealevelchangeHViscoElasticEnum
 syn keyword cConstant SolidearthSettingsHorizEnum
 syn keyword cConstant SolidearthSettingsMaxiterEnum
+syn keyword cConstant SolidearthSettingsGrdOceanEnum
 syn keyword cConstant SolidearthSettingsOceanAreaScalingEnum
+syn keyword cConstant StochasticForcingCovarianceEnum
+syn keyword cConstant StochasticForcingDefaultDimensionEnum
+syn keyword cConstant StochasticForcingDimensionsEnum
+syn keyword cConstant StochasticForcingFieldsEnum
+syn keyword cConstant StochasticForcingIsEffectivePressureEnum
+syn keyword cConstant StochasticForcingIsStochasticForcingEnum
+syn keyword cConstant StochasticForcingIsWaterPressureEnum
+syn keyword cConstant StochasticForcingNumFieldsEnum
+syn keyword cConstant StochasticForcingRandomflagEnum
 syn keyword cConstant RotationalPolarMoiEnum
 syn keyword cConstant SolidearthSettingsReltolEnum
-syn keyword cConstant SealevelriseRequestedOutputsEnum
-syn keyword cConstant SolidearthSettingsRigidEnum
+syn keyword cConstant SealevelchangeRequestedOutputsEnum
+syn keyword cConstant SolidearthSettingsSelfAttractionEnum
 syn keyword cConstant SolidearthSettingsRotationEnum
-syn keyword cConstant SealevelriseRunCountEnum
-syn keyword cConstant SealevelriseTransitionsEnum
-syn keyword cConstant SealevelriseUElasticEnum
+syn keyword cConstant SolidearthSettingsMaxSHCoeffEnum
+syn keyword cConstant SealevelchangeRunCountEnum
+syn keyword cConstant SealevelchangeTransitionsEnum
+syn keyword cConstant SealevelchangeUViscoElasticEnum
 syn keyword cConstant SettingsIoGatherEnum
 syn keyword cConstant SettingsNumResultsOnNodesEnum
@@ -380,5 +430,10 @@
 syn keyword cConstant SmbAccurefEnum
 syn keyword cConstant SmbAdThreshEnum
+syn keyword cConstant SmbAutoregressionInitialTimeEnum
+syn keyword cConstant SmbAutoregressionTimestepEnum
+syn keyword cConstant SmbAutoregressiveOrderEnum
 syn keyword cConstant SmbAveragingEnum
+syn keyword cConstant SmbBeta0Enum
+syn keyword cConstant SmbBeta1Enum
 syn keyword cConstant SmbDesfacEnum
 syn keyword cConstant SmbDpermilEnum
@@ -390,13 +445,14 @@
 syn keyword cConstant SmbDtEnum
 syn keyword cConstant SmbEnum
+syn keyword cConstant SmbEIdxEnum
 syn keyword cConstant SmbFEnum
 syn keyword cConstant SmbInitDensityScalingEnum
 syn keyword cConstant SmbIsaccumulationEnum
 syn keyword cConstant SmbIsalbedoEnum
-syn keyword cConstant SmbIsclimatologyEnum
 syn keyword cConstant SmbIsconstrainsurfaceTEnum
 syn keyword cConstant SmbIsd18opdEnum
 syn keyword cConstant SmbIsdelta18oEnum
 syn keyword cConstant SmbIsdensificationEnum
+syn keyword cConstant SmbIsdeltaLWupEnum
 syn keyword cConstant SmbIsfirnwarmingEnum
 syn keyword cConstant SmbIsgraingrowthEnum
@@ -410,6 +466,8 @@
 syn keyword cConstant SmbIsturbulentfluxEnum
 syn keyword cConstant SmbKEnum
+syn keyword cConstant SmbNumBasinsEnum
 syn keyword cConstant SmbNumRequestedOutputsEnum
 syn keyword cConstant SmbPfacEnum
+syn keyword cConstant SmbPhiEnum
 syn keyword cConstant SmbRdlEnum
 syn keyword cConstant SmbRequestedOutputsEnum
@@ -424,4 +482,5 @@
 syn keyword cConstant SmbT0dryEnum
 syn keyword cConstant SmbT0wetEnum
+syn keyword cConstant SmbTeThreshEnum
 syn keyword cConstant SmbTdiffEnum
 syn keyword cConstant SmbThermoDeltaTScalingEnum
@@ -463,5 +522,6 @@
 syn keyword cConstant TimesteppingCouplingTimeEnum
 syn keyword cConstant TimesteppingFinalTimeEnum
-syn keyword cConstant TimesteppingInterpForcingsEnum
+syn keyword cConstant TimesteppingInterpForcingEnum
+syn keyword cConstant TimesteppingCycleForcingEnum
 syn keyword cConstant TimesteppingStartTimeEnum
 syn keyword cConstant TimesteppingTimeStepEnum
@@ -475,5 +535,4 @@
 syn keyword cConstant ToolkitsTypesEnum
 syn keyword cConstant TransientAmrFrequencyEnum
-syn keyword cConstant TransientIscouplerEnum
 syn keyword cConstant TransientIsdamageevolutionEnum
 syn keyword cConstant TransientIsesaEnum
@@ -482,7 +541,9 @@
 syn keyword cConstant TransientIshydrologyEnum
 syn keyword cConstant TransientIsmasstransportEnum
+syn keyword cConstant TransientIsoceantransportEnum
 syn keyword cConstant TransientIsmovingfrontEnum
 syn keyword cConstant TransientIsoceancouplingEnum
-syn keyword cConstant TransientIsslrEnum
+syn keyword cConstant TransientIssamplingEnum
+syn keyword cConstant TransientIsslcEnum
 syn keyword cConstant TransientIssmbEnum
 syn keyword cConstant TransientIsstressbalanceEnum
@@ -491,11 +552,22 @@
 syn keyword cConstant TransientRequestedOutputsEnum
 syn keyword cConstant VelocityEnum
+syn keyword cConstant XxeEnum
+syn keyword cConstant YyeEnum
+syn keyword cConstant ZzeEnum
+syn keyword cConstant AreaeEnum
 syn keyword cConstant WorldCommEnum
 syn keyword cConstant ParametersENDEnum
 syn keyword cConstant InputsSTARTEnum
+syn keyword cConstant AccumulatedDeltaBottomPressureEnum
+syn keyword cConstant AccumulatedDeltaIceThicknessEnum
+syn keyword cConstant AccumulatedDeltaTwsEnum
 syn keyword cConstant AdjointEnum
 syn keyword cConstant AdjointpEnum
 syn keyword cConstant AdjointxEnum
+syn keyword cConstant AdjointxBaseEnum
+syn keyword cConstant AdjointxShearEnum
 syn keyword cConstant AdjointyEnum
+syn keyword cConstant AdjointyBaseEnum
+syn keyword cConstant AdjointyShearEnum
 syn keyword cConstant AdjointzEnum
 syn keyword cConstant AirEnum
@@ -531,7 +603,17 @@
 syn keyword cConstant BaseSlopeXEnum
 syn keyword cConstant BaseSlopeYEnum
+syn keyword cConstant BaselineBasalforcingsFloatingiceMeltingRateEnum
+syn keyword cConstant BaselineCalvingCalvingrateEnum
+syn keyword cConstant BaselineFrictionEffectivePressureEnum
 syn keyword cConstant BedEnum
+syn keyword cConstant BedGRDEnum
+syn keyword cConstant BedEastEnum
+syn keyword cConstant BedEastGRDEnum
+syn keyword cConstant BedNorthEnum
+syn keyword cConstant BedNorthGRDEnum
 syn keyword cConstant BedSlopeXEnum
 syn keyword cConstant BedSlopeYEnum
+syn keyword cConstant BottomPressureEnum
+syn keyword cConstant BottomPressureOldEnum
 syn keyword cConstant CalvingCalvingrateEnum
 syn keyword cConstant CalvingHabFractionEnum
@@ -555,4 +637,13 @@
 syn keyword cConstant DegreeOfChannelizationEnum
 syn keyword cConstant DepthBelowSurfaceEnum
+syn keyword cConstant DeltaIceThicknessEnum
+syn keyword cConstant DeltaTwsEnum
+syn keyword cConstant DeltaBottomPressureEnum
+syn keyword cConstant DeltaDslEnum
+syn keyword cConstant DslOldEnum
+syn keyword cConstant DslEnum
+syn keyword cConstant DeltaStrEnum
+syn keyword cConstant StrOldEnum
+syn keyword cConstant StrEnum
 syn keyword cConstant DeviatoricStresseffectiveEnum
 syn keyword cConstant DeviatoricStressxxEnum
@@ -572,11 +663,4 @@
 syn keyword cConstant DrivingStressXEnum
 syn keyword cConstant DrivingStressYEnum
-syn keyword cConstant DslGlobalAverageThermostericSeaLevelChangeEnum
-syn keyword cConstant DslSeaSurfaceHeightChangeAboveGeoidEnum
-syn keyword cConstant DslSeaWaterPressureChangeAtSeaFloorEnum
-syn keyword cConstant DslStericRateEnum
-syn keyword cConstant DslDynamicRateEnum
-syn keyword cConstant GiaMmeNgiaEnum
-syn keyword cConstant GiaMmeUgiaEnum
 syn keyword cConstant DummyEnum
 syn keyword cConstant EffectivePressureEnum
@@ -591,5 +675,4 @@
 syn keyword cConstant EplHeadSubstepEnum
 syn keyword cConstant EplHeadTransientEnum
-syn keyword cConstant EsaDeltathicknessEnum
 syn keyword cConstant EsaEmotionEnum
 syn keyword cConstant EsaNmotionEnum
@@ -621,6 +704,4 @@
 syn keyword cConstant FrontalForcingsThermalForcingEnum
 syn keyword cConstant GeometryHydrostaticRatioEnum
-syn keyword cConstant GiaLithosphereThicknessEnum
-syn keyword cConstant GiaMantleViscosityEnum
 syn keyword cConstant NGiaEnum
 syn keyword cConstant NGiaRateEnum
@@ -647,4 +728,8 @@
 syn keyword cConstant HydrologyEnglacialInputEnum
 syn keyword cConstant HydrologyGapHeightEnum
+syn keyword cConstant HydrologyGapHeightXEnum
+syn keyword cConstant HydrologyGapHeightXXEnum
+syn keyword cConstant HydrologyGapHeightYEnum
+syn keyword cConstant HydrologyGapHeightYYEnum
 syn keyword cConstant HydrologyHeadEnum
 syn keyword cConstant HydrologyHeadOldEnum
@@ -655,4 +740,7 @@
 syn keyword cConstant HydrologySheetThicknessEnum
 syn keyword cConstant HydrologySheetThicknessOldEnum
+syn keyword cConstant HydrologyTwsEnum
+syn keyword cConstant HydrologyTwsSpcEnum
+syn keyword cConstant HydrologyTwsAnalysisEnum
 syn keyword cConstant HydrologyWatercolumnMaxEnum
 syn keyword cConstant HydrologyWaterVxEnum
@@ -669,4 +757,5 @@
 syn keyword cConstant LevelsetfunctionSlopeXEnum
 syn keyword cConstant LevelsetfunctionSlopeYEnum
+syn keyword cConstant LevelsetObservationEnum
 syn keyword cConstant LoadingforceXEnum
 syn keyword cConstant LoadingforceYEnum
@@ -674,4 +763,5 @@
 syn keyword cConstant MaskOceanLevelsetEnum
 syn keyword cConstant MaskIceLevelsetEnum
+syn keyword cConstant MaskIceRefLevelsetEnum
 syn keyword cConstant MasstransportSpcthicknessEnum
 syn keyword cConstant MaterialsRheologyBEnum
@@ -689,8 +779,13 @@
 syn keyword cConstant MeshVertexonsurfaceEnum
 syn keyword cConstant MisfitEnum
+syn keyword cConstant MovingFrontalVxEnum
+syn keyword cConstant MovingFrontalVyEnum
 syn keyword cConstant NeumannfluxEnum
 syn keyword cConstant NewDamageEnum
 syn keyword cConstant NodeEnum
 syn keyword cConstant OmegaAbsGradientEnum
+syn keyword cConstant OceantransportSpcbottompressureEnum
+syn keyword cConstant OceantransportSpcstrEnum
+syn keyword cConstant OceantransportSpcdslEnum
 syn keyword cConstant P0Enum
 syn keyword cConstant P1Enum
@@ -707,32 +802,80 @@
 syn keyword cConstant RheologyBInitialguessMisfitEnum
 syn keyword cConstant RheologyBbarAbsGradientEnum
+syn keyword cConstant SampleEnum
+syn keyword cConstant SamplingBetaEnum
+syn keyword cConstant SamplingKappaEnum
 syn keyword cConstant SealevelEnum
-syn keyword cConstant SealevelEustaticMaskEnum
-syn keyword cConstant SealevelEustaticOceanMaskEnum
+syn keyword cConstant SealevelGRDEnum
+syn keyword cConstant SealevelBarystaticMaskEnum
+syn keyword cConstant SealevelBarystaticIceMaskEnum
+syn keyword cConstant SealevelBarystaticIceWeightsEnum
+syn keyword cConstant SealevelBarystaticIceAreaEnum
+syn keyword cConstant SealevelBarystaticIceLatbarEnum
+syn keyword cConstant SealevelBarystaticIceLongbarEnum
+syn keyword cConstant SealevelBarystaticIceLoadEnum
+syn keyword cConstant SealevelBarystaticHydroMaskEnum
+syn keyword cConstant SealevelBarystaticHydroWeightsEnum
+syn keyword cConstant SealevelBarystaticHydroAreaEnum
+syn keyword cConstant SealevelBarystaticHydroLatbarEnum
+syn keyword cConstant SealevelBarystaticHydroLongbarEnum
+syn keyword cConstant SealevelBarystaticHydroLoadEnum
+syn keyword cConstant SealevelBarystaticBpMaskEnum
+syn keyword cConstant SealevelBarystaticBpWeightsEnum
+syn keyword cConstant SealevelBarystaticBpAreaEnum
+syn keyword cConstant SealevelBarystaticBpLoadEnum
+syn keyword cConstant SealevelBarystaticOceanMaskEnum
+syn keyword cConstant SealevelBarystaticOceanWeightsEnum
+syn keyword cConstant SealevelBarystaticOceanAreaEnum
+syn keyword cConstant SealevelBarystaticOceanLatbarEnum
+syn keyword cConstant SealevelBarystaticOceanLongbarEnum
+syn keyword cConstant SealevelBarystaticOceanLoadEnum
 syn keyword cConstant SealevelNEsaEnum
 syn keyword cConstant SealevelNEsaRateEnum
 syn keyword cConstant SealevelRSLEnum
-syn keyword cConstant BslrEnum
-syn keyword cConstant BslrIceEnum
-syn keyword cConstant BslrHydroEnum
-syn keyword cConstant BslrRateEnum
-syn keyword cConstant GmtslrEnum
-syn keyword cConstant SealevelRSLEustaticEnum
-syn keyword cConstant SealevelRSLEustaticRateEnum
+syn keyword cConstant BslcEnum
+syn keyword cConstant BslcIceEnum
+syn keyword cConstant BslcHydroEnum
+syn keyword cConstant BslcOceanEnum
+syn keyword cConstant BslcRateEnum
+syn keyword cConstant GmtslcEnum
+syn keyword cConstant SealevelGrotm1Enum
+syn keyword cConstant SealevelGrotm2Enum
+syn keyword cConstant SealevelGrotm3Enum
+syn keyword cConstant SealevelGUrotm1Enum
+syn keyword cConstant SealevelGUrotm2Enum
+syn keyword cConstant SealevelGUrotm3Enum
+syn keyword cConstant SealevelGNrotm1Enum
+syn keyword cConstant SealevelGNrotm2Enum
+syn keyword cConstant SealevelGNrotm3Enum
+syn keyword cConstant SealevelGErotm1Enum
+syn keyword cConstant SealevelGErotm2Enum
+syn keyword cConstant SealevelGErotm3Enum
+syn keyword cConstant SealevelRSLBarystaticEnum
 syn keyword cConstant SealevelRSLRateEnum
+syn keyword cConstant SealevelUGrdEnum
+syn keyword cConstant SealevelNGrdEnum
 syn keyword cConstant SealevelUEastEsaEnum
-syn keyword cConstant SealevelUEsaEnum
-syn keyword cConstant SealevelUEsaRateEnum
 syn keyword cConstant SealevelUNorthEsaEnum
-syn keyword cConstant SealevelriseCumDeltathicknessEnum
-syn keyword cConstant SealevelriseCumDeltathicknessOldEnum
-syn keyword cConstant SurfaceloadOtherEnum
-syn keyword cConstant SurfaceloadIceThicknessChangeEnum
-syn keyword cConstant SurfaceloadWaterHeightChangeEnum
-syn keyword cConstant SealevelriseIndicesEnum
-syn keyword cConstant SealevelriseGEnum
-syn keyword cConstant SealevelriseGUEnum
-syn keyword cConstant SealevelriseGEEnum
-syn keyword cConstant SealevelriseGNEnum
+syn keyword cConstant SealevelchangeIndicesEnum
+syn keyword cConstant SealevelchangeGEnum
+syn keyword cConstant SealevelchangeGUEnum
+syn keyword cConstant SealevelchangeGEEnum
+syn keyword cConstant SealevelchangeGNEnum
+syn keyword cConstant SealevelchangeGsubelOceanEnum
+syn keyword cConstant SealevelchangeGUsubelOceanEnum
+syn keyword cConstant SealevelchangeGEsubelOceanEnum
+syn keyword cConstant SealevelchangeGNsubelOceanEnum
+syn keyword cConstant SealevelchangeGsubelIceEnum
+syn keyword cConstant SealevelchangeGUsubelIceEnum
+syn keyword cConstant SealevelchangeGEsubelIceEnum
+syn keyword cConstant SealevelchangeGNsubelIceEnum
+syn keyword cConstant SealevelchangeGsubelHydroEnum
+syn keyword cConstant SealevelchangeGUsubelHydroEnum
+syn keyword cConstant SealevelchangeGEsubelHydroEnum
+syn keyword cConstant SealevelchangeGNsubelHydroEnum
+syn keyword cConstant SealevelchangeViscousRSLEnum
+syn keyword cConstant SealevelchangeViscousUEnum
+syn keyword cConstant SealevelchangeViscousNEnum
+syn keyword cConstant SealevelchangeViscousEEnum
 syn keyword cConstant SedimentHeadEnum
 syn keyword cConstant SedimentHeadOldEnum
@@ -747,9 +890,15 @@
 syn keyword cConstant SmbAccumulatedMeltEnum
 syn keyword cConstant SmbAccumulatedPrecipitationEnum
+syn keyword cConstant SmbAccumulatedRainEnum
+syn keyword cConstant SmbAccumulatedRefreezeEnum
 syn keyword cConstant SmbAccumulatedRunoffEnum
 syn keyword cConstant SmbAEnum
+syn keyword cConstant SmbAdiffEnum
 syn keyword cConstant SmbAValueEnum
 syn keyword cConstant SmbAccumulationEnum
+syn keyword cConstant SmbAdiffiniEnum
 syn keyword cConstant SmbAiniEnum
+syn keyword cConstant SmbAutoregressionNoiseEnum
+syn keyword cConstant SmbBasinsIdEnum
 syn keyword cConstant SmbBMaxEnum
 syn keyword cConstant SmbBMinEnum
@@ -757,4 +906,7 @@
 syn keyword cConstant SmbBPosEnum
 syn keyword cConstant SmbCEnum
+syn keyword cConstant SmbCcsnowValueEnum
+syn keyword cConstant SmbCciceValueEnum
+syn keyword cConstant SmbCotValueEnum
 syn keyword cConstant SmbDEnum
 syn keyword cConstant SmbDailyairdensityEnum
@@ -769,5 +921,7 @@
 syn keyword cConstant SmbDiniEnum
 syn keyword cConstant SmbDlwrfEnum
+syn keyword cConstant SmbDulwrfValueEnum
 syn keyword cConstant SmbDswrfEnum
+syn keyword cConstant SmbDswdiffrfEnum
 syn keyword cConstant SmbDzAddEnum
 syn keyword cConstant SmbDzEnum
@@ -789,5 +943,4 @@
 syn keyword cConstant SmbIsInitializedEnum
 syn keyword cConstant SmbMAddEnum
-syn keyword cConstant SmbMassBalanceClimateEnum
 syn keyword cConstant SmbMassBalanceEnum
 syn keyword cConstant SmbMassBalanceSubstepEnum
@@ -810,4 +963,5 @@
 syn keyword cConstant SmbPrecipitationsPresentdayEnum
 syn keyword cConstant SmbPrecipitationsReconstructedEnum
+syn keyword cConstant SmbRainEnum
 syn keyword cConstant SmbReEnum
 syn keyword cConstant SmbRefreezeEnum
@@ -822,4 +976,5 @@
 syn keyword cConstant SmbSmbCorrEnum
 syn keyword cConstant SmbSmbrefEnum
+syn keyword cConstant SmbSzaValueEnum
 syn keyword cConstant SmbTEnum
 syn keyword cConstant SmbTaEnum
@@ -832,4 +987,5 @@
 syn keyword cConstant SmbTmeanEnum
 syn keyword cConstant SmbTzEnum
+syn keyword cConstant SmbValuesAutoregressionEnum
 syn keyword cConstant SmbVEnum
 syn keyword cConstant SmbVmeanEnum
@@ -842,4 +998,9 @@
 syn keyword cConstant SmbZTopEnum
 syn keyword cConstant SmbZYEnum
+syn keyword cConstant SolidearthExternalDisplacementEastRateEnum
+syn keyword cConstant SolidearthExternalDisplacementNorthRateEnum
+syn keyword cConstant SolidearthExternalDisplacementUpRateEnum
+syn keyword cConstant SolidearthExternalGeoidRateEnum
+syn keyword cConstant StochasticForcingDefaultIdEnum
 syn keyword cConstant StrainRateeffectiveEnum
 syn keyword cConstant StrainRateparallelEnum
@@ -877,4 +1038,6 @@
 syn keyword cConstant TemperaturePicardEnum
 syn keyword cConstant TemperatureSEMICEnum
+syn keyword cConstant ThermalforcingAutoregressionNoiseEnum
+syn keyword cConstant ThermalforcingValuesAutoregressionEnum
 syn keyword cConstant ThermalSpctemperatureEnum
 syn keyword cConstant ThicknessAbsGradientEnum
@@ -886,13 +1049,20 @@
 syn keyword cConstant ThicknessPositiveEnum
 syn keyword cConstant ThicknessResidualEnum
+syn keyword cConstant TransientAccumulatedDeltaIceThicknessEnum
 syn keyword cConstant VelEnum
 syn keyword cConstant VxAverageEnum
+syn keyword cConstant VxBaseEnum
 syn keyword cConstant VxEnum
 syn keyword cConstant VxMeshEnum
 syn keyword cConstant VxObsEnum
+syn keyword cConstant VxShearEnum
+syn keyword cConstant VxSurfaceEnum
 syn keyword cConstant VyAverageEnum
+syn keyword cConstant VyBaseEnum
 syn keyword cConstant VyEnum
 syn keyword cConstant VyMeshEnum
 syn keyword cConstant VyObsEnum
+syn keyword cConstant VyShearEnum
+syn keyword cConstant VySurfaceEnum
 syn keyword cConstant VzEnum
 syn keyword cConstant VzFSEnum
@@ -906,5 +1076,11 @@
 syn keyword cConstant WaterfractionEnum
 syn keyword cConstant WaterheightEnum
+syn keyword cConstant FrictionWaterPressureEnum
+syn keyword cConstant FrictionWaterPressureNoiseEnum
+syn keyword cConstant WeightsLevelsetObservationEnum
 syn keyword cConstant WeightsSurfaceObservationEnum
+syn keyword cConstant OldAccumulatedDeltaBottomPressureEnum
+syn keyword cConstant OldAccumulatedDeltaIceThicknessEnum
+syn keyword cConstant OldAccumulatedDeltaTwsEnum
 syn keyword cConstant Outputdefinition1Enum
 syn keyword cConstant Outputdefinition10Enum
@@ -1046,4 +1222,5 @@
 syn keyword cConstant CfsurfacelogvelEnum
 syn keyword cConstant CfsurfacesquareEnum
+syn keyword cConstant CflevelsetmisfitEnum
 syn keyword cConstant ChannelEnum
 syn keyword cConstant ChannelAreaEnum
@@ -1111,4 +1288,5 @@
 syn keyword cConstant FrontalForcingsDefaultEnum
 syn keyword cConstant FrontalForcingsRignotEnum
+syn keyword cConstant FrontalForcingsRignotAutoregressionEnum
 syn keyword cConstant FsetEnum
 syn keyword cConstant FullMeltOnPartiallyFloatingEnum
@@ -1121,6 +1299,4 @@
 syn keyword cConstant GenericParamEnum
 syn keyword cConstant GenericExternalResultEnum
-syn keyword cConstant GiaAnalysisEnum
-syn keyword cConstant GiaSolutionEnum
 syn keyword cConstant Gradient1Enum
 syn keyword cConstant Gradient2Enum
@@ -1242,4 +1418,6 @@
 syn keyword cConstant NyeH2OEnum
 syn keyword cConstant NumericalfluxEnum
+syn keyword cConstant OceantransportAnalysisEnum
+syn keyword cConstant OceantransportSolutionEnum
 syn keyword cConstant OldGradientEnum
 syn keyword cConstant OneLayerP4zEnum
@@ -1276,5 +1454,8 @@
 syn keyword cConstant RecoveryAnalysisEnum
 syn keyword cConstant RiftfrontEnum
+syn keyword cConstant SamplingAnalysisEnum
+syn keyword cConstant SamplingSolutionEnum
 syn keyword cConstant SIAApproximationEnum
+syn keyword cConstant SMBautoregressionEnum
 syn keyword cConstant SMBcomponentsEnum
 syn keyword cConstant SMBd18opddEnum
@@ -1299,8 +1480,8 @@
 syn keyword cConstant SealevelInertiaTensorYZEnum
 syn keyword cConstant SealevelInertiaTensorZZEnum
+syn keyword cConstant SealevelchangePolarMotionEnum
 syn keyword cConstant SealevelNmotionEnum
 syn keyword cConstant SealevelUmotionEnum
-syn keyword cConstant SealevelriseAnalysisEnum
-syn keyword cConstant SealevelriseSolutionEnum
+syn keyword cConstant SealevelchangeAnalysisEnum
 syn keyword cConstant SegEnum
 syn keyword cConstant SegInputEnum
@@ -1391,10 +1572,13 @@
 syn keyword cType AmrNeopz
 syn keyword cType ArrayInput
+syn keyword cType BarystaticContributions
 syn keyword cType BoolInput
 syn keyword cType BoolParam
 syn keyword cType Cfdragcoeffabsgrad
+syn keyword cType Cflevelsetmisfit
 syn keyword cType Cfsurfacelogvel
 syn keyword cType Cfsurfacesquare
 syn keyword cType Channel
+syn keyword cType classes
 syn keyword cType Constraint
 syn keyword cType Constraints
@@ -1403,6 +1587,6 @@
 syn keyword cType ControlInput
 syn keyword cType Covertree
+syn keyword cType DatasetInput
 syn keyword cType DataSetParam
-syn keyword cType DatasetInput
 syn keyword cType Definition
 syn keyword cType DependentObject
@@ -1417,6 +1601,6 @@
 syn keyword cType ElementInput
 syn keyword cType ElementMatrix
+syn keyword cType Elements
 syn keyword cType ElementVector
-syn keyword cType Elements
 syn keyword cType ExponentialVariogram
 syn keyword cType ExternalResult
@@ -1425,13 +1609,15 @@
 syn keyword cType Friction
 syn keyword cType Gauss
+syn keyword cType GaussianVariogram
+syn keyword cType gaussobjects
 syn keyword cType GaussPenta
 syn keyword cType GaussSeg
 syn keyword cType GaussTetra
 syn keyword cType GaussTria
-syn keyword cType GaussianVariogram
 syn keyword cType GenericExternalResult
 syn keyword cType GenericOption
 syn keyword cType GenericParam
 syn keyword cType GiaDeflectionCoreArgs
+syn keyword cType GrdLoads
 syn keyword cType Hook
 syn keyword cType Input
@@ -1444,4 +1630,5 @@
 syn keyword cType IssmDirectApplicInterface
 syn keyword cType IssmParallelDirectApplicInterface
+syn keyword cType krigingobjects
 syn keyword cType Load
 syn keyword cType Loads
@@ -1454,4 +1641,5 @@
 syn keyword cType Matice
 syn keyword cType Matlitho
+syn keyword cType matrixobjects
 syn keyword cType MatrixParam
 syn keyword cType Misfit
@@ -1466,6 +1654,6 @@
 syn keyword cType Observations
 syn keyword cType Option
+syn keyword cType Options
 syn keyword cType OptionUtilities
-syn keyword cType Options
 syn keyword cType Param
 syn keyword cType Parameters
@@ -1481,11 +1669,11 @@
 syn keyword cType Regionaloutput
 syn keyword cType Results
+syn keyword cType Riftfront
 syn keyword cType RiftStruct
-syn keyword cType Riftfront
-syn keyword cType SealevelMasks
+syn keyword cType SealevelGeometry
 syn keyword cType Seg
 syn keyword cType SegInput
+syn keyword cType Segment
 syn keyword cType SegRef
-syn keyword cType Segment
 syn keyword cType SpcDynamic
 syn keyword cType SpcStatic
@@ -1506,8 +1694,4 @@
 syn keyword cType Vertex
 syn keyword cType Vertices
-syn keyword cType classes
-syn keyword cType gaussobjects
-syn keyword cType krigingobjects
-syn keyword cType matrixobjects
 syn keyword cType AdjointBalancethickness2Analysis
 syn keyword cType AdjointBalancethicknessAnalysis
@@ -1529,5 +1713,4 @@
 syn keyword cType FreeSurfaceTopAnalysis
 syn keyword cType GLheightadvectionAnalysis
-syn keyword cType GiaAnalysis
 syn keyword cType HydrologyDCEfficientAnalysis
 syn keyword cType HydrologyDCInefficientAnalysis
@@ -1536,4 +1719,5 @@
 syn keyword cType HydrologyShaktiAnalysis
 syn keyword cType HydrologyShreveAnalysis
+syn keyword cType HydrologyTwsAnalysis
 syn keyword cType L2ProjectionBaseAnalysis
 syn keyword cType L2ProjectionEPLAnalysis
@@ -1542,5 +1726,7 @@
 syn keyword cType MasstransportAnalysis
 syn keyword cType MeltingAnalysis
-syn keyword cType SealevelriseAnalysis
+syn keyword cType OceantransportAnalysis
+syn keyword cType SamplingAnalysis
+syn keyword cType SealevelchangeAnalysis
 syn keyword cType SmbAnalysis
 syn keyword cType SmoothAnalysis
Index: issm/trunk/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- issm/trunk/src/c/shared/Enum/EnumDefinitions.h	(revision 25994)
+++ issm/trunk/src/c/shared/Enum/EnumDefinitions.h	(revision 26744)
@@ -57,4 +57,5 @@
 	AutodiffXpEnum,
 	BalancethicknessStabilizationEnum,
+	BarystaticContributionsEnum,
 	BasalforcingsBottomplumedepthEnum,
 	BasalforcingsCrustthicknessEnum,
@@ -94,4 +95,5 @@
 	BasalforcingsUpperwaterMeltingRateEnum,
 	CalvingCrevasseDepthEnum,
+	CalvingCrevasseThresholdEnum,
 	CalvingHeightAboveFloatationEnum,
 	CalvingLawEnum,
@@ -99,4 +101,5 @@
 	ConfigurationTypeEnum,
 	ConstantsGEnum,
+	ConstantsNewtonGravityEnum,
 	ConstantsReferencetemperatureEnum,
 	ConstantsYtsEnum,
@@ -104,11 +107,13 @@
 	ControlInputSizeNEnum,
 	ControlInputInterpolationEnum,
-	CumBslrEnum,
-	CumBslrIceEnum,
-	CumBslrHydroEnum,
-	CumBslrIcePartitionEnum,
-	CumBslrHydroPartitionEnum,
-	CumGmtslrEnum,
-	CumGmslrEnum,
+	CumBslcEnum,
+	CumBslcIceEnum,
+	CumBslcHydroEnum,
+	CumBslcOceanEnum,
+	CumBslcIcePartitionEnum,
+	CumBslcHydroPartitionEnum,
+	CumBslcOceanPartitionEnum,
+	CumGmtslcEnum,
+	CumGmslcEnum,
 	DamageC1Enum,
 	DamageC2Enum,
@@ -132,6 +137,11 @@
 	DslModelidEnum,
 	DslNummodelsEnum,
-	DslComputeFingerprintsEnum,
+	SolidearthIsExternalEnum,
+	SolidearthExternalNatureEnum,
+	SolidearthExternalModelidEnum,
+	SolidearthExternalNummodelsEnum,
+	SolidearthSettingsComputeBpGrdEnum,
 	EarthIdEnum,
+	ElasticEnum,
 	EplZigZagCounterEnum,
 	EsaHElasticEnum,
@@ -161,10 +171,13 @@
 	FrictionVoidRatioEnum,
 	FrontalForcingsBasinIcefrontAreaEnum,
+	FrontalForcingsAutoregressionInitialTimeEnum,
+   FrontalForcingsAutoregressionTimestepEnum,
+   FrontalForcingsAutoregressiveOrderEnum,
+	FrontalForcingsBeta0Enum,
+   FrontalForcingsBeta1Enum,
 	FrontalForcingsNumberofBasinsEnum,
 	FrontalForcingsParamEnum,
-	GiaModelEnum,
-	GiaModelidEnum,
-	GiaNummodelsEnum,
-	GiaCrossSectionShapeEnum,
+   FrontalForcingsPhiEnum,
+	GrdModelEnum,
 	GroundinglineFrictionInterpolationEnum,
 	GroundinglineMeltInterpolationEnum,
@@ -237,4 +250,6 @@
 	InversionStepThresholdEnum,
 	InversionTypeEnum,
+	IvinsEnum,
+	IsSlcCouplingEnum,
 	LevelsetKillIcebergsEnum,
 	LevelsetReinitFrequencyEnum,
@@ -242,13 +257,24 @@
 	LockFileNameEnum,
 	LoveAllowLayerDeletionEnum,
+	LoveCoreMantleBoundaryEnum,
+	LoveEarthMassEnum,
 	LoveForcingTypeEnum,
 	LoveFrequenciesEnum,
+	LoveIsTemporalEnum,
 	LoveG0Enum,
+	LoveGravitationalConstantEnum,
+	LoveInnerCoreBoundaryEnum,
+	LoveComplexComputationEnum,
+	LoveIntStepsPerLayerEnum,
 	LoveKernelsEnum,
 	LoveMu0Enum,
 	LoveNfreqEnum,
+	LoveNTemporalIterationsEnum,
+	LoveNYiEquationsEnum,
 	LoveR0Enum,
 	LoveShNmaxEnum,
 	LoveShNminEnum,
+	LoveStartingLayerEnum,
+	LoveUnderflowTolEnum,
 	MassFluxSegmentsEnum,
 	MassFluxSegmentsPresentEnum,
@@ -265,8 +291,4 @@
 	MaterialsHeatcapacityEnum,
 	MaterialsLatentheatEnum,
-	MaterialsLithosphereDensityEnum,
-	MaterialsLithosphereShearModulusEnum,
-	MaterialsMantleDensityEnum,
-	MaterialsMantleShearModulusEnum,
 	MaterialsMeltingpointEnum,
 	MaterialsMixedLayerCapacityEnum,
@@ -284,4 +306,5 @@
 	MeshNumberoflayersEnum,
 	MeshNumberofverticesEnum,
+	MeshNumberofelementsEnum,
 	MigrationMaxEnum,
 	ModelIdEnum,
@@ -322,15 +345,29 @@
 	RootPathEnum,
 	ModelnameEnum,
+	SamplingAlphaEnum,
+	SamplingPhiEnum,
+	SamplingNumRequestedOutputsEnum,
+	SamplingRequestedOutputsEnum,
+	SamplingRobinEnum,
+	SamplingSeedEnum,
+	SamplingTauEnum,
 	SaveResultsEnum,
 	SolidearthPartitionIceEnum,
 	SolidearthPartitionHydroEnum,
+	SolidearthPartitionOceanEnum,
 	SolidearthNpartIceEnum,
+	SolidearthNpartOceanEnum,
 	SolidearthNpartHydroEnum,
 	SolidearthPlanetRadiusEnum,
 	SolidearthPlanetAreaEnum,
 	SolidearthSettingsAbstolEnum,
+	SolidearthSettingsCrossSectionShapeEnum,
 	RotationalAngularVelocityEnum,
 	SolidearthSettingsElasticEnum,
-	SealevelriseGeometryDoneEnum,
+	SolidearthSettingsViscousEnum,
+	SealevelchangeGeometryDoneEnum,
+	SealevelchangeViscousNumStepsEnum,
+	SealevelchangeViscousTimesEnum,
+	SealevelchangeViscousIndexEnum,
 	RotationalEquatorialMoiEnum,
 	TidalLoveHEnum,
@@ -341,22 +378,35 @@
 	LoadLoveKEnum,
 	LoadLoveLEnum,
-	SealevelriseGRigidEnum,
-	SealevelriseGElasticEnum,
-	SolidearthSettingsComputesealevelchangeEnum,
+	LoveTimeFreqEnum,
+	LoveIsTimeEnum,
+	SealevelchangeGSelfAttractionEnum,
+	SealevelchangeGViscoElasticEnum,
+	SolidearthSettingsSealevelLoadingEnum,
 	SolidearthSettingsGRDEnum,
-	SolidearthSettingsGlfractionEnum,
 	SolidearthSettingsRunFrequencyEnum,
-	SealevelriseHElasticEnum,
+	SolidearthSettingsTimeAccEnum,
+	SealevelchangeHViscoElasticEnum,
 	SolidearthSettingsHorizEnum,
 	SolidearthSettingsMaxiterEnum,
+	SolidearthSettingsGrdOceanEnum,
 	SolidearthSettingsOceanAreaScalingEnum,
+	StochasticForcingCovarianceEnum,
+	StochasticForcingDefaultDimensionEnum,
+	StochasticForcingDimensionsEnum,
+	StochasticForcingFieldsEnum,
+	StochasticForcingIsEffectivePressureEnum,
+	StochasticForcingIsStochasticForcingEnum,
+	StochasticForcingIsWaterPressureEnum,
+	StochasticForcingNumFieldsEnum,
+	StochasticForcingRandomflagEnum,
 	RotationalPolarMoiEnum,
 	SolidearthSettingsReltolEnum,
-	SealevelriseRequestedOutputsEnum,
-	SolidearthSettingsRigidEnum,
+	SealevelchangeRequestedOutputsEnum,
+	SolidearthSettingsSelfAttractionEnum,
 	SolidearthSettingsRotationEnum,
-	SealevelriseRunCountEnum,
-	SealevelriseTransitionsEnum,
-	SealevelriseUElasticEnum,
+	SolidearthSettingsMaxSHCoeffEnum,
+	SealevelchangeRunCountEnum,
+	SealevelchangeTransitionsEnum,
+	SealevelchangeUViscoElasticEnum,
 	SettingsIoGatherEnum,
 	SettingsNumResultsOnNodesEnum,
@@ -374,5 +424,10 @@
 	SmbAccurefEnum,
 	SmbAdThreshEnum,
+	SmbAutoregressionInitialTimeEnum,
+	SmbAutoregressionTimestepEnum,
+   SmbAutoregressiveOrderEnum,
 	SmbAveragingEnum,
+	SmbBeta0Enum,
+   SmbBeta1Enum,
 	SmbDesfacEnum,
 	SmbDpermilEnum,
@@ -384,13 +439,14 @@
 	SmbDtEnum,
 	SmbEnum,
+	SmbEIdxEnum,
 	SmbFEnum,
 	SmbInitDensityScalingEnum,
 	SmbIsaccumulationEnum,
 	SmbIsalbedoEnum,
-	SmbIsclimatologyEnum,
 	SmbIsconstrainsurfaceTEnum,
 	SmbIsd18opdEnum,
 	SmbIsdelta18oEnum,
 	SmbIsdensificationEnum,
+	SmbIsdeltaLWupEnum,
 	SmbIsfirnwarmingEnum,
 	SmbIsgraingrowthEnum,
@@ -404,6 +460,8 @@
 	SmbIsturbulentfluxEnum,
 	SmbKEnum,
+	SmbNumBasinsEnum,
 	SmbNumRequestedOutputsEnum,
 	SmbPfacEnum,
+	SmbPhiEnum,
 	SmbRdlEnum,
 	SmbRequestedOutputsEnum,
@@ -418,4 +476,5 @@
 	SmbT0dryEnum,
 	SmbT0wetEnum,
+	SmbTeThreshEnum,
 	SmbTdiffEnum,
 	SmbThermoDeltaTScalingEnum,
@@ -457,5 +516,6 @@
 	TimesteppingCouplingTimeEnum,
 	TimesteppingFinalTimeEnum,
-	TimesteppingInterpForcingsEnum,
+	TimesteppingInterpForcingEnum,
+	TimesteppingCycleForcingEnum,
 	TimesteppingStartTimeEnum,
 	TimesteppingTimeStepEnum,
@@ -469,5 +529,4 @@
 	ToolkitsTypesEnum,
 	TransientAmrFrequencyEnum,
-	TransientIscouplerEnum,
 	TransientIsdamageevolutionEnum,
 	TransientIsesaEnum,
@@ -475,8 +534,10 @@
 	TransientIsgroundinglineEnum,
 	TransientIshydrologyEnum,
-	TransientIsmasstransportEnum,
+	TransientIsmasstransportEnum, 
+	TransientIsoceantransportEnum,
 	TransientIsmovingfrontEnum,
 	TransientIsoceancouplingEnum,
-	TransientIsslrEnum,
+	TransientIssamplingEnum,
+	TransientIsslcEnum,
 	TransientIssmbEnum,
 	TransientIsstressbalanceEnum,
@@ -485,4 +546,8 @@
 	TransientRequestedOutputsEnum,
 	VelocityEnum,
+	XxeEnum,
+	YyeEnum,
+	ZzeEnum,
+	AreaeEnum,
 	WorldCommEnum,
 	/*}}}*/
@@ -490,8 +555,15 @@
 	InputsSTARTEnum,
 	/*Inputs{{{*/
+	AccumulatedDeltaBottomPressureEnum,
+	AccumulatedDeltaIceThicknessEnum,
+	AccumulatedDeltaTwsEnum,
 	AdjointEnum,
 	AdjointpEnum,
 	AdjointxEnum,
+	AdjointxBaseEnum,
+	AdjointxShearEnum,
 	AdjointyEnum,
+	AdjointyBaseEnum,
+	AdjointyShearEnum,
 	AdjointzEnum,
 	AirEnum,
@@ -527,7 +599,17 @@
 	BaseSlopeXEnum,
 	BaseSlopeYEnum,
+	BaselineBasalforcingsFloatingiceMeltingRateEnum,
+	BaselineCalvingCalvingrateEnum,
+	BaselineFrictionEffectivePressureEnum,
 	BedEnum,
+	BedGRDEnum,
+	BedEastEnum,
+	BedEastGRDEnum,
+	BedNorthEnum,
+	BedNorthGRDEnum,
 	BedSlopeXEnum,
 	BedSlopeYEnum,
+	BottomPressureEnum,
+	BottomPressureOldEnum,
 	CalvingCalvingrateEnum,
 	CalvingHabFractionEnum,
@@ -551,4 +633,13 @@
 	DegreeOfChannelizationEnum,
 	DepthBelowSurfaceEnum,
+	DeltaIceThicknessEnum,
+	DeltaTwsEnum,
+	DeltaBottomPressureEnum,
+	DeltaDslEnum,
+	DslOldEnum,
+	DslEnum,
+	DeltaStrEnum,
+	StrOldEnum,
+	StrEnum,
 	DeviatoricStresseffectiveEnum,
 	DeviatoricStressxxEnum,
@@ -568,11 +659,4 @@
 	DrivingStressXEnum,
 	DrivingStressYEnum,
-	DslGlobalAverageThermostericSeaLevelChangeEnum,
-	DslSeaSurfaceHeightChangeAboveGeoidEnum,
-	DslSeaWaterPressureChangeAtSeaFloorEnum,
-	DslStericRateEnum,
-	DslDynamicRateEnum,
-	GiaMmeNgiaEnum,
-	GiaMmeUgiaEnum,
 	DummyEnum,
    EffectivePressureEnum,
@@ -587,5 +671,4 @@
 	EplHeadSubstepEnum,
    EplHeadTransientEnum,
-	EsaDeltathicknessEnum,
 	EsaEmotionEnum,
 	EsaNmotionEnum,
@@ -617,6 +700,4 @@
 	FrontalForcingsThermalForcingEnum,
 	GeometryHydrostaticRatioEnum,
-	GiaLithosphereThicknessEnum,
-	GiaMantleViscosityEnum,
 	NGiaEnum,
 	NGiaRateEnum,
@@ -643,4 +724,8 @@
    HydrologyEnglacialInputEnum,
 	HydrologyGapHeightEnum,
+	HydrologyGapHeightXEnum,
+	HydrologyGapHeightXXEnum,
+	HydrologyGapHeightYEnum,
+	HydrologyGapHeightYYEnum,
 	HydrologyHeadEnum,
 	HydrologyHeadOldEnum,
@@ -651,4 +736,7 @@
 	HydrologySheetThicknessEnum,
 	HydrologySheetThicknessOldEnum,
+	HydrologyTwsEnum,
+	HydrologyTwsSpcEnum,
+	HydrologyTwsAnalysisEnum,
 	HydrologyWatercolumnMaxEnum,
 	HydrologyWaterVxEnum,
@@ -665,4 +753,5 @@
 	LevelsetfunctionSlopeXEnum,
 	LevelsetfunctionSlopeYEnum,
+	LevelsetObservationEnum,
 	LoadingforceXEnum,
 	LoadingforceYEnum,
@@ -670,4 +759,5 @@
 	MaskOceanLevelsetEnum,
 	MaskIceLevelsetEnum,
+	MaskIceRefLevelsetEnum,
 	MasstransportSpcthicknessEnum,
 	MaterialsRheologyBEnum,
@@ -685,8 +775,13 @@
 	MeshVertexonsurfaceEnum,
 	MisfitEnum,
+	MovingFrontalVxEnum,
+	MovingFrontalVyEnum,
 	NeumannfluxEnum,
 	NewDamageEnum,
 	NodeEnum,
 	OmegaAbsGradientEnum,
+	OceantransportSpcbottompressureEnum,
+	OceantransportSpcstrEnum,
+	OceantransportSpcdslEnum,
 	P0Enum,
 	P1Enum,
@@ -703,32 +798,80 @@
 	RheologyBInitialguessMisfitEnum,
 	RheologyBbarAbsGradientEnum,
+	SampleEnum,
+	SamplingBetaEnum,
+	SamplingKappaEnum,
 	SealevelEnum,
-	SealevelEustaticMaskEnum,
-	SealevelEustaticOceanMaskEnum,
+	SealevelGRDEnum,
+	SealevelBarystaticMaskEnum,
+	SealevelBarystaticIceMaskEnum,
+	SealevelBarystaticIceWeightsEnum,
+	SealevelBarystaticIceAreaEnum,
+	SealevelBarystaticIceLatbarEnum,
+	SealevelBarystaticIceLongbarEnum,
+	SealevelBarystaticIceLoadEnum,
+	SealevelBarystaticHydroMaskEnum,
+	SealevelBarystaticHydroWeightsEnum,
+	SealevelBarystaticHydroAreaEnum,
+	SealevelBarystaticHydroLatbarEnum,
+	SealevelBarystaticHydroLongbarEnum,
+	SealevelBarystaticHydroLoadEnum,
+	SealevelBarystaticBpMaskEnum,
+	SealevelBarystaticBpWeightsEnum,
+	SealevelBarystaticBpAreaEnum,
+	SealevelBarystaticBpLoadEnum,
+	SealevelBarystaticOceanMaskEnum,
+	SealevelBarystaticOceanWeightsEnum,
+	SealevelBarystaticOceanAreaEnum,
+	SealevelBarystaticOceanLatbarEnum,
+	SealevelBarystaticOceanLongbarEnum,
+	SealevelBarystaticOceanLoadEnum,
 	SealevelNEsaEnum,
 	SealevelNEsaRateEnum,
 	SealevelRSLEnum,
-	BslrEnum,
-	BslrIceEnum,
-	BslrHydroEnum,
-	BslrRateEnum,
-	GmtslrEnum,
-	SealevelRSLEustaticEnum,
-	SealevelRSLEustaticRateEnum,
+	BslcEnum,
+	BslcIceEnum,
+	BslcHydroEnum,
+	BslcOceanEnum,
+	BslcRateEnum,
+	GmtslcEnum,
+	SealevelGrotm1Enum,
+	SealevelGrotm2Enum,
+	SealevelGrotm3Enum,
+	SealevelGUrotm1Enum,
+	SealevelGUrotm2Enum,
+	SealevelGUrotm3Enum,
+	SealevelGNrotm1Enum,
+	SealevelGNrotm2Enum,
+	SealevelGNrotm3Enum,
+	SealevelGErotm1Enum,
+	SealevelGErotm2Enum,
+	SealevelGErotm3Enum,
+	SealevelRSLBarystaticEnum,
 	SealevelRSLRateEnum,
+	SealevelUGrdEnum,
+	SealevelNGrdEnum,
 	SealevelUEastEsaEnum,
-	SealevelUEsaEnum,
-	SealevelUEsaRateEnum,
 	SealevelUNorthEsaEnum,
-	SealevelriseCumDeltathicknessEnum,
-	SealevelriseCumDeltathicknessOldEnum,
-	SurfaceloadOtherEnum,
-	SurfaceloadIceThicknessChangeEnum,
-	SurfaceloadWaterHeightChangeEnum,
-	SealevelriseIndicesEnum,
-	SealevelriseGEnum,
-	SealevelriseGUEnum,
-	SealevelriseGEEnum,
-	SealevelriseGNEnum,
+	SealevelchangeIndicesEnum,
+	SealevelchangeGEnum,
+	SealevelchangeGUEnum,
+	SealevelchangeGEEnum,
+	SealevelchangeGNEnum,
+	SealevelchangeGsubelOceanEnum,
+	SealevelchangeGUsubelOceanEnum,
+	SealevelchangeGEsubelOceanEnum,
+	SealevelchangeGNsubelOceanEnum,
+	SealevelchangeGsubelIceEnum,
+	SealevelchangeGUsubelIceEnum,
+	SealevelchangeGEsubelIceEnum,
+	SealevelchangeGNsubelIceEnum,
+	SealevelchangeGsubelHydroEnum,
+	SealevelchangeGUsubelHydroEnum,
+	SealevelchangeGEsubelHydroEnum,
+	SealevelchangeGNsubelHydroEnum,
+	SealevelchangeViscousRSLEnum,
+	SealevelchangeViscousUEnum,
+	SealevelchangeViscousNEnum,
+	SealevelchangeViscousEEnum,
 	SedimentHeadEnum,
 	SedimentHeadOldEnum,
@@ -743,9 +886,15 @@
 	SmbAccumulatedMeltEnum,
 	SmbAccumulatedPrecipitationEnum,
+	SmbAccumulatedRainEnum,
+	SmbAccumulatedRefreezeEnum,
 	SmbAccumulatedRunoffEnum,
 	SmbAEnum,
+	SmbAdiffEnum,
 	SmbAValueEnum,
 	SmbAccumulationEnum,
+	SmbAdiffiniEnum,
 	SmbAiniEnum,
+   SmbAutoregressionNoiseEnum,
+	SmbBasinsIdEnum,
 	SmbBMaxEnum,
 	SmbBMinEnum,
@@ -753,4 +902,7 @@
 	SmbBPosEnum,
 	SmbCEnum,
+	SmbCcsnowValueEnum,
+	SmbCciceValueEnum,
+	SmbCotValueEnum,
 	SmbDEnum,
 	SmbDailyairdensityEnum,
@@ -765,5 +917,7 @@
 	SmbDiniEnum,
 	SmbDlwrfEnum,
+	SmbDulwrfValueEnum,
 	SmbDswrfEnum,
+	SmbDswdiffrfEnum,
 	SmbDzAddEnum,
 	SmbDzEnum,
@@ -785,5 +939,4 @@
 	SmbIsInitializedEnum,
 	SmbMAddEnum,
-	SmbMassBalanceClimateEnum,
 	SmbMassBalanceEnum,
    SmbMassBalanceSubstepEnum,
@@ -807,4 +960,5 @@
 	SmbPrecipitationsPresentdayEnum,
 	SmbPrecipitationsReconstructedEnum,
+	SmbRainEnum,
 	SmbReEnum,
 	SmbRefreezeEnum,
@@ -819,4 +973,5 @@
 	SmbSmbCorrEnum,
 	SmbSmbrefEnum,
+	SmbSzaValueEnum,
 	SmbTEnum,
 	SmbTaEnum,
@@ -829,4 +984,5 @@
 	SmbTmeanEnum,
 	SmbTzEnum,
+	SmbValuesAutoregressionEnum,
 	SmbVEnum,
 	SmbVmeanEnum,
@@ -839,4 +995,9 @@
 	SmbZTopEnum,
 	SmbZYEnum,
+	SolidearthExternalDisplacementEastRateEnum,
+	SolidearthExternalDisplacementNorthRateEnum,
+	SolidearthExternalDisplacementUpRateEnum,
+	SolidearthExternalGeoidRateEnum,
+	StochasticForcingDefaultIdEnum,
 	StrainRateeffectiveEnum,
 	StrainRateparallelEnum,
@@ -874,4 +1035,6 @@
 	TemperaturePicardEnum,
 	TemperatureSEMICEnum,
+   ThermalforcingAutoregressionNoiseEnum,
+	ThermalforcingValuesAutoregressionEnum,	
 	ThermalSpctemperatureEnum,
 	ThicknessAbsGradientEnum,
@@ -883,13 +1046,20 @@
 	ThicknessPositiveEnum,
 	ThicknessResidualEnum,
+	TransientAccumulatedDeltaIceThicknessEnum,
 	VelEnum,
 	VxAverageEnum,
+	VxBaseEnum,
 	VxEnum,
 	VxMeshEnum,
 	VxObsEnum,
+	VxShearEnum,
+	VxSurfaceEnum,
 	VyAverageEnum,
+	VyBaseEnum,
 	VyEnum,
 	VyMeshEnum,
 	VyObsEnum,
+	VyShearEnum,
+	VySurfaceEnum,
 	VzEnum,
 	VzFSEnum,
@@ -903,5 +1073,11 @@
 	WaterfractionEnum,
 	WaterheightEnum,
+	FrictionWaterPressureEnum,
+	FrictionWaterPressureNoiseEnum,
+	WeightsLevelsetObservationEnum,
 	WeightsSurfaceObservationEnum,
+	OldAccumulatedDeltaBottomPressureEnum,
+	OldAccumulatedDeltaIceThicknessEnum,
+	OldAccumulatedDeltaTwsEnum,
 	Outputdefinition1Enum,
 	Outputdefinition10Enum,
@@ -1045,4 +1221,5 @@
 	CfsurfacelogvelEnum,
 	CfsurfacesquareEnum,
+	CflevelsetmisfitEnum,
 	ChannelEnum,
 	ChannelAreaEnum,
@@ -1110,4 +1287,5 @@
 	FrontalForcingsDefaultEnum,
 	FrontalForcingsRignotEnum,
+	FrontalForcingsRignotAutoregressionEnum,
 	FsetEnum,
 	FullMeltOnPartiallyFloatingEnum,
@@ -1120,6 +1298,4 @@
 	GenericParamEnum,
 	GenericExternalResultEnum,
-	GiaAnalysisEnum,
-	GiaSolutionEnum,
 	Gradient1Enum,
 	Gradient2Enum,
@@ -1241,4 +1417,6 @@
 	NyeH2OEnum,
 	NumericalfluxEnum,
+	OceantransportAnalysisEnum,
+	OceantransportSolutionEnum,
 	OldGradientEnum,
 	OneLayerP4zEnum,
@@ -1275,5 +1453,8 @@
 	RecoveryAnalysisEnum,
 	RiftfrontEnum,
+	SamplingAnalysisEnum,
+	SamplingSolutionEnum,
 	SIAApproximationEnum,
+	SMBautoregressionEnum,
 	SMBcomponentsEnum,
 	SMBd18opddEnum,
@@ -1298,8 +1479,8 @@
 	SealevelInertiaTensorYZEnum,
 	SealevelInertiaTensorZZEnum,
+	SealevelchangePolarMotionEnum,
 	SealevelNmotionEnum,
 	SealevelUmotionEnum,
-	SealevelriseAnalysisEnum,
-	SealevelriseSolutionEnum,
+	SealevelchangeAnalysisEnum,
 	SegEnum,
 	SegInputEnum,
Index: issm/trunk/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- issm/trunk/src/c/shared/Enum/EnumToStringx.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/Enum/EnumToStringx.cpp	(revision 26744)
@@ -65,4 +65,5 @@
 		case AutodiffXpEnum : return "AutodiffXp";
 		case BalancethicknessStabilizationEnum : return "BalancethicknessStabilization";
+		case BarystaticContributionsEnum : return "BarystaticContributions";
 		case BasalforcingsBottomplumedepthEnum : return "BasalforcingsBottomplumedepth";
 		case BasalforcingsCrustthicknessEnum : return "BasalforcingsCrustthickness";
@@ -102,4 +103,5 @@
 		case BasalforcingsUpperwaterMeltingRateEnum : return "BasalforcingsUpperwaterMeltingRate";
 		case CalvingCrevasseDepthEnum : return "CalvingCrevasseDepth";
+		case CalvingCrevasseThresholdEnum : return "CalvingCrevasseThreshold";
 		case CalvingHeightAboveFloatationEnum : return "CalvingHeightAboveFloatation";
 		case CalvingLawEnum : return "CalvingLaw";
@@ -107,4 +109,5 @@
 		case ConfigurationTypeEnum : return "ConfigurationType";
 		case ConstantsGEnum : return "ConstantsG";
+		case ConstantsNewtonGravityEnum : return "ConstantsNewtonGravity";
 		case ConstantsReferencetemperatureEnum : return "ConstantsReferencetemperature";
 		case ConstantsYtsEnum : return "ConstantsYts";
@@ -112,11 +115,13 @@
 		case ControlInputSizeNEnum : return "ControlInputSizeN";
 		case ControlInputInterpolationEnum : return "ControlInputInterpolation";
-		case CumBslrEnum : return "CumBslr";
-		case CumBslrIceEnum : return "CumBslrIce";
-		case CumBslrHydroEnum : return "CumBslrHydro";
-		case CumBslrIcePartitionEnum : return "CumBslrIcePartition";
-		case CumBslrHydroPartitionEnum : return "CumBslrHydroPartition";
-		case CumGmtslrEnum : return "CumGmtslr";
-		case CumGmslrEnum : return "CumGmslr";
+		case CumBslcEnum : return "CumBslc";
+		case CumBslcIceEnum : return "CumBslcIce";
+		case CumBslcHydroEnum : return "CumBslcHydro";
+		case CumBslcOceanEnum : return "CumBslcOcean";
+		case CumBslcIcePartitionEnum : return "CumBslcIcePartition";
+		case CumBslcHydroPartitionEnum : return "CumBslcHydroPartition";
+		case CumBslcOceanPartitionEnum : return "CumBslcOceanPartition";
+		case CumGmtslcEnum : return "CumGmtslc";
+		case CumGmslcEnum : return "CumGmslc";
 		case DamageC1Enum : return "DamageC1";
 		case DamageC2Enum : return "DamageC2";
@@ -140,6 +145,11 @@
 		case DslModelidEnum : return "DslModelid";
 		case DslNummodelsEnum : return "DslNummodels";
-		case DslComputeFingerprintsEnum : return "DslComputeFingerprints";
+		case SolidearthIsExternalEnum : return "SolidearthIsExternal";
+		case SolidearthExternalNatureEnum : return "SolidearthExternalNature";
+		case SolidearthExternalModelidEnum : return "SolidearthExternalModelid";
+		case SolidearthExternalNummodelsEnum : return "SolidearthExternalNummodels";
+		case SolidearthSettingsComputeBpGrdEnum : return "SolidearthSettingsComputeBpGrd";
 		case EarthIdEnum : return "EarthId";
+		case ElasticEnum : return "Elastic";
 		case EplZigZagCounterEnum : return "EplZigZagCounter";
 		case EsaHElasticEnum : return "EsaHElastic";
@@ -169,10 +179,13 @@
 		case FrictionVoidRatioEnum : return "FrictionVoidRatio";
 		case FrontalForcingsBasinIcefrontAreaEnum : return "FrontalForcingsBasinIcefrontArea";
+		case FrontalForcingsAutoregressionInitialTimeEnum : return "FrontalForcingsAutoregressionInitialTime";
+		case FrontalForcingsAutoregressionTimestepEnum : return "FrontalForcingsAutoregressionTimestep";
+		case FrontalForcingsAutoregressiveOrderEnum : return "FrontalForcingsAutoregressiveOrder";
+		case FrontalForcingsBeta0Enum : return "FrontalForcingsBeta0";
+		case FrontalForcingsBeta1Enum : return "FrontalForcingsBeta1";
 		case FrontalForcingsNumberofBasinsEnum : return "FrontalForcingsNumberofBasins";
 		case FrontalForcingsParamEnum : return "FrontalForcingsParam";
-		case GiaModelEnum : return "GiaModel";
-		case GiaModelidEnum : return "GiaModelid";
-		case GiaNummodelsEnum : return "GiaNummodels";
-		case GiaCrossSectionShapeEnum : return "GiaCrossSectionShape";
+		case FrontalForcingsPhiEnum : return "FrontalForcingsPhi";
+		case GrdModelEnum : return "GrdModel";
 		case GroundinglineFrictionInterpolationEnum : return "GroundinglineFrictionInterpolation";
 		case GroundinglineMeltInterpolationEnum : return "GroundinglineMeltInterpolation";
@@ -245,4 +258,6 @@
 		case InversionStepThresholdEnum : return "InversionStepThreshold";
 		case InversionTypeEnum : return "InversionType";
+		case IvinsEnum : return "Ivins";
+		case IsSlcCouplingEnum : return "IsSlcCoupling";
 		case LevelsetKillIcebergsEnum : return "LevelsetKillIcebergs";
 		case LevelsetReinitFrequencyEnum : return "LevelsetReinitFrequency";
@@ -250,13 +265,24 @@
 		case LockFileNameEnum : return "LockFileName";
 		case LoveAllowLayerDeletionEnum : return "LoveAllowLayerDeletion";
+		case LoveCoreMantleBoundaryEnum : return "LoveCoreMantleBoundary";
+		case LoveEarthMassEnum : return "LoveEarthMass";
 		case LoveForcingTypeEnum : return "LoveForcingType";
 		case LoveFrequenciesEnum : return "LoveFrequencies";
+		case LoveIsTemporalEnum : return "LoveIsTemporal";
 		case LoveG0Enum : return "LoveG0";
+		case LoveGravitationalConstantEnum : return "LoveGravitationalConstant";
+		case LoveInnerCoreBoundaryEnum : return "LoveInnerCoreBoundary";
+		case LoveComplexComputationEnum : return "LoveComplexComputation";
+		case LoveIntStepsPerLayerEnum : return "LoveIntStepsPerLayer";
 		case LoveKernelsEnum : return "LoveKernels";
 		case LoveMu0Enum : return "LoveMu0";
 		case LoveNfreqEnum : return "LoveNfreq";
+		case LoveNTemporalIterationsEnum : return "LoveNTemporalIterations";
+		case LoveNYiEquationsEnum : return "LoveNYiEquations";
 		case LoveR0Enum : return "LoveR0";
 		case LoveShNmaxEnum : return "LoveShNmax";
 		case LoveShNminEnum : return "LoveShNmin";
+		case LoveStartingLayerEnum : return "LoveStartingLayer";
+		case LoveUnderflowTolEnum : return "LoveUnderflowTol";
 		case MassFluxSegmentsEnum : return "MassFluxSegments";
 		case MassFluxSegmentsPresentEnum : return "MassFluxSegmentsPresent";
@@ -273,8 +299,4 @@
 		case MaterialsHeatcapacityEnum : return "MaterialsHeatcapacity";
 		case MaterialsLatentheatEnum : return "MaterialsLatentheat";
-		case MaterialsLithosphereDensityEnum : return "MaterialsLithosphereDensity";
-		case MaterialsLithosphereShearModulusEnum : return "MaterialsLithosphereShearModulus";
-		case MaterialsMantleDensityEnum : return "MaterialsMantleDensity";
-		case MaterialsMantleShearModulusEnum : return "MaterialsMantleShearModulus";
 		case MaterialsMeltingpointEnum : return "MaterialsMeltingpoint";
 		case MaterialsMixedLayerCapacityEnum : return "MaterialsMixedLayerCapacity";
@@ -292,4 +314,5 @@
 		case MeshNumberoflayersEnum : return "MeshNumberoflayers";
 		case MeshNumberofverticesEnum : return "MeshNumberofvertices";
+		case MeshNumberofelementsEnum : return "MeshNumberofelements";
 		case MigrationMaxEnum : return "MigrationMax";
 		case ModelIdEnum : return "ModelId";
@@ -330,15 +353,29 @@
 		case RootPathEnum : return "RootPath";
 		case ModelnameEnum : return "Modelname";
+		case SamplingAlphaEnum : return "SamplingAlpha";
+		case SamplingPhiEnum : return "SamplingPhi";
+		case SamplingNumRequestedOutputsEnum : return "SamplingNumRequestedOutputs";
+		case SamplingRequestedOutputsEnum : return "SamplingRequestedOutputs";
+		case SamplingRobinEnum : return "SamplingRobin";
+		case SamplingSeedEnum : return "SamplingSeed";
+		case SamplingTauEnum : return "SamplingTau";
 		case SaveResultsEnum : return "SaveResults";
 		case SolidearthPartitionIceEnum : return "SolidearthPartitionIce";
 		case SolidearthPartitionHydroEnum : return "SolidearthPartitionHydro";
+		case SolidearthPartitionOceanEnum : return "SolidearthPartitionOcean";
 		case SolidearthNpartIceEnum : return "SolidearthNpartIce";
+		case SolidearthNpartOceanEnum : return "SolidearthNpartOcean";
 		case SolidearthNpartHydroEnum : return "SolidearthNpartHydro";
 		case SolidearthPlanetRadiusEnum : return "SolidearthPlanetRadius";
 		case SolidearthPlanetAreaEnum : return "SolidearthPlanetArea";
 		case SolidearthSettingsAbstolEnum : return "SolidearthSettingsAbstol";
+		case SolidearthSettingsCrossSectionShapeEnum : return "SolidearthSettingsCrossSectionShape";
 		case RotationalAngularVelocityEnum : return "RotationalAngularVelocity";
 		case SolidearthSettingsElasticEnum : return "SolidearthSettingsElastic";
-		case SealevelriseGeometryDoneEnum : return "SealevelriseGeometryDone";
+		case SolidearthSettingsViscousEnum : return "SolidearthSettingsViscous";
+		case SealevelchangeGeometryDoneEnum : return "SealevelchangeGeometryDone";
+		case SealevelchangeViscousNumStepsEnum : return "SealevelchangeViscousNumSteps";
+		case SealevelchangeViscousTimesEnum : return "SealevelchangeViscousTimes";
+		case SealevelchangeViscousIndexEnum : return "SealevelchangeViscousIndex";
 		case RotationalEquatorialMoiEnum : return "RotationalEquatorialMoi";
 		case TidalLoveHEnum : return "TidalLoveH";
@@ -349,22 +386,35 @@
 		case LoadLoveKEnum : return "LoadLoveK";
 		case LoadLoveLEnum : return "LoadLoveL";
-		case SealevelriseGRigidEnum : return "SealevelriseGRigid";
-		case SealevelriseGElasticEnum : return "SealevelriseGElastic";
-		case SolidearthSettingsComputesealevelchangeEnum : return "SolidearthSettingsComputesealevelchange";
+		case LoveTimeFreqEnum : return "LoveTimeFreq";
+		case LoveIsTimeEnum : return "LoveIsTime";
+		case SealevelchangeGSelfAttractionEnum : return "SealevelchangeGSelfAttraction";
+		case SealevelchangeGViscoElasticEnum : return "SealevelchangeGViscoElastic";
+		case SolidearthSettingsSealevelLoadingEnum : return "SolidearthSettingsSealevelLoading";
 		case SolidearthSettingsGRDEnum : return "SolidearthSettingsGRD";
-		case SolidearthSettingsGlfractionEnum : return "SolidearthSettingsGlfraction";
 		case SolidearthSettingsRunFrequencyEnum : return "SolidearthSettingsRunFrequency";
-		case SealevelriseHElasticEnum : return "SealevelriseHElastic";
+		case SolidearthSettingsTimeAccEnum : return "SolidearthSettingsTimeAcc";
+		case SealevelchangeHViscoElasticEnum : return "SealevelchangeHViscoElastic";
 		case SolidearthSettingsHorizEnum : return "SolidearthSettingsHoriz";
 		case SolidearthSettingsMaxiterEnum : return "SolidearthSettingsMaxiter";
+		case SolidearthSettingsGrdOceanEnum : return "SolidearthSettingsGrdOcean";
 		case SolidearthSettingsOceanAreaScalingEnum : return "SolidearthSettingsOceanAreaScaling";
+		case StochasticForcingCovarianceEnum : return "StochasticForcingCovariance";
+		case StochasticForcingDefaultDimensionEnum : return "StochasticForcingDefaultDimension";
+		case StochasticForcingDimensionsEnum : return "StochasticForcingDimensions";
+		case StochasticForcingFieldsEnum : return "StochasticForcingFields";
+		case StochasticForcingIsEffectivePressureEnum : return "StochasticForcingIsEffectivePressure";
+		case StochasticForcingIsStochasticForcingEnum : return "StochasticForcingIsStochasticForcing";
+		case StochasticForcingIsWaterPressureEnum : return "StochasticForcingIsWaterPressure";
+		case StochasticForcingNumFieldsEnum : return "StochasticForcingNumFields";
+		case StochasticForcingRandomflagEnum : return "StochasticForcingRandomflag";
 		case RotationalPolarMoiEnum : return "RotationalPolarMoi";
 		case SolidearthSettingsReltolEnum : return "SolidearthSettingsReltol";
-		case SealevelriseRequestedOutputsEnum : return "SealevelriseRequestedOutputs";
-		case SolidearthSettingsRigidEnum : return "SolidearthSettingsRigid";
+		case SealevelchangeRequestedOutputsEnum : return "SealevelchangeRequestedOutputs";
+		case SolidearthSettingsSelfAttractionEnum : return "SolidearthSettingsSelfAttraction";
 		case SolidearthSettingsRotationEnum : return "SolidearthSettingsRotation";
-		case SealevelriseRunCountEnum : return "SealevelriseRunCount";
-		case SealevelriseTransitionsEnum : return "SealevelriseTransitions";
-		case SealevelriseUElasticEnum : return "SealevelriseUElastic";
+		case SolidearthSettingsMaxSHCoeffEnum : return "SolidearthSettingsMaxSHCoeff";
+		case SealevelchangeRunCountEnum : return "SealevelchangeRunCount";
+		case SealevelchangeTransitionsEnum : return "SealevelchangeTransitions";
+		case SealevelchangeUViscoElasticEnum : return "SealevelchangeUViscoElastic";
 		case SettingsIoGatherEnum : return "SettingsIoGather";
 		case SettingsNumResultsOnNodesEnum : return "SettingsNumResultsOnNodes";
@@ -382,5 +432,10 @@
 		case SmbAccurefEnum : return "SmbAccuref";
 		case SmbAdThreshEnum : return "SmbAdThresh";
+		case SmbAutoregressionInitialTimeEnum : return "SmbAutoregressionInitialTime";
+		case SmbAutoregressionTimestepEnum : return "SmbAutoregressionTimestep";
+		case SmbAutoregressiveOrderEnum : return "SmbAutoregressiveOrder";
 		case SmbAveragingEnum : return "SmbAveraging";
+		case SmbBeta0Enum : return "SmbBeta0";
+		case SmbBeta1Enum : return "SmbBeta1";
 		case SmbDesfacEnum : return "SmbDesfac";
 		case SmbDpermilEnum : return "SmbDpermil";
@@ -392,13 +447,14 @@
 		case SmbDtEnum : return "SmbDt";
 		case SmbEnum : return "Smb";
+		case SmbEIdxEnum : return "SmbEIdx";
 		case SmbFEnum : return "SmbF";
 		case SmbInitDensityScalingEnum : return "SmbInitDensityScaling";
 		case SmbIsaccumulationEnum : return "SmbIsaccumulation";
 		case SmbIsalbedoEnum : return "SmbIsalbedo";
-		case SmbIsclimatologyEnum : return "SmbIsclimatology";
 		case SmbIsconstrainsurfaceTEnum : return "SmbIsconstrainsurfaceT";
 		case SmbIsd18opdEnum : return "SmbIsd18opd";
 		case SmbIsdelta18oEnum : return "SmbIsdelta18o";
 		case SmbIsdensificationEnum : return "SmbIsdensification";
+		case SmbIsdeltaLWupEnum : return "SmbIsdeltaLWup";
 		case SmbIsfirnwarmingEnum : return "SmbIsfirnwarming";
 		case SmbIsgraingrowthEnum : return "SmbIsgraingrowth";
@@ -412,6 +468,8 @@
 		case SmbIsturbulentfluxEnum : return "SmbIsturbulentflux";
 		case SmbKEnum : return "SmbK";
+		case SmbNumBasinsEnum : return "SmbNumBasins";
 		case SmbNumRequestedOutputsEnum : return "SmbNumRequestedOutputs";
 		case SmbPfacEnum : return "SmbPfac";
+		case SmbPhiEnum : return "SmbPhi";
 		case SmbRdlEnum : return "SmbRdl";
 		case SmbRequestedOutputsEnum : return "SmbRequestedOutputs";
@@ -426,4 +484,5 @@
 		case SmbT0dryEnum : return "SmbT0dry";
 		case SmbT0wetEnum : return "SmbT0wet";
+		case SmbTeThreshEnum : return "SmbTeThresh";
 		case SmbTdiffEnum : return "SmbTdiff";
 		case SmbThermoDeltaTScalingEnum : return "SmbThermoDeltaTScaling";
@@ -465,5 +524,6 @@
 		case TimesteppingCouplingTimeEnum : return "TimesteppingCouplingTime";
 		case TimesteppingFinalTimeEnum : return "TimesteppingFinalTime";
-		case TimesteppingInterpForcingsEnum : return "TimesteppingInterpForcings";
+		case TimesteppingInterpForcingEnum : return "TimesteppingInterpForcing";
+		case TimesteppingCycleForcingEnum : return "TimesteppingCycleForcing";
 		case TimesteppingStartTimeEnum : return "TimesteppingStartTime";
 		case TimesteppingTimeStepEnum : return "TimesteppingTimeStep";
@@ -477,5 +537,4 @@
 		case ToolkitsTypesEnum : return "ToolkitsTypes";
 		case TransientAmrFrequencyEnum : return "TransientAmrFrequency";
-		case TransientIscouplerEnum : return "TransientIscoupler";
 		case TransientIsdamageevolutionEnum : return "TransientIsdamageevolution";
 		case TransientIsesaEnum : return "TransientIsesa";
@@ -484,7 +543,9 @@
 		case TransientIshydrologyEnum : return "TransientIshydrology";
 		case TransientIsmasstransportEnum : return "TransientIsmasstransport";
+		case TransientIsoceantransportEnum : return "TransientIsoceantransport";
 		case TransientIsmovingfrontEnum : return "TransientIsmovingfront";
 		case TransientIsoceancouplingEnum : return "TransientIsoceancoupling";
-		case TransientIsslrEnum : return "TransientIsslr";
+		case TransientIssamplingEnum : return "TransientIssampling";
+		case TransientIsslcEnum : return "TransientIsslc";
 		case TransientIssmbEnum : return "TransientIssmb";
 		case TransientIsstressbalanceEnum : return "TransientIsstressbalance";
@@ -493,11 +554,22 @@
 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
 		case VelocityEnum : return "Velocity";
+		case XxeEnum : return "Xxe";
+		case YyeEnum : return "Yye";
+		case ZzeEnum : return "Zze";
+		case AreaeEnum : return "Areae";
 		case WorldCommEnum : return "WorldComm";
 		case ParametersENDEnum : return "ParametersEND";
 		case InputsSTARTEnum : return "InputsSTART";
+		case AccumulatedDeltaBottomPressureEnum : return "AccumulatedDeltaBottomPressure";
+		case AccumulatedDeltaIceThicknessEnum : return "AccumulatedDeltaIceThickness";
+		case AccumulatedDeltaTwsEnum : return "AccumulatedDeltaTws";
 		case AdjointEnum : return "Adjoint";
 		case AdjointpEnum : return "Adjointp";
 		case AdjointxEnum : return "Adjointx";
+		case AdjointxBaseEnum : return "AdjointxBase";
+		case AdjointxShearEnum : return "AdjointxShear";
 		case AdjointyEnum : return "Adjointy";
+		case AdjointyBaseEnum : return "AdjointyBase";
+		case AdjointyShearEnum : return "AdjointyShear";
 		case AdjointzEnum : return "Adjointz";
 		case AirEnum : return "Air";
@@ -533,7 +605,17 @@
 		case BaseSlopeXEnum : return "BaseSlopeX";
 		case BaseSlopeYEnum : return "BaseSlopeY";
+		case BaselineBasalforcingsFloatingiceMeltingRateEnum : return "BaselineBasalforcingsFloatingiceMeltingRate";
+		case BaselineCalvingCalvingrateEnum : return "BaselineCalvingCalvingrate";
+		case BaselineFrictionEffectivePressureEnum : return "BaselineFrictionEffectivePressure";
 		case BedEnum : return "Bed";
+		case BedGRDEnum : return "BedGRD";
+		case BedEastEnum : return "BedEast";
+		case BedEastGRDEnum : return "BedEastGRD";
+		case BedNorthEnum : return "BedNorth";
+		case BedNorthGRDEnum : return "BedNorthGRD";
 		case BedSlopeXEnum : return "BedSlopeX";
 		case BedSlopeYEnum : return "BedSlopeY";
+		case BottomPressureEnum : return "BottomPressure";
+		case BottomPressureOldEnum : return "BottomPressureOld";
 		case CalvingCalvingrateEnum : return "CalvingCalvingrate";
 		case CalvingHabFractionEnum : return "CalvingHabFraction";
@@ -557,4 +639,13 @@
 		case DegreeOfChannelizationEnum : return "DegreeOfChannelization";
 		case DepthBelowSurfaceEnum : return "DepthBelowSurface";
+		case DeltaIceThicknessEnum : return "DeltaIceThickness";
+		case DeltaTwsEnum : return "DeltaTws";
+		case DeltaBottomPressureEnum : return "DeltaBottomPressure";
+		case DeltaDslEnum : return "DeltaDsl";
+		case DslOldEnum : return "DslOld";
+		case DslEnum : return "Dsl";
+		case DeltaStrEnum : return "DeltaStr";
+		case StrOldEnum : return "StrOld";
+		case StrEnum : return "Str";
 		case DeviatoricStresseffectiveEnum : return "DeviatoricStresseffective";
 		case DeviatoricStressxxEnum : return "DeviatoricStressxx";
@@ -574,11 +665,4 @@
 		case DrivingStressXEnum : return "DrivingStressX";
 		case DrivingStressYEnum : return "DrivingStressY";
-		case DslGlobalAverageThermostericSeaLevelChangeEnum : return "DslGlobalAverageThermostericSeaLevelChange";
-		case DslSeaSurfaceHeightChangeAboveGeoidEnum : return "DslSeaSurfaceHeightChangeAboveGeoid";
-		case DslSeaWaterPressureChangeAtSeaFloorEnum : return "DslSeaWaterPressureChangeAtSeaFloor";
-		case DslStericRateEnum : return "DslStericRate";
-		case DslDynamicRateEnum : return "DslDynamicRate";
-		case GiaMmeNgiaEnum : return "GiaMmeNgia";
-		case GiaMmeUgiaEnum : return "GiaMmeUgia";
 		case DummyEnum : return "Dummy";
 		case EffectivePressureEnum : return "EffectivePressure";
@@ -593,5 +677,4 @@
 		case EplHeadSubstepEnum : return "EplHeadSubstep";
 		case EplHeadTransientEnum : return "EplHeadTransient";
-		case EsaDeltathicknessEnum : return "EsaDeltathickness";
 		case EsaEmotionEnum : return "EsaEmotion";
 		case EsaNmotionEnum : return "EsaNmotion";
@@ -623,6 +706,4 @@
 		case FrontalForcingsThermalForcingEnum : return "FrontalForcingsThermalForcing";
 		case GeometryHydrostaticRatioEnum : return "GeometryHydrostaticRatio";
-		case GiaLithosphereThicknessEnum : return "GiaLithosphereThickness";
-		case GiaMantleViscosityEnum : return "GiaMantleViscosity";
 		case NGiaEnum : return "NGia";
 		case NGiaRateEnum : return "NGiaRate";
@@ -649,4 +730,8 @@
 		case HydrologyEnglacialInputEnum : return "HydrologyEnglacialInput";
 		case HydrologyGapHeightEnum : return "HydrologyGapHeight";
+		case HydrologyGapHeightXEnum : return "HydrologyGapHeightX";
+		case HydrologyGapHeightXXEnum : return "HydrologyGapHeightXX";
+		case HydrologyGapHeightYEnum : return "HydrologyGapHeightY";
+		case HydrologyGapHeightYYEnum : return "HydrologyGapHeightYY";
 		case HydrologyHeadEnum : return "HydrologyHead";
 		case HydrologyHeadOldEnum : return "HydrologyHeadOld";
@@ -657,4 +742,7 @@
 		case HydrologySheetThicknessEnum : return "HydrologySheetThickness";
 		case HydrologySheetThicknessOldEnum : return "HydrologySheetThicknessOld";
+		case HydrologyTwsEnum : return "HydrologyTws";
+		case HydrologyTwsSpcEnum : return "HydrologyTwsSpc";
+		case HydrologyTwsAnalysisEnum : return "HydrologyTwsAnalysis";
 		case HydrologyWatercolumnMaxEnum : return "HydrologyWatercolumnMax";
 		case HydrologyWaterVxEnum : return "HydrologyWaterVx";
@@ -671,4 +759,5 @@
 		case LevelsetfunctionSlopeXEnum : return "LevelsetfunctionSlopeX";
 		case LevelsetfunctionSlopeYEnum : return "LevelsetfunctionSlopeY";
+		case LevelsetObservationEnum : return "LevelsetObservation";
 		case LoadingforceXEnum : return "LoadingforceX";
 		case LoadingforceYEnum : return "LoadingforceY";
@@ -676,4 +765,5 @@
 		case MaskOceanLevelsetEnum : return "MaskOceanLevelset";
 		case MaskIceLevelsetEnum : return "MaskIceLevelset";
+		case MaskIceRefLevelsetEnum : return "MaskIceRefLevelset";
 		case MasstransportSpcthicknessEnum : return "MasstransportSpcthickness";
 		case MaterialsRheologyBEnum : return "MaterialsRheologyB";
@@ -691,8 +781,13 @@
 		case MeshVertexonsurfaceEnum : return "MeshVertexonsurface";
 		case MisfitEnum : return "Misfit";
+		case MovingFrontalVxEnum : return "MovingFrontalVx";
+		case MovingFrontalVyEnum : return "MovingFrontalVy";
 		case NeumannfluxEnum : return "Neumannflux";
 		case NewDamageEnum : return "NewDamage";
 		case NodeEnum : return "Node";
 		case OmegaAbsGradientEnum : return "OmegaAbsGradient";
+		case OceantransportSpcbottompressureEnum : return "OceantransportSpcbottompressure";
+		case OceantransportSpcstrEnum : return "OceantransportSpcstr";
+		case OceantransportSpcdslEnum : return "OceantransportSpcdsl";
 		case P0Enum : return "P0";
 		case P1Enum : return "P1";
@@ -709,32 +804,80 @@
 		case RheologyBInitialguessMisfitEnum : return "RheologyBInitialguessMisfit";
 		case RheologyBbarAbsGradientEnum : return "RheologyBbarAbsGradient";
+		case SampleEnum : return "Sample";
+		case SamplingBetaEnum : return "SamplingBeta";
+		case SamplingKappaEnum : return "SamplingKappa";
 		case SealevelEnum : return "Sealevel";
-		case SealevelEustaticMaskEnum : return "SealevelEustaticMask";
-		case SealevelEustaticOceanMaskEnum : return "SealevelEustaticOceanMask";
+		case SealevelGRDEnum : return "SealevelGRD";
+		case SealevelBarystaticMaskEnum : return "SealevelBarystaticMask";
+		case SealevelBarystaticIceMaskEnum : return "SealevelBarystaticIceMask";
+		case SealevelBarystaticIceWeightsEnum : return "SealevelBarystaticIceWeights";
+		case SealevelBarystaticIceAreaEnum : return "SealevelBarystaticIceArea";
+		case SealevelBarystaticIceLatbarEnum : return "SealevelBarystaticIceLatbar";
+		case SealevelBarystaticIceLongbarEnum : return "SealevelBarystaticIceLongbar";
+		case SealevelBarystaticIceLoadEnum : return "SealevelBarystaticIceLoad";
+		case SealevelBarystaticHydroMaskEnum : return "SealevelBarystaticHydroMask";
+		case SealevelBarystaticHydroWeightsEnum : return "SealevelBarystaticHydroWeights";
+		case SealevelBarystaticHydroAreaEnum : return "SealevelBarystaticHydroArea";
+		case SealevelBarystaticHydroLatbarEnum : return "SealevelBarystaticHydroLatbar";
+		case SealevelBarystaticHydroLongbarEnum : return "SealevelBarystaticHydroLongbar";
+		case SealevelBarystaticHydroLoadEnum : return "SealevelBarystaticHydroLoad";
+		case SealevelBarystaticBpMaskEnum : return "SealevelBarystaticBpMask";
+		case SealevelBarystaticBpWeightsEnum : return "SealevelBarystaticBpWeights";
+		case SealevelBarystaticBpAreaEnum : return "SealevelBarystaticBpArea";
+		case SealevelBarystaticBpLoadEnum : return "SealevelBarystaticBpLoad";
+		case SealevelBarystaticOceanMaskEnum : return "SealevelBarystaticOceanMask";
+		case SealevelBarystaticOceanWeightsEnum : return "SealevelBarystaticOceanWeights";
+		case SealevelBarystaticOceanAreaEnum : return "SealevelBarystaticOceanArea";
+		case SealevelBarystaticOceanLatbarEnum : return "SealevelBarystaticOceanLatbar";
+		case SealevelBarystaticOceanLongbarEnum : return "SealevelBarystaticOceanLongbar";
+		case SealevelBarystaticOceanLoadEnum : return "SealevelBarystaticOceanLoad";
 		case SealevelNEsaEnum : return "SealevelNEsa";
 		case SealevelNEsaRateEnum : return "SealevelNEsaRate";
 		case SealevelRSLEnum : return "SealevelRSL";
-		case BslrEnum : return "Bslr";
-		case BslrIceEnum : return "BslrIce";
-		case BslrHydroEnum : return "BslrHydro";
-		case BslrRateEnum : return "BslrRate";
-		case GmtslrEnum : return "Gmtslr";
-		case SealevelRSLEustaticEnum : return "SealevelRSLEustatic";
-		case SealevelRSLEustaticRateEnum : return "SealevelRSLEustaticRate";
+		case BslcEnum : return "Bslc";
+		case BslcIceEnum : return "BslcIce";
+		case BslcHydroEnum : return "BslcHydro";
+		case BslcOceanEnum : return "BslcOcean";
+		case BslcRateEnum : return "BslcRate";
+		case GmtslcEnum : return "Gmtslc";
+		case SealevelGrotm1Enum : return "SealevelGrotm1";
+		case SealevelGrotm2Enum : return "SealevelGrotm2";
+		case SealevelGrotm3Enum : return "SealevelGrotm3";
+		case SealevelGUrotm1Enum : return "SealevelGUrotm1";
+		case SealevelGUrotm2Enum : return "SealevelGUrotm2";
+		case SealevelGUrotm3Enum : return "SealevelGUrotm3";
+		case SealevelGNrotm1Enum : return "SealevelGNrotm1";
+		case SealevelGNrotm2Enum : return "SealevelGNrotm2";
+		case SealevelGNrotm3Enum : return "SealevelGNrotm3";
+		case SealevelGErotm1Enum : return "SealevelGErotm1";
+		case SealevelGErotm2Enum : return "SealevelGErotm2";
+		case SealevelGErotm3Enum : return "SealevelGErotm3";
+		case SealevelRSLBarystaticEnum : return "SealevelRSLBarystatic";
 		case SealevelRSLRateEnum : return "SealevelRSLRate";
+		case SealevelUGrdEnum : return "SealevelUGrd";
+		case SealevelNGrdEnum : return "SealevelNGrd";
 		case SealevelUEastEsaEnum : return "SealevelUEastEsa";
-		case SealevelUEsaEnum : return "SealevelUEsa";
-		case SealevelUEsaRateEnum : return "SealevelUEsaRate";
 		case SealevelUNorthEsaEnum : return "SealevelUNorthEsa";
-		case SealevelriseCumDeltathicknessEnum : return "SealevelriseCumDeltathickness";
-		case SealevelriseCumDeltathicknessOldEnum : return "SealevelriseCumDeltathicknessOld";
-		case SurfaceloadOtherEnum : return "SurfaceloadOther";
-		case SurfaceloadIceThicknessChangeEnum : return "SurfaceloadIceThicknessChange";
-		case SurfaceloadWaterHeightChangeEnum : return "SurfaceloadWaterHeightChange";
-		case SealevelriseIndicesEnum : return "SealevelriseIndices";
-		case SealevelriseGEnum : return "SealevelriseG";
-		case SealevelriseGUEnum : return "SealevelriseGU";
-		case SealevelriseGEEnum : return "SealevelriseGE";
-		case SealevelriseGNEnum : return "SealevelriseGN";
+		case SealevelchangeIndicesEnum : return "SealevelchangeIndices";
+		case SealevelchangeGEnum : return "SealevelchangeG";
+		case SealevelchangeGUEnum : return "SealevelchangeGU";
+		case SealevelchangeGEEnum : return "SealevelchangeGE";
+		case SealevelchangeGNEnum : return "SealevelchangeGN";
+		case SealevelchangeGsubelOceanEnum : return "SealevelchangeGsubelOcean";
+		case SealevelchangeGUsubelOceanEnum : return "SealevelchangeGUsubelOcean";
+		case SealevelchangeGEsubelOceanEnum : return "SealevelchangeGEsubelOcean";
+		case SealevelchangeGNsubelOceanEnum : return "SealevelchangeGNsubelOcean";
+		case SealevelchangeGsubelIceEnum : return "SealevelchangeGsubelIce";
+		case SealevelchangeGUsubelIceEnum : return "SealevelchangeGUsubelIce";
+		case SealevelchangeGEsubelIceEnum : return "SealevelchangeGEsubelIce";
+		case SealevelchangeGNsubelIceEnum : return "SealevelchangeGNsubelIce";
+		case SealevelchangeGsubelHydroEnum : return "SealevelchangeGsubelHydro";
+		case SealevelchangeGUsubelHydroEnum : return "SealevelchangeGUsubelHydro";
+		case SealevelchangeGEsubelHydroEnum : return "SealevelchangeGEsubelHydro";
+		case SealevelchangeGNsubelHydroEnum : return "SealevelchangeGNsubelHydro";
+		case SealevelchangeViscousRSLEnum : return "SealevelchangeViscousRSL";
+		case SealevelchangeViscousUEnum : return "SealevelchangeViscousU";
+		case SealevelchangeViscousNEnum : return "SealevelchangeViscousN";
+		case SealevelchangeViscousEEnum : return "SealevelchangeViscousE";
 		case SedimentHeadEnum : return "SedimentHead";
 		case SedimentHeadOldEnum : return "SedimentHeadOld";
@@ -749,9 +892,15 @@
 		case SmbAccumulatedMeltEnum : return "SmbAccumulatedMelt";
 		case SmbAccumulatedPrecipitationEnum : return "SmbAccumulatedPrecipitation";
+		case SmbAccumulatedRainEnum : return "SmbAccumulatedRain";
+		case SmbAccumulatedRefreezeEnum : return "SmbAccumulatedRefreeze";
 		case SmbAccumulatedRunoffEnum : return "SmbAccumulatedRunoff";
 		case SmbAEnum : return "SmbA";
+		case SmbAdiffEnum : return "SmbAdiff";
 		case SmbAValueEnum : return "SmbAValue";
 		case SmbAccumulationEnum : return "SmbAccumulation";
+		case SmbAdiffiniEnum : return "SmbAdiffini";
 		case SmbAiniEnum : return "SmbAini";
+		case SmbAutoregressionNoiseEnum : return "SmbAutoregressionNoise";
+		case SmbBasinsIdEnum : return "SmbBasinsId";
 		case SmbBMaxEnum : return "SmbBMax";
 		case SmbBMinEnum : return "SmbBMin";
@@ -759,4 +908,7 @@
 		case SmbBPosEnum : return "SmbBPos";
 		case SmbCEnum : return "SmbC";
+		case SmbCcsnowValueEnum : return "SmbCcsnowValue";
+		case SmbCciceValueEnum : return "SmbCciceValue";
+		case SmbCotValueEnum : return "SmbCotValue";
 		case SmbDEnum : return "SmbD";
 		case SmbDailyairdensityEnum : return "SmbDailyairdensity";
@@ -771,5 +923,7 @@
 		case SmbDiniEnum : return "SmbDini";
 		case SmbDlwrfEnum : return "SmbDlwrf";
+		case SmbDulwrfValueEnum : return "SmbDulwrfValue";
 		case SmbDswrfEnum : return "SmbDswrf";
+		case SmbDswdiffrfEnum : return "SmbDswdiffrf";
 		case SmbDzAddEnum : return "SmbDzAdd";
 		case SmbDzEnum : return "SmbDz";
@@ -791,5 +945,4 @@
 		case SmbIsInitializedEnum : return "SmbIsInitialized";
 		case SmbMAddEnum : return "SmbMAdd";
-		case SmbMassBalanceClimateEnum : return "SmbMassBalanceClimate";
 		case SmbMassBalanceEnum : return "SmbMassBalance";
 		case SmbMassBalanceSubstepEnum : return "SmbMassBalanceSubstep";
@@ -812,4 +965,5 @@
 		case SmbPrecipitationsPresentdayEnum : return "SmbPrecipitationsPresentday";
 		case SmbPrecipitationsReconstructedEnum : return "SmbPrecipitationsReconstructed";
+		case SmbRainEnum : return "SmbRain";
 		case SmbReEnum : return "SmbRe";
 		case SmbRefreezeEnum : return "SmbRefreeze";
@@ -824,4 +978,5 @@
 		case SmbSmbCorrEnum : return "SmbSmbCorr";
 		case SmbSmbrefEnum : return "SmbSmbref";
+		case SmbSzaValueEnum : return "SmbSzaValue";
 		case SmbTEnum : return "SmbT";
 		case SmbTaEnum : return "SmbTa";
@@ -834,4 +989,5 @@
 		case SmbTmeanEnum : return "SmbTmean";
 		case SmbTzEnum : return "SmbTz";
+		case SmbValuesAutoregressionEnum : return "SmbValuesAutoregression";
 		case SmbVEnum : return "SmbV";
 		case SmbVmeanEnum : return "SmbVmean";
@@ -844,4 +1000,9 @@
 		case SmbZTopEnum : return "SmbZTop";
 		case SmbZYEnum : return "SmbZY";
+		case SolidearthExternalDisplacementEastRateEnum : return "SolidearthExternalDisplacementEastRate";
+		case SolidearthExternalDisplacementNorthRateEnum : return "SolidearthExternalDisplacementNorthRate";
+		case SolidearthExternalDisplacementUpRateEnum : return "SolidearthExternalDisplacementUpRate";
+		case SolidearthExternalGeoidRateEnum : return "SolidearthExternalGeoidRate";
+		case StochasticForcingDefaultIdEnum : return "StochasticForcingDefaultId";
 		case StrainRateeffectiveEnum : return "StrainRateeffective";
 		case StrainRateparallelEnum : return "StrainRateparallel";
@@ -879,4 +1040,6 @@
 		case TemperaturePicardEnum : return "TemperaturePicard";
 		case TemperatureSEMICEnum : return "TemperatureSEMIC";
+		case ThermalforcingAutoregressionNoiseEnum : return "ThermalforcingAutoregressionNoise";
+		case ThermalforcingValuesAutoregressionEnum : return "ThermalforcingValuesAutoregression";
 		case ThermalSpctemperatureEnum : return "ThermalSpctemperature";
 		case ThicknessAbsGradientEnum : return "ThicknessAbsGradient";
@@ -888,13 +1051,20 @@
 		case ThicknessPositiveEnum : return "ThicknessPositive";
 		case ThicknessResidualEnum : return "ThicknessResidual";
+		case TransientAccumulatedDeltaIceThicknessEnum : return "TransientAccumulatedDeltaIceThickness";
 		case VelEnum : return "Vel";
 		case VxAverageEnum : return "VxAverage";
+		case VxBaseEnum : return "VxBase";
 		case VxEnum : return "Vx";
 		case VxMeshEnum : return "VxMesh";
 		case VxObsEnum : return "VxObs";
+		case VxShearEnum : return "VxShear";
+		case VxSurfaceEnum : return "VxSurface";
 		case VyAverageEnum : return "VyAverage";
+		case VyBaseEnum : return "VyBase";
 		case VyEnum : return "Vy";
 		case VyMeshEnum : return "VyMesh";
 		case VyObsEnum : return "VyObs";
+		case VyShearEnum : return "VyShear";
+		case VySurfaceEnum : return "VySurface";
 		case VzEnum : return "Vz";
 		case VzFSEnum : return "VzFS";
@@ -908,5 +1078,11 @@
 		case WaterfractionEnum : return "Waterfraction";
 		case WaterheightEnum : return "Waterheight";
+		case FrictionWaterPressureEnum : return "FrictionWaterPressure";
+		case FrictionWaterPressureNoiseEnum : return "FrictionWaterPressureNoise";
+		case WeightsLevelsetObservationEnum : return "WeightsLevelsetObservation";
 		case WeightsSurfaceObservationEnum : return "WeightsSurfaceObservation";
+		case OldAccumulatedDeltaBottomPressureEnum : return "OldAccumulatedDeltaBottomPressure";
+		case OldAccumulatedDeltaIceThicknessEnum : return "OldAccumulatedDeltaIceThickness";
+		case OldAccumulatedDeltaTwsEnum : return "OldAccumulatedDeltaTws";
 		case Outputdefinition1Enum : return "Outputdefinition1";
 		case Outputdefinition10Enum : return "Outputdefinition10";
@@ -1048,4 +1224,5 @@
 		case CfsurfacelogvelEnum : return "Cfsurfacelogvel";
 		case CfsurfacesquareEnum : return "Cfsurfacesquare";
+		case CflevelsetmisfitEnum : return "Cflevelsetmisfit";
 		case ChannelEnum : return "Channel";
 		case ChannelAreaEnum : return "ChannelArea";
@@ -1113,4 +1290,5 @@
 		case FrontalForcingsDefaultEnum : return "FrontalForcingsDefault";
 		case FrontalForcingsRignotEnum : return "FrontalForcingsRignot";
+		case FrontalForcingsRignotAutoregressionEnum : return "FrontalForcingsRignotAutoregression";
 		case FsetEnum : return "Fset";
 		case FullMeltOnPartiallyFloatingEnum : return "FullMeltOnPartiallyFloating";
@@ -1123,6 +1301,4 @@
 		case GenericParamEnum : return "GenericParam";
 		case GenericExternalResultEnum : return "GenericExternalResult";
-		case GiaAnalysisEnum : return "GiaAnalysis";
-		case GiaSolutionEnum : return "GiaSolution";
 		case Gradient1Enum : return "Gradient1";
 		case Gradient2Enum : return "Gradient2";
@@ -1244,4 +1420,6 @@
 		case NyeH2OEnum : return "NyeH2O";
 		case NumericalfluxEnum : return "Numericalflux";
+		case OceantransportAnalysisEnum : return "OceantransportAnalysis";
+		case OceantransportSolutionEnum : return "OceantransportSolution";
 		case OldGradientEnum : return "OldGradient";
 		case OneLayerP4zEnum : return "OneLayerP4z";
@@ -1278,5 +1456,8 @@
 		case RecoveryAnalysisEnum : return "RecoveryAnalysis";
 		case RiftfrontEnum : return "Riftfront";
+		case SamplingAnalysisEnum : return "SamplingAnalysis";
+		case SamplingSolutionEnum : return "SamplingSolution";
 		case SIAApproximationEnum : return "SIAApproximation";
+		case SMBautoregressionEnum : return "SMBautoregression";
 		case SMBcomponentsEnum : return "SMBcomponents";
 		case SMBd18opddEnum : return "SMBd18opdd";
@@ -1301,8 +1482,8 @@
 		case SealevelInertiaTensorYZEnum : return "SealevelInertiaTensorYZ";
 		case SealevelInertiaTensorZZEnum : return "SealevelInertiaTensorZZ";
+		case SealevelchangePolarMotionEnum : return "SealevelchangePolarMotion";
 		case SealevelNmotionEnum : return "SealevelNmotion";
 		case SealevelUmotionEnum : return "SealevelUmotion";
-		case SealevelriseAnalysisEnum : return "SealevelriseAnalysis";
-		case SealevelriseSolutionEnum : return "SealevelriseSolution";
+		case SealevelchangeAnalysisEnum : return "SealevelchangeAnalysis";
 		case SegEnum : return "Seg";
 		case SegInputEnum : return "SegInput";
Index: issm/trunk/src/c/shared/Enum/Enumjl.vim
===================================================================
--- issm/trunk/src/c/shared/Enum/Enumjl.vim	(revision 26744)
+++ issm/trunk/src/c/shared/Enum/Enumjl.vim	(revision 26744)
@@ -0,0 +1,1561 @@
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" ISSM specific julia syntax highlighting
+"
+"   WARNING: DO NOT MODIFY THIS FILE
+"            this file has been automatically generated by Synchronize.sh
+"            Please read README for more information
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+"ISSM Enums
+syn keyword juliaConstC ParametersSTARTEnum
+syn keyword juliaConstC AdolcParamEnum
+syn keyword juliaConstC AmrDeviatoricErrorGroupThresholdEnum
+syn keyword juliaConstC AmrDeviatoricErrorMaximumEnum
+syn keyword juliaConstC AmrDeviatoricErrorResolutionEnum
+syn keyword juliaConstC AmrDeviatoricErrorThresholdEnum
+syn keyword juliaConstC AmrErrEnum
+syn keyword juliaConstC AmrFieldEnum
+syn keyword juliaConstC AmrGradationEnum
+syn keyword juliaConstC AmrGroundingLineDistanceEnum
+syn keyword juliaConstC AmrGroundingLineResolutionEnum
+syn keyword juliaConstC AmrHmaxEnum
+syn keyword juliaConstC AmrHminEnum
+syn keyword juliaConstC AmrIceFrontDistanceEnum
+syn keyword juliaConstC AmrIceFrontResolutionEnum
+syn keyword juliaConstC AmrKeepMetricEnum
+syn keyword juliaConstC AmrLagEnum
+syn keyword juliaConstC AmrLevelMaxEnum
+syn keyword juliaConstC AmrRestartEnum
+syn keyword juliaConstC AmrThicknessErrorGroupThresholdEnum
+syn keyword juliaConstC AmrThicknessErrorMaximumEnum
+syn keyword juliaConstC AmrThicknessErrorResolutionEnum
+syn keyword juliaConstC AmrThicknessErrorThresholdEnum
+syn keyword juliaConstC AmrTypeEnum
+syn keyword juliaConstC AnalysisCounterEnum
+syn keyword juliaConstC AnalysisTypeEnum
+syn keyword juliaConstC AugmentedLagrangianREnum
+syn keyword juliaConstC AugmentedLagrangianRholambdaEnum
+syn keyword juliaConstC AugmentedLagrangianRhopEnum
+syn keyword juliaConstC AugmentedLagrangianRlambdaEnum
+syn keyword juliaConstC AugmentedLagrangianThetaEnum
+syn keyword juliaConstC AutodiffCbufsizeEnum
+syn keyword juliaConstC AutodiffDependentObjectsEnum
+syn keyword juliaConstC AutodiffDriverEnum
+syn keyword juliaConstC AutodiffFosForwardIndexEnum
+syn keyword juliaConstC AutodiffFosReverseIndexEnum
+syn keyword juliaConstC AutodiffFovForwardIndicesEnum
+syn keyword juliaConstC AutodiffGcTriggerMaxSizeEnum
+syn keyword juliaConstC AutodiffGcTriggerRatioEnum
+syn keyword juliaConstC AutodiffIsautodiffEnum
+syn keyword juliaConstC AutodiffLbufsizeEnum
+syn keyword juliaConstC AutodiffNumDependentsEnum
+syn keyword juliaConstC AutodiffNumIndependentsEnum
+syn keyword juliaConstC AutodiffObufsizeEnum
+syn keyword juliaConstC AutodiffTapeAllocEnum
+syn keyword juliaConstC AutodiffTbufsizeEnum
+syn keyword juliaConstC AutodiffXpEnum
+syn keyword juliaConstC BalancethicknessStabilizationEnum
+syn keyword juliaConstC BarystaticContributionsEnum
+syn keyword juliaConstC BasalforcingsBottomplumedepthEnum
+syn keyword juliaConstC BasalforcingsCrustthicknessEnum
+syn keyword juliaConstC BasalforcingsDeepwaterElevationEnum
+syn keyword juliaConstC BasalforcingsDeepwaterMeltingRateEnum
+syn keyword juliaConstC BasalforcingsDtbgEnum
+syn keyword juliaConstC BasalforcingsEnum
+syn keyword juliaConstC BasalforcingsIsmip6AverageTfEnum
+syn keyword juliaConstC BasalforcingsIsmip6BasinAreaEnum
+syn keyword juliaConstC BasalforcingsIsmip6DeltaTEnum
+syn keyword juliaConstC BasalforcingsIsmip6Gamma0Enum
+syn keyword juliaConstC BasalforcingsIsmip6IsLocalEnum
+syn keyword juliaConstC BasalforcingsIsmip6NumBasinsEnum
+syn keyword juliaConstC BasalforcingsIsmip6TfDepthsEnum
+syn keyword juliaConstC BasalforcingsLowercrustheatEnum
+syn keyword juliaConstC BasalforcingsMantleconductivityEnum
+syn keyword juliaConstC BasalforcingsNusseltEnum
+syn keyword juliaConstC BasalforcingsPicoAverageOverturningEnum
+syn keyword juliaConstC BasalforcingsPicoAverageSalinityEnum
+syn keyword juliaConstC BasalforcingsPicoAverageTemperatureEnum
+syn keyword juliaConstC BasalforcingsPicoBoxAreaEnum
+syn keyword juliaConstC BasalforcingsPicoFarOceansalinityEnum
+syn keyword juliaConstC BasalforcingsPicoFarOceantemperatureEnum
+syn keyword juliaConstC BasalforcingsPicoGammaTEnum
+syn keyword juliaConstC BasalforcingsPicoIsplumeEnum
+syn keyword juliaConstC BasalforcingsPicoMaxboxcountEnum
+syn keyword juliaConstC BasalforcingsPicoNumBasinsEnum
+syn keyword juliaConstC BasalforcingsPlumeradiusEnum
+syn keyword juliaConstC BasalforcingsPlumexEnum
+syn keyword juliaConstC BasalforcingsPlumeyEnum
+syn keyword juliaConstC BasalforcingsThresholdThicknessEnum
+syn keyword juliaConstC BasalforcingsTopplumedepthEnum
+syn keyword juliaConstC BasalforcingsUppercrustheatEnum
+syn keyword juliaConstC BasalforcingsUppercrustthicknessEnum
+syn keyword juliaConstC BasalforcingsUpperdepthMeltEnum
+syn keyword juliaConstC BasalforcingsUpperwaterElevationEnum
+syn keyword juliaConstC BasalforcingsUpperwaterMeltingRateEnum
+syn keyword juliaConstC CalvingCrevasseDepthEnum
+syn keyword juliaConstC CalvingCrevasseThresholdEnum
+syn keyword juliaConstC CalvingHeightAboveFloatationEnum
+syn keyword juliaConstC CalvingLawEnum
+syn keyword juliaConstC CalvingMinthicknessEnum
+syn keyword juliaConstC ConfigurationTypeEnum
+syn keyword juliaConstC ConstantsGEnum
+syn keyword juliaConstC ConstantsNewtonGravityEnum
+syn keyword juliaConstC ConstantsReferencetemperatureEnum
+syn keyword juliaConstC ConstantsYtsEnum
+syn keyword juliaConstC ControlInputSizeMEnum
+syn keyword juliaConstC ControlInputSizeNEnum
+syn keyword juliaConstC ControlInputInterpolationEnum
+syn keyword juliaConstC CumBslcEnum
+syn keyword juliaConstC CumBslcIceEnum
+syn keyword juliaConstC CumBslcHydroEnum
+syn keyword juliaConstC CumBslcOceanEnum
+syn keyword juliaConstC CumBslcIcePartitionEnum
+syn keyword juliaConstC CumBslcHydroPartitionEnum
+syn keyword juliaConstC CumBslcOceanPartitionEnum
+syn keyword juliaConstC CumGmtslcEnum
+syn keyword juliaConstC CumGmslcEnum
+syn keyword juliaConstC DamageC1Enum
+syn keyword juliaConstC DamageC2Enum
+syn keyword juliaConstC DamageC3Enum
+syn keyword juliaConstC DamageC4Enum
+syn keyword juliaConstC DamageEnum
+syn keyword juliaConstC DamageEquivStressEnum
+syn keyword juliaConstC DamageEvolutionNumRequestedOutputsEnum
+syn keyword juliaConstC DamageEvolutionRequestedOutputsEnum
+syn keyword juliaConstC DamageHealingEnum
+syn keyword juliaConstC DamageKappaEnum
+syn keyword juliaConstC DamageLawEnum
+syn keyword juliaConstC DamageMaxDamageEnum
+syn keyword juliaConstC DamageStabilizationEnum
+syn keyword juliaConstC DamageStressThresholdEnum
+syn keyword juliaConstC DamageStressUBoundEnum
+syn keyword juliaConstC DebugProfilingEnum
+syn keyword juliaConstC DomainDimensionEnum
+syn keyword juliaConstC DomainTypeEnum
+syn keyword juliaConstC DslModelEnum
+syn keyword juliaConstC DslModelidEnum
+syn keyword juliaConstC DslNummodelsEnum
+syn keyword juliaConstC SolidearthIsExternalEnum
+syn keyword juliaConstC SolidearthExternalNatureEnum
+syn keyword juliaConstC SolidearthExternalModelidEnum
+syn keyword juliaConstC SolidearthExternalNummodelsEnum
+syn keyword juliaConstC SolidearthSettingsComputeBpGrdEnum
+syn keyword juliaConstC EarthIdEnum
+syn keyword juliaConstC ElasticEnum
+syn keyword juliaConstC EplZigZagCounterEnum
+syn keyword juliaConstC EsaHElasticEnum
+syn keyword juliaConstC EsaHemisphereEnum
+syn keyword juliaConstC EsaRequestedOutputsEnum
+syn keyword juliaConstC EsaUElasticEnum
+syn keyword juliaConstC ExtrapolationVariableEnum
+syn keyword juliaConstC FemModelCommEnum
+syn keyword juliaConstC FieldsEnum
+syn keyword juliaConstC FlowequationFeFSEnum
+syn keyword juliaConstC FlowequationIsFSEnum
+syn keyword juliaConstC FlowequationIsHOEnum
+syn keyword juliaConstC FlowequationIsL1L2Enum
+syn keyword juliaConstC FlowequationIsMLHOEnum
+syn keyword juliaConstC FlowequationIsSIAEnum
+syn keyword juliaConstC FlowequationIsSSAEnum
+syn keyword juliaConstC FlowequationIsNitscheEnum
+syn keyword juliaConstC FeFSNitscheGammaEnum
+syn keyword juliaConstC FrictionCouplingEnum
+syn keyword juliaConstC FrictionDeltaEnum
+syn keyword juliaConstC FrictionEffectivePressureLimitEnum
+syn keyword juliaConstC FrictionFEnum
+syn keyword juliaConstC FrictionGammaEnum
+syn keyword juliaConstC FrictionLawEnum
+syn keyword juliaConstC FrictionPseudoplasticityExponentEnum
+syn keyword juliaConstC FrictionThresholdSpeedEnum
+syn keyword juliaConstC FrictionVoidRatioEnum
+syn keyword juliaConstC FrontalForcingsBasinIcefrontAreaEnum
+syn keyword juliaConstC FrontalForcingsAutoregressionInitialTimeEnum
+syn keyword juliaConstC FrontalForcingsAutoregressionTimestepEnum
+syn keyword juliaConstC FrontalForcingsAutoregressiveOrderEnum
+syn keyword juliaConstC FrontalForcingsBeta0Enum
+syn keyword juliaConstC FrontalForcingsBeta1Enum
+syn keyword juliaConstC FrontalForcingsNumberofBasinsEnum
+syn keyword juliaConstC FrontalForcingsParamEnum
+syn keyword juliaConstC FrontalForcingsPhiEnum
+syn keyword juliaConstC GrdModelEnum
+syn keyword juliaConstC GroundinglineFrictionInterpolationEnum
+syn keyword juliaConstC GroundinglineMeltInterpolationEnum
+syn keyword juliaConstC GroundinglineMigrationEnum
+syn keyword juliaConstC HydrologyAveragingEnum
+syn keyword juliaConstC HydrologyCavitySpacingEnum
+syn keyword juliaConstC HydrologyChannelConductivityEnum
+syn keyword juliaConstC HydrologyChannelSheetWidthEnum
+syn keyword juliaConstC HydrologyEnglacialVoidRatioEnum
+syn keyword juliaConstC HydrologyIschannelsEnum
+syn keyword juliaConstC HydrologyMeltFlagEnum
+syn keyword juliaConstC HydrologyModelEnum
+syn keyword juliaConstC HydrologyNumRequestedOutputsEnum
+syn keyword juliaConstC HydrologyPressureMeltCoefficientEnum
+syn keyword juliaConstC HydrologyRelaxationEnum
+syn keyword juliaConstC HydrologyRequestedOutputsEnum
+syn keyword juliaConstC HydrologySedimentKmaxEnum
+syn keyword juliaConstC HydrologyStepsPerStepEnum
+syn keyword juliaConstC HydrologyStorageEnum
+syn keyword juliaConstC HydrologydcEplColapseThicknessEnum
+syn keyword juliaConstC HydrologydcEplConductivityEnum
+syn keyword juliaConstC HydrologydcEplInitialThicknessEnum
+syn keyword juliaConstC HydrologydcEplLayerCompressibilityEnum
+syn keyword juliaConstC HydrologydcEplMaxThicknessEnum
+syn keyword juliaConstC HydrologydcEplPoreWaterMassEnum
+syn keyword juliaConstC HydrologydcEplThickCompEnum
+syn keyword juliaConstC HydrologydcEplflipLockEnum
+syn keyword juliaConstC HydrologydcIsefficientlayerEnum
+syn keyword juliaConstC HydrologydcLeakageFactorEnum
+syn keyword juliaConstC HydrologydcMaxIterEnum
+syn keyword juliaConstC HydrologydcPenaltyFactorEnum
+syn keyword juliaConstC HydrologydcPenaltyLockEnum
+syn keyword juliaConstC HydrologydcRelTolEnum
+syn keyword juliaConstC HydrologydcSedimentlimitEnum
+syn keyword juliaConstC HydrologydcSedimentlimitFlagEnum
+syn keyword juliaConstC HydrologydcSedimentLayerCompressibilityEnum
+syn keyword juliaConstC HydrologydcSedimentPoreWaterMassEnum
+syn keyword juliaConstC HydrologydcSedimentPorosityEnum
+syn keyword juliaConstC HydrologydcSedimentThicknessEnum
+syn keyword juliaConstC HydrologydcTransferFlagEnum
+syn keyword juliaConstC HydrologydcUnconfinedFlagEnum
+syn keyword juliaConstC HydrologyshreveStabilizationEnum
+syn keyword juliaConstC IcecapToEarthCommEnum
+syn keyword juliaConstC IndexEnum
+syn keyword juliaConstC InputFileNameEnum
+syn keyword juliaConstC DirectoryNameEnum
+syn keyword juliaConstC IndicesEnum
+syn keyword juliaConstC InputToDepthaverageInEnum
+syn keyword juliaConstC InputToDepthaverageOutEnum
+syn keyword juliaConstC InputToExtrudeEnum
+syn keyword juliaConstC InputToL2ProjectEnum
+syn keyword juliaConstC InputToSmoothEnum
+syn keyword juliaConstC InversionAlgorithmEnum
+syn keyword juliaConstC InversionControlParametersEnum
+syn keyword juliaConstC InversionControlScalingFactorsEnum
+syn keyword juliaConstC InversionCostFunctionsEnum
+syn keyword juliaConstC InversionDxminEnum
+syn keyword juliaConstC InversionGatolEnum
+syn keyword juliaConstC InversionGradientScalingEnum
+syn keyword juliaConstC InversionGrtolEnum
+syn keyword juliaConstC InversionGttolEnum
+syn keyword juliaConstC InversionIncompleteAdjointEnum
+syn keyword juliaConstC InversionIscontrolEnum
+syn keyword juliaConstC InversionMaxiterEnum
+syn keyword juliaConstC InversionMaxiterPerStepEnum
+syn keyword juliaConstC InversionMaxstepsEnum
+syn keyword juliaConstC InversionNstepsEnum
+syn keyword juliaConstC InversionNumControlParametersEnum
+syn keyword juliaConstC InversionNumCostFunctionsEnum
+syn keyword juliaConstC InversionStepThresholdEnum
+syn keyword juliaConstC InversionTypeEnum
+syn keyword juliaConstC IvinsEnum
+syn keyword juliaConstC IsSlcCouplingEnum
+syn keyword juliaConstC LevelsetKillIcebergsEnum
+syn keyword juliaConstC LevelsetReinitFrequencyEnum
+syn keyword juliaConstC LevelsetStabilizationEnum
+syn keyword juliaConstC LockFileNameEnum
+syn keyword juliaConstC LoveAllowLayerDeletionEnum
+syn keyword juliaConstC LoveCoreMantleBoundaryEnum
+syn keyword juliaConstC LoveEarthMassEnum
+syn keyword juliaConstC LoveForcingTypeEnum
+syn keyword juliaConstC LoveFrequenciesEnum
+syn keyword juliaConstC LoveIsTemporalEnum
+syn keyword juliaConstC LoveG0Enum
+syn keyword juliaConstC LoveGravitationalConstantEnum
+syn keyword juliaConstC LoveInnerCoreBoundaryEnum
+syn keyword juliaConstC LoveComplexComputationEnum
+syn keyword juliaConstC LoveIntStepsPerLayerEnum
+syn keyword juliaConstC LoveKernelsEnum
+syn keyword juliaConstC LoveMu0Enum
+syn keyword juliaConstC LoveNfreqEnum
+syn keyword juliaConstC LoveNTemporalIterationsEnum
+syn keyword juliaConstC LoveNYiEquationsEnum
+syn keyword juliaConstC LoveR0Enum
+syn keyword juliaConstC LoveShNmaxEnum
+syn keyword juliaConstC LoveShNminEnum
+syn keyword juliaConstC LoveStartingLayerEnum
+syn keyword juliaConstC LoveUnderflowTolEnum
+syn keyword juliaConstC MassFluxSegmentsEnum
+syn keyword juliaConstC MassFluxSegmentsPresentEnum
+syn keyword juliaConstC MasstransportHydrostaticAdjustmentEnum
+syn keyword juliaConstC MasstransportIsfreesurfaceEnum
+syn keyword juliaConstC MasstransportMinThicknessEnum
+syn keyword juliaConstC MasstransportNumRequestedOutputsEnum
+syn keyword juliaConstC MasstransportPenaltyFactorEnum
+syn keyword juliaConstC MasstransportRequestedOutputsEnum
+syn keyword juliaConstC MasstransportStabilizationEnum
+syn keyword juliaConstC MaterialsBetaEnum
+syn keyword juliaConstC MaterialsEarthDensityEnum
+syn keyword juliaConstC MaterialsEffectiveconductivityAveragingEnum
+syn keyword juliaConstC MaterialsHeatcapacityEnum
+syn keyword juliaConstC MaterialsLatentheatEnum
+syn keyword juliaConstC MaterialsMeltingpointEnum
+syn keyword juliaConstC MaterialsMixedLayerCapacityEnum
+syn keyword juliaConstC MaterialsMuWaterEnum
+syn keyword juliaConstC MaterialsRheologyLawEnum
+syn keyword juliaConstC MaterialsRhoFreshwaterEnum
+syn keyword juliaConstC MaterialsRhoIceEnum
+syn keyword juliaConstC MaterialsRhoSeawaterEnum
+syn keyword juliaConstC MaterialsTemperateiceconductivityEnum
+syn keyword juliaConstC MaterialsThermalExchangeVelocityEnum
+syn keyword juliaConstC MaterialsThermalconductivityEnum
+syn keyword juliaConstC MeltingOffsetEnum
+syn keyword juliaConstC MeshAverageVertexConnectivityEnum
+syn keyword juliaConstC MeshElementtypeEnum
+syn keyword juliaConstC MeshNumberoflayersEnum
+syn keyword juliaConstC MeshNumberofverticesEnum
+syn keyword juliaConstC MeshNumberofelementsEnum
+syn keyword juliaConstC MigrationMaxEnum
+syn keyword juliaConstC ModelIdEnum
+syn keyword juliaConstC NbinsEnum
+syn keyword juliaConstC NodesEnum
+syn keyword juliaConstC NumModelsEnum
+syn keyword juliaConstC OceanGridNxEnum
+syn keyword juliaConstC OceanGridNyEnum
+syn keyword juliaConstC OceanGridXEnum
+syn keyword juliaConstC OceanGridYEnum
+syn keyword juliaConstC OutputBufferPointerEnum
+syn keyword juliaConstC OutputBufferSizePointerEnum
+syn keyword juliaConstC OutputFileNameEnum
+syn keyword juliaConstC OutputFilePointerEnum
+syn keyword juliaConstC OutputdefinitionEnum
+syn keyword juliaConstC QmuErrNameEnum
+syn keyword juliaConstC QmuInNameEnum
+syn keyword juliaConstC QmuIsdakotaEnum
+syn keyword juliaConstC QmuOutNameEnum
+syn keyword juliaConstC QmuOutputEnum
+syn keyword juliaConstC QmuCurrEvalIdEnum
+syn keyword juliaConstC QmuNsampleEnum
+syn keyword juliaConstC QmuResponsedescriptorsEnum
+syn keyword juliaConstC QmuVariableDescriptorsEnum
+syn keyword juliaConstC QmuVariablePartitionsEnum
+syn keyword juliaConstC QmuVariablePartitionsNpartEnum
+syn keyword juliaConstC QmuVariablePartitionsNtEnum
+syn keyword juliaConstC QmuResponsePartitionsEnum
+syn keyword juliaConstC QmuResponsePartitionsNpartEnum
+syn keyword juliaConstC QmuStatisticsEnum
+syn keyword juliaConstC QmuNumstatisticsEnum
+syn keyword juliaConstC QmuNdirectoriesEnum
+syn keyword juliaConstC QmuNfilesPerDirectoryEnum
+syn keyword juliaConstC QmuStatisticsMethodEnum
+syn keyword juliaConstC QmuMethodsEnum
+syn keyword juliaConstC RestartFileNameEnum
+syn keyword juliaConstC ResultsEnum
+syn keyword juliaConstC RootPathEnum
+syn keyword juliaConstC ModelnameEnum
+syn keyword juliaConstC SamplingAlphaEnum
+syn keyword juliaConstC SamplingPhiEnum
+syn keyword juliaConstC SamplingNumRequestedOutputsEnum
+syn keyword juliaConstC SamplingRequestedOutputsEnum
+syn keyword juliaConstC SamplingRobinEnum
+syn keyword juliaConstC SamplingSeedEnum
+syn keyword juliaConstC SamplingTauEnum
+syn keyword juliaConstC SaveResultsEnum
+syn keyword juliaConstC SolidearthPartitionIceEnum
+syn keyword juliaConstC SolidearthPartitionHydroEnum
+syn keyword juliaConstC SolidearthPartitionOceanEnum
+syn keyword juliaConstC SolidearthNpartIceEnum
+syn keyword juliaConstC SolidearthNpartOceanEnum
+syn keyword juliaConstC SolidearthNpartHydroEnum
+syn keyword juliaConstC SolidearthPlanetRadiusEnum
+syn keyword juliaConstC SolidearthPlanetAreaEnum
+syn keyword juliaConstC SolidearthSettingsAbstolEnum
+syn keyword juliaConstC SolidearthSettingsCrossSectionShapeEnum
+syn keyword juliaConstC RotationalAngularVelocityEnum
+syn keyword juliaConstC SolidearthSettingsElasticEnum
+syn keyword juliaConstC SolidearthSettingsViscousEnum
+syn keyword juliaConstC SealevelchangeGeometryDoneEnum
+syn keyword juliaConstC SealevelchangeViscousNumStepsEnum
+syn keyword juliaConstC SealevelchangeViscousTimesEnum
+syn keyword juliaConstC SealevelchangeViscousIndexEnum
+syn keyword juliaConstC RotationalEquatorialMoiEnum
+syn keyword juliaConstC TidalLoveHEnum
+syn keyword juliaConstC TidalLoveKEnum
+syn keyword juliaConstC TidalLoveLEnum
+syn keyword juliaConstC TidalLoveK2SecularEnum
+syn keyword juliaConstC LoadLoveHEnum
+syn keyword juliaConstC LoadLoveKEnum
+syn keyword juliaConstC LoadLoveLEnum
+syn keyword juliaConstC LoveTimeFreqEnum
+syn keyword juliaConstC LoveIsTimeEnum
+syn keyword juliaConstC SealevelchangeGSelfAttractionEnum
+syn keyword juliaConstC SealevelchangeGViscoElasticEnum
+syn keyword juliaConstC SolidearthSettingsSealevelLoadingEnum
+syn keyword juliaConstC SolidearthSettingsGRDEnum
+syn keyword juliaConstC SolidearthSettingsRunFrequencyEnum
+syn keyword juliaConstC SolidearthSettingsTimeAccEnum
+syn keyword juliaConstC SealevelchangeHViscoElasticEnum
+syn keyword juliaConstC SolidearthSettingsHorizEnum
+syn keyword juliaConstC SolidearthSettingsMaxiterEnum
+syn keyword juliaConstC SolidearthSettingsGrdOceanEnum
+syn keyword juliaConstC SolidearthSettingsOceanAreaScalingEnum
+syn keyword juliaConstC StochasticForcingCovarianceEnum
+syn keyword juliaConstC StochasticForcingDefaultDimensionEnum
+syn keyword juliaConstC StochasticForcingDimensionsEnum
+syn keyword juliaConstC StochasticForcingFieldsEnum
+syn keyword juliaConstC StochasticForcingIsEffectivePressureEnum
+syn keyword juliaConstC StochasticForcingIsStochasticForcingEnum
+syn keyword juliaConstC StochasticForcingIsWaterPressureEnum
+syn keyword juliaConstC StochasticForcingNumFieldsEnum
+syn keyword juliaConstC StochasticForcingRandomflagEnum
+syn keyword juliaConstC RotationalPolarMoiEnum
+syn keyword juliaConstC SolidearthSettingsReltolEnum
+syn keyword juliaConstC SealevelchangeRequestedOutputsEnum
+syn keyword juliaConstC SolidearthSettingsSelfAttractionEnum
+syn keyword juliaConstC SolidearthSettingsRotationEnum
+syn keyword juliaConstC SolidearthSettingsMaxSHCoeffEnum
+syn keyword juliaConstC SealevelchangeRunCountEnum
+syn keyword juliaConstC SealevelchangeTransitionsEnum
+syn keyword juliaConstC SealevelchangeUViscoElasticEnum
+syn keyword juliaConstC SettingsIoGatherEnum
+syn keyword juliaConstC SettingsNumResultsOnNodesEnum
+syn keyword juliaConstC SettingsOutputFrequencyEnum
+syn keyword juliaConstC SettingsCheckpointFrequencyEnum
+syn keyword juliaConstC SettingsResultsOnNodesEnum
+syn keyword juliaConstC SettingsSbCouplingFrequencyEnum
+syn keyword juliaConstC SettingsSolverResidueThresholdEnum
+syn keyword juliaConstC SettingsWaitonlockEnum
+syn keyword juliaConstC SmbAIceEnum
+syn keyword juliaConstC SmbAIdxEnum
+syn keyword juliaConstC SmbASnowEnum
+syn keyword juliaConstC SmbAccualtiEnum
+syn keyword juliaConstC SmbAccugradEnum
+syn keyword juliaConstC SmbAccurefEnum
+syn keyword juliaConstC SmbAdThreshEnum
+syn keyword juliaConstC SmbAutoregressionInitialTimeEnum
+syn keyword juliaConstC SmbAutoregressionTimestepEnum
+syn keyword juliaConstC SmbAutoregressiveOrderEnum
+syn keyword juliaConstC SmbAveragingEnum
+syn keyword juliaConstC SmbBeta0Enum
+syn keyword juliaConstC SmbBeta1Enum
+syn keyword juliaConstC SmbDesfacEnum
+syn keyword juliaConstC SmbDpermilEnum
+syn keyword juliaConstC SmbDsnowIdxEnum
+syn keyword juliaConstC SmbCldFracEnum
+syn keyword juliaConstC SmbDelta18oEnum
+syn keyword juliaConstC SmbDelta18oSurfaceEnum
+syn keyword juliaConstC SmbDenIdxEnum
+syn keyword juliaConstC SmbDtEnum
+syn keyword juliaConstC SmbEnum
+syn keyword juliaConstC SmbEIdxEnum
+syn keyword juliaConstC SmbFEnum
+syn keyword juliaConstC SmbInitDensityScalingEnum
+syn keyword juliaConstC SmbIsaccumulationEnum
+syn keyword juliaConstC SmbIsalbedoEnum
+syn keyword juliaConstC SmbIsconstrainsurfaceTEnum
+syn keyword juliaConstC SmbIsd18opdEnum
+syn keyword juliaConstC SmbIsdelta18oEnum
+syn keyword juliaConstC SmbIsdensificationEnum
+syn keyword juliaConstC SmbIsdeltaLWupEnum
+syn keyword juliaConstC SmbIsfirnwarmingEnum
+syn keyword juliaConstC SmbIsgraingrowthEnum
+syn keyword juliaConstC SmbIsmeltEnum
+syn keyword juliaConstC SmbIsmungsmEnum
+syn keyword juliaConstC SmbIsprecipscaledEnum
+syn keyword juliaConstC SmbIssetpddfacEnum
+syn keyword juliaConstC SmbIsshortwaveEnum
+syn keyword juliaConstC SmbIstemperaturescaledEnum
+syn keyword juliaConstC SmbIsthermalEnum
+syn keyword juliaConstC SmbIsturbulentfluxEnum
+syn keyword juliaConstC SmbKEnum
+syn keyword juliaConstC SmbNumBasinsEnum
+syn keyword juliaConstC SmbNumRequestedOutputsEnum
+syn keyword juliaConstC SmbPfacEnum
+syn keyword juliaConstC SmbPhiEnum
+syn keyword juliaConstC SmbRdlEnum
+syn keyword juliaConstC SmbRequestedOutputsEnum
+syn keyword juliaConstC SmbRlapsEnum
+syn keyword juliaConstC SmbRlapslgmEnum
+syn keyword juliaConstC SmbRunoffaltiEnum
+syn keyword juliaConstC SmbRunoffgradEnum
+syn keyword juliaConstC SmbRunoffrefEnum
+syn keyword juliaConstC SmbSealevEnum
+syn keyword juliaConstC SmbStepsPerStepEnum
+syn keyword juliaConstC SmbSwIdxEnum
+syn keyword juliaConstC SmbT0dryEnum
+syn keyword juliaConstC SmbT0wetEnum
+syn keyword juliaConstC SmbTeThreshEnum
+syn keyword juliaConstC SmbTdiffEnum
+syn keyword juliaConstC SmbThermoDeltaTScalingEnum
+syn keyword juliaConstC SmbTemperaturesReconstructedYearsEnum
+syn keyword juliaConstC SmbPrecipitationsReconstructedYearsEnum
+syn keyword juliaConstC SmoothThicknessMultiplierEnum
+syn keyword juliaConstC SolutionTypeEnum
+syn keyword juliaConstC SteadystateMaxiterEnum
+syn keyword juliaConstC SteadystateNumRequestedOutputsEnum
+syn keyword juliaConstC SteadystateReltolEnum
+syn keyword juliaConstC SteadystateRequestedOutputsEnum
+syn keyword juliaConstC StepEnum
+syn keyword juliaConstC StepsEnum
+syn keyword juliaConstC StressbalanceAbstolEnum
+syn keyword juliaConstC StressbalanceFSreconditioningEnum
+syn keyword juliaConstC StressbalanceIsnewtonEnum
+syn keyword juliaConstC StressbalanceMaxiterEnum
+syn keyword juliaConstC StressbalanceNumRequestedOutputsEnum
+syn keyword juliaConstC StressbalancePenaltyFactorEnum
+syn keyword juliaConstC StressbalanceReltolEnum
+syn keyword juliaConstC StressbalanceRequestedOutputsEnum
+syn keyword juliaConstC StressbalanceRestolEnum
+syn keyword juliaConstC StressbalanceRiftPenaltyThresholdEnum
+syn keyword juliaConstC StressbalanceShelfDampeningEnum
+syn keyword juliaConstC ThermalIsdrainicecolumnEnum
+syn keyword juliaConstC ThermalIsdynamicbasalspcEnum
+syn keyword juliaConstC ThermalIsenthalpyEnum
+syn keyword juliaConstC ThermalMaxiterEnum
+syn keyword juliaConstC ThermalNumRequestedOutputsEnum
+syn keyword juliaConstC ThermalPenaltyFactorEnum
+syn keyword juliaConstC ThermalPenaltyLockEnum
+syn keyword juliaConstC ThermalPenaltyThresholdEnum
+syn keyword juliaConstC ThermalReltolEnum
+syn keyword juliaConstC ThermalRequestedOutputsEnum
+syn keyword juliaConstC ThermalStabilizationEnum
+syn keyword juliaConstC ThermalWatercolumnUpperlimitEnum
+syn keyword juliaConstC TimeEnum
+syn keyword juliaConstC TimesteppingCflCoefficientEnum
+syn keyword juliaConstC TimesteppingCouplingTimeEnum
+syn keyword juliaConstC TimesteppingFinalTimeEnum
+syn keyword juliaConstC TimesteppingInterpForcingEnum
+syn keyword juliaConstC TimesteppingCycleForcingEnum
+syn keyword juliaConstC TimesteppingStartTimeEnum
+syn keyword juliaConstC TimesteppingTimeStepEnum
+syn keyword juliaConstC TimesteppingTimeStepMaxEnum
+syn keyword juliaConstC TimesteppingTimeStepMinEnum
+syn keyword juliaConstC TimesteppingTypeEnum
+syn keyword juliaConstC ToMITgcmCommEnum
+syn keyword juliaConstC ToolkitsFileNameEnum
+syn keyword juliaConstC ToolkitsOptionsAnalysesEnum
+syn keyword juliaConstC ToolkitsOptionsStringsEnum
+syn keyword juliaConstC ToolkitsTypesEnum
+syn keyword juliaConstC TransientAmrFrequencyEnum
+syn keyword juliaConstC TransientIsdamageevolutionEnum
+syn keyword juliaConstC TransientIsesaEnum
+syn keyword juliaConstC TransientIsgiaEnum
+syn keyword juliaConstC TransientIsgroundinglineEnum
+syn keyword juliaConstC TransientIshydrologyEnum
+syn keyword juliaConstC TransientIsmasstransportEnum
+syn keyword juliaConstC TransientIsoceantransportEnum
+syn keyword juliaConstC TransientIsmovingfrontEnum
+syn keyword juliaConstC TransientIsoceancouplingEnum
+syn keyword juliaConstC TransientIssamplingEnum
+syn keyword juliaConstC TransientIsslcEnum
+syn keyword juliaConstC TransientIssmbEnum
+syn keyword juliaConstC TransientIsstressbalanceEnum
+syn keyword juliaConstC TransientIsthermalEnum
+syn keyword juliaConstC TransientNumRequestedOutputsEnum
+syn keyword juliaConstC TransientRequestedOutputsEnum
+syn keyword juliaConstC VelocityEnum
+syn keyword juliaConstC XxeEnum
+syn keyword juliaConstC YyeEnum
+syn keyword juliaConstC ZzeEnum
+syn keyword juliaConstC AreaeEnum
+syn keyword juliaConstC WorldCommEnum
+syn keyword juliaConstC ParametersENDEnum
+syn keyword juliaConstC InputsSTARTEnum
+syn keyword juliaConstC AccumulatedDeltaBottomPressureEnum
+syn keyword juliaConstC AccumulatedDeltaIceThicknessEnum
+syn keyword juliaConstC AccumulatedDeltaTwsEnum
+syn keyword juliaConstC AdjointEnum
+syn keyword juliaConstC AdjointpEnum
+syn keyword juliaConstC AdjointxEnum
+syn keyword juliaConstC AdjointxBaseEnum
+syn keyword juliaConstC AdjointxShearEnum
+syn keyword juliaConstC AdjointyEnum
+syn keyword juliaConstC AdjointyBaseEnum
+syn keyword juliaConstC AdjointyShearEnum
+syn keyword juliaConstC AdjointzEnum
+syn keyword juliaConstC AirEnum
+syn keyword juliaConstC ApproximationEnum
+syn keyword juliaConstC BalancethicknessMisfitEnum
+syn keyword juliaConstC BalancethicknessOmega0Enum
+syn keyword juliaConstC BalancethicknessOmegaEnum
+syn keyword juliaConstC BalancethicknessSpcthicknessEnum
+syn keyword juliaConstC BalancethicknessThickeningRateEnum
+syn keyword juliaConstC BasalCrevasseEnum
+syn keyword juliaConstC BasalforcingsFloatingiceMeltingRateEnum
+syn keyword juliaConstC BasalforcingsGeothermalfluxEnum
+syn keyword juliaConstC BasalforcingsGroundediceMeltingRateEnum
+syn keyword juliaConstC BasalforcingsPerturbationMeltingRateEnum
+syn keyword juliaConstC BasalforcingsIsmip6BasinIdEnum
+syn keyword juliaConstC BasalforcingsIsmip6TfEnum
+syn keyword juliaConstC BasalforcingsIsmip6TfShelfEnum
+syn keyword juliaConstC BasalforcingsIsmip6MeltAnomalyEnum
+syn keyword juliaConstC BasalforcingsMeltrateFactorEnum
+syn keyword juliaConstC BasalforcingsOceanSalinityEnum
+syn keyword juliaConstC BasalforcingsOceanTempEnum
+syn keyword juliaConstC BasalforcingsPicoBasinIdEnum
+syn keyword juliaConstC BasalforcingsPicoBoxIdEnum
+syn keyword juliaConstC BasalforcingsPicoOverturningCoeffEnum
+syn keyword juliaConstC BasalforcingsPicoSubShelfOceanOverturningEnum
+syn keyword juliaConstC BasalforcingsPicoSubShelfOceanSalinityEnum
+syn keyword juliaConstC BasalforcingsPicoSubShelfOceanTempEnum
+syn keyword juliaConstC BasalStressxEnum
+syn keyword juliaConstC BasalStressyEnum
+syn keyword juliaConstC BasalStressEnum
+syn keyword juliaConstC BaseEnum
+syn keyword juliaConstC BaseOldEnum
+syn keyword juliaConstC BaseSlopeXEnum
+syn keyword juliaConstC BaseSlopeYEnum
+syn keyword juliaConstC BaselineBasalforcingsFloatingiceMeltingRateEnum
+syn keyword juliaConstC BaselineCalvingCalvingrateEnum
+syn keyword juliaConstC BaselineFrictionEffectivePressureEnum
+syn keyword juliaConstC BedEnum
+syn keyword juliaConstC BedGRDEnum
+syn keyword juliaConstC BedEastEnum
+syn keyword juliaConstC BedEastGRDEnum
+syn keyword juliaConstC BedNorthEnum
+syn keyword juliaConstC BedNorthGRDEnum
+syn keyword juliaConstC BedSlopeXEnum
+syn keyword juliaConstC BedSlopeYEnum
+syn keyword juliaConstC BottomPressureEnum
+syn keyword juliaConstC BottomPressureOldEnum
+syn keyword juliaConstC CalvingCalvingrateEnum
+syn keyword juliaConstC CalvingHabFractionEnum
+syn keyword juliaConstC CalvingMeltingrateEnum
+syn keyword juliaConstC CalvingStressThresholdFloatingiceEnum
+syn keyword juliaConstC CalvingStressThresholdGroundediceEnum
+syn keyword juliaConstC CalvinglevermannCoeffEnum
+syn keyword juliaConstC CalvingratexAverageEnum
+syn keyword juliaConstC CalvingratexEnum
+syn keyword juliaConstC CalvingrateyAverageEnum
+syn keyword juliaConstC CalvingrateyEnum
+syn keyword juliaConstC CalvingFluxLevelsetEnum
+syn keyword juliaConstC CalvingMeltingFluxLevelsetEnum
+syn keyword juliaConstC ConvergedEnum
+syn keyword juliaConstC CrevasseDepthEnum
+syn keyword juliaConstC DamageDEnum
+syn keyword juliaConstC DamageDOldEnum
+syn keyword juliaConstC DamageDbarEnum
+syn keyword juliaConstC DamageDbarOldEnum
+syn keyword juliaConstC DamageFEnum
+syn keyword juliaConstC DegreeOfChannelizationEnum
+syn keyword juliaConstC DepthBelowSurfaceEnum
+syn keyword juliaConstC DeltaIceThicknessEnum
+syn keyword juliaConstC DeltaTwsEnum
+syn keyword juliaConstC DeltaBottomPressureEnum
+syn keyword juliaConstC DeltaDslEnum
+syn keyword juliaConstC DslOldEnum
+syn keyword juliaConstC DslEnum
+syn keyword juliaConstC DeltaStrEnum
+syn keyword juliaConstC StrOldEnum
+syn keyword juliaConstC StrEnum
+syn keyword juliaConstC DeviatoricStresseffectiveEnum
+syn keyword juliaConstC DeviatoricStressxxEnum
+syn keyword juliaConstC DeviatoricStressxyEnum
+syn keyword juliaConstC DeviatoricStressxzEnum
+syn keyword juliaConstC DeviatoricStressyyEnum
+syn keyword juliaConstC DeviatoricStressyzEnum
+syn keyword juliaConstC DeviatoricStresszzEnum
+syn keyword juliaConstC DeviatoricStress1Enum
+syn keyword juliaConstC DeviatoricStress2Enum
+syn keyword juliaConstC DistanceToCalvingfrontEnum
+syn keyword juliaConstC DistanceToGroundinglineEnum
+syn keyword juliaConstC Domain2DhorizontalEnum
+syn keyword juliaConstC Domain2DverticalEnum
+syn keyword juliaConstC Domain3DEnum
+syn keyword juliaConstC DragCoefficientAbsGradientEnum
+syn keyword juliaConstC DrivingStressXEnum
+syn keyword juliaConstC DrivingStressYEnum
+syn keyword juliaConstC DummyEnum
+syn keyword juliaConstC EffectivePressureEnum
+syn keyword juliaConstC EffectivePressureSubstepEnum
+syn keyword juliaConstC EffectivePressureTransientEnum
+syn keyword juliaConstC EnthalpyEnum
+syn keyword juliaConstC EnthalpyPicardEnum
+syn keyword juliaConstC EplHeadEnum
+syn keyword juliaConstC EplHeadOldEnum
+syn keyword juliaConstC EplHeadSlopeXEnum
+syn keyword juliaConstC EplHeadSlopeYEnum
+syn keyword juliaConstC EplHeadSubstepEnum
+syn keyword juliaConstC EplHeadTransientEnum
+syn keyword juliaConstC EsaEmotionEnum
+syn keyword juliaConstC EsaNmotionEnum
+syn keyword juliaConstC EsaRotationrateEnum
+syn keyword juliaConstC EsaStrainratexxEnum
+syn keyword juliaConstC EsaStrainratexyEnum
+syn keyword juliaConstC EsaStrainrateyyEnum
+syn keyword juliaConstC EsaUmotionEnum
+syn keyword juliaConstC EsaXmotionEnum
+syn keyword juliaConstC EsaYmotionEnum
+syn keyword juliaConstC EtaDiffEnum
+syn keyword juliaConstC FlowequationBorderFSEnum
+syn keyword juliaConstC FrictionAsEnum
+syn keyword juliaConstC FrictionCEnum
+syn keyword juliaConstC FrictionCmaxEnum
+syn keyword juliaConstC FrictionCoefficientEnum
+syn keyword juliaConstC FrictionCoefficientcoulombEnum
+syn keyword juliaConstC FrictionEffectivePressureEnum
+syn keyword juliaConstC FrictionMEnum
+syn keyword juliaConstC FrictionPEnum
+syn keyword juliaConstC FrictionPressureAdjustedTemperatureEnum
+syn keyword juliaConstC FrictionQEnum
+syn keyword juliaConstC FrictionSedimentCompressibilityCoefficientEnum
+syn keyword juliaConstC FrictionTillFrictionAngleEnum
+syn keyword juliaConstC FrictionWaterLayerEnum
+syn keyword juliaConstC FrictionfEnum
+syn keyword juliaConstC FrontalForcingsBasinIdEnum
+syn keyword juliaConstC FrontalForcingsSubglacialDischargeEnum
+syn keyword juliaConstC FrontalForcingsThermalForcingEnum
+syn keyword juliaConstC GeometryHydrostaticRatioEnum
+syn keyword juliaConstC NGiaEnum
+syn keyword juliaConstC NGiaRateEnum
+syn keyword juliaConstC UGiaEnum
+syn keyword juliaConstC UGiaRateEnum
+syn keyword juliaConstC GradientEnum
+syn keyword juliaConstC GroundinglineHeightEnum
+syn keyword juliaConstC HydraulicPotentialEnum
+syn keyword juliaConstC HydraulicPotentialOldEnum
+syn keyword juliaConstC HydrologyBasalFluxEnum
+syn keyword juliaConstC HydrologyBumpHeightEnum
+syn keyword juliaConstC HydrologyBumpSpacingEnum
+syn keyword juliaConstC HydrologydcBasalMoulinInputEnum
+syn keyword juliaConstC HydrologydcEplThicknessEnum
+syn keyword juliaConstC HydrologydcEplThicknessOldEnum
+syn keyword juliaConstC HydrologydcEplThicknessSubstepEnum
+syn keyword juliaConstC HydrologydcEplThicknessTransientEnum
+syn keyword juliaConstC HydrologydcMaskEplactiveEltEnum
+syn keyword juliaConstC HydrologydcMaskEplactiveNodeEnum
+syn keyword juliaConstC HydrologydcMaskThawedEltEnum
+syn keyword juliaConstC HydrologydcMaskThawedNodeEnum
+syn keyword juliaConstC HydrologydcSedimentTransmitivityEnum
+syn keyword juliaConstC HydrologyDrainageRateEnum
+syn keyword juliaConstC HydrologyEnglacialInputEnum
+syn keyword juliaConstC HydrologyGapHeightEnum
+syn keyword juliaConstC HydrologyGapHeightXEnum
+syn keyword juliaConstC HydrologyGapHeightXXEnum
+syn keyword juliaConstC HydrologyGapHeightYEnum
+syn keyword juliaConstC HydrologyGapHeightYYEnum
+syn keyword juliaConstC HydrologyHeadEnum
+syn keyword juliaConstC HydrologyHeadOldEnum
+syn keyword juliaConstC HydrologyMoulinInputEnum
+syn keyword juliaConstC HydrologyNeumannfluxEnum
+syn keyword juliaConstC HydrologyReynoldsEnum
+syn keyword juliaConstC HydrologySheetConductivityEnum
+syn keyword juliaConstC HydrologySheetThicknessEnum
+syn keyword juliaConstC HydrologySheetThicknessOldEnum
+syn keyword juliaConstC HydrologyTwsEnum
+syn keyword juliaConstC HydrologyTwsSpcEnum
+syn keyword juliaConstC HydrologyTwsAnalysisEnum
+syn keyword juliaConstC HydrologyWatercolumnMaxEnum
+syn keyword juliaConstC HydrologyWaterVxEnum
+syn keyword juliaConstC HydrologyWaterVyEnum
+syn keyword juliaConstC IceEnum
+syn keyword juliaConstC IceMaskNodeActivationEnum
+syn keyword juliaConstC InputEnum
+syn keyword juliaConstC InversionCostFunctionsCoefficientsEnum
+syn keyword juliaConstC InversionSurfaceObsEnum
+syn keyword juliaConstC InversionThicknessObsEnum
+syn keyword juliaConstC InversionVelObsEnum
+syn keyword juliaConstC InversionVxObsEnum
+syn keyword juliaConstC InversionVyObsEnum
+syn keyword juliaConstC LevelsetfunctionSlopeXEnum
+syn keyword juliaConstC LevelsetfunctionSlopeYEnum
+syn keyword juliaConstC LevelsetObservationEnum
+syn keyword juliaConstC LoadingforceXEnum
+syn keyword juliaConstC LoadingforceYEnum
+syn keyword juliaConstC LoadingforceZEnum
+syn keyword juliaConstC MaskOceanLevelsetEnum
+syn keyword juliaConstC MaskIceLevelsetEnum
+syn keyword juliaConstC MaskIceRefLevelsetEnum
+syn keyword juliaConstC MasstransportSpcthicknessEnum
+syn keyword juliaConstC MaterialsRheologyBEnum
+syn keyword juliaConstC MaterialsRheologyBbarEnum
+syn keyword juliaConstC MaterialsRheologyEEnum
+syn keyword juliaConstC MaterialsRheologyEbarEnum
+syn keyword juliaConstC MaterialsRheologyEcEnum
+syn keyword juliaConstC MaterialsRheologyEcbarEnum
+syn keyword juliaConstC MaterialsRheologyEsEnum
+syn keyword juliaConstC MaterialsRheologyEsbarEnum
+syn keyword juliaConstC MaterialsRheologyNEnum
+syn keyword juliaConstC MeshScaleFactorEnum
+syn keyword juliaConstC MeshVertexonbaseEnum
+syn keyword juliaConstC MeshVertexonboundaryEnum
+syn keyword juliaConstC MeshVertexonsurfaceEnum
+syn keyword juliaConstC MisfitEnum
+syn keyword juliaConstC MovingFrontalVxEnum
+syn keyword juliaConstC MovingFrontalVyEnum
+syn keyword juliaConstC NeumannfluxEnum
+syn keyword juliaConstC NewDamageEnum
+syn keyword juliaConstC NodeEnum
+syn keyword juliaConstC OmegaAbsGradientEnum
+syn keyword juliaConstC OceantransportSpcbottompressureEnum
+syn keyword juliaConstC OceantransportSpcstrEnum
+syn keyword juliaConstC OceantransportSpcdslEnum
+syn keyword juliaConstC P0Enum
+syn keyword juliaConstC P1Enum
+syn keyword juliaConstC PartitioningEnum
+syn keyword juliaConstC PressureEnum
+syn keyword juliaConstC RadarEnum
+syn keyword juliaConstC RadarAttenuationMacGregorEnum
+syn keyword juliaConstC RadarAttenuationWolffEnum
+syn keyword juliaConstC RadarIcePeriodEnum
+syn keyword juliaConstC RadarPowerMacGregorEnum
+syn keyword juliaConstC RadarPowerWolffEnum
+syn keyword juliaConstC RheologyBAbsGradientEnum
+syn keyword juliaConstC RheologyBInitialguessEnum
+syn keyword juliaConstC RheologyBInitialguessMisfitEnum
+syn keyword juliaConstC RheologyBbarAbsGradientEnum
+syn keyword juliaConstC SampleEnum
+syn keyword juliaConstC SamplingBetaEnum
+syn keyword juliaConstC SamplingKappaEnum
+syn keyword juliaConstC SealevelEnum
+syn keyword juliaConstC SealevelGRDEnum
+syn keyword juliaConstC SealevelBarystaticMaskEnum
+syn keyword juliaConstC SealevelBarystaticIceMaskEnum
+syn keyword juliaConstC SealevelBarystaticIceWeightsEnum
+syn keyword juliaConstC SealevelBarystaticIceAreaEnum
+syn keyword juliaConstC SealevelBarystaticIceLatbarEnum
+syn keyword juliaConstC SealevelBarystaticIceLongbarEnum
+syn keyword juliaConstC SealevelBarystaticIceLoadEnum
+syn keyword juliaConstC SealevelBarystaticHydroMaskEnum
+syn keyword juliaConstC SealevelBarystaticHydroWeightsEnum
+syn keyword juliaConstC SealevelBarystaticHydroAreaEnum
+syn keyword juliaConstC SealevelBarystaticHydroLatbarEnum
+syn keyword juliaConstC SealevelBarystaticHydroLongbarEnum
+syn keyword juliaConstC SealevelBarystaticHydroLoadEnum
+syn keyword juliaConstC SealevelBarystaticBpMaskEnum
+syn keyword juliaConstC SealevelBarystaticBpWeightsEnum
+syn keyword juliaConstC SealevelBarystaticBpAreaEnum
+syn keyword juliaConstC SealevelBarystaticBpLoadEnum
+syn keyword juliaConstC SealevelBarystaticOceanMaskEnum
+syn keyword juliaConstC SealevelBarystaticOceanWeightsEnum
+syn keyword juliaConstC SealevelBarystaticOceanAreaEnum
+syn keyword juliaConstC SealevelBarystaticOceanLatbarEnum
+syn keyword juliaConstC SealevelBarystaticOceanLongbarEnum
+syn keyword juliaConstC SealevelBarystaticOceanLoadEnum
+syn keyword juliaConstC SealevelNEsaEnum
+syn keyword juliaConstC SealevelNEsaRateEnum
+syn keyword juliaConstC SealevelRSLEnum
+syn keyword juliaConstC BslcEnum
+syn keyword juliaConstC BslcIceEnum
+syn keyword juliaConstC BslcHydroEnum
+syn keyword juliaConstC BslcOceanEnum
+syn keyword juliaConstC BslcRateEnum
+syn keyword juliaConstC GmtslcEnum
+syn keyword juliaConstC SealevelGrotm1Enum
+syn keyword juliaConstC SealevelGrotm2Enum
+syn keyword juliaConstC SealevelGrotm3Enum
+syn keyword juliaConstC SealevelGUrotm1Enum
+syn keyword juliaConstC SealevelGUrotm2Enum
+syn keyword juliaConstC SealevelGUrotm3Enum
+syn keyword juliaConstC SealevelGNrotm1Enum
+syn keyword juliaConstC SealevelGNrotm2Enum
+syn keyword juliaConstC SealevelGNrotm3Enum
+syn keyword juliaConstC SealevelGErotm1Enum
+syn keyword juliaConstC SealevelGErotm2Enum
+syn keyword juliaConstC SealevelGErotm3Enum
+syn keyword juliaConstC SealevelRSLBarystaticEnum
+syn keyword juliaConstC SealevelRSLRateEnum
+syn keyword juliaConstC SealevelUGrdEnum
+syn keyword juliaConstC SealevelNGrdEnum
+syn keyword juliaConstC SealevelUEastEsaEnum
+syn keyword juliaConstC SealevelUNorthEsaEnum
+syn keyword juliaConstC SealevelchangeIndicesEnum
+syn keyword juliaConstC SealevelchangeGEnum
+syn keyword juliaConstC SealevelchangeGUEnum
+syn keyword juliaConstC SealevelchangeGEEnum
+syn keyword juliaConstC SealevelchangeGNEnum
+syn keyword juliaConstC SealevelchangeGsubelOceanEnum
+syn keyword juliaConstC SealevelchangeGUsubelOceanEnum
+syn keyword juliaConstC SealevelchangeGEsubelOceanEnum
+syn keyword juliaConstC SealevelchangeGNsubelOceanEnum
+syn keyword juliaConstC SealevelchangeGsubelIceEnum
+syn keyword juliaConstC SealevelchangeGUsubelIceEnum
+syn keyword juliaConstC SealevelchangeGEsubelIceEnum
+syn keyword juliaConstC SealevelchangeGNsubelIceEnum
+syn keyword juliaConstC SealevelchangeGsubelHydroEnum
+syn keyword juliaConstC SealevelchangeGUsubelHydroEnum
+syn keyword juliaConstC SealevelchangeGEsubelHydroEnum
+syn keyword juliaConstC SealevelchangeGNsubelHydroEnum
+syn keyword juliaConstC SealevelchangeViscousRSLEnum
+syn keyword juliaConstC SealevelchangeViscousUEnum
+syn keyword juliaConstC SealevelchangeViscousNEnum
+syn keyword juliaConstC SealevelchangeViscousEEnum
+syn keyword juliaConstC SedimentHeadEnum
+syn keyword juliaConstC SedimentHeadOldEnum
+syn keyword juliaConstC SedimentHeadSubstepEnum
+syn keyword juliaConstC SedimentHeadTransientEnum
+syn keyword juliaConstC SedimentHeadResidualEnum
+syn keyword juliaConstC SedimentHeadStackedEnum
+syn keyword juliaConstC SigmaNNEnum
+syn keyword juliaConstC SigmaVMEnum
+syn keyword juliaConstC SmbAccumulatedECEnum
+syn keyword juliaConstC SmbAccumulatedMassBalanceEnum
+syn keyword juliaConstC SmbAccumulatedMeltEnum
+syn keyword juliaConstC SmbAccumulatedPrecipitationEnum
+syn keyword juliaConstC SmbAccumulatedRainEnum
+syn keyword juliaConstC SmbAccumulatedRefreezeEnum
+syn keyword juliaConstC SmbAccumulatedRunoffEnum
+syn keyword juliaConstC SmbAEnum
+syn keyword juliaConstC SmbAdiffEnum
+syn keyword juliaConstC SmbAValueEnum
+syn keyword juliaConstC SmbAccumulationEnum
+syn keyword juliaConstC SmbAdiffiniEnum
+syn keyword juliaConstC SmbAiniEnum
+syn keyword juliaConstC SmbAutoregressionNoiseEnum
+syn keyword juliaConstC SmbBasinsIdEnum
+syn keyword juliaConstC SmbBMaxEnum
+syn keyword juliaConstC SmbBMinEnum
+syn keyword juliaConstC SmbBNegEnum
+syn keyword juliaConstC SmbBPosEnum
+syn keyword juliaConstC SmbCEnum
+syn keyword juliaConstC SmbCcsnowValueEnum
+syn keyword juliaConstC SmbCciceValueEnum
+syn keyword juliaConstC SmbCotValueEnum
+syn keyword juliaConstC SmbDEnum
+syn keyword juliaConstC SmbDailyairdensityEnum
+syn keyword juliaConstC SmbDailyairhumidityEnum
+syn keyword juliaConstC SmbDailydlradiationEnum
+syn keyword juliaConstC SmbDailydsradiationEnum
+syn keyword juliaConstC SmbDailypressureEnum
+syn keyword juliaConstC SmbDailyrainfallEnum
+syn keyword juliaConstC SmbDailysnowfallEnum
+syn keyword juliaConstC SmbDailytemperatureEnum
+syn keyword juliaConstC SmbDailywindspeedEnum
+syn keyword juliaConstC SmbDiniEnum
+syn keyword juliaConstC SmbDlwrfEnum
+syn keyword juliaConstC SmbDulwrfValueEnum
+syn keyword juliaConstC SmbDswrfEnum
+syn keyword juliaConstC SmbDswdiffrfEnum
+syn keyword juliaConstC SmbDzAddEnum
+syn keyword juliaConstC SmbDzEnum
+syn keyword juliaConstC SmbDzMinEnum
+syn keyword juliaConstC SmbDzTopEnum
+syn keyword juliaConstC SmbDziniEnum
+syn keyword juliaConstC SmbEAirEnum
+syn keyword juliaConstC SmbECEnum
+syn keyword juliaConstC SmbECDtEnum
+syn keyword juliaConstC SmbECiniEnum
+syn keyword juliaConstC SmbElaEnum
+syn keyword juliaConstC SmbEvaporationEnum
+syn keyword juliaConstC SmbFACEnum
+syn keyword juliaConstC SmbGdnEnum
+syn keyword juliaConstC SmbGdniniEnum
+syn keyword juliaConstC SmbGspEnum
+syn keyword juliaConstC SmbGspiniEnum
+syn keyword juliaConstC SmbHrefEnum
+syn keyword juliaConstC SmbIsInitializedEnum
+syn keyword juliaConstC SmbMAddEnum
+syn keyword juliaConstC SmbMassBalanceEnum
+syn keyword juliaConstC SmbMassBalanceSubstepEnum
+syn keyword juliaConstC SmbMassBalanceTransientEnum
+syn keyword juliaConstC SmbMeanLHFEnum
+syn keyword juliaConstC SmbMeanSHFEnum
+syn keyword juliaConstC SmbMeanULWEnum
+syn keyword juliaConstC SmbMeltEnum
+syn keyword juliaConstC SmbMonthlytemperaturesEnum
+syn keyword juliaConstC SmbMSurfEnum
+syn keyword juliaConstC SmbNetLWEnum
+syn keyword juliaConstC SmbNetSWEnum
+syn keyword juliaConstC SmbPAirEnum
+syn keyword juliaConstC SmbPEnum
+syn keyword juliaConstC SmbPddfacIceEnum
+syn keyword juliaConstC SmbPddfacSnowEnum
+syn keyword juliaConstC SmbPrecipitationEnum
+syn keyword juliaConstC SmbPrecipitationsAnomalyEnum
+syn keyword juliaConstC SmbPrecipitationsLgmEnum
+syn keyword juliaConstC SmbPrecipitationsPresentdayEnum
+syn keyword juliaConstC SmbPrecipitationsReconstructedEnum
+syn keyword juliaConstC SmbRainEnum
+syn keyword juliaConstC SmbReEnum
+syn keyword juliaConstC SmbRefreezeEnum
+syn keyword juliaConstC SmbReiniEnum
+syn keyword juliaConstC SmbRunoffEnum
+syn keyword juliaConstC SmbRunoffSubstepEnum
+syn keyword juliaConstC SmbRunoffTransientEnum
+syn keyword juliaConstC SmbS0gcmEnum
+syn keyword juliaConstC SmbS0pEnum
+syn keyword juliaConstC SmbS0tEnum
+syn keyword juliaConstC SmbSizeiniEnum
+syn keyword juliaConstC SmbSmbCorrEnum
+syn keyword juliaConstC SmbSmbrefEnum
+syn keyword juliaConstC SmbSzaValueEnum
+syn keyword juliaConstC SmbTEnum
+syn keyword juliaConstC SmbTaEnum
+syn keyword juliaConstC SmbTeValueEnum
+syn keyword juliaConstC SmbTemperaturesAnomalyEnum
+syn keyword juliaConstC SmbTemperaturesLgmEnum
+syn keyword juliaConstC SmbTemperaturesPresentdayEnum
+syn keyword juliaConstC SmbTemperaturesReconstructedEnum
+syn keyword juliaConstC SmbTiniEnum
+syn keyword juliaConstC SmbTmeanEnum
+syn keyword juliaConstC SmbTzEnum
+syn keyword juliaConstC SmbValuesAutoregressionEnum
+syn keyword juliaConstC SmbVEnum
+syn keyword juliaConstC SmbVmeanEnum
+syn keyword juliaConstC SmbVzEnum
+syn keyword juliaConstC SmbWEnum
+syn keyword juliaConstC SmbWAddEnum
+syn keyword juliaConstC SmbWiniEnum
+syn keyword juliaConstC SmbZMaxEnum
+syn keyword juliaConstC SmbZMinEnum
+syn keyword juliaConstC SmbZTopEnum
+syn keyword juliaConstC SmbZYEnum
+syn keyword juliaConstC SolidearthExternalDisplacementEastRateEnum
+syn keyword juliaConstC SolidearthExternalDisplacementNorthRateEnum
+syn keyword juliaConstC SolidearthExternalDisplacementUpRateEnum
+syn keyword juliaConstC SolidearthExternalGeoidRateEnum
+syn keyword juliaConstC StochasticForcingDefaultIdEnum
+syn keyword juliaConstC StrainRateeffectiveEnum
+syn keyword juliaConstC StrainRateparallelEnum
+syn keyword juliaConstC StrainRateperpendicularEnum
+syn keyword juliaConstC StrainRatexxEnum
+syn keyword juliaConstC StrainRatexyEnum
+syn keyword juliaConstC StrainRatexzEnum
+syn keyword juliaConstC StrainRateyyEnum
+syn keyword juliaConstC StrainRateyzEnum
+syn keyword juliaConstC StrainRatezzEnum
+syn keyword juliaConstC StressMaxPrincipalEnum
+syn keyword juliaConstC StressTensorxxEnum
+syn keyword juliaConstC StressTensorxyEnum
+syn keyword juliaConstC StressTensorxzEnum
+syn keyword juliaConstC StressTensoryyEnum
+syn keyword juliaConstC StressTensoryzEnum
+syn keyword juliaConstC StressTensorzzEnum
+syn keyword juliaConstC SurfaceAbsMisfitEnum
+syn keyword juliaConstC SurfaceAbsVelMisfitEnum
+syn keyword juliaConstC AreaEnum
+syn keyword juliaConstC SealevelAreaEnum
+syn keyword juliaConstC SurfaceAreaEnum
+syn keyword juliaConstC SurfaceAverageVelMisfitEnum
+syn keyword juliaConstC SurfaceCrevasseEnum
+syn keyword juliaConstC SurfaceEnum
+syn keyword juliaConstC SurfaceOldEnum
+syn keyword juliaConstC SurfaceLogVelMisfitEnum
+syn keyword juliaConstC SurfaceLogVxVyMisfitEnum
+syn keyword juliaConstC SurfaceObservationEnum
+syn keyword juliaConstC SurfaceRelVelMisfitEnum
+syn keyword juliaConstC SurfaceSlopeXEnum
+syn keyword juliaConstC SurfaceSlopeYEnum
+syn keyword juliaConstC TemperatureEnum
+syn keyword juliaConstC TemperaturePDDEnum
+syn keyword juliaConstC TemperaturePicardEnum
+syn keyword juliaConstC TemperatureSEMICEnum
+syn keyword juliaConstC ThermalforcingAutoregressionNoiseEnum
+syn keyword juliaConstC ThermalforcingValuesAutoregressionEnum
+syn keyword juliaConstC ThermalSpctemperatureEnum
+syn keyword juliaConstC ThicknessAbsGradientEnum
+syn keyword juliaConstC ThicknessAbsMisfitEnum
+syn keyword juliaConstC ThicknessAcrossGradientEnum
+syn keyword juliaConstC ThicknessAlongGradientEnum
+syn keyword juliaConstC ThicknessEnum
+syn keyword juliaConstC ThicknessOldEnum
+syn keyword juliaConstC ThicknessPositiveEnum
+syn keyword juliaConstC ThicknessResidualEnum
+syn keyword juliaConstC TransientAccumulatedDeltaIceThicknessEnum
+syn keyword juliaConstC VelEnum
+syn keyword juliaConstC VxAverageEnum
+syn keyword juliaConstC VxBaseEnum
+syn keyword juliaConstC VxEnum
+syn keyword juliaConstC VxMeshEnum
+syn keyword juliaConstC VxObsEnum
+syn keyword juliaConstC VxShearEnum
+syn keyword juliaConstC VxSurfaceEnum
+syn keyword juliaConstC VyAverageEnum
+syn keyword juliaConstC VyBaseEnum
+syn keyword juliaConstC VyEnum
+syn keyword juliaConstC VyMeshEnum
+syn keyword juliaConstC VyObsEnum
+syn keyword juliaConstC VyShearEnum
+syn keyword juliaConstC VySurfaceEnum
+syn keyword juliaConstC VzEnum
+syn keyword juliaConstC VzFSEnum
+syn keyword juliaConstC VzHOEnum
+syn keyword juliaConstC VzMeshEnum
+syn keyword juliaConstC VzSSAEnum
+syn keyword juliaConstC WaterColumnOldEnum
+syn keyword juliaConstC WatercolumnEnum
+syn keyword juliaConstC WaterfractionDrainageEnum
+syn keyword juliaConstC WaterfractionDrainageIntegratedEnum
+syn keyword juliaConstC WaterfractionEnum
+syn keyword juliaConstC WaterheightEnum
+syn keyword juliaConstC FrictionWaterPressureEnum
+syn keyword juliaConstC FrictionWaterPressureNoiseEnum
+syn keyword juliaConstC WeightsLevelsetObservationEnum
+syn keyword juliaConstC WeightsSurfaceObservationEnum
+syn keyword juliaConstC OldAccumulatedDeltaBottomPressureEnum
+syn keyword juliaConstC OldAccumulatedDeltaIceThicknessEnum
+syn keyword juliaConstC OldAccumulatedDeltaTwsEnum
+syn keyword juliaConstC Outputdefinition1Enum
+syn keyword juliaConstC Outputdefinition10Enum
+syn keyword juliaConstC Outputdefinition11Enum
+syn keyword juliaConstC Outputdefinition12Enum
+syn keyword juliaConstC Outputdefinition13Enum
+syn keyword juliaConstC Outputdefinition14Enum
+syn keyword juliaConstC Outputdefinition15Enum
+syn keyword juliaConstC Outputdefinition16Enum
+syn keyword juliaConstC Outputdefinition17Enum
+syn keyword juliaConstC Outputdefinition18Enum
+syn keyword juliaConstC Outputdefinition19Enum
+syn keyword juliaConstC Outputdefinition20Enum
+syn keyword juliaConstC Outputdefinition21Enum
+syn keyword juliaConstC Outputdefinition22Enum
+syn keyword juliaConstC Outputdefinition23Enum
+syn keyword juliaConstC Outputdefinition24Enum
+syn keyword juliaConstC Outputdefinition25Enum
+syn keyword juliaConstC Outputdefinition26Enum
+syn keyword juliaConstC Outputdefinition27Enum
+syn keyword juliaConstC Outputdefinition28Enum
+syn keyword juliaConstC Outputdefinition29Enum
+syn keyword juliaConstC Outputdefinition2Enum
+syn keyword juliaConstC Outputdefinition30Enum
+syn keyword juliaConstC Outputdefinition31Enum
+syn keyword juliaConstC Outputdefinition32Enum
+syn keyword juliaConstC Outputdefinition33Enum
+syn keyword juliaConstC Outputdefinition34Enum
+syn keyword juliaConstC Outputdefinition35Enum
+syn keyword juliaConstC Outputdefinition36Enum
+syn keyword juliaConstC Outputdefinition37Enum
+syn keyword juliaConstC Outputdefinition38Enum
+syn keyword juliaConstC Outputdefinition39Enum
+syn keyword juliaConstC Outputdefinition3Enum
+syn keyword juliaConstC Outputdefinition40Enum
+syn keyword juliaConstC Outputdefinition41Enum
+syn keyword juliaConstC Outputdefinition42Enum
+syn keyword juliaConstC Outputdefinition43Enum
+syn keyword juliaConstC Outputdefinition44Enum
+syn keyword juliaConstC Outputdefinition45Enum
+syn keyword juliaConstC Outputdefinition46Enum
+syn keyword juliaConstC Outputdefinition47Enum
+syn keyword juliaConstC Outputdefinition48Enum
+syn keyword juliaConstC Outputdefinition49Enum
+syn keyword juliaConstC Outputdefinition4Enum
+syn keyword juliaConstC Outputdefinition50Enum
+syn keyword juliaConstC Outputdefinition51Enum
+syn keyword juliaConstC Outputdefinition52Enum
+syn keyword juliaConstC Outputdefinition53Enum
+syn keyword juliaConstC Outputdefinition54Enum
+syn keyword juliaConstC Outputdefinition55Enum
+syn keyword juliaConstC Outputdefinition56Enum
+syn keyword juliaConstC Outputdefinition57Enum
+syn keyword juliaConstC Outputdefinition58Enum
+syn keyword juliaConstC Outputdefinition59Enum
+syn keyword juliaConstC Outputdefinition5Enum
+syn keyword juliaConstC Outputdefinition60Enum
+syn keyword juliaConstC Outputdefinition61Enum
+syn keyword juliaConstC Outputdefinition62Enum
+syn keyword juliaConstC Outputdefinition63Enum
+syn keyword juliaConstC Outputdefinition64Enum
+syn keyword juliaConstC Outputdefinition65Enum
+syn keyword juliaConstC Outputdefinition66Enum
+syn keyword juliaConstC Outputdefinition67Enum
+syn keyword juliaConstC Outputdefinition68Enum
+syn keyword juliaConstC Outputdefinition69Enum
+syn keyword juliaConstC Outputdefinition6Enum
+syn keyword juliaConstC Outputdefinition70Enum
+syn keyword juliaConstC Outputdefinition71Enum
+syn keyword juliaConstC Outputdefinition72Enum
+syn keyword juliaConstC Outputdefinition73Enum
+syn keyword juliaConstC Outputdefinition74Enum
+syn keyword juliaConstC Outputdefinition75Enum
+syn keyword juliaConstC Outputdefinition76Enum
+syn keyword juliaConstC Outputdefinition77Enum
+syn keyword juliaConstC Outputdefinition78Enum
+syn keyword juliaConstC Outputdefinition79Enum
+syn keyword juliaConstC Outputdefinition7Enum
+syn keyword juliaConstC Outputdefinition80Enum
+syn keyword juliaConstC Outputdefinition81Enum
+syn keyword juliaConstC Outputdefinition82Enum
+syn keyword juliaConstC Outputdefinition83Enum
+syn keyword juliaConstC Outputdefinition84Enum
+syn keyword juliaConstC Outputdefinition85Enum
+syn keyword juliaConstC Outputdefinition86Enum
+syn keyword juliaConstC Outputdefinition87Enum
+syn keyword juliaConstC Outputdefinition88Enum
+syn keyword juliaConstC Outputdefinition89Enum
+syn keyword juliaConstC Outputdefinition8Enum
+syn keyword juliaConstC Outputdefinition90Enum
+syn keyword juliaConstC Outputdefinition91Enum
+syn keyword juliaConstC Outputdefinition92Enum
+syn keyword juliaConstC Outputdefinition93Enum
+syn keyword juliaConstC Outputdefinition94Enum
+syn keyword juliaConstC Outputdefinition95Enum
+syn keyword juliaConstC Outputdefinition96Enum
+syn keyword juliaConstC Outputdefinition97Enum
+syn keyword juliaConstC Outputdefinition98Enum
+syn keyword juliaConstC Outputdefinition99Enum
+syn keyword juliaConstC Outputdefinition9Enum
+syn keyword juliaConstC Outputdefinition100Enum
+syn keyword juliaConstC InputsENDEnum
+syn keyword juliaConstC AbsoluteEnum
+syn keyword juliaConstC AdaptiveTimesteppingEnum
+syn keyword juliaConstC AdjointBalancethickness2AnalysisEnum
+syn keyword juliaConstC AdjointBalancethicknessAnalysisEnum
+syn keyword juliaConstC AdjointHorizAnalysisEnum
+syn keyword juliaConstC AggressiveMigrationEnum
+syn keyword juliaConstC AmrBamgEnum
+syn keyword juliaConstC AmrNeopzEnum
+syn keyword juliaConstC AndroidFrictionCoefficientEnum
+syn keyword juliaConstC ArrheniusEnum
+syn keyword juliaConstC AutodiffJacobianEnum
+syn keyword juliaConstC Balancethickness2AnalysisEnum
+syn keyword juliaConstC Balancethickness2SolutionEnum
+syn keyword juliaConstC BalancethicknessAnalysisEnum
+syn keyword juliaConstC BalancethicknessApparentMassbalanceEnum
+syn keyword juliaConstC BalancethicknessSoftAnalysisEnum
+syn keyword juliaConstC BalancethicknessSoftSolutionEnum
+syn keyword juliaConstC BalancethicknessSolutionEnum
+syn keyword juliaConstC BalancevelocityAnalysisEnum
+syn keyword juliaConstC BalancevelocitySolutionEnum
+syn keyword juliaConstC BasalforcingsIsmip6Enum
+syn keyword juliaConstC BasalforcingsPicoEnum
+syn keyword juliaConstC BeckmannGoosseFloatingMeltRateEnum
+syn keyword juliaConstC BedSlopeSolutionEnum
+syn keyword juliaConstC BoolExternalResultEnum
+syn keyword juliaConstC BoolInputEnum
+syn keyword juliaConstC IntInputEnum
+syn keyword juliaConstC DoubleInputEnum
+syn keyword juliaConstC BoolParamEnum
+syn keyword juliaConstC BoundaryEnum
+syn keyword juliaConstC BuddJackaEnum
+syn keyword juliaConstC CalvingDev2Enum
+syn keyword juliaConstC CalvingHabEnum
+syn keyword juliaConstC CalvingLevermannEnum
+syn keyword juliaConstC CalvingVonmisesEnum
+syn keyword juliaConstC CfdragcoeffabsgradEnum
+syn keyword juliaConstC CfsurfacelogvelEnum
+syn keyword juliaConstC CfsurfacesquareEnum
+syn keyword juliaConstC CflevelsetmisfitEnum
+syn keyword juliaConstC ChannelEnum
+syn keyword juliaConstC ChannelAreaEnum
+syn keyword juliaConstC ChannelAreaOldEnum
+syn keyword juliaConstC ChannelDischargeEnum
+syn keyword juliaConstC ClosedEnum
+syn keyword juliaConstC ColinearEnum
+syn keyword juliaConstC ConstraintsEnum
+syn keyword juliaConstC ContactEnum
+syn keyword juliaConstC ContourEnum
+syn keyword juliaConstC ContoursEnum
+syn keyword juliaConstC ControlInputEnum
+syn keyword juliaConstC ControlInputGradEnum
+syn keyword juliaConstC ControlInputMaxsEnum
+syn keyword juliaConstC ControlInputMinsEnum
+syn keyword juliaConstC ControlInputValuesEnum
+syn keyword juliaConstC CrouzeixRaviartEnum
+syn keyword juliaConstC CuffeyEnum
+syn keyword juliaConstC CuffeyTemperateEnum
+syn keyword juliaConstC DamageEvolutionAnalysisEnum
+syn keyword juliaConstC DamageEvolutionSolutionEnum
+syn keyword juliaConstC DataSetEnum
+syn keyword juliaConstC DataSetParamEnum
+syn keyword juliaConstC DatasetInputEnum
+syn keyword juliaConstC DefaultAnalysisEnum
+syn keyword juliaConstC DefaultCalvingEnum
+syn keyword juliaConstC DenseEnum
+syn keyword juliaConstC DependentObjectEnum
+syn keyword juliaConstC DepthAverageAnalysisEnum
+syn keyword juliaConstC DeviatoricStressErrorEstimatorEnum
+syn keyword juliaConstC DivergenceEnum
+syn keyword juliaConstC Domain3DsurfaceEnum
+syn keyword juliaConstC DoubleArrayInputEnum
+syn keyword juliaConstC ArrayInputEnum
+syn keyword juliaConstC DoubleExternalResultEnum
+syn keyword juliaConstC DoubleMatArrayParamEnum
+syn keyword juliaConstC DoubleMatExternalResultEnum
+syn keyword juliaConstC DoubleMatParamEnum
+syn keyword juliaConstC DoubleParamEnum
+syn keyword juliaConstC DoubleVecParamEnum
+syn keyword juliaConstC ElementEnum
+syn keyword juliaConstC ElementHookEnum
+syn keyword juliaConstC ElementSIdEnum
+syn keyword juliaConstC EnthalpyAnalysisEnum
+syn keyword juliaConstC EsaAnalysisEnum
+syn keyword juliaConstC EsaSolutionEnum
+syn keyword juliaConstC EsaTransitionsEnum
+syn keyword juliaConstC ExternalResultEnum
+syn keyword juliaConstC ExtrapolationAnalysisEnum
+syn keyword juliaConstC ExtrudeFromBaseAnalysisEnum
+syn keyword juliaConstC ExtrudeFromTopAnalysisEnum
+syn keyword juliaConstC FSApproximationEnum
+syn keyword juliaConstC FSSolverEnum
+syn keyword juliaConstC FSpressureEnum
+syn keyword juliaConstC FSvelocityEnum
+syn keyword juliaConstC FemModelEnum
+syn keyword juliaConstC FileParamEnum
+syn keyword juliaConstC FixedTimesteppingEnum
+syn keyword juliaConstC FloatingAreaEnum
+syn keyword juliaConstC FloatingAreaScaledEnum
+syn keyword juliaConstC FloatingMeltRateEnum
+syn keyword juliaConstC FreeEnum
+syn keyword juliaConstC FreeSurfaceBaseAnalysisEnum
+syn keyword juliaConstC FreeSurfaceTopAnalysisEnum
+syn keyword juliaConstC FrontalForcingsDefaultEnum
+syn keyword juliaConstC FrontalForcingsRignotEnum
+syn keyword juliaConstC FrontalForcingsRignotAutoregressionEnum
+syn keyword juliaConstC FsetEnum
+syn keyword juliaConstC FullMeltOnPartiallyFloatingEnum
+syn keyword juliaConstC GLheightadvectionAnalysisEnum
+syn keyword juliaConstC GaussPentaEnum
+syn keyword juliaConstC GaussSegEnum
+syn keyword juliaConstC GaussTetraEnum
+syn keyword juliaConstC GaussTriaEnum
+syn keyword juliaConstC GenericOptionEnum
+syn keyword juliaConstC GenericParamEnum
+syn keyword juliaConstC GenericExternalResultEnum
+syn keyword juliaConstC Gradient1Enum
+syn keyword juliaConstC Gradient2Enum
+syn keyword juliaConstC Gradient3Enum
+syn keyword juliaConstC Gradient4Enum
+syn keyword juliaConstC GroundedAreaEnum
+syn keyword juliaConstC GroundedAreaScaledEnum
+syn keyword juliaConstC GroundingOnlyEnum
+syn keyword juliaConstC GroundinglineMassFluxEnum
+syn keyword juliaConstC GsetEnum
+syn keyword juliaConstC GslEnum
+syn keyword juliaConstC HOApproximationEnum
+syn keyword juliaConstC HOFSApproximationEnum
+syn keyword juliaConstC HookEnum
+syn keyword juliaConstC HydrologyDCEfficientAnalysisEnum
+syn keyword juliaConstC HydrologyDCInefficientAnalysisEnum
+syn keyword juliaConstC HydrologyGlaDSAnalysisEnum
+syn keyword juliaConstC HydrologyGlaDSEnum
+syn keyword juliaConstC HydrologyPismAnalysisEnum
+syn keyword juliaConstC HydrologyShaktiAnalysisEnum
+syn keyword juliaConstC HydrologyShreveAnalysisEnum
+syn keyword juliaConstC HydrologySolutionEnum
+syn keyword juliaConstC HydrologydcEnum
+syn keyword juliaConstC HydrologypismEnum
+syn keyword juliaConstC HydrologyshaktiEnum
+syn keyword juliaConstC HydrologyshreveEnum
+syn keyword juliaConstC IceMassEnum
+syn keyword juliaConstC IceMassScaledEnum
+syn keyword juliaConstC IceVolumeAboveFloatationEnum
+syn keyword juliaConstC IceVolumeAboveFloatationScaledEnum
+syn keyword juliaConstC IceVolumeEnum
+syn keyword juliaConstC IceVolumeScaledEnum
+syn keyword juliaConstC IcefrontMassFluxEnum
+syn keyword juliaConstC IcefrontMassFluxLevelsetEnum
+syn keyword juliaConstC IncrementalEnum
+syn keyword juliaConstC IndexedEnum
+syn keyword juliaConstC IntExternalResultEnum
+syn keyword juliaConstC ElementInputEnum
+syn keyword juliaConstC IntMatExternalResultEnum
+syn keyword juliaConstC IntMatParamEnum
+syn keyword juliaConstC IntParamEnum
+syn keyword juliaConstC IntVecParamEnum
+syn keyword juliaConstC InputsEnum
+syn keyword juliaConstC InternalEnum
+syn keyword juliaConstC IntersectEnum
+syn keyword juliaConstC InversionVzObsEnum
+syn keyword juliaConstC JEnum
+syn keyword juliaConstC L1L2ApproximationEnum
+syn keyword juliaConstC MLHOApproximationEnum
+syn keyword juliaConstC L2ProjectionBaseAnalysisEnum
+syn keyword juliaConstC L2ProjectionEPLAnalysisEnum
+syn keyword juliaConstC LACrouzeixRaviartEnum
+syn keyword juliaConstC LATaylorHoodEnum
+syn keyword juliaConstC LambdaSEnum
+syn keyword juliaConstC LevelsetAnalysisEnum
+syn keyword juliaConstC LevelsetfunctionPicardEnum
+syn keyword juliaConstC LinearFloatingMeltRateEnum
+syn keyword juliaConstC LliboutryDuvalEnum
+syn keyword juliaConstC LoadsEnum
+syn keyword juliaConstC LoveAnalysisEnum
+syn keyword juliaConstC LoveHiEnum
+syn keyword juliaConstC LoveHrEnum
+syn keyword juliaConstC LoveKernelsImagEnum
+syn keyword juliaConstC LoveKernelsRealEnum
+syn keyword juliaConstC LoveKiEnum
+syn keyword juliaConstC LoveKrEnum
+syn keyword juliaConstC LoveLiEnum
+syn keyword juliaConstC LoveLrEnum
+syn keyword juliaConstC LoveSolutionEnum
+syn keyword juliaConstC MINIEnum
+syn keyword juliaConstC MINIcondensedEnum
+syn keyword juliaConstC MantlePlumeGeothermalFluxEnum
+syn keyword juliaConstC MassFluxEnum
+syn keyword juliaConstC MassconEnum
+syn keyword juliaConstC MassconaxpbyEnum
+syn keyword juliaConstC MassfluxatgateEnum
+syn keyword juliaConstC MasstransportAnalysisEnum
+syn keyword juliaConstC MasstransportSolutionEnum
+syn keyword juliaConstC MatdamageiceEnum
+syn keyword juliaConstC MatenhancediceEnum
+syn keyword juliaConstC MaterialsEnum
+syn keyword juliaConstC MatestarEnum
+syn keyword juliaConstC MaticeEnum
+syn keyword juliaConstC MatlithoEnum
+syn keyword juliaConstC MathydroEnum
+syn keyword juliaConstC MatrixParamEnum
+syn keyword juliaConstC MaxAbsVxEnum
+syn keyword juliaConstC MaxAbsVyEnum
+syn keyword juliaConstC MaxAbsVzEnum
+syn keyword juliaConstC MaxDivergenceEnum
+syn keyword juliaConstC MaxVelEnum
+syn keyword juliaConstC MaxVxEnum
+syn keyword juliaConstC MaxVyEnum
+syn keyword juliaConstC MaxVzEnum
+syn keyword juliaConstC MelangeEnum
+syn keyword juliaConstC MeltingAnalysisEnum
+syn keyword juliaConstC MeshElementsEnum
+syn keyword juliaConstC MeshXEnum
+syn keyword juliaConstC MeshYEnum
+syn keyword juliaConstC MinVelEnum
+syn keyword juliaConstC MinVxEnum
+syn keyword juliaConstC MinVyEnum
+syn keyword juliaConstC MinVzEnum
+syn keyword juliaConstC MismipFloatingMeltRateEnum
+syn keyword juliaConstC MoulinEnum
+syn keyword juliaConstC MpiDenseEnum
+syn keyword juliaConstC MpiEnum
+syn keyword juliaConstC MpiSparseEnum
+syn keyword juliaConstC MumpsEnum
+syn keyword juliaConstC NoFrictionOnPartiallyFloatingEnum
+syn keyword juliaConstC NoMeltOnPartiallyFloatingEnum
+syn keyword juliaConstC NodalEnum
+syn keyword juliaConstC NodalvalueEnum
+syn keyword juliaConstC NodeSIdEnum
+syn keyword juliaConstC NoneApproximationEnum
+syn keyword juliaConstC NoneEnum
+syn keyword juliaConstC NumberedcostfunctionEnum
+syn keyword juliaConstC NyeCO2Enum
+syn keyword juliaConstC NyeH2OEnum
+syn keyword juliaConstC NumericalfluxEnum
+syn keyword juliaConstC OceantransportAnalysisEnum
+syn keyword juliaConstC OceantransportSolutionEnum
+syn keyword juliaConstC OldGradientEnum
+syn keyword juliaConstC OneLayerP4zEnum
+syn keyword juliaConstC OpenEnum
+syn keyword juliaConstC OptionEnum
+syn keyword juliaConstC ParamEnum
+syn keyword juliaConstC ParametersEnum
+syn keyword juliaConstC P0ArrayEnum
+syn keyword juliaConstC P0DGEnum
+syn keyword juliaConstC P1DGEnum
+syn keyword juliaConstC P1P1Enum
+syn keyword juliaConstC P1P1GLSEnum
+syn keyword juliaConstC P1bubbleEnum
+syn keyword juliaConstC P1bubblecondensedEnum
+syn keyword juliaConstC P1xP2Enum
+syn keyword juliaConstC P1xP3Enum
+syn keyword juliaConstC P1xP4Enum
+syn keyword juliaConstC P2Enum
+syn keyword juliaConstC P2bubbleEnum
+syn keyword juliaConstC P2bubblecondensedEnum
+syn keyword juliaConstC P2xP1Enum
+syn keyword juliaConstC P2xP4Enum
+syn keyword juliaConstC PatersonEnum
+syn keyword juliaConstC PengridEnum
+syn keyword juliaConstC PenpairEnum
+syn keyword juliaConstC PentaEnum
+syn keyword juliaConstC PentaInputEnum
+syn keyword juliaConstC ProfilerEnum
+syn keyword juliaConstC ProfilingCurrentFlopsEnum
+syn keyword juliaConstC ProfilingCurrentMemEnum
+syn keyword juliaConstC ProfilingSolutionTimeEnum
+syn keyword juliaConstC RegionaloutputEnum
+syn keyword juliaConstC RegularEnum
+syn keyword juliaConstC RecoveryAnalysisEnum
+syn keyword juliaConstC RiftfrontEnum
+syn keyword juliaConstC SamplingAnalysisEnum
+syn keyword juliaConstC SamplingSolutionEnum
+syn keyword juliaConstC SIAApproximationEnum
+syn keyword juliaConstC SMBautoregressionEnum
+syn keyword juliaConstC SMBcomponentsEnum
+syn keyword juliaConstC SMBd18opddEnum
+syn keyword juliaConstC SMBforcingEnum
+syn keyword juliaConstC SMBgcmEnum
+syn keyword juliaConstC SMBgembEnum
+syn keyword juliaConstC SMBgradientsEnum
+syn keyword juliaConstC SMBgradientscomponentsEnum
+syn keyword juliaConstC SMBgradientselaEnum
+syn keyword juliaConstC SMBhenningEnum
+syn keyword juliaConstC SMBmeltcomponentsEnum
+syn keyword juliaConstC SMBpddEnum
+syn keyword juliaConstC SMBpddSicopolisEnum
+syn keyword juliaConstC SMBsemicEnum
+syn keyword juliaConstC SSAApproximationEnum
+syn keyword juliaConstC SSAFSApproximationEnum
+syn keyword juliaConstC SSAHOApproximationEnum
+syn keyword juliaConstC ScaledEnum
+syn keyword juliaConstC SealevelAbsoluteEnum
+syn keyword juliaConstC SealevelEmotionEnum
+syn keyword juliaConstC SealevelInertiaTensorXZEnum
+syn keyword juliaConstC SealevelInertiaTensorYZEnum
+syn keyword juliaConstC SealevelInertiaTensorZZEnum
+syn keyword juliaConstC SealevelchangePolarMotionEnum
+syn keyword juliaConstC SealevelNmotionEnum
+syn keyword juliaConstC SealevelUmotionEnum
+syn keyword juliaConstC SealevelchangeAnalysisEnum
+syn keyword juliaConstC SegEnum
+syn keyword juliaConstC SegInputEnum
+syn keyword juliaConstC SegmentEnum
+syn keyword juliaConstC SegmentRiftfrontEnum
+syn keyword juliaConstC SeparateEnum
+syn keyword juliaConstC SeqEnum
+syn keyword juliaConstC SmbAnalysisEnum
+syn keyword juliaConstC SmbSolutionEnum
+syn keyword juliaConstC SmoothAnalysisEnum
+syn keyword juliaConstC SoftMigrationEnum
+syn keyword juliaConstC SpatialLinearFloatingMeltRateEnum
+syn keyword juliaConstC SpcDynamicEnum
+syn keyword juliaConstC SpcStaticEnum
+syn keyword juliaConstC SpcTransientEnum
+syn keyword juliaConstC SsetEnum
+syn keyword juliaConstC StatisticsSolutionEnum
+syn keyword juliaConstC SteadystateSolutionEnum
+syn keyword juliaConstC StressIntensityFactorEnum
+syn keyword juliaConstC StressbalanceAnalysisEnum
+syn keyword juliaConstC StressbalanceConvergenceNumStepsEnum
+syn keyword juliaConstC StressbalanceSIAAnalysisEnum
+syn keyword juliaConstC StressbalanceSolutionEnum
+syn keyword juliaConstC StressbalanceVerticalAnalysisEnum
+syn keyword juliaConstC StringArrayParamEnum
+syn keyword juliaConstC StringExternalResultEnum
+syn keyword juliaConstC StringParamEnum
+syn keyword juliaConstC SubelementFriction1Enum
+syn keyword juliaConstC SubelementFriction2Enum
+syn keyword juliaConstC SubelementMelt1Enum
+syn keyword juliaConstC SubelementMelt2Enum
+syn keyword juliaConstC SubelementMigrationEnum
+syn keyword juliaConstC SurfaceSlopeSolutionEnum
+syn keyword juliaConstC TaylorHoodEnum
+syn keyword juliaConstC TetraEnum
+syn keyword juliaConstC TetraInputEnum
+syn keyword juliaConstC ThermalAnalysisEnum
+syn keyword juliaConstC ThermalSolutionEnum
+syn keyword juliaConstC ThicknessErrorEstimatorEnum
+syn keyword juliaConstC TotalCalvingFluxLevelsetEnum
+syn keyword juliaConstC TotalCalvingMeltingFluxLevelsetEnum
+syn keyword juliaConstC TotalFloatingBmbEnum
+syn keyword juliaConstC TotalFloatingBmbScaledEnum
+syn keyword juliaConstC TotalGroundedBmbEnum
+syn keyword juliaConstC TotalGroundedBmbScaledEnum
+syn keyword juliaConstC TotalSmbEnum
+syn keyword juliaConstC TotalSmbScaledEnum
+syn keyword juliaConstC TransientArrayParamEnum
+syn keyword juliaConstC TransientInputEnum
+syn keyword juliaConstC TransientParamEnum
+syn keyword juliaConstC TransientSolutionEnum
+syn keyword juliaConstC TriaEnum
+syn keyword juliaConstC TriaInputEnum
+syn keyword juliaConstC UzawaPressureAnalysisEnum
+syn keyword juliaConstC VectorParamEnum
+syn keyword juliaConstC VertexEnum
+syn keyword juliaConstC VertexLIdEnum
+syn keyword juliaConstC VertexPIdEnum
+syn keyword juliaConstC VertexSIdEnum
+syn keyword juliaConstC VerticesEnum
+syn keyword juliaConstC ViscousHeatingEnum
+syn keyword juliaConstC WaterEnum
+syn keyword juliaConstC XTaylorHoodEnum
+syn keyword juliaConstC XYEnum
+syn keyword juliaConstC XYZEnum
+syn keyword juliaConstC BalancethicknessD0Enum
+syn keyword juliaConstC BalancethicknessDiffusionCoefficientEnum
+syn keyword juliaConstC BilinearInterpEnum
+syn keyword juliaConstC CalvingdevCoeffEnum
+syn keyword juliaConstC DeviatoricStressEnum
+syn keyword juliaConstC EtaAbsGradientEnum
+syn keyword juliaConstC MeshZEnum
+syn keyword juliaConstC NearestInterpEnum
+syn keyword juliaConstC OutputdefinitionListEnum
+syn keyword juliaConstC SealevelObsEnum
+syn keyword juliaConstC SealevelWeightsEnum
+syn keyword juliaConstC StrainRateEnum
+syn keyword juliaConstC StressTensorEnum
+syn keyword juliaConstC StressbalanceViscosityOvershootEnum
+syn keyword juliaConstC SubelementMigration4Enum
+syn keyword juliaConstC TimesteppingTimeAdaptEnum
+syn keyword juliaConstC TriangleInterpEnum
+syn keyword juliaConstC MaximumNumberOfDefinitionsEnum
+"ISSM Enums end
Index: issm/trunk/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- issm/trunk/src/c/shared/Enum/StringToEnumx.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/Enum/StringToEnumx.cpp	(revision 26744)
@@ -65,4 +65,5 @@
 	      else if (strcmp(name,"AutodiffXp")==0) return AutodiffXpEnum;
 	      else if (strcmp(name,"BalancethicknessStabilization")==0) return BalancethicknessStabilizationEnum;
+	      else if (strcmp(name,"BarystaticContributions")==0) return BarystaticContributionsEnum;
 	      else if (strcmp(name,"BasalforcingsBottomplumedepth")==0) return BasalforcingsBottomplumedepthEnum;
 	      else if (strcmp(name,"BasalforcingsCrustthickness")==0) return BasalforcingsCrustthicknessEnum;
@@ -102,4 +103,5 @@
 	      else if (strcmp(name,"BasalforcingsUpperwaterMeltingRate")==0) return BasalforcingsUpperwaterMeltingRateEnum;
 	      else if (strcmp(name,"CalvingCrevasseDepth")==0) return CalvingCrevasseDepthEnum;
+	      else if (strcmp(name,"CalvingCrevasseThreshold")==0) return CalvingCrevasseThresholdEnum;
 	      else if (strcmp(name,"CalvingHeightAboveFloatation")==0) return CalvingHeightAboveFloatationEnum;
 	      else if (strcmp(name,"CalvingLaw")==0) return CalvingLawEnum;
@@ -107,4 +109,5 @@
 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
 	      else if (strcmp(name,"ConstantsG")==0) return ConstantsGEnum;
+	      else if (strcmp(name,"ConstantsNewtonGravity")==0) return ConstantsNewtonGravityEnum;
 	      else if (strcmp(name,"ConstantsReferencetemperature")==0) return ConstantsReferencetemperatureEnum;
 	      else if (strcmp(name,"ConstantsYts")==0) return ConstantsYtsEnum;
@@ -112,11 +115,13 @@
 	      else if (strcmp(name,"ControlInputSizeN")==0) return ControlInputSizeNEnum;
 	      else if (strcmp(name,"ControlInputInterpolation")==0) return ControlInputInterpolationEnum;
-	      else if (strcmp(name,"CumBslr")==0) return CumBslrEnum;
-	      else if (strcmp(name,"CumBslrIce")==0) return CumBslrIceEnum;
-	      else if (strcmp(name,"CumBslrHydro")==0) return CumBslrHydroEnum;
-	      else if (strcmp(name,"CumBslrIcePartition")==0) return CumBslrIcePartitionEnum;
-	      else if (strcmp(name,"CumBslrHydroPartition")==0) return CumBslrHydroPartitionEnum;
-	      else if (strcmp(name,"CumGmtslr")==0) return CumGmtslrEnum;
-	      else if (strcmp(name,"CumGmslr")==0) return CumGmslrEnum;
+	      else if (strcmp(name,"CumBslc")==0) return CumBslcEnum;
+	      else if (strcmp(name,"CumBslcIce")==0) return CumBslcIceEnum;
+	      else if (strcmp(name,"CumBslcHydro")==0) return CumBslcHydroEnum;
+	      else if (strcmp(name,"CumBslcOcean")==0) return CumBslcOceanEnum;
+	      else if (strcmp(name,"CumBslcIcePartition")==0) return CumBslcIcePartitionEnum;
+	      else if (strcmp(name,"CumBslcHydroPartition")==0) return CumBslcHydroPartitionEnum;
+	      else if (strcmp(name,"CumBslcOceanPartition")==0) return CumBslcOceanPartitionEnum;
+	      else if (strcmp(name,"CumGmtslc")==0) return CumGmtslcEnum;
+	      else if (strcmp(name,"CumGmslc")==0) return CumGmslcEnum;
 	      else if (strcmp(name,"DamageC1")==0) return DamageC1Enum;
 	      else if (strcmp(name,"DamageC2")==0) return DamageC2Enum;
@@ -132,17 +137,22 @@
 	      else if (strcmp(name,"DamageMaxDamage")==0) return DamageMaxDamageEnum;
 	      else if (strcmp(name,"DamageStabilization")==0) return DamageStabilizationEnum;
-	      else if (strcmp(name,"DamageStressThreshold")==0) return DamageStressThresholdEnum;
+         else stage=2;
+   }
+   if(stage==2){
+	      if (strcmp(name,"DamageStressThreshold")==0) return DamageStressThresholdEnum;
 	      else if (strcmp(name,"DamageStressUBound")==0) return DamageStressUBoundEnum;
 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
 	      else if (strcmp(name,"DomainDimension")==0) return DomainDimensionEnum;
 	      else if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
-         else stage=2;
-   }
-   if(stage==2){
-	      if (strcmp(name,"DslModel")==0) return DslModelEnum;
+	      else if (strcmp(name,"DslModel")==0) return DslModelEnum;
 	      else if (strcmp(name,"DslModelid")==0) return DslModelidEnum;
 	      else if (strcmp(name,"DslNummodels")==0) return DslNummodelsEnum;
-	      else if (strcmp(name,"DslComputeFingerprints")==0) return DslComputeFingerprintsEnum;
+	      else if (strcmp(name,"SolidearthIsExternal")==0) return SolidearthIsExternalEnum;
+	      else if (strcmp(name,"SolidearthExternalNature")==0) return SolidearthExternalNatureEnum;
+	      else if (strcmp(name,"SolidearthExternalModelid")==0) return SolidearthExternalModelidEnum;
+	      else if (strcmp(name,"SolidearthExternalNummodels")==0) return SolidearthExternalNummodelsEnum;
+	      else if (strcmp(name,"SolidearthSettingsComputeBpGrd")==0) return SolidearthSettingsComputeBpGrdEnum;
 	      else if (strcmp(name,"EarthId")==0) return EarthIdEnum;
+	      else if (strcmp(name,"Elastic")==0) return ElasticEnum;
 	      else if (strcmp(name,"EplZigZagCounter")==0) return EplZigZagCounterEnum;
 	      else if (strcmp(name,"EsaHElastic")==0) return EsaHElasticEnum;
@@ -172,10 +182,13 @@
 	      else if (strcmp(name,"FrictionVoidRatio")==0) return FrictionVoidRatioEnum;
 	      else if (strcmp(name,"FrontalForcingsBasinIcefrontArea")==0) return FrontalForcingsBasinIcefrontAreaEnum;
+	      else if (strcmp(name,"FrontalForcingsAutoregressionInitialTime")==0) return FrontalForcingsAutoregressionInitialTimeEnum;
+	      else if (strcmp(name,"FrontalForcingsAutoregressionTimestep")==0) return FrontalForcingsAutoregressionTimestepEnum;
+	      else if (strcmp(name,"FrontalForcingsAutoregressiveOrder")==0) return FrontalForcingsAutoregressiveOrderEnum;
+	      else if (strcmp(name,"FrontalForcingsBeta0")==0) return FrontalForcingsBeta0Enum;
+	      else if (strcmp(name,"FrontalForcingsBeta1")==0) return FrontalForcingsBeta1Enum;
 	      else if (strcmp(name,"FrontalForcingsNumberofBasins")==0) return FrontalForcingsNumberofBasinsEnum;
 	      else if (strcmp(name,"FrontalForcingsParam")==0) return FrontalForcingsParamEnum;
-	      else if (strcmp(name,"GiaModel")==0) return GiaModelEnum;
-	      else if (strcmp(name,"GiaModelid")==0) return GiaModelidEnum;
-	      else if (strcmp(name,"GiaNummodels")==0) return GiaNummodelsEnum;
-	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
+	      else if (strcmp(name,"FrontalForcingsPhi")==0) return FrontalForcingsPhiEnum;
+	      else if (strcmp(name,"GrdModel")==0) return GrdModelEnum;
 	      else if (strcmp(name,"GroundinglineFrictionInterpolation")==0) return GroundinglineFrictionInterpolationEnum;
 	      else if (strcmp(name,"GroundinglineMeltInterpolation")==0) return GroundinglineMeltInterpolationEnum;
@@ -247,5 +260,10 @@
 	      else if (strcmp(name,"InversionNumCostFunctions")==0) return InversionNumCostFunctionsEnum;
 	      else if (strcmp(name,"InversionStepThreshold")==0) return InversionStepThresholdEnum;
-	      else if (strcmp(name,"InversionType")==0) return InversionTypeEnum;
+         else stage=3;
+   }
+   if(stage==3){
+	      if (strcmp(name,"InversionType")==0) return InversionTypeEnum;
+	      else if (strcmp(name,"Ivins")==0) return IvinsEnum;
+	      else if (strcmp(name,"IsSlcCoupling")==0) return IsSlcCouplingEnum;
 	      else if (strcmp(name,"LevelsetKillIcebergs")==0) return LevelsetKillIcebergsEnum;
 	      else if (strcmp(name,"LevelsetReinitFrequency")==0) return LevelsetReinitFrequencyEnum;
@@ -253,16 +271,24 @@
 	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
 	      else if (strcmp(name,"LoveAllowLayerDeletion")==0) return LoveAllowLayerDeletionEnum;
+	      else if (strcmp(name,"LoveCoreMantleBoundary")==0) return LoveCoreMantleBoundaryEnum;
+	      else if (strcmp(name,"LoveEarthMass")==0) return LoveEarthMassEnum;
 	      else if (strcmp(name,"LoveForcingType")==0) return LoveForcingTypeEnum;
 	      else if (strcmp(name,"LoveFrequencies")==0) return LoveFrequenciesEnum;
+	      else if (strcmp(name,"LoveIsTemporal")==0) return LoveIsTemporalEnum;
 	      else if (strcmp(name,"LoveG0")==0) return LoveG0Enum;
+	      else if (strcmp(name,"LoveGravitationalConstant")==0) return LoveGravitationalConstantEnum;
+	      else if (strcmp(name,"LoveInnerCoreBoundary")==0) return LoveInnerCoreBoundaryEnum;
+	      else if (strcmp(name,"LoveComplexComputation")==0) return LoveComplexComputationEnum;
+	      else if (strcmp(name,"LoveIntStepsPerLayer")==0) return LoveIntStepsPerLayerEnum;
 	      else if (strcmp(name,"LoveKernels")==0) return LoveKernelsEnum;
 	      else if (strcmp(name,"LoveMu0")==0) return LoveMu0Enum;
 	      else if (strcmp(name,"LoveNfreq")==0) return LoveNfreqEnum;
+	      else if (strcmp(name,"LoveNTemporalIterations")==0) return LoveNTemporalIterationsEnum;
+	      else if (strcmp(name,"LoveNYiEquations")==0) return LoveNYiEquationsEnum;
 	      else if (strcmp(name,"LoveR0")==0) return LoveR0Enum;
-         else stage=3;
-   }
-   if(stage==3){
-	      if (strcmp(name,"LoveShNmax")==0) return LoveShNmaxEnum;
+	      else if (strcmp(name,"LoveShNmax")==0) return LoveShNmaxEnum;
 	      else if (strcmp(name,"LoveShNmin")==0) return LoveShNminEnum;
+	      else if (strcmp(name,"LoveStartingLayer")==0) return LoveStartingLayerEnum;
+	      else if (strcmp(name,"LoveUnderflowTol")==0) return LoveUnderflowTolEnum;
 	      else if (strcmp(name,"MassFluxSegments")==0) return MassFluxSegmentsEnum;
 	      else if (strcmp(name,"MassFluxSegmentsPresent")==0) return MassFluxSegmentsPresentEnum;
@@ -279,8 +305,4 @@
 	      else if (strcmp(name,"MaterialsHeatcapacity")==0) return MaterialsHeatcapacityEnum;
 	      else if (strcmp(name,"MaterialsLatentheat")==0) return MaterialsLatentheatEnum;
-	      else if (strcmp(name,"MaterialsLithosphereDensity")==0) return MaterialsLithosphereDensityEnum;
-	      else if (strcmp(name,"MaterialsLithosphereShearModulus")==0) return MaterialsLithosphereShearModulusEnum;
-	      else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;
-	      else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
 	      else if (strcmp(name,"MaterialsMeltingpoint")==0) return MaterialsMeltingpointEnum;
 	      else if (strcmp(name,"MaterialsMixedLayerCapacity")==0) return MaterialsMixedLayerCapacityEnum;
@@ -298,4 +320,5 @@
 	      else if (strcmp(name,"MeshNumberoflayers")==0) return MeshNumberoflayersEnum;
 	      else if (strcmp(name,"MeshNumberofvertices")==0) return MeshNumberofverticesEnum;
+	      else if (strcmp(name,"MeshNumberofelements")==0) return MeshNumberofelementsEnum;
 	      else if (strcmp(name,"MigrationMax")==0) return MigrationMaxEnum;
 	      else if (strcmp(name,"ModelId")==0) return ModelIdEnum;
@@ -336,15 +359,32 @@
 	      else if (strcmp(name,"RootPath")==0) return RootPathEnum;
 	      else if (strcmp(name,"Modelname")==0) return ModelnameEnum;
+	      else if (strcmp(name,"SamplingAlpha")==0) return SamplingAlphaEnum;
+	      else if (strcmp(name,"SamplingPhi")==0) return SamplingPhiEnum;
+	      else if (strcmp(name,"SamplingNumRequestedOutputs")==0) return SamplingNumRequestedOutputsEnum;
+	      else if (strcmp(name,"SamplingRequestedOutputs")==0) return SamplingRequestedOutputsEnum;
+	      else if (strcmp(name,"SamplingRobin")==0) return SamplingRobinEnum;
+	      else if (strcmp(name,"SamplingSeed")==0) return SamplingSeedEnum;
+	      else if (strcmp(name,"SamplingTau")==0) return SamplingTauEnum;
 	      else if (strcmp(name,"SaveResults")==0) return SaveResultsEnum;
 	      else if (strcmp(name,"SolidearthPartitionIce")==0) return SolidearthPartitionIceEnum;
 	      else if (strcmp(name,"SolidearthPartitionHydro")==0) return SolidearthPartitionHydroEnum;
+	      else if (strcmp(name,"SolidearthPartitionOcean")==0) return SolidearthPartitionOceanEnum;
 	      else if (strcmp(name,"SolidearthNpartIce")==0) return SolidearthNpartIceEnum;
+	      else if (strcmp(name,"SolidearthNpartOcean")==0) return SolidearthNpartOceanEnum;
 	      else if (strcmp(name,"SolidearthNpartHydro")==0) return SolidearthNpartHydroEnum;
 	      else if (strcmp(name,"SolidearthPlanetRadius")==0) return SolidearthPlanetRadiusEnum;
 	      else if (strcmp(name,"SolidearthPlanetArea")==0) return SolidearthPlanetAreaEnum;
 	      else if (strcmp(name,"SolidearthSettingsAbstol")==0) return SolidearthSettingsAbstolEnum;
+	      else if (strcmp(name,"SolidearthSettingsCrossSectionShape")==0) return SolidearthSettingsCrossSectionShapeEnum;
 	      else if (strcmp(name,"RotationalAngularVelocity")==0) return RotationalAngularVelocityEnum;
 	      else if (strcmp(name,"SolidearthSettingsElastic")==0) return SolidearthSettingsElasticEnum;
-	      else if (strcmp(name,"SealevelriseGeometryDone")==0) return SealevelriseGeometryDoneEnum;
+	      else if (strcmp(name,"SolidearthSettingsViscous")==0) return SolidearthSettingsViscousEnum;
+	      else if (strcmp(name,"SealevelchangeGeometryDone")==0) return SealevelchangeGeometryDoneEnum;
+	      else if (strcmp(name,"SealevelchangeViscousNumSteps")==0) return SealevelchangeViscousNumStepsEnum;
+	      else if (strcmp(name,"SealevelchangeViscousTimes")==0) return SealevelchangeViscousTimesEnum;
+         else stage=4;
+   }
+   if(stage==4){
+	      if (strcmp(name,"SealevelchangeViscousIndex")==0) return SealevelchangeViscousIndexEnum;
 	      else if (strcmp(name,"RotationalEquatorialMoi")==0) return RotationalEquatorialMoiEnum;
 	      else if (strcmp(name,"TidalLoveH")==0) return TidalLoveHEnum;
@@ -355,22 +395,35 @@
 	      else if (strcmp(name,"LoadLoveK")==0) return LoadLoveKEnum;
 	      else if (strcmp(name,"LoadLoveL")==0) return LoadLoveLEnum;
-	      else if (strcmp(name,"SealevelriseGRigid")==0) return SealevelriseGRigidEnum;
-	      else if (strcmp(name,"SealevelriseGElastic")==0) return SealevelriseGElasticEnum;
-	      else if (strcmp(name,"SolidearthSettingsComputesealevelchange")==0) return SolidearthSettingsComputesealevelchangeEnum;
+	      else if (strcmp(name,"LoveTimeFreq")==0) return LoveTimeFreqEnum;
+	      else if (strcmp(name,"LoveIsTime")==0) return LoveIsTimeEnum;
+	      else if (strcmp(name,"SealevelchangeGSelfAttraction")==0) return SealevelchangeGSelfAttractionEnum;
+	      else if (strcmp(name,"SealevelchangeGViscoElastic")==0) return SealevelchangeGViscoElasticEnum;
+	      else if (strcmp(name,"SolidearthSettingsSealevelLoading")==0) return SolidearthSettingsSealevelLoadingEnum;
 	      else if (strcmp(name,"SolidearthSettingsGRD")==0) return SolidearthSettingsGRDEnum;
-	      else if (strcmp(name,"SolidearthSettingsGlfraction")==0) return SolidearthSettingsGlfractionEnum;
 	      else if (strcmp(name,"SolidearthSettingsRunFrequency")==0) return SolidearthSettingsRunFrequencyEnum;
-	      else if (strcmp(name,"SealevelriseHElastic")==0) return SealevelriseHElasticEnum;
+	      else if (strcmp(name,"SolidearthSettingsTimeAcc")==0) return SolidearthSettingsTimeAccEnum;
+	      else if (strcmp(name,"SealevelchangeHViscoElastic")==0) return SealevelchangeHViscoElasticEnum;
 	      else if (strcmp(name,"SolidearthSettingsHoriz")==0) return SolidearthSettingsHorizEnum;
 	      else if (strcmp(name,"SolidearthSettingsMaxiter")==0) return SolidearthSettingsMaxiterEnum;
+	      else if (strcmp(name,"SolidearthSettingsGrdOcean")==0) return SolidearthSettingsGrdOceanEnum;
 	      else if (strcmp(name,"SolidearthSettingsOceanAreaScaling")==0) return SolidearthSettingsOceanAreaScalingEnum;
+	      else if (strcmp(name,"StochasticForcingCovariance")==0) return StochasticForcingCovarianceEnum;
+	      else if (strcmp(name,"StochasticForcingDefaultDimension")==0) return StochasticForcingDefaultDimensionEnum;
+	      else if (strcmp(name,"StochasticForcingDimensions")==0) return StochasticForcingDimensionsEnum;
+	      else if (strcmp(name,"StochasticForcingFields")==0) return StochasticForcingFieldsEnum;
+	      else if (strcmp(name,"StochasticForcingIsEffectivePressure")==0) return StochasticForcingIsEffectivePressureEnum;
+	      else if (strcmp(name,"StochasticForcingIsStochasticForcing")==0) return StochasticForcingIsStochasticForcingEnum;
+	      else if (strcmp(name,"StochasticForcingIsWaterPressure")==0) return StochasticForcingIsWaterPressureEnum;
+	      else if (strcmp(name,"StochasticForcingNumFields")==0) return StochasticForcingNumFieldsEnum;
+	      else if (strcmp(name,"StochasticForcingRandomflag")==0) return StochasticForcingRandomflagEnum;
 	      else if (strcmp(name,"RotationalPolarMoi")==0) return RotationalPolarMoiEnum;
 	      else if (strcmp(name,"SolidearthSettingsReltol")==0) return SolidearthSettingsReltolEnum;
-	      else if (strcmp(name,"SealevelriseRequestedOutputs")==0) return SealevelriseRequestedOutputsEnum;
-	      else if (strcmp(name,"SolidearthSettingsRigid")==0) return SolidearthSettingsRigidEnum;
+	      else if (strcmp(name,"SealevelchangeRequestedOutputs")==0) return SealevelchangeRequestedOutputsEnum;
+	      else if (strcmp(name,"SolidearthSettingsSelfAttraction")==0) return SolidearthSettingsSelfAttractionEnum;
 	      else if (strcmp(name,"SolidearthSettingsRotation")==0) return SolidearthSettingsRotationEnum;
-	      else if (strcmp(name,"SealevelriseRunCount")==0) return SealevelriseRunCountEnum;
-	      else if (strcmp(name,"SealevelriseTransitions")==0) return SealevelriseTransitionsEnum;
-	      else if (strcmp(name,"SealevelriseUElastic")==0) return SealevelriseUElasticEnum;
+	      else if (strcmp(name,"SolidearthSettingsMaxSHCoeff")==0) return SolidearthSettingsMaxSHCoeffEnum;
+	      else if (strcmp(name,"SealevelchangeRunCount")==0) return SealevelchangeRunCountEnum;
+	      else if (strcmp(name,"SealevelchangeTransitions")==0) return SealevelchangeTransitionsEnum;
+	      else if (strcmp(name,"SealevelchangeUViscoElastic")==0) return SealevelchangeUViscoElasticEnum;
 	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
 	      else if (strcmp(name,"SettingsNumResultsOnNodes")==0) return SettingsNumResultsOnNodesEnum;
@@ -383,13 +436,15 @@
 	      else if (strcmp(name,"SmbAIce")==0) return SmbAIceEnum;
 	      else if (strcmp(name,"SmbAIdx")==0) return SmbAIdxEnum;
-         else stage=4;
-   }
-   if(stage==4){
-	      if (strcmp(name,"SmbASnow")==0) return SmbASnowEnum;
+	      else if (strcmp(name,"SmbASnow")==0) return SmbASnowEnum;
 	      else if (strcmp(name,"SmbAccualti")==0) return SmbAccualtiEnum;
 	      else if (strcmp(name,"SmbAccugrad")==0) return SmbAccugradEnum;
 	      else if (strcmp(name,"SmbAccuref")==0) return SmbAccurefEnum;
 	      else if (strcmp(name,"SmbAdThresh")==0) return SmbAdThreshEnum;
+	      else if (strcmp(name,"SmbAutoregressionInitialTime")==0) return SmbAutoregressionInitialTimeEnum;
+	      else if (strcmp(name,"SmbAutoregressionTimestep")==0) return SmbAutoregressionTimestepEnum;
+	      else if (strcmp(name,"SmbAutoregressiveOrder")==0) return SmbAutoregressiveOrderEnum;
 	      else if (strcmp(name,"SmbAveraging")==0) return SmbAveragingEnum;
+	      else if (strcmp(name,"SmbBeta0")==0) return SmbBeta0Enum;
+	      else if (strcmp(name,"SmbBeta1")==0) return SmbBeta1Enum;
 	      else if (strcmp(name,"SmbDesfac")==0) return SmbDesfacEnum;
 	      else if (strcmp(name,"SmbDpermil")==0) return SmbDpermilEnum;
@@ -401,13 +456,14 @@
 	      else if (strcmp(name,"SmbDt")==0) return SmbDtEnum;
 	      else if (strcmp(name,"Smb")==0) return SmbEnum;
+	      else if (strcmp(name,"SmbEIdx")==0) return SmbEIdxEnum;
 	      else if (strcmp(name,"SmbF")==0) return SmbFEnum;
 	      else if (strcmp(name,"SmbInitDensityScaling")==0) return SmbInitDensityScalingEnum;
 	      else if (strcmp(name,"SmbIsaccumulation")==0) return SmbIsaccumulationEnum;
 	      else if (strcmp(name,"SmbIsalbedo")==0) return SmbIsalbedoEnum;
-	      else if (strcmp(name,"SmbIsclimatology")==0) return SmbIsclimatologyEnum;
 	      else if (strcmp(name,"SmbIsconstrainsurfaceT")==0) return SmbIsconstrainsurfaceTEnum;
 	      else if (strcmp(name,"SmbIsd18opd")==0) return SmbIsd18opdEnum;
 	      else if (strcmp(name,"SmbIsdelta18o")==0) return SmbIsdelta18oEnum;
 	      else if (strcmp(name,"SmbIsdensification")==0) return SmbIsdensificationEnum;
+	      else if (strcmp(name,"SmbIsdeltaLWup")==0) return SmbIsdeltaLWupEnum;
 	      else if (strcmp(name,"SmbIsfirnwarming")==0) return SmbIsfirnwarmingEnum;
 	      else if (strcmp(name,"SmbIsgraingrowth")==0) return SmbIsgraingrowthEnum;
@@ -421,6 +477,8 @@
 	      else if (strcmp(name,"SmbIsturbulentflux")==0) return SmbIsturbulentfluxEnum;
 	      else if (strcmp(name,"SmbK")==0) return SmbKEnum;
+	      else if (strcmp(name,"SmbNumBasins")==0) return SmbNumBasinsEnum;
 	      else if (strcmp(name,"SmbNumRequestedOutputs")==0) return SmbNumRequestedOutputsEnum;
 	      else if (strcmp(name,"SmbPfac")==0) return SmbPfacEnum;
+	      else if (strcmp(name,"SmbPhi")==0) return SmbPhiEnum;
 	      else if (strcmp(name,"SmbRdl")==0) return SmbRdlEnum;
 	      else if (strcmp(name,"SmbRequestedOutputs")==0) return SmbRequestedOutputsEnum;
@@ -435,4 +493,5 @@
 	      else if (strcmp(name,"SmbT0dry")==0) return SmbT0dryEnum;
 	      else if (strcmp(name,"SmbT0wet")==0) return SmbT0wetEnum;
+	      else if (strcmp(name,"SmbTeThresh")==0) return SmbTeThreshEnum;
 	      else if (strcmp(name,"SmbTdiff")==0) return SmbTdiffEnum;
 	      else if (strcmp(name,"SmbThermoDeltaTScaling")==0) return SmbThermoDeltaTScalingEnum;
@@ -447,5 +506,8 @@
 	      else if (strcmp(name,"Step")==0) return StepEnum;
 	      else if (strcmp(name,"Steps")==0) return StepsEnum;
-	      else if (strcmp(name,"StressbalanceAbstol")==0) return StressbalanceAbstolEnum;
+         else stage=5;
+   }
+   if(stage==5){
+	      if (strcmp(name,"StressbalanceAbstol")==0) return StressbalanceAbstolEnum;
 	      else if (strcmp(name,"StressbalanceFSreconditioning")==0) return StressbalanceFSreconditioningEnum;
 	      else if (strcmp(name,"StressbalanceIsnewton")==0) return StressbalanceIsnewtonEnum;
@@ -474,5 +536,6 @@
 	      else if (strcmp(name,"TimesteppingCouplingTime")==0) return TimesteppingCouplingTimeEnum;
 	      else if (strcmp(name,"TimesteppingFinalTime")==0) return TimesteppingFinalTimeEnum;
-	      else if (strcmp(name,"TimesteppingInterpForcings")==0) return TimesteppingInterpForcingsEnum;
+	      else if (strcmp(name,"TimesteppingInterpForcing")==0) return TimesteppingInterpForcingEnum;
+	      else if (strcmp(name,"TimesteppingCycleForcing")==0) return TimesteppingCycleForcingEnum;
 	      else if (strcmp(name,"TimesteppingStartTime")==0) return TimesteppingStartTimeEnum;
 	      else if (strcmp(name,"TimesteppingTimeStep")==0) return TimesteppingTimeStepEnum;
@@ -486,5 +549,4 @@
 	      else if (strcmp(name,"ToolkitsTypes")==0) return ToolkitsTypesEnum;
 	      else if (strcmp(name,"TransientAmrFrequency")==0) return TransientAmrFrequencyEnum;
-	      else if (strcmp(name,"TransientIscoupler")==0) return TransientIscouplerEnum;
 	      else if (strcmp(name,"TransientIsdamageevolution")==0) return TransientIsdamageevolutionEnum;
 	      else if (strcmp(name,"TransientIsesa")==0) return TransientIsesaEnum;
@@ -493,7 +555,9 @@
 	      else if (strcmp(name,"TransientIshydrology")==0) return TransientIshydrologyEnum;
 	      else if (strcmp(name,"TransientIsmasstransport")==0) return TransientIsmasstransportEnum;
+	      else if (strcmp(name,"TransientIsoceantransport")==0) return TransientIsoceantransportEnum;
 	      else if (strcmp(name,"TransientIsmovingfront")==0) return TransientIsmovingfrontEnum;
 	      else if (strcmp(name,"TransientIsoceancoupling")==0) return TransientIsoceancouplingEnum;
-	      else if (strcmp(name,"TransientIsslr")==0) return TransientIsslrEnum;
+	      else if (strcmp(name,"TransientIssampling")==0) return TransientIssamplingEnum;
+	      else if (strcmp(name,"TransientIsslc")==0) return TransientIsslcEnum;
 	      else if (strcmp(name,"TransientIssmb")==0) return TransientIssmbEnum;
 	      else if (strcmp(name,"TransientIsstressbalance")==0) return TransientIsstressbalanceEnum;
@@ -502,14 +566,22 @@
 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
 	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+	      else if (strcmp(name,"Xxe")==0) return XxeEnum;
+	      else if (strcmp(name,"Yye")==0) return YyeEnum;
+	      else if (strcmp(name,"Zze")==0) return ZzeEnum;
+	      else if (strcmp(name,"Areae")==0) return AreaeEnum;
 	      else if (strcmp(name,"WorldComm")==0) return WorldCommEnum;
 	      else if (strcmp(name,"ParametersEND")==0) return ParametersENDEnum;
 	      else if (strcmp(name,"InputsSTART")==0) return InputsSTARTEnum;
+	      else if (strcmp(name,"AccumulatedDeltaBottomPressure")==0) return AccumulatedDeltaBottomPressureEnum;
+	      else if (strcmp(name,"AccumulatedDeltaIceThickness")==0) return AccumulatedDeltaIceThicknessEnum;
+	      else if (strcmp(name,"AccumulatedDeltaTws")==0) return AccumulatedDeltaTwsEnum;
 	      else if (strcmp(name,"Adjoint")==0) return AdjointEnum;
-         else stage=5;
-   }
-   if(stage==5){
-	      if (strcmp(name,"Adjointp")==0) return AdjointpEnum;
+	      else if (strcmp(name,"Adjointp")==0) return AdjointpEnum;
 	      else if (strcmp(name,"Adjointx")==0) return AdjointxEnum;
+	      else if (strcmp(name,"AdjointxBase")==0) return AdjointxBaseEnum;
+	      else if (strcmp(name,"AdjointxShear")==0) return AdjointxShearEnum;
 	      else if (strcmp(name,"Adjointy")==0) return AdjointyEnum;
+	      else if (strcmp(name,"AdjointyBase")==0) return AdjointyBaseEnum;
+	      else if (strcmp(name,"AdjointyShear")==0) return AdjointyShearEnum;
 	      else if (strcmp(name,"Adjointz")==0) return AdjointzEnum;
 	      else if (strcmp(name,"Air")==0) return AirEnum;
@@ -545,7 +617,20 @@
 	      else if (strcmp(name,"BaseSlopeX")==0) return BaseSlopeXEnum;
 	      else if (strcmp(name,"BaseSlopeY")==0) return BaseSlopeYEnum;
+	      else if (strcmp(name,"BaselineBasalforcingsFloatingiceMeltingRate")==0) return BaselineBasalforcingsFloatingiceMeltingRateEnum;
+	      else if (strcmp(name,"BaselineCalvingCalvingrate")==0) return BaselineCalvingCalvingrateEnum;
+	      else if (strcmp(name,"BaselineFrictionEffectivePressure")==0) return BaselineFrictionEffectivePressureEnum;
 	      else if (strcmp(name,"Bed")==0) return BedEnum;
+	      else if (strcmp(name,"BedGRD")==0) return BedGRDEnum;
+	      else if (strcmp(name,"BedEast")==0) return BedEastEnum;
+	      else if (strcmp(name,"BedEastGRD")==0) return BedEastGRDEnum;
+	      else if (strcmp(name,"BedNorth")==0) return BedNorthEnum;
+	      else if (strcmp(name,"BedNorthGRD")==0) return BedNorthGRDEnum;
 	      else if (strcmp(name,"BedSlopeX")==0) return BedSlopeXEnum;
 	      else if (strcmp(name,"BedSlopeY")==0) return BedSlopeYEnum;
+	      else if (strcmp(name,"BottomPressure")==0) return BottomPressureEnum;
+         else stage=6;
+   }
+   if(stage==6){
+	      if (strcmp(name,"BottomPressureOld")==0) return BottomPressureOldEnum;
 	      else if (strcmp(name,"CalvingCalvingrate")==0) return CalvingCalvingrateEnum;
 	      else if (strcmp(name,"CalvingHabFraction")==0) return CalvingHabFractionEnum;
@@ -569,4 +654,13 @@
 	      else if (strcmp(name,"DegreeOfChannelization")==0) return DegreeOfChannelizationEnum;
 	      else if (strcmp(name,"DepthBelowSurface")==0) return DepthBelowSurfaceEnum;
+	      else if (strcmp(name,"DeltaIceThickness")==0) return DeltaIceThicknessEnum;
+	      else if (strcmp(name,"DeltaTws")==0) return DeltaTwsEnum;
+	      else if (strcmp(name,"DeltaBottomPressure")==0) return DeltaBottomPressureEnum;
+	      else if (strcmp(name,"DeltaDsl")==0) return DeltaDslEnum;
+	      else if (strcmp(name,"DslOld")==0) return DslOldEnum;
+	      else if (strcmp(name,"Dsl")==0) return DslEnum;
+	      else if (strcmp(name,"DeltaStr")==0) return DeltaStrEnum;
+	      else if (strcmp(name,"StrOld")==0) return StrOldEnum;
+	      else if (strcmp(name,"Str")==0) return StrEnum;
 	      else if (strcmp(name,"DeviatoricStresseffective")==0) return DeviatoricStresseffectiveEnum;
 	      else if (strcmp(name,"DeviatoricStressxx")==0) return DeviatoricStressxxEnum;
@@ -586,11 +680,4 @@
 	      else if (strcmp(name,"DrivingStressX")==0) return DrivingStressXEnum;
 	      else if (strcmp(name,"DrivingStressY")==0) return DrivingStressYEnum;
-	      else if (strcmp(name,"DslGlobalAverageThermostericSeaLevelChange")==0) return DslGlobalAverageThermostericSeaLevelChangeEnum;
-	      else if (strcmp(name,"DslSeaSurfaceHeightChangeAboveGeoid")==0) return DslSeaSurfaceHeightChangeAboveGeoidEnum;
-	      else if (strcmp(name,"DslSeaWaterPressureChangeAtSeaFloor")==0) return DslSeaWaterPressureChangeAtSeaFloorEnum;
-	      else if (strcmp(name,"DslStericRate")==0) return DslStericRateEnum;
-	      else if (strcmp(name,"DslDynamicRate")==0) return DslDynamicRateEnum;
-	      else if (strcmp(name,"GiaMmeNgia")==0) return GiaMmeNgiaEnum;
-	      else if (strcmp(name,"GiaMmeUgia")==0) return GiaMmeUgiaEnum;
 	      else if (strcmp(name,"Dummy")==0) return DummyEnum;
 	      else if (strcmp(name,"EffectivePressure")==0) return EffectivePressureEnum;
@@ -605,5 +692,4 @@
 	      else if (strcmp(name,"EplHeadSubstep")==0) return EplHeadSubstepEnum;
 	      else if (strcmp(name,"EplHeadTransient")==0) return EplHeadTransientEnum;
-	      else if (strcmp(name,"EsaDeltathickness")==0) return EsaDeltathicknessEnum;
 	      else if (strcmp(name,"EsaEmotion")==0) return EsaEmotionEnum;
 	      else if (strcmp(name,"EsaNmotion")==0) return EsaNmotionEnum;
@@ -629,8 +715,5 @@
 	      else if (strcmp(name,"FrictionSedimentCompressibilityCoefficient")==0) return FrictionSedimentCompressibilityCoefficientEnum;
 	      else if (strcmp(name,"FrictionTillFrictionAngle")==0) return FrictionTillFrictionAngleEnum;
-         else stage=6;
-   }
-   if(stage==6){
-	      if (strcmp(name,"FrictionWaterLayer")==0) return FrictionWaterLayerEnum;
+	      else if (strcmp(name,"FrictionWaterLayer")==0) return FrictionWaterLayerEnum;
 	      else if (strcmp(name,"Frictionf")==0) return FrictionfEnum;
 	      else if (strcmp(name,"FrontalForcingsBasinId")==0) return FrontalForcingsBasinIdEnum;
@@ -638,6 +721,4 @@
 	      else if (strcmp(name,"FrontalForcingsThermalForcing")==0) return FrontalForcingsThermalForcingEnum;
 	      else if (strcmp(name,"GeometryHydrostaticRatio")==0) return GeometryHydrostaticRatioEnum;
-	      else if (strcmp(name,"GiaLithosphereThickness")==0) return GiaLithosphereThicknessEnum;
-	      else if (strcmp(name,"GiaMantleViscosity")==0) return GiaMantleViscosityEnum;
 	      else if (strcmp(name,"NGia")==0) return NGiaEnum;
 	      else if (strcmp(name,"NGiaRate")==0) return NGiaRateEnum;
@@ -664,12 +745,22 @@
 	      else if (strcmp(name,"HydrologyEnglacialInput")==0) return HydrologyEnglacialInputEnum;
 	      else if (strcmp(name,"HydrologyGapHeight")==0) return HydrologyGapHeightEnum;
+	      else if (strcmp(name,"HydrologyGapHeightX")==0) return HydrologyGapHeightXEnum;
+	      else if (strcmp(name,"HydrologyGapHeightXX")==0) return HydrologyGapHeightXXEnum;
+	      else if (strcmp(name,"HydrologyGapHeightY")==0) return HydrologyGapHeightYEnum;
+	      else if (strcmp(name,"HydrologyGapHeightYY")==0) return HydrologyGapHeightYYEnum;
 	      else if (strcmp(name,"HydrologyHead")==0) return HydrologyHeadEnum;
 	      else if (strcmp(name,"HydrologyHeadOld")==0) return HydrologyHeadOldEnum;
 	      else if (strcmp(name,"HydrologyMoulinInput")==0) return HydrologyMoulinInputEnum;
-	      else if (strcmp(name,"HydrologyNeumannflux")==0) return HydrologyNeumannfluxEnum;
+         else stage=7;
+   }
+   if(stage==7){
+	      if (strcmp(name,"HydrologyNeumannflux")==0) return HydrologyNeumannfluxEnum;
 	      else if (strcmp(name,"HydrologyReynolds")==0) return HydrologyReynoldsEnum;
 	      else if (strcmp(name,"HydrologySheetConductivity")==0) return HydrologySheetConductivityEnum;
 	      else if (strcmp(name,"HydrologySheetThickness")==0) return HydrologySheetThicknessEnum;
 	      else if (strcmp(name,"HydrologySheetThicknessOld")==0) return HydrologySheetThicknessOldEnum;
+	      else if (strcmp(name,"HydrologyTws")==0) return HydrologyTwsEnum;
+	      else if (strcmp(name,"HydrologyTwsSpc")==0) return HydrologyTwsSpcEnum;
+	      else if (strcmp(name,"HydrologyTwsAnalysis")==0) return HydrologyTwsAnalysisEnum;
 	      else if (strcmp(name,"HydrologyWatercolumnMax")==0) return HydrologyWatercolumnMaxEnum;
 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
@@ -686,4 +777,5 @@
 	      else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum;
 	      else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum;
+	      else if (strcmp(name,"LevelsetObservation")==0) return LevelsetObservationEnum;
 	      else if (strcmp(name,"LoadingforceX")==0) return LoadingforceXEnum;
 	      else if (strcmp(name,"LoadingforceY")==0) return LoadingforceYEnum;
@@ -691,4 +783,5 @@
 	      else if (strcmp(name,"MaskOceanLevelset")==0) return MaskOceanLevelsetEnum;
 	      else if (strcmp(name,"MaskIceLevelset")==0) return MaskIceLevelsetEnum;
+	      else if (strcmp(name,"MaskIceRefLevelset")==0) return MaskIceRefLevelsetEnum;
 	      else if (strcmp(name,"MasstransportSpcthickness")==0) return MasstransportSpcthicknessEnum;
 	      else if (strcmp(name,"MaterialsRheologyB")==0) return MaterialsRheologyBEnum;
@@ -706,8 +799,13 @@
 	      else if (strcmp(name,"MeshVertexonsurface")==0) return MeshVertexonsurfaceEnum;
 	      else if (strcmp(name,"Misfit")==0) return MisfitEnum;
+	      else if (strcmp(name,"MovingFrontalVx")==0) return MovingFrontalVxEnum;
+	      else if (strcmp(name,"MovingFrontalVy")==0) return MovingFrontalVyEnum;
 	      else if (strcmp(name,"Neumannflux")==0) return NeumannfluxEnum;
 	      else if (strcmp(name,"NewDamage")==0) return NewDamageEnum;
 	      else if (strcmp(name,"Node")==0) return NodeEnum;
 	      else if (strcmp(name,"OmegaAbsGradient")==0) return OmegaAbsGradientEnum;
+	      else if (strcmp(name,"OceantransportSpcbottompressure")==0) return OceantransportSpcbottompressureEnum;
+	      else if (strcmp(name,"OceantransportSpcstr")==0) return OceantransportSpcstrEnum;
+	      else if (strcmp(name,"OceantransportSpcdsl")==0) return OceantransportSpcdslEnum;
 	      else if (strcmp(name,"P0")==0) return P0Enum;
 	      else if (strcmp(name,"P1")==0) return P1Enum;
@@ -724,36 +822,84 @@
 	      else if (strcmp(name,"RheologyBInitialguessMisfit")==0) return RheologyBInitialguessMisfitEnum;
 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
+	      else if (strcmp(name,"Sample")==0) return SampleEnum;
+	      else if (strcmp(name,"SamplingBeta")==0) return SamplingBetaEnum;
+	      else if (strcmp(name,"SamplingKappa")==0) return SamplingKappaEnum;
 	      else if (strcmp(name,"Sealevel")==0) return SealevelEnum;
-	      else if (strcmp(name,"SealevelEustaticMask")==0) return SealevelEustaticMaskEnum;
-	      else if (strcmp(name,"SealevelEustaticOceanMask")==0) return SealevelEustaticOceanMaskEnum;
+	      else if (strcmp(name,"SealevelGRD")==0) return SealevelGRDEnum;
+	      else if (strcmp(name,"SealevelBarystaticMask")==0) return SealevelBarystaticMaskEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceMask")==0) return SealevelBarystaticIceMaskEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceWeights")==0) return SealevelBarystaticIceWeightsEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceArea")==0) return SealevelBarystaticIceAreaEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceLatbar")==0) return SealevelBarystaticIceLatbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceLongbar")==0) return SealevelBarystaticIceLongbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticIceLoad")==0) return SealevelBarystaticIceLoadEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroMask")==0) return SealevelBarystaticHydroMaskEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroWeights")==0) return SealevelBarystaticHydroWeightsEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroArea")==0) return SealevelBarystaticHydroAreaEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroLatbar")==0) return SealevelBarystaticHydroLatbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroLongbar")==0) return SealevelBarystaticHydroLongbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticHydroLoad")==0) return SealevelBarystaticHydroLoadEnum;
+	      else if (strcmp(name,"SealevelBarystaticBpMask")==0) return SealevelBarystaticBpMaskEnum;
+	      else if (strcmp(name,"SealevelBarystaticBpWeights")==0) return SealevelBarystaticBpWeightsEnum;
+	      else if (strcmp(name,"SealevelBarystaticBpArea")==0) return SealevelBarystaticBpAreaEnum;
+	      else if (strcmp(name,"SealevelBarystaticBpLoad")==0) return SealevelBarystaticBpLoadEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanMask")==0) return SealevelBarystaticOceanMaskEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanWeights")==0) return SealevelBarystaticOceanWeightsEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanArea")==0) return SealevelBarystaticOceanAreaEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanLatbar")==0) return SealevelBarystaticOceanLatbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanLongbar")==0) return SealevelBarystaticOceanLongbarEnum;
+	      else if (strcmp(name,"SealevelBarystaticOceanLoad")==0) return SealevelBarystaticOceanLoadEnum;
 	      else if (strcmp(name,"SealevelNEsa")==0) return SealevelNEsaEnum;
 	      else if (strcmp(name,"SealevelNEsaRate")==0) return SealevelNEsaRateEnum;
 	      else if (strcmp(name,"SealevelRSL")==0) return SealevelRSLEnum;
-	      else if (strcmp(name,"Bslr")==0) return BslrEnum;
-	      else if (strcmp(name,"BslrIce")==0) return BslrIceEnum;
-	      else if (strcmp(name,"BslrHydro")==0) return BslrHydroEnum;
-	      else if (strcmp(name,"BslrRate")==0) return BslrRateEnum;
-	      else if (strcmp(name,"Gmtslr")==0) return GmtslrEnum;
-	      else if (strcmp(name,"SealevelRSLEustatic")==0) return SealevelRSLEustaticEnum;
-	      else if (strcmp(name,"SealevelRSLEustaticRate")==0) return SealevelRSLEustaticRateEnum;
+	      else if (strcmp(name,"Bslc")==0) return BslcEnum;
+	      else if (strcmp(name,"BslcIce")==0) return BslcIceEnum;
+	      else if (strcmp(name,"BslcHydro")==0) return BslcHydroEnum;
+	      else if (strcmp(name,"BslcOcean")==0) return BslcOceanEnum;
+	      else if (strcmp(name,"BslcRate")==0) return BslcRateEnum;
+	      else if (strcmp(name,"Gmtslc")==0) return GmtslcEnum;
+	      else if (strcmp(name,"SealevelGrotm1")==0) return SealevelGrotm1Enum;
+	      else if (strcmp(name,"SealevelGrotm2")==0) return SealevelGrotm2Enum;
+	      else if (strcmp(name,"SealevelGrotm3")==0) return SealevelGrotm3Enum;
+	      else if (strcmp(name,"SealevelGUrotm1")==0) return SealevelGUrotm1Enum;
+	      else if (strcmp(name,"SealevelGUrotm2")==0) return SealevelGUrotm2Enum;
+	      else if (strcmp(name,"SealevelGUrotm3")==0) return SealevelGUrotm3Enum;
+	      else if (strcmp(name,"SealevelGNrotm1")==0) return SealevelGNrotm1Enum;
+	      else if (strcmp(name,"SealevelGNrotm2")==0) return SealevelGNrotm2Enum;
+	      else if (strcmp(name,"SealevelGNrotm3")==0) return SealevelGNrotm3Enum;
+	      else if (strcmp(name,"SealevelGErotm1")==0) return SealevelGErotm1Enum;
+	      else if (strcmp(name,"SealevelGErotm2")==0) return SealevelGErotm2Enum;
+	      else if (strcmp(name,"SealevelGErotm3")==0) return SealevelGErotm3Enum;
+	      else if (strcmp(name,"SealevelRSLBarystatic")==0) return SealevelRSLBarystaticEnum;
 	      else if (strcmp(name,"SealevelRSLRate")==0) return SealevelRSLRateEnum;
-	      else if (strcmp(name,"SealevelUEastEsa")==0) return SealevelUEastEsaEnum;
-	      else if (strcmp(name,"SealevelUEsa")==0) return SealevelUEsaEnum;
-	      else if (strcmp(name,"SealevelUEsaRate")==0) return SealevelUEsaRateEnum;
+	      else if (strcmp(name,"SealevelUGrd")==0) return SealevelUGrdEnum;
+	      else if (strcmp(name,"SealevelNGrd")==0) return SealevelNGrdEnum;
+         else stage=8;
+   }
+   if(stage==8){
+	      if (strcmp(name,"SealevelUEastEsa")==0) return SealevelUEastEsaEnum;
 	      else if (strcmp(name,"SealevelUNorthEsa")==0) return SealevelUNorthEsaEnum;
-	      else if (strcmp(name,"SealevelriseCumDeltathickness")==0) return SealevelriseCumDeltathicknessEnum;
-	      else if (strcmp(name,"SealevelriseCumDeltathicknessOld")==0) return SealevelriseCumDeltathicknessOldEnum;
-	      else if (strcmp(name,"SurfaceloadOther")==0) return SurfaceloadOtherEnum;
-	      else if (strcmp(name,"SurfaceloadIceThicknessChange")==0) return SurfaceloadIceThicknessChangeEnum;
-	      else if (strcmp(name,"SurfaceloadWaterHeightChange")==0) return SurfaceloadWaterHeightChangeEnum;
-	      else if (strcmp(name,"SealevelriseIndices")==0) return SealevelriseIndicesEnum;
-	      else if (strcmp(name,"SealevelriseG")==0) return SealevelriseGEnum;
-	      else if (strcmp(name,"SealevelriseGU")==0) return SealevelriseGUEnum;
-	      else if (strcmp(name,"SealevelriseGE")==0) return SealevelriseGEEnum;
-	      else if (strcmp(name,"SealevelriseGN")==0) return SealevelriseGNEnum;
-         else stage=7;
-   }
-   if(stage==7){
-	      if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
+	      else if (strcmp(name,"SealevelchangeIndices")==0) return SealevelchangeIndicesEnum;
+	      else if (strcmp(name,"SealevelchangeG")==0) return SealevelchangeGEnum;
+	      else if (strcmp(name,"SealevelchangeGU")==0) return SealevelchangeGUEnum;
+	      else if (strcmp(name,"SealevelchangeGE")==0) return SealevelchangeGEEnum;
+	      else if (strcmp(name,"SealevelchangeGN")==0) return SealevelchangeGNEnum;
+	      else if (strcmp(name,"SealevelchangeGsubelOcean")==0) return SealevelchangeGsubelOceanEnum;
+	      else if (strcmp(name,"SealevelchangeGUsubelOcean")==0) return SealevelchangeGUsubelOceanEnum;
+	      else if (strcmp(name,"SealevelchangeGEsubelOcean")==0) return SealevelchangeGEsubelOceanEnum;
+	      else if (strcmp(name,"SealevelchangeGNsubelOcean")==0) return SealevelchangeGNsubelOceanEnum;
+	      else if (strcmp(name,"SealevelchangeGsubelIce")==0) return SealevelchangeGsubelIceEnum;
+	      else if (strcmp(name,"SealevelchangeGUsubelIce")==0) return SealevelchangeGUsubelIceEnum;
+	      else if (strcmp(name,"SealevelchangeGEsubelIce")==0) return SealevelchangeGEsubelIceEnum;
+	      else if (strcmp(name,"SealevelchangeGNsubelIce")==0) return SealevelchangeGNsubelIceEnum;
+	      else if (strcmp(name,"SealevelchangeGsubelHydro")==0) return SealevelchangeGsubelHydroEnum;
+	      else if (strcmp(name,"SealevelchangeGUsubelHydro")==0) return SealevelchangeGUsubelHydroEnum;
+	      else if (strcmp(name,"SealevelchangeGEsubelHydro")==0) return SealevelchangeGEsubelHydroEnum;
+	      else if (strcmp(name,"SealevelchangeGNsubelHydro")==0) return SealevelchangeGNsubelHydroEnum;
+	      else if (strcmp(name,"SealevelchangeViscousRSL")==0) return SealevelchangeViscousRSLEnum;
+	      else if (strcmp(name,"SealevelchangeViscousU")==0) return SealevelchangeViscousUEnum;
+	      else if (strcmp(name,"SealevelchangeViscousN")==0) return SealevelchangeViscousNEnum;
+	      else if (strcmp(name,"SealevelchangeViscousE")==0) return SealevelchangeViscousEEnum;
+	      else if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
 	      else if (strcmp(name,"SedimentHeadOld")==0) return SedimentHeadOldEnum;
 	      else if (strcmp(name,"SedimentHeadSubstep")==0) return SedimentHeadSubstepEnum;
@@ -767,9 +913,15 @@
 	      else if (strcmp(name,"SmbAccumulatedMelt")==0) return SmbAccumulatedMeltEnum;
 	      else if (strcmp(name,"SmbAccumulatedPrecipitation")==0) return SmbAccumulatedPrecipitationEnum;
+	      else if (strcmp(name,"SmbAccumulatedRain")==0) return SmbAccumulatedRainEnum;
+	      else if (strcmp(name,"SmbAccumulatedRefreeze")==0) return SmbAccumulatedRefreezeEnum;
 	      else if (strcmp(name,"SmbAccumulatedRunoff")==0) return SmbAccumulatedRunoffEnum;
 	      else if (strcmp(name,"SmbA")==0) return SmbAEnum;
+	      else if (strcmp(name,"SmbAdiff")==0) return SmbAdiffEnum;
 	      else if (strcmp(name,"SmbAValue")==0) return SmbAValueEnum;
 	      else if (strcmp(name,"SmbAccumulation")==0) return SmbAccumulationEnum;
+	      else if (strcmp(name,"SmbAdiffini")==0) return SmbAdiffiniEnum;
 	      else if (strcmp(name,"SmbAini")==0) return SmbAiniEnum;
+	      else if (strcmp(name,"SmbAutoregressionNoise")==0) return SmbAutoregressionNoiseEnum;
+	      else if (strcmp(name,"SmbBasinsId")==0) return SmbBasinsIdEnum;
 	      else if (strcmp(name,"SmbBMax")==0) return SmbBMaxEnum;
 	      else if (strcmp(name,"SmbBMin")==0) return SmbBMinEnum;
@@ -777,4 +929,7 @@
 	      else if (strcmp(name,"SmbBPos")==0) return SmbBPosEnum;
 	      else if (strcmp(name,"SmbC")==0) return SmbCEnum;
+	      else if (strcmp(name,"SmbCcsnowValue")==0) return SmbCcsnowValueEnum;
+	      else if (strcmp(name,"SmbCciceValue")==0) return SmbCciceValueEnum;
+	      else if (strcmp(name,"SmbCotValue")==0) return SmbCotValueEnum;
 	      else if (strcmp(name,"SmbD")==0) return SmbDEnum;
 	      else if (strcmp(name,"SmbDailyairdensity")==0) return SmbDailyairdensityEnum;
@@ -789,5 +944,7 @@
 	      else if (strcmp(name,"SmbDini")==0) return SmbDiniEnum;
 	      else if (strcmp(name,"SmbDlwrf")==0) return SmbDlwrfEnum;
+	      else if (strcmp(name,"SmbDulwrfValue")==0) return SmbDulwrfValueEnum;
 	      else if (strcmp(name,"SmbDswrf")==0) return SmbDswrfEnum;
+	      else if (strcmp(name,"SmbDswdiffrf")==0) return SmbDswdiffrfEnum;
 	      else if (strcmp(name,"SmbDzAdd")==0) return SmbDzAddEnum;
 	      else if (strcmp(name,"SmbDz")==0) return SmbDzEnum;
@@ -809,5 +966,4 @@
 	      else if (strcmp(name,"SmbIsInitialized")==0) return SmbIsInitializedEnum;
 	      else if (strcmp(name,"SmbMAdd")==0) return SmbMAddEnum;
-	      else if (strcmp(name,"SmbMassBalanceClimate")==0) return SmbMassBalanceClimateEnum;
 	      else if (strcmp(name,"SmbMassBalance")==0) return SmbMassBalanceEnum;
 	      else if (strcmp(name,"SmbMassBalanceSubstep")==0) return SmbMassBalanceSubstepEnum;
@@ -830,4 +986,5 @@
 	      else if (strcmp(name,"SmbPrecipitationsPresentday")==0) return SmbPrecipitationsPresentdayEnum;
 	      else if (strcmp(name,"SmbPrecipitationsReconstructed")==0) return SmbPrecipitationsReconstructedEnum;
+	      else if (strcmp(name,"SmbRain")==0) return SmbRainEnum;
 	      else if (strcmp(name,"SmbRe")==0) return SmbReEnum;
 	      else if (strcmp(name,"SmbRefreeze")==0) return SmbRefreezeEnum;
@@ -841,5 +998,9 @@
 	      else if (strcmp(name,"SmbSizeini")==0) return SmbSizeiniEnum;
 	      else if (strcmp(name,"SmbSmbCorr")==0) return SmbSmbCorrEnum;
-	      else if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum;
+         else stage=9;
+   }
+   if(stage==9){
+	      if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum;
+	      else if (strcmp(name,"SmbSzaValue")==0) return SmbSzaValueEnum;
 	      else if (strcmp(name,"SmbT")==0) return SmbTEnum;
 	      else if (strcmp(name,"SmbTa")==0) return SmbTaEnum;
@@ -852,4 +1013,5 @@
 	      else if (strcmp(name,"SmbTmean")==0) return SmbTmeanEnum;
 	      else if (strcmp(name,"SmbTz")==0) return SmbTzEnum;
+	      else if (strcmp(name,"SmbValuesAutoregression")==0) return SmbValuesAutoregressionEnum;
 	      else if (strcmp(name,"SmbV")==0) return SmbVEnum;
 	      else if (strcmp(name,"SmbVmean")==0) return SmbVmeanEnum;
@@ -862,4 +1024,9 @@
 	      else if (strcmp(name,"SmbZTop")==0) return SmbZTopEnum;
 	      else if (strcmp(name,"SmbZY")==0) return SmbZYEnum;
+	      else if (strcmp(name,"SolidearthExternalDisplacementEastRate")==0) return SolidearthExternalDisplacementEastRateEnum;
+	      else if (strcmp(name,"SolidearthExternalDisplacementNorthRate")==0) return SolidearthExternalDisplacementNorthRateEnum;
+	      else if (strcmp(name,"SolidearthExternalDisplacementUpRate")==0) return SolidearthExternalDisplacementUpRateEnum;
+	      else if (strcmp(name,"SolidearthExternalGeoidRate")==0) return SolidearthExternalGeoidRateEnum;
+	      else if (strcmp(name,"StochasticForcingDefaultId")==0) return StochasticForcingDefaultIdEnum;
 	      else if (strcmp(name,"StrainRateeffective")==0) return StrainRateeffectiveEnum;
 	      else if (strcmp(name,"StrainRateparallel")==0) return StrainRateparallelEnum;
@@ -875,8 +1042,5 @@
 	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
 	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
-         else stage=8;
-   }
-   if(stage==8){
-	      if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
@@ -900,4 +1064,6 @@
 	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
 	      else if (strcmp(name,"TemperatureSEMIC")==0) return TemperatureSEMICEnum;
+	      else if (strcmp(name,"ThermalforcingAutoregressionNoise")==0) return ThermalforcingAutoregressionNoiseEnum;
+	      else if (strcmp(name,"ThermalforcingValuesAutoregression")==0) return ThermalforcingValuesAutoregressionEnum;
 	      else if (strcmp(name,"ThermalSpctemperature")==0) return ThermalSpctemperatureEnum;
 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
@@ -909,13 +1075,20 @@
 	      else if (strcmp(name,"ThicknessPositive")==0) return ThicknessPositiveEnum;
 	      else if (strcmp(name,"ThicknessResidual")==0) return ThicknessResidualEnum;
+	      else if (strcmp(name,"TransientAccumulatedDeltaIceThickness")==0) return TransientAccumulatedDeltaIceThicknessEnum;
 	      else if (strcmp(name,"Vel")==0) return VelEnum;
 	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+	      else if (strcmp(name,"VxBase")==0) return VxBaseEnum;
 	      else if (strcmp(name,"Vx")==0) return VxEnum;
 	      else if (strcmp(name,"VxMesh")==0) return VxMeshEnum;
 	      else if (strcmp(name,"VxObs")==0) return VxObsEnum;
+	      else if (strcmp(name,"VxShear")==0) return VxShearEnum;
+	      else if (strcmp(name,"VxSurface")==0) return VxSurfaceEnum;
 	      else if (strcmp(name,"VyAverage")==0) return VyAverageEnum;
+	      else if (strcmp(name,"VyBase")==0) return VyBaseEnum;
 	      else if (strcmp(name,"Vy")==0) return VyEnum;
 	      else if (strcmp(name,"VyMesh")==0) return VyMeshEnum;
 	      else if (strcmp(name,"VyObs")==0) return VyObsEnum;
+	      else if (strcmp(name,"VyShear")==0) return VyShearEnum;
+	      else if (strcmp(name,"VySurface")==0) return VySurfaceEnum;
 	      else if (strcmp(name,"Vz")==0) return VzEnum;
 	      else if (strcmp(name,"VzFS")==0) return VzFSEnum;
@@ -929,5 +1102,11 @@
 	      else if (strcmp(name,"Waterfraction")==0) return WaterfractionEnum;
 	      else if (strcmp(name,"Waterheight")==0) return WaterheightEnum;
+	      else if (strcmp(name,"FrictionWaterPressure")==0) return FrictionWaterPressureEnum;
+	      else if (strcmp(name,"FrictionWaterPressureNoise")==0) return FrictionWaterPressureNoiseEnum;
+	      else if (strcmp(name,"WeightsLevelsetObservation")==0) return WeightsLevelsetObservationEnum;
 	      else if (strcmp(name,"WeightsSurfaceObservation")==0) return WeightsSurfaceObservationEnum;
+	      else if (strcmp(name,"OldAccumulatedDeltaBottomPressure")==0) return OldAccumulatedDeltaBottomPressureEnum;
+	      else if (strcmp(name,"OldAccumulatedDeltaIceThickness")==0) return OldAccumulatedDeltaIceThicknessEnum;
+	      else if (strcmp(name,"OldAccumulatedDeltaTws")==0) return OldAccumulatedDeltaTwsEnum;
 	      else if (strcmp(name,"Outputdefinition1")==0) return Outputdefinition1Enum;
 	      else if (strcmp(name,"Outputdefinition10")==0) return Outputdefinition10Enum;
@@ -942,5 +1121,8 @@
 	      else if (strcmp(name,"Outputdefinition19")==0) return Outputdefinition19Enum;
 	      else if (strcmp(name,"Outputdefinition20")==0) return Outputdefinition20Enum;
-	      else if (strcmp(name,"Outputdefinition21")==0) return Outputdefinition21Enum;
+         else stage=10;
+   }
+   if(stage==10){
+	      if (strcmp(name,"Outputdefinition21")==0) return Outputdefinition21Enum;
 	      else if (strcmp(name,"Outputdefinition22")==0) return Outputdefinition22Enum;
 	      else if (strcmp(name,"Outputdefinition23")==0) return Outputdefinition23Enum;
@@ -998,8 +1180,5 @@
 	      else if (strcmp(name,"Outputdefinition70")==0) return Outputdefinition70Enum;
 	      else if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
-         else stage=9;
-   }
-   if(stage==9){
-	      if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
+	      else if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
 	      else if (strcmp(name,"Outputdefinition73")==0) return Outputdefinition73Enum;
 	      else if (strcmp(name,"Outputdefinition74")==0) return Outputdefinition74Enum;
@@ -1065,5 +1244,8 @@
 	      else if (strcmp(name,"Boundary")==0) return BoundaryEnum;
 	      else if (strcmp(name,"BuddJacka")==0) return BuddJackaEnum;
-	      else if (strcmp(name,"CalvingDev2")==0) return CalvingDev2Enum;
+         else stage=11;
+   }
+   if(stage==11){
+	      if (strcmp(name,"CalvingDev2")==0) return CalvingDev2Enum;
 	      else if (strcmp(name,"CalvingHab")==0) return CalvingHabEnum;
 	      else if (strcmp(name,"CalvingLevermann")==0) return CalvingLevermannEnum;
@@ -1072,4 +1254,5 @@
 	      else if (strcmp(name,"Cfsurfacelogvel")==0) return CfsurfacelogvelEnum;
 	      else if (strcmp(name,"Cfsurfacesquare")==0) return CfsurfacesquareEnum;
+	      else if (strcmp(name,"Cflevelsetmisfit")==0) return CflevelsetmisfitEnum;
 	      else if (strcmp(name,"Channel")==0) return ChannelEnum;
 	      else if (strcmp(name,"ChannelArea")==0) return ChannelAreaEnum;
@@ -1121,8 +1304,5 @@
 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
 	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
-         else stage=10;
-   }
-   if(stage==10){
-	      if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
+	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
@@ -1140,4 +1320,5 @@
 	      else if (strcmp(name,"FrontalForcingsDefault")==0) return FrontalForcingsDefaultEnum;
 	      else if (strcmp(name,"FrontalForcingsRignot")==0) return FrontalForcingsRignotEnum;
+	      else if (strcmp(name,"FrontalForcingsRignotAutoregression")==0) return FrontalForcingsRignotAutoregressionEnum;
 	      else if (strcmp(name,"Fset")==0) return FsetEnum;
 	      else if (strcmp(name,"FullMeltOnPartiallyFloating")==0) return FullMeltOnPartiallyFloatingEnum;
@@ -1150,6 +1331,4 @@
 	      else if (strcmp(name,"GenericParam")==0) return GenericParamEnum;
 	      else if (strcmp(name,"GenericExternalResult")==0) return GenericExternalResultEnum;
-	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
-	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
 	      else if (strcmp(name,"Gradient1")==0) return Gradient1Enum;
 	      else if (strcmp(name,"Gradient2")==0) return Gradient2Enum;
@@ -1188,5 +1367,8 @@
 	      else if (strcmp(name,"Indexed")==0) return IndexedEnum;
 	      else if (strcmp(name,"IntExternalResult")==0) return IntExternalResultEnum;
-	      else if (strcmp(name,"ElementInput")==0) return ElementInputEnum;
+         else stage=12;
+   }
+   if(stage==12){
+	      if (strcmp(name,"ElementInput")==0) return ElementInputEnum;
 	      else if (strcmp(name,"IntMatExternalResult")==0) return IntMatExternalResultEnum;
 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
@@ -1244,8 +1426,5 @@
 	      else if (strcmp(name,"MaxVx")==0) return MaxVxEnum;
 	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
-         else stage=11;
-   }
-   if(stage==11){
-	      if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
 	      else if (strcmp(name,"Melange")==0) return MelangeEnum;
 	      else if (strcmp(name,"MeltingAnalysis")==0) return MeltingAnalysisEnum;
@@ -1274,4 +1453,6 @@
 	      else if (strcmp(name,"NyeH2O")==0) return NyeH2OEnum;
 	      else if (strcmp(name,"Numericalflux")==0) return NumericalfluxEnum;
+	      else if (strcmp(name,"OceantransportAnalysis")==0) return OceantransportAnalysisEnum;
+	      else if (strcmp(name,"OceantransportSolution")==0) return OceantransportSolutionEnum;
 	      else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
 	      else if (strcmp(name,"OneLayerP4z")==0) return OneLayerP4zEnum;
@@ -1308,5 +1489,11 @@
 	      else if (strcmp(name,"RecoveryAnalysis")==0) return RecoveryAnalysisEnum;
 	      else if (strcmp(name,"Riftfront")==0) return RiftfrontEnum;
+	      else if (strcmp(name,"SamplingAnalysis")==0) return SamplingAnalysisEnum;
+         else stage=13;
+   }
+   if(stage==13){
+	      if (strcmp(name,"SamplingSolution")==0) return SamplingSolutionEnum;
 	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+	      else if (strcmp(name,"SMBautoregression")==0) return SMBautoregressionEnum;
 	      else if (strcmp(name,"SMBcomponents")==0) return SMBcomponentsEnum;
 	      else if (strcmp(name,"SMBd18opdd")==0) return SMBd18opddEnum;
@@ -1331,8 +1518,8 @@
 	      else if (strcmp(name,"SealevelInertiaTensorYZ")==0) return SealevelInertiaTensorYZEnum;
 	      else if (strcmp(name,"SealevelInertiaTensorZZ")==0) return SealevelInertiaTensorZZEnum;
+	      else if (strcmp(name,"SealevelchangePolarMotion")==0) return SealevelchangePolarMotionEnum;
 	      else if (strcmp(name,"SealevelNmotion")==0) return SealevelNmotionEnum;
 	      else if (strcmp(name,"SealevelUmotion")==0) return SealevelUmotionEnum;
-	      else if (strcmp(name,"SealevelriseAnalysis")==0) return SealevelriseAnalysisEnum;
-	      else if (strcmp(name,"SealevelriseSolution")==0) return SealevelriseSolutionEnum;
+	      else if (strcmp(name,"SealevelchangeAnalysis")==0) return SealevelchangeAnalysisEnum;
 	      else if (strcmp(name,"Seg")==0) return SegEnum;
 	      else if (strcmp(name,"SegInput")==0) return SegInputEnum;
@@ -1367,8 +1554,5 @@
 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
 	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
-         else stage=12;
-   }
-   if(stage==12){
-	      if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
+	      else if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
 	      else if (strcmp(name,"Tetra")==0) return TetraEnum;
 	      else if (strcmp(name,"TetraInput")==0) return TetraInputEnum;
@@ -1420,5 +1604,5 @@
 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
-         else stage=13;
+         else stage=14;
    }
 	/*If we reach this point, the string provided has not been found*/
Index: issm/trunk/src/c/shared/Enum/Synchronize.sh
===================================================================
--- issm/trunk/src/c/shared/Enum/Synchronize.sh	(revision 25994)
+++ issm/trunk/src/c/shared/Enum/Synchronize.sh	(revision 26744)
@@ -39,5 +39,5 @@
 #core
 cat temp | grep [a-zA-Z0-9]Analysis | \
-	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
+	grep -v DefaultAnalysis | grep -v RecoveryAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
 	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
 		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
@@ -229,4 +229,22 @@
 echo "\"ISSM objects end" >> $ISSM_DIR/src/c/shared/Enum/Enum.vim
 #}}}
+#Build Enumjl.vim{{{
+#Header
+cat <<END > $ISSM_DIR/src/c/shared/Enum/Enumjl.vim
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" ISSM specific julia syntax highlighting
+"
+"   WARNING: DO NOT MODIFY THIS FILE
+"            this file has been automatically generated by Synchronize.sh
+"            Please read README for more information
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+"ISSM Enums
+END
+cat temp |  awk '{print "syn keyword juliaConstC " $1}' >> $ISSM_DIR/src/c/shared/Enum/Enumjl.vim
+cat <<END >> $ISSM_DIR/src/c/shared/Enum/Enumjl.vim
+"ISSM Enums end
+END
+#}}}
 
 #clean up{{{
Index: issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp
===================================================================
--- issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp	(revision 26744)
@@ -673,2 +673,20 @@
 
 } /*}}}*/
+void CholeskyRealPositiveDefinite(IssmDouble* Lchol, IssmDouble* A, int ndim) { /*{{{*/
+   /*CholeskyRealPositiveDefinite   computes lower triangular matrix of the Cholesky decomposition of A
+   Follows the Cholesky–Banachiewicz algorithm
+   Lchol should point to an IssmDouble* of same dimensions as A*/
+
+	/*ensure zero-initialization*/
+	for(int i=0;i<(ndim*ndim);i++) Lchol[i]=0;;
+
+	for(int i=0;i<ndim;i++){
+		for(int j=0;j<=i;j++){
+			IssmDouble sum=0.;
+			for(int k=0;k<j;k++) sum += Lchol[i*ndim+k]*Lchol[j*ndim+k];
+			
+			if(i==j) Lchol[i*ndim+j] = sqrt(A[i*ndim+j]-sum);
+			else Lchol[i*ndim+j]     = 1./Lchol[j*ndim+j] * (A[i*ndim+j]-sum);
+		}
+	}
+} /*}}}*/
Index: issm/trunk/src/c/shared/Matrix/matrix.h
===================================================================
--- issm/trunk/src/c/shared/Matrix/matrix.h	(revision 25994)
+++ issm/trunk/src/c/shared/Matrix/matrix.h	(revision 26744)
@@ -25,5 +25,5 @@
 void Matrix4x4Determinant(IssmDouble* Adet,IssmDouble* A);
 void Matrix4x4Solve(IssmDouble* X,IssmDouble* A,IssmDouble* B);
- 
+
 void newcell(IssmDouble** pcell, IssmDouble newvalue, bool top, int m);
 IssmDouble  cellsum(IssmDouble* cell, int m);
@@ -31,3 +31,4 @@
 void cellsplit(IssmDouble** pcell, int m, int i,IssmDouble scale);
 void cellecho(int numcells, int m, ...);
+void CholeskyRealPositiveDefinite(IssmDouble* Lchol, IssmDouble* A, int ndim);
 #endif //ifndef _MATRIXUTILS_H_
Index: issm/trunk/src/c/shared/MemOps/MemOps.h
===================================================================
--- issm/trunk/src/c/shared/MemOps/MemOps.h	(revision 25994)
+++ issm/trunk/src/c/shared/MemOps/MemOps.h	(revision 26744)
@@ -7,4 +7,5 @@
 
 #include <cassert>
+#include <cstring> /*for memcpy*/
 
 /* memory management of types T with non-trivial constructors require C++ style memory management*/
@@ -68,6 +69,5 @@
   T* aT_p=xNew<T>(size);
 #endif
-  for (unsigned int i=0; i<size;++i) 
-    aT_p[i]=(T)0;
+  for(unsigned int i=0; i<size;++i) aT_p[i]=(T)0;
   return aT_p;
 #else
@@ -80,6 +80,5 @@
 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES
   T** aT_pp=xNew<T>(dim1,dim2);
-  for (unsigned int i=0; i<dim1*dim2;++i)
-    (*aT_pp)[i]=(T)0;
+  for (unsigned int i=0; i<dim1*dim2;++i) (*aT_pp)[i]=(T)0;
   return aT_pp;
 #else
@@ -152,6 +151,9 @@
 template <class T>  T* xMemCpy(T* dest, const T* src, unsigned int size) {/*{{{*/
   assert(dest); assert(src);
-  for (int i=0; i<size;++i) 
-    dest[i]=src[i];
+  #if defined(_HAVE_ADOLC_)
+  for (int i=0; i<size;++i) dest[i]=src[i];
+  #else
+  memcpy(dest,src,size*sizeof(T));
+  #endif
   return dest;
 };
Index: issm/trunk/src/c/shared/Numerics/types.h
===================================================================
--- issm/trunk/src/c/shared/Numerics/types.h	(revision 25994)
+++ issm/trunk/src/c/shared/Numerics/types.h	(revision 26744)
@@ -13,4 +13,5 @@
 
 #include <stdio.h>
+#include <complex>
 
 /*here are our abstracted types: inspired on petsc */
@@ -24,17 +25,24 @@
 /*ADOLC typedefs*/
 #include "adolc/adolc.h"
-typedef adouble IssmDouble; /*for active variables*/
-typedef double  IssmPDouble; /*for passive variables*/
+typedef adouble              IssmDouble;  /*for active variables*/
+//typedef acomplex             IssmComplex; /*for active variables*/ /*FIXME!*/
+typedef std::complex<double> IssmComplex; /*for active variables*/ /*FIXME!*/
+typedef double               IssmPDouble; /*for passive variables*/
+typedef std::complex<double> IssmPComplex;/*for passive variables*/
 
 #elif defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
 /*CoDiPack typedefs*/
 #include <codi.hpp>
-typedef codi::RealReverse IssmDouble;
-typedef double            IssmPDouble;
+typedef codi::RealReverse               IssmDouble;
+typedef std::complex<codi::RealReverse> IssmComplex;
+typedef double                          IssmPDouble;
+typedef IssmComplex                     IssmPComplex;
 
+#else 
 /*Non-AD typedefs*/
-#else 
-typedef double     IssmDouble; 
-typedef IssmDouble IssmPDouble;
+typedef double               IssmDouble; 
+typedef std::complex<double> IssmComplex; 
+typedef IssmDouble           IssmPDouble;
+typedef IssmComplex          IssmPComplex;
 #endif
 
Index: issm/trunk/src/c/shared/Random/random.cpp
===================================================================
--- issm/trunk/src/c/shared/Random/random.cpp	(revision 26744)
+++ issm/trunk/src/c/shared/Random/random.cpp	(revision 26744)
@@ -0,0 +1,99 @@
+/*!\file: random
+ * \brief random number generating functions
+ */ 
+
+/*Headers*/
+/*{{{*/
+#include <stdio.h>
+#include <sys/types.h>
+#include <math.h>
+#include <float.h>    /*  DBL_EPSILON  */
+#include <cstdarg>
+#include <iostream>
+
+#include "../Matrix/matrix.h"
+#include "../Exceptions/exceptions.h"
+#include "../MemOps/MemOps.h"
+#include "../io/io.h"
+#include "./randomgenerator.h"
+/*}}}*/
+
+void univariateNormal(IssmPDouble* prand, IssmPDouble mean, IssmPDouble sdev, int seed=-1) { /*{{{*/
+
+	/*Seed the pseudo-random number generator*/
+	rnd::linear_congruential_engine randomengine;
+	randomengine.seed(seed);
+	/*Normal distribution*/
+	rnd::normal_distribution distriNormal(mean,sdev);
+	/*Assign output pointer and cleanup*/
+	*prand = distriNormal.generator(randomengine);
+	randomengine.free_resources();
+} /*}}}*/
+void multivariateNormal(IssmDouble** prand, int dim, IssmDouble mean, IssmDouble* covariancematrix, int seed=-1) { /*{{{*/
+   
+	IssmPDouble* sampleStandardNormal    = xNew<IssmPDouble>(dim);
+   IssmDouble* sampleMultivariateNormal = xNew<IssmDouble>(dim);
+   IssmDouble* Lchol                    = xNewZeroInit<IssmDouble>(dim*dim);
+
+	/*True randomness if seed<0, otherwise random seed is fixed at seed*/
+	/*Seed the pseudo-random number generator, repeatedly calling univariateNormal does not ensure randomness*/
+	rnd::linear_congruential_engine randomengine;
+	randomengine.seed(seed);
+	/*Normal distribution*/
+	rnd::normal_distribution distriNormal(0.0,1.0);
+	for(int i=0;i<dim;i++){
+		sampleStandardNormal[i] = distriNormal.generator(randomengine);
+	}
+
+	/*Cholsesky decomposition of the covariance matrix*/
+	CholeskyRealPositiveDefinite(Lchol,covariancematrix,dim);
+   
+	/*Matrix by vector multiplication*/
+	for(int i=0;i<dim;i++){ 
+      /*Entry-by-entry multiplication along matrix row*/
+      IssmDouble sum=0.;
+      for(int j=0;j<dim;j++) sum += sampleStandardNormal[j]*Lchol[i*dim+j]; 
+      sampleMultivariateNormal[i] = mean+sum;
+   }
+
+   /*Assign output pointer and cleanup*/
+   *prand = sampleMultivariateNormal;
+   xDelete<IssmPDouble>(sampleStandardNormal);
+   xDelete<IssmDouble>(Lchol);
+	randomengine.free_resources();
+} /*}}}*/
+void multivariateNormal(IssmDouble** prand, int dim, IssmDouble* mean, IssmDouble* covariancematrix, int seed=-1) { /*{{{*/
+	
+	IssmPDouble* sampleStandardNormal    = xNew<IssmPDouble>(dim);
+	IssmDouble* sampleMultivariateNormal = xNew<IssmDouble>(dim);
+	IssmDouble* Lchol                    = xNewZeroInit<IssmDouble>(dim*dim);
+	
+	/*True randomness if seed<0, otherwise random seed is fixed at seed*/
+	/*Seed the pseudo-random number generator, repeatedly calling univariateNormal does not ensure randomness*/
+	rnd::linear_congruential_engine randomengine;
+	randomengine.seed(seed);
+	/*Normal distribution*/
+	rnd::normal_distribution distriNormal(0.0,1.0);
+	for(int i=0;i<dim;i++){
+		sampleStandardNormal[i] = distriNormal.generator(randomengine);
+	}
+
+	/*Cholsesky decomposition of the covariance matrix*/
+	CholeskyRealPositiveDefinite(Lchol,covariancematrix,dim);
+
+	/*Matrix by vector multiplication*/
+	for(int i=0;i<dim;i++){
+		IssmDouble sum = 0.;
+      for(int j=0;j<dim;j++) sum += sampleStandardNormal[j]*Lchol[i*dim+j]; 
+      sampleMultivariateNormal[i] = mean[i]+sum;
+	}
+   
+	/*Assign output pointer and cleanup*/
+	*prand = sampleMultivariateNormal;
+	xDelete<IssmPDouble>(sampleStandardNormal);
+	xDelete<IssmDouble>(Lchol);
+	randomengine.free_resources();
+} /*}}}*/
+
+
+
Index: issm/trunk/src/c/shared/Random/random.h
===================================================================
--- issm/trunk/src/c/shared/Random/random.h	(revision 26744)
+++ issm/trunk/src/c/shared/Random/random.h	(revision 26744)
@@ -0,0 +1,12 @@
+/*!\file: random.h
+ * \brief prototypes for random.h
+ */ 
+
+#ifndef _RANDOM_H_
+#define _RANDOM_H_
+
+void univariateNormal(IssmDouble* prand, IssmDouble mean, IssmDouble sdev, int seed=-1);
+void multivariateNormal(IssmDouble** prand, int dim, IssmDouble mean, IssmDouble* covariancematrix, int seed=-1);
+void multivariateNormal(IssmDouble** prand, int dim, IssmDouble* mean, IssmDouble* covariancematrix, int seed=-1);
+
+#endif //ifndef _RANDOM_H_
Index: issm/trunk/src/c/shared/Random/randomgenerator.cpp
===================================================================
--- issm/trunk/src/c/shared/Random/randomgenerator.cpp	(revision 26744)
+++ issm/trunk/src/c/shared/Random/randomgenerator.cpp	(revision 26744)
@@ -0,0 +1,222 @@
+/*!\file: randomgenerator
+ * \brief random number generating functions
+ */
+
+#include <iostream>
+#include "./randomgenerator.h"
+#include <cmath>
+#include <chrono>
+
+#undef M_PI
+#define M_PI 3.141592653589793238462643
+
+namespace rnd{
+
+  /* Linear congruential engine */
+
+  linear_congruential_engine::linear_congruential_engine(){/*{{{*/
+
+      pseed = new unsigned int;
+			*pseed = std::chrono::steady_clock::now().time_since_epoch()/std::chrono::milliseconds(1);
+      a = 1103515245;		       // BSD Formula
+      c = 12345;					     // BSD Formula
+      m = 2147483648;			     // BSD Formula
+			return;
+	}/*}}}*/
+
+  linear_congruential_engine::linear_congruential_engine(unsigned int _a, unsigned int _b, unsigned int _m){/*{{{*/
+
+      pseed = new unsigned int;
+			*pseed = std::chrono::steady_clock::now().time_since_epoch()/std::chrono::milliseconds(1);
+      a = _a;
+      c = _b;
+      m = _m;
+			return;
+	}/*}}}*/
+
+	linear_congruential_engine::~linear_congruential_engine(){}
+
+  unsigned int linear_congruential_engine::get_m() { return m; }
+
+  void linear_congruential_engine::seed( int s ) {
+      if(s<0)
+        *pseed = std::chrono::steady_clock::now().time_since_epoch()/std::chrono::milliseconds(1);
+      else
+        *pseed = (unsigned) s;
+  }
+
+  unsigned int linear_congruential_engine::generator(){
+    *pseed = ( a * *pseed + c ) % m ;
+    return *pseed;
+  }
+
+  void linear_congruential_engine::free_resources(){
+	  delete pseed;
+	  return;
+  }
+
+  /* Uniform distribution */
+
+	uniform_distribution::uniform_distribution(){/*{{{*/
+			a = 0.0;
+			b = 1.0;
+			return;
+	}
+	/*}}}*/
+
+	uniform_distribution::uniform_distribution(double _a,double _b){/*{{{*/
+			a = _a;
+			b = _b;
+			return;
+	}
+	/*}}}*/
+
+	uniform_distribution::~uniform_distribution(){}
+
+	double uniform_distribution::generator(rnd::linear_congruential_engine random_engine) {
+			return (b-a)*(double) random_engine.generator()/ random_engine.get_m() + a;
+	}
+
+  /* Normal distribution */
+
+	normal_distribution::normal_distribution(){/*{{{*/
+			mean   = 0;
+			sdev  = 1.0;
+			return;
+	}
+	/*}}}*/
+
+	normal_distribution::normal_distribution(double m,double s){/*{{{*/
+			mean   = m;
+			sdev  = s;
+			return;
+	}
+	/*}}}*/
+
+	normal_distribution::~normal_distribution(){}
+
+	double normal_distribution::generator(rnd::linear_congruential_engine random_engine){/*{{{*/
+
+			rnd::uniform_distribution	distribution;
+
+			double u1 = distribution.generator(random_engine);
+			double u2 = distribution.generator(random_engine);
+
+			double R = sqrt(-2*log(u1));
+			double theta = 2*M_PI*u2;
+
+			return mean + sdev * (R*cos(theta));
+
+	}
+	/*}}}*/
+
+  /* Log-Normal distribution */
+
+  lognormal_distribution::lognormal_distribution(){/*{{{*/
+      logmean   = 0;
+      logsdev  = 1.0;
+      return;
+  }
+  /*}}}*/
+
+  lognormal_distribution::lognormal_distribution(double m,double s){/*{{{*/
+      logmean   = m;
+      logsdev  = s;
+      return;
+  }
+  /*}}}*/
+
+  lognormal_distribution::~lognormal_distribution(){}
+
+  double lognormal_distribution::generator(rnd::linear_congruential_engine random_engine){/*{{{*/
+
+      rnd::normal_distribution	distribution(logmean,logsdev);
+
+      return exp(distribution.generator(random_engine));
+
+  }
+  /*}}}*/
+
+  /* Chi-squared distribution */
+
+  chi_squared_distribution::chi_squared_distribution(){/*{{{*/
+      k  = 1;
+      return;
+  }
+  /*}}}*/
+
+  chi_squared_distribution::chi_squared_distribution(unsigned int dof){/*{{{*/
+      k   = dof;
+      return;
+  }
+  /*}}}*/
+
+  chi_squared_distribution::~chi_squared_distribution(){}
+
+  double chi_squared_distribution::generator(rnd::linear_congruential_engine random_engine){/*{{{*/
+
+      rnd::normal_distribution	distribution;
+
+      double rand = 0;
+
+      for(int i=0;i<k;i++)
+        rand = rand + pow(distribution.generator(random_engine),2);
+
+      return rand;
+
+  }
+  /*}}}*/
+
+
+  /* Exponential distribution */
+
+  exponential_distribution::exponential_distribution(){/*{{{*/
+      lambda  = 1.0;
+      return;
+  }
+  /*}}}*/
+
+  exponential_distribution::exponential_distribution(double scale){/*{{{*/
+      lambda   = scale;
+      return;
+  }
+  /*}}}*/
+
+  exponential_distribution::~exponential_distribution(){}
+
+  double exponential_distribution::generator(rnd::linear_congruential_engine random_engine){/*{{{*/
+
+      rnd::uniform_distribution	distribution;
+
+      return -1.0/lambda*log(1.0-distribution.generator(random_engine));
+
+  }
+  /*}}}*/
+
+  /* Student-t distribution */
+
+  student_t_distribution::student_t_distribution(){/*{{{*/
+      k  = 1;
+      return;
+  }
+  /*}}}*/
+
+  student_t_distribution::student_t_distribution(unsigned int dof){/*{{{*/
+      k   = dof;
+      return;
+  }
+  /*}}}*/
+
+  student_t_distribution::~student_t_distribution(){}
+
+  double student_t_distribution::generator(rnd::linear_congruential_engine random_engine){/*{{{*/
+
+      rnd::normal_distribution	normal_distribution;
+      rnd::chi_squared_distribution	chi_squared_distribution(k);
+
+      return normal_distribution.generator(random_engine)/sqrt(chi_squared_distribution.generator(random_engine)/k);
+
+  }
+  /*}}}*/
+
+}
Index: issm/trunk/src/c/shared/Random/randomgenerator.h
===================================================================
--- issm/trunk/src/c/shared/Random/randomgenerator.h	(revision 26744)
+++ issm/trunk/src/c/shared/Random/randomgenerator.h	(revision 26744)
@@ -0,0 +1,142 @@
+/*!\file: randomgenerator.h
+ * \brief prototypes for randomgenerator.h
+ */
+
+#ifndef _RANDOMGENERATOR_H_
+#define _RANDOMGENERATOR_H_
+
+#undef M_PI
+#define M_PI 3.141592653589793238462643
+
+namespace rnd{
+
+  class linear_congruential_engine
+  {
+    private:
+      unsigned int a;
+      unsigned int c;
+      unsigned int m;
+      unsigned int *pseed;
+
+    public:
+
+      /*constructors, destructors: */
+      linear_congruential_engine();
+      linear_congruential_engine(unsigned int _a, unsigned int _b, unsigned int _m);
+      ~linear_congruential_engine();
+
+      unsigned int get_m();
+      void seed( int s );
+      unsigned int generator();
+		void free_resources();
+  };
+
+  class uniform_distribution
+  {
+
+    private:
+      double a;  // lower bound of range
+      double b;  // upper bound of range
+
+    public:
+
+      /*constructors, destructors: */
+      uniform_distribution();
+      uniform_distribution(double _a,double _b);
+      ~uniform_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+  class normal_distribution
+  {
+
+    private:
+      double mean;
+      double sdev;
+
+    public:
+
+      /*constructors, destructors: */
+      normal_distribution();
+      normal_distribution(double m,double s);
+      ~normal_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+  class lognormal_distribution
+  {
+
+    private:
+      double logmean;
+      double logsdev;
+
+    public:
+
+      /*constructors, destructors: */
+      lognormal_distribution();
+      lognormal_distribution(double m,double s);
+      ~lognormal_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+  class chi_squared_distribution
+  {
+
+    private:
+      unsigned int k;
+
+    public:
+
+      /*constructors, destructors: */
+      chi_squared_distribution();
+      chi_squared_distribution(unsigned int k);
+      ~chi_squared_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+  class exponential_distribution
+  {
+
+    private:
+      double lambda;
+
+    public:
+
+      /*constructors, destructors: */
+      exponential_distribution();
+      exponential_distribution(double scale);
+      ~exponential_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+  class student_t_distribution
+  {
+
+    private:
+      unsigned int k;
+
+    public:
+
+      /*constructors, destructors: */
+      student_t_distribution();
+      student_t_distribution(unsigned int k);
+      ~student_t_distribution();
+
+      double generator(rnd::linear_congruential_engine random_engine);
+
+  };
+
+
+}
+
+#endif //* _RANDOMGENERATOR_H_ */
Index: issm/trunk/src/c/shared/io/Comm/IssmComm.cpp
===================================================================
--- issm/trunk/src/c/shared/io/Comm/IssmComm.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/io/Comm/IssmComm.cpp	(revision 26744)
@@ -12,4 +12,9 @@
 #include "../../Numerics/types.h"
 #include "../../Exceptions/exceptions.h"
+
+#ifdef _DO_NOT_LOAD_GLOBALS_
+ISSM_MPI_Comm	IssmComm::comm;
+bool			IssmComm::parallel;
+#endif
 
 void IssmComm::SetComm(ISSM_MPI_Comm incomm){ /*{{{*/
Index: issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.cpp
===================================================================
--- issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.cpp	(revision 26744)
@@ -121,4 +121,9 @@
 		const char* field = "md.friction.coefficient";
 		input_enum        = FrictionCoefficientEnum;
+		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
+	}
+	else if(strcmp(string_in,"FrictionC")==0 || strcmp(string_in,"md.friction.C")==0){
+		const char* field = "md.friction.C";
+		input_enum        = FrictionCEnum;
 		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
 	}
@@ -163,7 +168,7 @@
 		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
 	}
-	else if(strcmp(string_in,"SurfaceloadIceThicknessChange")==0){
-		const char* field = "md.solidearth.surfaceload.icethicknesschange";
-		input_enum        = SurfaceloadIceThicknessChangeEnum;
+	else if(strcmp(string_in,"IceLoad")==0){
+		const char* field = "md.masstransport.spcthickness";
+		input_enum        = MasstransportSpcthicknessEnum;
 		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
 	}
@@ -173,12 +178,22 @@
 		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
 	}
-	else if(strcmp(string_in,"DslGlobalAverageThermostericSeaLevelChange")==0){
-		const char* field = "md.dsl.global_average_thermosteric_sea_level_change";
-		input_enum        = DslGlobalAverageThermostericSeaLevelChangeEnum;
-		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
-	}
-	else if(strcmp(string_in,"SurfaceloadWaterHeightChange")==0){
-		const char* field = "md.solidearth.surfaceload.waterheightchange";
-		input_enum        = SurfaceloadWaterHeightChangeEnum;
+	else if(strcmp(string_in,"DslGlobalAverageThermostericSeaLevel")==0){
+		const char* field = "md.dsl.global_average_thermosteric_sea_level";
+		input_enum        = OceantransportSpcstrEnum;
+		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
+	}
+	else if(strcmp(string_in,"DslSeaWaterPressureAtSeaFloor")==0){
+		const char* field = "md.dsl.sea_water_pressure_at_sea_floor";
+		input_enum        = OceantransportSpcbottompressureEnum;
+		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
+	}
+	else if(strcmp(string_in,"DslSeaSurfaceHeightAboveGeoid")==0){
+		const char* field = "md.dsl.sea_surface_height_above_geoid";
+		input_enum        = OceantransportSpcdslEnum;
+		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
+	}
+	else if(strcmp(string_in,"TwsLoad")==0){
+		const char* field = "md.hydrology.spcwatercolumn";
+		input_enum        = HydrologyTwsSpcEnum;
 		fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1));
 	}
@@ -226,4 +241,5 @@
 		case 11: return SMBgradientscomponentsEnum;
 		case 12: return SMBsemicEnum;	
+		case 55: return SMBautoregressionEnum;
 		default: _error_("Marshalled SMB code \""<<enum_in<<"\" not supported yet");
 	}
@@ -258,4 +274,5 @@
 		case 1: return FrontalForcingsDefaultEnum;
 		case 2: return FrontalForcingsRignotEnum;
+		case 55: return FrontalForcingsRignotAutoregressionEnum;
 		default: _error_("Marshalled Frontalforcings code \""<<enum_in<<"\" not supported yet");
 	}
@@ -268,4 +285,5 @@
 		case 4: return HydrologypismEnum;
 		case 5: return HydrologyGlaDSEnum;
+		case 6: return HydrologyTwsEnum;
 		default: _error_("Marshalled hydrology code \""<<enum_in<<"\" not supported yet");
 	}
@@ -307,4 +325,12 @@
 		case 2: return AmrNeopzEnum;
 		default: _error_("Marshalled AMR code \""<<enum_in<<"\" not supported yet");
+	}
+}/*}}}*/
+int IoCodeToEnumGrd(int enum_in){/*{{{*/
+	switch(enum_in){
+		case 0: return NoneEnum;
+		case 1: return ElasticEnum;
+		case 2: return IvinsEnum;
+		default: _error_("Marshalled GRD code \""<<enum_in<<"\" not supported yet");
 	}
 }/*}}}*/
Index: issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.h
===================================================================
--- issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.h	(revision 25994)
+++ issm/trunk/src/c/shared/io/Marshalling/IoCodeConversions.h	(revision 26744)
@@ -13,4 +13,5 @@
 int IoCodeToEnumTimestepping(int enum_in);
 int IoCodeToEnumAmr(int enum_in);
+int IoCodeToEnumGrd(int enum_in);
 
 int IoCodeToEnumVertexEquation(int enum_in);
Index: issm/trunk/src/c/shared/io/Marshalling/Marshalling.cpp
===================================================================
--- issm/trunk/src/c/shared/io/Marshalling/Marshalling.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/io/Marshalling/Marshalling.cpp	(revision 26744)
@@ -10,4 +10,5 @@
 
 #include "./Marshalling.h"
+#include "../../Numerics/isnan.h"
 
 WriteCheckpointFunctor::WriteCheckpointFunctor(char** pmarshalled_data_in) : MarshallHandle(MARSHALLING_WRITE){/*{{{*/
@@ -75,5 +76,12 @@
 	this->identifiers  = identifiers_in;
 	this->size_max         = size_max_in;
+	#if _CODIPACK_MAJOR_==2
+	this->tape_codi    = &(IssmDouble::getTape());
+	#elif _CODIPACK_MAJOR_==1
 	this->tape_codi    = &(IssmDouble::getGlobalTape());
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 }/*}}}*/
 void RegisterInputFunctor::Echo(void){/*{{{*/
@@ -83,6 +91,14 @@
 void RegisterInputFunctor::call(IssmDouble & value){/*{{{*/
 	_assert_(this->double_count<size_max);
+	_assert_(!xIsNan<IssmDouble>(value));
 	this->tape_codi->registerInput(value);
+	#if _CODIPACK_MAJOR_==2
+	this->identifiers[this->double_count] = value.getIdentifier();
+	#elif _CODIPACK_MAJOR_==1
 	this->identifiers[this->double_count] = value.getGradientData();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
+
 	this->double_count++;
 }/*}}}*/
@@ -91,6 +107,14 @@
 		for(int i=0;i<size;i++){
 			_assert_(this->double_count<size_max);
+			_assert_(!xIsNan<IssmDouble>(value[i]));
 			this->tape_codi->registerInput(value[i]);
+			#if _CODIPACK_MAJOR_==2
+			this->identifiers[this->double_count] = value[i].getIdentifier();
+			#elif _CODIPACK_MAJOR_==1
 			this->identifiers[this->double_count] = value[i].getGradientData();
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 			this->double_count++;
 		}
@@ -100,5 +124,11 @@
 RegisterOutputFunctor::RegisterOutputFunctor(void) : MarshallHandle(AD_REGISTEROUTPUT){/*{{{*/
 	this->double_count = 0;
+	#if _CODIPACK_MAJOR_==2
+	this->tape_codi    = &(IssmDouble::getTape());
+	#elif _CODIPACK_MAJOR_==1
 	this->tape_codi    = &(IssmDouble::getGlobalTape());
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
 }/*}}}*/
 void RegisterOutputFunctor::Echo(void){/*{{{*/
@@ -107,4 +137,5 @@
 }/*}}}*/
 void RegisterOutputFunctor::call(IssmDouble & value){/*{{{*/
+	_assert_(!xIsNan<IssmDouble>(value));
 	this->tape_codi->registerOutput(value);
 	this->double_count++;
@@ -113,4 +144,5 @@
 	if(value){
 		for(int i=0;i<size;i++){
+			_assert_(!xIsNan<IssmDouble>(value[i]));
 			this->tape_codi->registerOutput(value[i]);
 			this->double_count++;
@@ -121,7 +153,13 @@
 SetAdjointFunctor::SetAdjointFunctor(double* adjoint_in,int size_max_in) : MarshallHandle(AD_SETADJOINT){/*{{{*/
 	this->double_count = 0;
-	this->tape_codi    = &(IssmDouble::getGlobalTape());
 	this->adjoint      = adjoint_in;
 	this->size_max     = size_max_in;
+	#if _CODIPACK_MAJOR_==2
+	this->tape_codi    = &(IssmDouble::getTape());
+	#elif _CODIPACK_MAJOR_==1
+	this->tape_codi    = &(IssmDouble::getGlobalTape());
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
 }/*}}}*/
 void SetAdjointFunctor::Echo(void){/*{{{*/
@@ -131,4 +169,5 @@
 void SetAdjointFunctor::call(IssmDouble & value){/*{{{*/
 	_assert_(this->double_count<size_max);
+	_assert_(!xIsNan<IssmDouble>(this->adjoint[this->double_count]));
 	value.gradient() = this->adjoint[this->double_count];
 	this->double_count++;
@@ -138,4 +177,5 @@
 		for(int i=0;i<size;i++){
 			_assert_(this->double_count<size_max);
+			_assert_(!xIsNan<IssmDouble>(this->adjoint[this->double_count]));
 			value[i].gradient() = this->adjoint[this->double_count];
 			this->double_count++;
Index: issm/trunk/src/c/shared/io/Marshalling/Marshalling.h
===================================================================
--- issm/trunk/src/c/shared/io/Marshalling/Marshalling.h	(revision 25994)
+++ issm/trunk/src/c/shared/io/Marshalling/Marshalling.h	(revision 26744)
@@ -108,4 +108,11 @@
 };/*}}}*/
 #if defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
+#if _CODIPACK_MAJOR_==2
+using Tape = typename IssmDouble::Tape;
+#elif _CODIPACK_MAJOR_==1
+using Tape = typename IssmDouble::TapeType;
+#else
+#error "_CODIPACK_MAJOR_ not supported"
+#endif
 class CountDoublesFunctor:    public MarshallHandle{ /*{{{*/
 
@@ -128,5 +135,5 @@
 		int *identifiers;
 		int  size_max;
-		IssmDouble::TapeType *tape_codi;
+		Tape *tape_codi;
 
 	public:
@@ -142,5 +149,5 @@
 	private:
 		int   double_count;
-		IssmDouble::TapeType* tape_codi;
+		Tape *tape_codi;
 
 	public:
@@ -155,8 +162,8 @@
 
 	private:
-		int                   double_count;
-		int                   size_max;
-		IssmDouble::TapeType* tape_codi;
-		double*               adjoint;
+		int     double_count;
+		int     size_max;
+		Tape   *tape_codi;
+		double *adjoint;
 
 	public:
Index: issm/trunk/src/c/shared/io/Print/PrintfFunction.cpp
===================================================================
--- issm/trunk/src/c/shared/io/Print/PrintfFunction.cpp	(revision 25994)
+++ issm/trunk/src/c/shared/io/Print/PrintfFunction.cpp	(revision 26744)
@@ -32,4 +32,6 @@
 		#ifdef _HAVE_ANDROID_JNI_
 		__android_log_print(ANDROID_LOG_INFO, "Native",message.c_str());
+		#elif _IS_MSYS2_
+		printf("%s",message.c_str());
 		#else
 		ApiPrintf(message.c_str());
@@ -42,4 +44,6 @@
 	#ifdef _HAVE_ANDROID_JNI_
 	__android_log_print(ANDROID_LOG_INFO, "Native",message.c_str());
+	#elif _IS_MSYS2_
+	printf("%s",message.c_str());
 	#else
 	ApiPrintf(message.c_str());
Index: issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp	(revision 25994)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp	(revision 26744)
@@ -418,4 +418,5 @@
 			danalysis->MassMatrix(&Mc,femmodel);
 			danalysis->FctKMatrix(&K,NULL,femmodel);
+			danalysis->FctPVector(&p,femmodel);
 			break;
 		default: _error_("analysis type " << EnumToStringx(analysis_type) << " not supported for FCT\n");
Index: issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp	(revision 25994)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp	(revision 26744)
@@ -76,5 +76,5 @@
 		Solverx(&uf, Kff, pf, old_uf, df, femmodel->parameters);
 		femmodel->profiler->Stop(SOLVER);
-	
+
 		Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete ys;
 
@@ -98,5 +98,5 @@
 			}
 		}
-		
+
 		/*Increase count: */
 		count++;
Index: issm/trunk/src/c/solutionsequences/solutionsequence_sampling.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_sampling.cpp	(revision 26744)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_sampling.cpp	(revision 26744)
@@ -0,0 +1,148 @@
+/*!\file: solutionsequence_sampling.cpp
+ * \brief: numerical core of linear solutions
+ */
+
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+#include "../analyses/analyses.h"
+#include "../shared/Random/randomgenerator.h"
+//#include <random>
+
+void GaussianVector(Vector<IssmDouble>* ppf,int seed){/*{{{*/
+
+
+	/*Intermediaries*/
+	double      rdnumber;
+
+	/*Define seed*/
+	rnd::linear_congruential_engine random_engine;
+	if(seed>=0)
+	{
+		int my_rank;
+		ISSM_MPI_Comm_rank(ISSM_MPI_COMM_WORLD,&my_rank);
+		seed = seed + 783728*my_rank; // change default seed for parallel simulations (by considering an arbitrary shif based on the rank number)
+	}
+	random_engine.seed(seed);
+
+	/* Define univariate distribution */
+
+	rnd::normal_distribution distribution(0.0,1.0);
+
+	int        *local_indices = NULL;
+	IssmDouble *local_vector = NULL;
+	ppf->GetLocalVector(&local_vector,&local_indices);
+
+  int M;
+	ppf->GetLocalSize(&M);
+	for(int i=0;i<M;i++){
+		rdnumber = distribution.generator(random_engine);
+		ppf->SetValue(local_indices[i],rdnumber,INS_VAL);
+	}
+	ppf->Assemble();
+
+}/*}}}*/
+void solutionsequence_sampling(FemModel* femmodel){
+
+	/*intermediary: */
+  Matrix<IssmDouble>*  Kff = NULL;
+	Matrix<IssmDouble>*  Kfs = NULL;
+  Vector<IssmDouble>*  ug  = NULL;
+  Vector<IssmDouble>*  uf  = NULL;
+  Vector<IssmDouble>*  old_uf  = NULL;     // previous solution vector (for transient)
+  Vector<IssmDouble>*  pf  = NULL;
+  Vector<IssmDouble>*  df  = NULL;
+  Vector<IssmDouble>*  ys=NULL;
+
+  SamplingAnalysis*    analysis = NULL;
+
+  Vector<IssmDouble>*  Ml = NULL;      // diagonal lumped mass matrix
+  Vector<IssmDouble>*  Mscale = NULL;  // square root of diagonal lumped factor matrix
+
+  /*parameters:*/
+  int solution_type, alpha, step, seed, nsize;
+  IssmDouble phi, tau;
+
+  /*Recover parameters: */
+  femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+  femmodel->parameters->FindParam(&seed,SamplingSeedEnum);
+  femmodel->parameters->FindParam(&alpha,SamplingAlphaEnum);
+  femmodel->parameters->FindParam(&tau,SamplingTauEnum);
+
+  /*Recover parameters for transient simulation: */
+  if(solution_type==TransientSolutionEnum)
+  {
+    femmodel->parameters->FindParam(&step,StepEnum);
+    femmodel->parameters->FindParam(&phi,SamplingPhiEnum);
+		if(seed>=0) seed = seed + 13923272*step; // change default seed for transient simulations (by considering an arbitrary shif based on the step number)
+
+    GetSolutionFromInputsx(&ug,femmodel);
+    Reducevectorgtofx(&uf, ug, femmodel->nodes,femmodel->parameters);
+    old_uf=uf->Duplicate();
+  }
+
+  /*CreateAnalysis*/
+
+  analysis = new SamplingAnalysis();
+
+  analysis->LumpedMassMatrix(&Ml,femmodel); //Create lumped mass matrix
+
+  if(alpha%2!=0)  analysis->LumpedKMatrix(&Mscale,femmodel);   /* Compute square root of lump mass matrix (for alpha even) or stiffness matrix (for alpha odd) */
+  else{
+    Mscale=Ml->Duplicate();
+    Ml->Copy(Mscale);
+  }
+  Mscale->Pow(0.5);
+
+  femmodel->UpdateConstraintsx();
+  SystemMatricesx(&Kff, &Kfs, &pf, &df, NULL,femmodel);
+  CreateNodalConstraintsx(&ys,femmodel->nodes);
+  Reduceloadx(pf, Kfs, ys);
+  delete Kfs;
+
+  /*Copy old solution for transient run */
+  if(solution_type==TransientSolutionEnum) uf->Copy(old_uf);
+
+  /* Generate random RHS */
+  GaussianVector(pf,seed);
+
+  /* Multiply random RHS by square root of mass matrix (for alpha even) or stiffness matrix (for alpha odd) */
+  pf->PointwiseMult(pf,Mscale);
+
+  /*Go solve SPDE */
+  femmodel->profiler->Start(SOLVER);
+  Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters);
+  femmodel->profiler->Stop(SOLVER);
+
+  /* Iterate to compute a realization for alpha>2 */
+  for(int i=3;i<=alpha;i+=2){
+
+    /*Create RHS */
+    uf->Copy(pf);
+    pf->PointwiseMult(pf,Ml);
+
+    /*Go solve SPDE */
+    femmodel->profiler->Start(SOLVER);
+    Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters);
+    femmodel->profiler->Stop(SOLVER);
+
+  }
+
+  /* Divide results by tau */
+  uf->Scale(1.0/tau);
+
+  /* Update solution x_{t+1} = phi x_{t} + noise for transient */
+  if(solution_type==TransientSolutionEnum) uf->AXPY(old_uf,phi);
+
+  /* Update input */
+  Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);
+  InputUpdateFromSolutionx(femmodel,ug);
+
+  /*clean-up*/
+  delete Kff; delete pf; delete df; delete uf; delete ys; delete old_uf;
+  delete Ml; delete Mscale;
+  delete analysis;
+  delete ug;
+
+}
Index: issm/trunk/src/c/solutionsequences/solutionsequence_schurcg.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_schurcg.cpp	(revision 25994)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_schurcg.cpp	(revision 26744)
@@ -33,5 +33,4 @@
 	IssmPDouble				t1,t2;					/* Time measurement for bottleneck analysis */
 
-	
 	double tmp1,tmp2,tmp3;
 	int tmpi;
@@ -39,6 +38,4 @@
 
 	int noIt;
-
-
 
 	int precond = 0;
@@ -49,5 +46,4 @@
 	PetscBool flag,flg;
 	#endif
-
 
 	char ksp_type[50];
@@ -71,5 +67,4 @@
 	#endif
 
-	
 	if(precond){
 		_printf0_("Running WITH preconditioner\n");
@@ -78,8 +73,7 @@
 	}
 
-
 	/*Initialize output*/
 	Vector<IssmDouble>* out_uf=new Vector<IssmDouble>(uf0);
-	
+
 	/* Extract block matrices from the saddle point matrix */
 	/* [ A   B ] = Kff
@@ -97,5 +91,5 @@
 	MatGetSubMatrix(Kff,isp,isv,MAT_INITIAL_MATRIX,&BT);
 	#endif
-	
+
 	/* Extract preconditioner matrix on the pressure space*/
 	#if PETSC_VERSION_GT(3,8,0)
@@ -105,5 +99,4 @@
 	#endif
 
-
 	/* Get number of velocity / pressure nodes */
 	MatGetSize(B,&nu,&np);
@@ -117,5 +110,4 @@
 	VecGetSubVector(out_uf->pvector->vector,isv,&uold);
 	VecGetSubVector(out_uf->pvector->vector,isp,&p);
-
 
 	/* Set up intermediaries */
@@ -133,5 +125,5 @@
 	VecDuplicate(p,&wnew);VecSet(wnew,0.0);
 	VecDuplicate(uold,&chi);VecSet(chi,0.0);
-	
+
 	/* Get global RHS (for each block sub-problem respectively)*/
 	VecGetSubVector(pf,isv,&f1);
@@ -143,5 +135,5 @@
 	/* a(u0,v) = f1(v)-b(p0,v)  i.e.  Au0 = F1-Bp0 */
 	/* u0 = u_DIR on \Gamma_DIR */
-	
+
 	/* Create KSP context */
 	KSPCreate(IssmComm::GetComm(),&kspu);
@@ -174,13 +166,11 @@
 		_error_("Suggested KSP method not implemented yet!\n");
 	}
-	
+
 	KSPSetInitialGuessNonzero(kspu,PETSC_TRUE);
-	
+
 	/*Strong rel. residual tolerance needed when solving for the velocity update. 
 	 * This is because ISSM uses the dimensional equations, so the initial guess chi = 0
 	 * results in a very high initial residual (~ 1e19)*/
 	KSPSetTolerances(kspu,ELLTOL,PETSC_DEFAULT,PETSC_DEFAULT,maxiter); //maxiter
-
-
 
 	KSPGetPC(kspu,&pcu);
@@ -210,5 +200,4 @@
 	KSPSetUp(kspu);
 
-	
 	/* Create RHS */
 	/* RHS = F1-B * pold */
@@ -227,7 +216,5 @@
 		VecNorm(resu,NORM_2,&tmp5);
 
-
-	}
-
+	}
 
 	/* Go solve Au0 = F1-Bp0*/
@@ -235,9 +222,7 @@
 	KSPGetIterationNumber(kspu,&noIt);
 
-
-
 	if (VerboseConvergence())
 	{
-	
+
 	KSPGetIterationNumber(kspu,&tmpi);
 	VecScale(rhsu,-1.);MatMultAdd(A,uold,rhsu,tmpu);VecScale(rhsu,-1.);
@@ -249,17 +234,13 @@
 	}
 
-
-
 	/* Set up u_new */
 	VecDuplicate(uold,&unew);VecCopy(uold,unew);
 	VecAssemblyBegin(unew);VecAssemblyEnd(unew);
 
-
-
 	/* ------------------------------------------------------------- */
 
 	/*Get initial residual*/
 	/*(1/mu(x) * g0, q) = b(q,u0) - (f2,q)  i.e.  IP * g0 = BT * u0 - F2*/
-	
+
 	/* Create KSP context */
 	KSPCreate(IssmComm::GetComm(),&kspip);
@@ -269,15 +250,13 @@
 	KSPSetOperators(kspip,IP,IP,DIFFERENT_NONZERO_PATTERN);
 	#endif
-	
+
 	/* Create RHS */
 	/* RHS = BT * uold - F2 */
 	VecScale(uold,-1.);MatMultAdd(BT,uold,f2,rhsp);VecScale(uold,-1.);
 
-
 	/* Set KSP & PC options */
 	KSPSetType(kspip,KSPGMRES);
 	KSPSetInitialGuessNonzero(kspip,PETSC_TRUE);
-	
-	
+
 	KSPGetPC(kspip,&pcp);
 	PCSetType(pcp,PCJACOBI);
@@ -294,14 +273,10 @@
 	}
 
-
-
 	/* Go solve */
 	KSPSolve(kspip,rhsp,gold);
 
-
-
 	if (VerboseConvergence())
 	{
-	
+
 	KSPGetResidualNorm(kspip,&tmp1);
 	VecScale(rhsp,-1.);MatMultAdd(IP,gold,rhsp,tmpp);VecScale(rhsp,-1.);
@@ -311,5 +286,4 @@
 	_printf0_("||IP*g00 - rhsp||_euc: " << tmp4 <<"\n||Jac(-1)*(IP*g00-rhsp)||_euc: " << tmp5 << "\n||IP*gn0-rhsp||_euc: " << tmp2<< "\n||Jac(-1)*(IP*gn0-rhsp)||_euc: " << tmp1 << "\nIteration number: "<<tmpi<<"\n"); 	
 	}
-
 
 	/*Initial residual*/
@@ -318,5 +292,4 @@
 	_printf0_("inner product norm g0: "<<initRnorm<<"\n");
 
-
 	/*Iterate only if inital residual large enough*/
 	if(initRnorm > 1e-5)
@@ -326,5 +299,4 @@
 	VecDuplicate(gold,&gnew);VecCopy(gold,gnew);
 	VecAssemblyBegin(gnew);VecAssemblyEnd(gnew);
-
 
 	/* ------------------------------------------------------------ */
@@ -334,5 +306,4 @@
 	VecDuplicate(gold,&wold);VecCopy(gold,wold);
 	VecAssemblyBegin(wold);VecAssemblyEnd(wold);
-
 
 	/* Count number of iterations */
@@ -351,11 +322,10 @@
 		VecScale(wold,1.);MatMult(B,wold,rhsu);VecScale(wold,1.);
 		VecSet(chi,0.0);
-	
-		
+
 		if(VerboseConvergence())
 		{
 		VecScale(rhsu,-1.);MatMultAdd(A,chi,rhsu,tmpu);VecScale(rhsu,-1.);
 		VecNorm(tmpu,NORM_2,&tmp4);
-			
+
 		KSPInitialResidual(kspu,chi,tmpu,tmpu2,resu,rhsu);
 		VecNorm(resu,NORM_2,&tmp5);
@@ -363,26 +333,19 @@
 		}
 
-		
 			KSPSolve(kspu,rhsu,chi);
-		
-	
-		
-		
+
 		if (VerboseConvergence())
 		{
 		VecNorm(chi,NORM_2,&tmp1);
 		KSPGetResidualNorm(kspu,&tmp2);
-	
+
 		VecScale(rhsu,-1.);MatMultAdd(A,chi,rhsu,tmpu);VecScale(rhsu,-1.);
 		VecNorm(tmpu,NORM_2,&tmp3);
-		
-		
+
 		KSPGetIterationNumber(kspu,&tmpi);
 		_printf0_("||chi_nk||_euc: "<< tmp1 << "\n||A*chi_0k - rhsu||_euc: "<<tmp4<< "\n||P(-1)*(A*chi_0k-rhsu)||_euc: " << tmp5 << "\n||A*chi_nk - rhsu||_euc: "<< tmp3 <<"\n||P(-1)*(A*chi_nk - rhsu)||_euc: " << tmp2 <<"\nIteration Number: " << tmpi <<"\n");
 		}
 
-
 		/* ---------------------------------------------------------- */
-
 
 		/*Set step size*/
@@ -390,17 +353,14 @@
 		MatMult(IP,gold,tmpp);
 		VecDot(tmpp,wold,&rho);
-		
+
 		MatMult(BT,chi,tmpp);
 		VecDot(tmpp,wold,&tmpScalar);
 		rho = rho/tmpScalar;
 
-
 		/* ---------------------------------------------------------- */
-
 
 		/*Pressure update*/
 		/*p(m+1) = pm + rhom * wm*/
 		VecAXPY(p,-1.*rho,wold);
-
 
 		/*Velocity update*/
@@ -408,5 +368,4 @@
 		VecWAXPY(unew,rho,chi,uold);
 		VecNorm(unew,NORM_2,&tmpScalar);
-
 
 		if (VerboseConvergence())
@@ -421,6 +380,4 @@
 		_printf0_("Incompressibility norm: " << tmp7 <<"\n");
 		}
-
-
 
 		/* ---------------------------------------------------------- */
@@ -432,11 +389,9 @@
 		VecWAXPY(rhsp,-1.*rho,tmpp,tmpp2);
 		KSPSolve(kspip,rhsp,gnew);
-		
-
 
 		/* ---------------------------------------------------------- */
 
 		MatMult(IP,gnew,tmpp);
-		
+
 		VecDot(tmpp,gnew,&gamma);
 		rnorm = sqrt(gamma);
@@ -454,5 +409,5 @@
 			_printf0_("L2-Norm g: "<< rnorm << "\n");
 		}
-	
+
 		/*Break prematurely if solver doesn't reach desired tolerance in reasonable time frame*/
 		if(count > 10./TOL)   
@@ -461,8 +416,6 @@
 		 break;
 		}
-	
 
 		/* ---------------------------------------------------------- */
-
 
 		/*Directional update*/
@@ -475,5 +428,5 @@
 		/* Assign new to old iterates */
 		VecCopy(wnew,wold);VecCopy(gnew,gold);VecCopy(unew,uold);
-		
+
 		count++;
 	}
@@ -487,10 +440,9 @@
 	*puf=out_uf;
 
-
 	/* Cleanup */
 	KSPDestroy(&kspu);KSPDestroy(&kspip);
 
 	MatDestroy(&A);MatDestroy(&B);MatDestroy(&BT);MatDestroy(&IP);
-	
+
 	VecDestroy(&p);VecDestroy(&uold);VecDestroy(&unew);VecDestroy(&rhsu);VecDestroy(&rhsp);
 	VecDestroy(&gold);VecDestroy(&gnew);VecDestroy(&wold);VecDestroy(&wnew);VecDestroy(&chi);
@@ -522,5 +474,4 @@
 	double rnorm1, rnorm2;
 
-
 	if(VerboseModule()) _printf0_("   checking convergence\n");
 
@@ -548,5 +499,5 @@
 	MatGetSubMatrix(Kff->pmatrix->matrix,isp,isv,MAT_INITIAL_MATRIX,&BT);
 	#endif
-	
+
 		/*no. of free nodes in velocity/pressure space*/
 		MatGetSize(B,&n_u,&n_p);
@@ -560,5 +511,4 @@
 		VecGetSubVector(uf->pvector->vector,isv,&u);
 		VecGetSubVector(uf->pvector->vector,isp,&p);
-		
 
 		/*Extract values of the RHS corresponding to the first/second block*/
@@ -573,13 +523,11 @@
 		VecDuplicate(p,&res2);VecSet(res2,1.0);
 
-
 	/*Display solver caracteristics*/
 	if (VerboseConvergence()){
-		
+
 		/*Calculate res1 = A*u + B*p - f1*/
 		VecScale(f1,-1.);MatMultAdd(A,u,f1,tmp);MatMultAdd(B,p,tmp,res1);VecScale(f1,-1.);
 		/*Calculate res2 = B^T * u - f2*/
 		VecScale(f2,-1.);MatMultAdd(BT,u,f2,res2);VecScale(f2,-1.);
-
 
 		/*compute norm(res1), norm(res2), norm(F) and residue*/
@@ -597,9 +545,8 @@
 	VecRestoreSubVector(uf->pvector->vector,isv,&u);
 	VecRestoreSubVector(uf->pvector->vector,isp,&p);
-	
+
 	/*Extract values corresponding to velocity/pressure on the old solution*/
 	VecGetSubVector(old_uf->pvector->vector,isv,&uold);
 	VecGetSubVector(old_uf->pvector->vector,isp,&pold);
-		
 
 	/*Force equilibrium (Mandatory)*/
@@ -609,5 +556,5 @@
 	/*Calculate res2 = B^T * uold - f2*/
 	VecScale(f2,-1.);MatMultAdd(BT,uold,f2,res2);VecScale(f2,-1.);
-	
+
 	/*compute norm(res1), norm(res2), norm(F) and residue*/
 	VecNorm(res1,NORM_2,&rnorm1);VecNorm(res2,NORM_2,&rnorm2);
@@ -626,6 +573,4 @@
 	VecRestoreSubVector(old_uf->pvector->vector,isv,&uold);
 	VecRestoreSubVector(old_uf->pvector->vector,isp,&pold);
-	
-
 
 	//print
@@ -721,5 +666,5 @@
 	int  count=0;
 	bool converged=false;
-	
+
 	/*Start non-linear iteration using input velocity: */
 	GetSolutionFromInputsx(&ug,femmodel);
@@ -729,5 +674,5 @@
 	InputUpdateFromConstantx(femmodel,converged,ConvergedEnum);
 	InputUpdateFromSolutionx(femmodel,ug);
-	
+
 	for(;;){
 
@@ -747,7 +692,7 @@
 		PetscOptionsGetInt(NULL,PETSC_NULL,"-schur_pc",&precond,NULL);
 		#endif
-	
+
 		StressbalanceAnalysis* analysis = new StressbalanceAnalysis();	
-	
+
 		/* Construct Schur preconditioner matrix or mass matrix depending on input */
 		if(precond)
@@ -760,5 +705,5 @@
 			}
 		}else{
-			
+
 			for(Object* & object : femmodel->elements->objects){
 				Element* element2=xDynamicCast<Element*>(object);
@@ -769,7 +714,6 @@
 		}
 
-	   		
 		delete analysis;
-	
+
 		/*Obtain index sets for velocity and pressure components */
 		IS isv = NULL;
@@ -785,9 +729,7 @@
 		Kff->Assemble();
 
-	
 		/*Solve*/
 		femmodel->profiler->Start(SOLVER);
 		_assert_(Kff->type==PetscMatType); 
-
 
 		SchurCGSolver(&uf,
Index: issm/trunk/src/c/solutionsequences/solutionsequences.h
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequences.h	(revision 25994)
+++ issm/trunk/src/c/solutionsequences/solutionsequences.h	(revision 26744)
@@ -1,4 +1,4 @@
 /*
- * solutionsequences.h: 
+ * solutionsequences.h:
  */
 
@@ -25,4 +25,5 @@
 void solutionsequence_adjoint_linear(FemModel* femmodel);
 void solutionsequence_schurcg(FemModel* femmodel);
+void solutionsequence_sampling(FemModel* femmodel);
 
 /*convergence*/
Index: issm/trunk/src/c/toolkits/ToolkitOptions.cpp
===================================================================
--- issm/trunk/src/c/toolkits/ToolkitOptions.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/ToolkitOptions.cpp	(revision 26744)
@@ -8,4 +8,9 @@
 #include "../shared/Exceptions/exceptions.h"
 #include "../shared/MemOps/MemOps.h"
+
+#ifdef _DO_NOT_LOAD_GLOBALS_
+char* ToolkitOptions::toolkittype;
+char* ToolkitOptions::toolkitoptions;
+#endif
 
 void  ToolkitOptions::Init(const char* toolkit_in,const char* options){ /*{{{*/
Index: issm/trunk/src/c/toolkits/codipack/CoDiPackCommon.hpp
===================================================================
--- issm/trunk/src/c/toolkits/codipack/CoDiPackCommon.hpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/codipack/CoDiPackCommon.hpp	(revision 26744)
@@ -35,5 +35,11 @@
 inline void getVectorGradData(const Real* vec, Data* dataVec, int n) {
   for(int i = 0; i < n; ++i) {
-    dataVec[i]=vec[i].getGradientData();
+	 #if _CODIPACK_MAJOR_==2
+    dataVec[i]=vec[i].getIdentifier();
+	 #elif _CODIPACK_MAJOR_==1
+	 dataVec[i]=vec[i].getGradientData();
+	 #else
+	 #error "_CODIPACK_MAJOR_ not supported"
+	 #endif
   }
 }
@@ -43,5 +49,11 @@
   for(int i = 0; i < n; ++i) {
     pasVec[i]=vec[i].getValue();
-    dataVec[i]=vec[i].getGradientData();
+	 #if _CODIPACK_MAJOR_==2
+    dataVec[i]=vec[i].getIdentifier();
+	 #elif _CODIPACK_MAJOR_==1
+	 dataVec[i]=vec[i].getGradientData();
+	 #else
+	 #error "_CODIPACK_MAJOR_ not supported"
+	 #endif
   }
 }
@@ -50,14 +62,32 @@
 inline void getPrimalAndGradData(const Real& value, Passive& pas, Data& data) {
   pas=value.getValue();
+  #if _CODIPACK_MAJOR_==2
+  data=value.getIdentifier();
+  #elif _CODIPACK_MAJOR_==1
   data=value.getGradientData();
+  #else
+  #error "_CODIPACK_MAJOR_ not supported"
+  #endif
 }
 
 template<typename Real, typename Data>
 inline void registerVector(Real* vec, Data* dataVec, int n) {
-  typename Real::TapeType& tape = Real::getGlobalTape();
+	#if _CODIPACK_MAJOR_==2
+	typename Real::Tape& tape = Real::getTape();
+	#elif _CODIPACK_MAJOR_==1
+	typename Real::TapeType& tape = Real::getGlobalTape();
+	#else
+	#error "_CODIPACK_MAJOR_ not supported"
+	#endif
 
   for(int i = 0; i < n; ++i) {
     tape.registerInput(vec[i]);
-    dataVec[i]=vec[i].getGradientData();
+	 #if _CODIPACK_MAJOR_==2
+    dataVec[i]=vec[i].getIdentifier();
+	 #elif _CODIPACK_MAJOR_==1
+	 dataVec[i]=vec[i].getGradientData();
+	 #else
+	 #error "_CODIPACK_MAJOR_ not supported"
+	 #endif
   }
 }
Index: issm/trunk/src/c/toolkits/codipack/ampi_interface.cpp
===================================================================
--- issm/trunk/src/c/toolkits/codipack/ampi_interface.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/codipack/ampi_interface.cpp	(revision 26744)
@@ -12,3 +12,2 @@
 #error "Cannot compile without MeDiPack and AdjointMpi"
 #endif
-
Index: issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp
===================================================================
--- issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp	(revision 26744)
@@ -254,16 +254,17 @@
 
 #ifdef _HAVE_CODIPACK_
-void SolverxSeq_codi_b(void* tape_in,void* data_in,void* ra) {/*{{{*/
+#if _CODIPACK_MAJOR_==2
+using Tape = typename IssmDouble::Tape;
+using AccessInterface = codi::VectorAccessInterface<typename Tape::Real, typename Tape::Identifier>;
+void SolverxSeq_codi_b(Tape* tape,void* data_in, AccessInterface* ra) {/*{{{*/
 
 	/*recast data_in and tape*/
-	codi::DataStore* data = (codi::DataStore*)data_in;
-	//IssmDouble::TapeType& tape = (IssmDouble::TapeType&)tape_in;
-	IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
+	codi::ExternalFunctionUserData* data = (codi::ExternalFunctionUserData*)data_in;
 
   IssmDouble::Real* valueATrans;
-  IssmDouble::GradientData* indexATrans;
-  IssmDouble::GradientData* indexB;
+  IssmDouble::Identifier* indexATrans;
+  IssmDouble::Identifier* indexB;
   IssmDouble::Real* valueX;
-  IssmDouble::GradientData* indexX;
+  IssmDouble::Identifier* indexX;
   int n;
 
@@ -275,17 +276,16 @@
   data->getData(n);
 
-
   // create the adjoint vector for x and reset the adjoint values on the tape
-  IssmDouble::GradientValue* adjX = xNew<IssmDouble::GradientValue>(n);
-  getVectorAdjoint(tape, indexX, adjX, n);
-
-  IssmDouble::GradientValue* sol  = xNew<IssmDouble::GradientValue>(n);
+  IssmDouble::Gradient* adjX = xNew<IssmDouble::Gradient>(n);
+  getVectorAdjoint(*tape, indexX, adjX, n);
+
+  IssmDouble::Gradient* sol  = xNew<IssmDouble::Gradient>(n);
   SolverxSeq(sol, valueATrans, adjX, n);
 
-  updateVectorAdjoint(tape, indexB, sol, n);
+  updateVectorAdjoint(*tape, indexB, sol, n);
   for(int i=0; i<n; ++i) {
     for (int j=0; j<n; ++j) {
       // we access the transposed matrix here because we stored the indices in a transposed way
-      updateAdjoint(tape, indexATrans[i*n+j], -sol[j]*valueX[i]);
+      updateAdjoint(*tape, indexATrans[i*n+j], -sol[j]*valueX[i]);
     }
   }
@@ -295,14 +295,14 @@
 }
 /*}}}*/
-void SolverxSeq_codi_delete(void* tape_in,void* data_in) {/*{{{*/
+void SolverxSeq_codi_delete(Tape* tape,void* data_in) {/*{{{*/
 
 	/*recast data_in*/
-	codi::DataStore* data = (codi::DataStore*)data_in;
+	codi::ExternalFunctionUserData* data = (codi::ExternalFunctionUserData*)data_in;
 
   IssmDouble::Real* valueATrans;
-  IssmDouble::GradientData* indexATrans;
-  IssmDouble::GradientData* indexB;
+  IssmDouble::Identifier* indexATrans;
+  IssmDouble::Identifier* indexB;
   IssmDouble::Real* valueX;
-  IssmDouble::GradientData* indexX;
+  IssmDouble::Identifier* indexX;
   int n;
 
@@ -319,18 +319,18 @@
   xDelete(valueX);
   xDelete(indexX);
- 
+
   delete data;
 }
 /*}}}*/
 void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/
-  IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
-  codi::DataStore* dataHandler = NULL;
+  IssmDouble::Tape& tape = IssmDouble::getTape();
+  codi::ExternalFunctionUserData* dataHandler = NULL;
 
   if(tape.isActive()) {
-    dataHandler = new codi::DataStore();
+    dataHandler = new codi::ExternalFunctionUserData();
 
     // create the index vector and the double data for A and B
     IssmDouble::Real* valueATrans = xNew<IssmDouble::Real>(n*n);
-    IssmDouble::GradientData* indexATrans = xNew<IssmDouble::GradientData>(n*n);
+    IssmDouble::Identifier* indexATrans = xNew<IssmDouble::Identifier>(n*n);
 
     // read the data for matrix in a transposed fashion
@@ -342,5 +342,5 @@
 
     // read the data from B (primal values are not required vor B
-    IssmDouble::GradientData* indexB = xNew<IssmDouble::GradientData>(n);
+    IssmDouble::Identifier* indexB = xNew<IssmDouble::Identifier>(n);
     getVectorGradData(B, indexB, n);
 
@@ -366,5 +366,5 @@
   if(tape.isActive()) {
     // create the index vector X and register x as active variables
-    IssmDouble::GradientData* indexX = xNew<IssmDouble::GradientData>(n);
+    IssmDouble::Identifier* indexX = xNew<IssmDouble::Identifier>(n);
     registerVector(X, indexX, n);
 
@@ -375,5 +375,5 @@
     dataHandler->addData(n);
 
-    tape.pushExternalFunctionHandle(&SolverxSeq_codi_b, dataHandler, &SolverxSeq_codi_delete);
+	 tape.pushExternalFunction(codi::ExternalFunction<Tape>::create(&SolverxSeq_codi_b,(void*)dataHandler, &SolverxSeq_codi_delete));
   }
   else{
@@ -386,4 +386,140 @@
 }
 /*}}}*/
+#elif _CODIPACK_MAJOR_==1
+void SolverxSeq_codi_b(void* tape_in,void* data_in,void* ra) {/*{{{*/
+
+	/*recast data_in and tape*/
+	codi::DataStore* data = (codi::DataStore*)data_in;
+	//IssmDouble::TapeType& tape = (IssmDouble::TapeType&)tape_in;
+	IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
+
+	IssmDouble::Real* valueATrans;
+	IssmDouble::GradientData* indexATrans;
+	IssmDouble::GradientData* indexB;
+	IssmDouble::Real* valueX;
+	IssmDouble::GradientData* indexX;
+	int n;
+
+	data->getData(valueATrans);
+	data->getData(indexATrans);
+	data->getData(indexB);
+	data->getData(valueX);
+	data->getData(indexX);
+	data->getData(n);
+
+
+	// create the adjoint vector for x and reset the adjoint values on the tape
+	IssmDouble::GradientValue* adjX = xNew<IssmDouble::GradientValue>(n);
+	getVectorAdjoint(tape, indexX, adjX, n);
+
+	IssmDouble::GradientValue* sol  = xNew<IssmDouble::GradientValue>(n);
+	SolverxSeq(sol, valueATrans, adjX, n);
+
+	updateVectorAdjoint(tape, indexB, sol, n);
+	for(int i=0; i<n; ++i) {
+		for (int j=0; j<n; ++j) {
+			// we access the transposed matrix here because we stored the indices in a transposed way
+			updateAdjoint(tape, indexATrans[i*n+j], -sol[j]*valueX[i]);
+		}
+	}
+
+	xDelete(sol);
+	xDelete(adjX);
+}
+/*}}}*/
+void SolverxSeq_codi_delete(void* tape_in,void* data_in) {/*{{{*/
+
+	/*recast data_in*/
+	codi::DataStore* data = (codi::DataStore*)data_in;
+
+	IssmDouble::Real* valueATrans;
+	IssmDouble::GradientData* indexATrans;
+	IssmDouble::GradientData* indexB;
+	IssmDouble::Real* valueX;
+	IssmDouble::GradientData* indexX;
+	int n;
+
+	data->getData(valueATrans);
+	data->getData(indexATrans);
+	data->getData(indexB);
+	data->getData(valueX);
+	data->getData(indexX);
+	data->getData(n);
+
+	xDelete(valueATrans);
+	xDelete(indexATrans);
+	xDelete(indexB);
+	xDelete(valueX);
+	xDelete(indexX);
+
+	delete data;
+}
+/*}}}*/
+void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){/*{{{*/
+	IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
+	codi::DataStore* dataHandler = NULL;
+
+	if(tape.isActive()) {
+		dataHandler = new codi::DataStore();
+
+		// create the index vector and the double data for A and B
+		IssmDouble::Real* valueATrans = xNew<IssmDouble::Real>(n*n);
+		IssmDouble::GradientData* indexATrans = xNew<IssmDouble::GradientData>(n*n);
+
+		// read the data for matrix in a transposed fashion
+		for (int i=0; i<n; ++i) {
+			for (int j=0; j<n; ++j) {
+				getPrimalAndGradData(A[i*n+j], valueATrans[j*n+i], indexATrans[j*n+i]);
+			}
+		}
+
+		// read the data from B (primal values are not required vor B
+		IssmDouble::GradientData* indexB = xNew<IssmDouble::GradientData>(n);
+		getVectorGradData(B, indexB, n);
+
+		dataHandler->addData(valueATrans);
+		dataHandler->addData(indexATrans);
+		dataHandler->addData(indexB);
+	}
+
+	// unpack the primal values from the matrix and the vector
+	IssmDouble::Real* valueA = xNew<IssmDouble::Real>(n*n);
+	IssmDouble::Real* valueB = xNew<IssmDouble::Real>(n);
+	// read the data from A and B
+	getVectorPrimal(A, valueA, n*n);
+	getVectorPrimal(B, valueB, n);
+
+	// create the placeholder for X and solve the system
+	IssmDouble::Real* valueX = xNew<IssmDouble::Real>(n);
+	SolverxSeq(valueX, valueA, valueB, n);
+
+	// pack the values into x
+	setVectorPrimal(X, valueX, n);
+
+	if(tape.isActive()) {
+		// create the index vector X and register x as active variables
+		IssmDouble::GradientData* indexX = xNew<IssmDouble::GradientData>(n);
+		registerVector(X, indexX, n);
+
+		dataHandler->addData(valueX);
+		dataHandler->addData(indexX);
+
+		// store other arguments
+		dataHandler->addData(n);
+
+		tape.pushExternalFunctionHandle(&SolverxSeq_codi_b, dataHandler, &SolverxSeq_codi_delete);
+	}
+	else{
+		// if the tape is active valueX is stored in the dataHandler and deleted in the reverse sweep
+		xDelete(valueX);
+	}
+
+	xDelete(valueB);
+	xDelete(valueA);
+}
+/*}}}*/
+#else
+#error "_CODIPACK_MAJOR_ not supported"
+#endif
 void DenseGslSolve(/*output*/ IssmDouble** px,/*stiffness matrix:*/ IssmDouble* Kff, int Kff_M, int Kff_N, /*right hand side load vector: */ IssmDouble* pf, int pf_M, Parameters* parameters){ /*{{{*/
 
@@ -401,3 +537,4 @@
 }
 /*}}}*/
-#endif
+
+#endif
Index: issm/trunk/src/c/toolkits/issm/Bucket.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/Bucket.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/Bucket.h	(revision 26744)
@@ -34,37 +34,78 @@
 			this->Initialize();
 		} /*}}}*/
-		Bucket(int min,int* idxmin,int nin,int* idxnin,doubletype* valuesin,InsMode modein){ /*{{{*/
+		Bucket(int m_in,int* idxm_in,int n_in,int* idxn_in,doubletype* values_in,InsMode mode_in){ /*{{{*/
 
 			this->Initialize();
 
+			/*Check whether we have negative indices?*/
+			int m_numneg = 0;
+			int n_numneg = 0;
+			for(int i=0;i<m_in;i++) if(idxm_in[i]<0) m_numneg++;
+			for(int i=0;i<n_in;i++) if(idxn_in[i]<0) n_numneg++;
+
 			this->type=MATRIX_BUCKET;
-			this->m=min;
-			this->n=nin;
-			this->mode=modein;
+			this->m=m_in-m_numneg;
+			this->n=n_in-n_numneg;
+			this->mode=mode_in;
+			if(this->m*this->n){
+				this->idxm=xNew<int>(this->m); 
+				this->idxn=xNew<int>(this->n); 
+				this->values=xNew<doubletype>(this->n*this->m);
+
+				if(m_numneg==0 && n_numneg==0){
+					xMemCpy(this->values,values_in,this->n*this->m);
+					xMemCpy(this->idxm,idxm_in,this->m);
+					xMemCpy(this->idxn,idxn_in,this->n);
+				}
+				else{
+					int count;
+					count =0; for(int i=0;i<m_in;i++) if(idxm_in[i]>=0) this->idxm[count++] = idxm_in[i];
+					count =0; for(int i=0;i<n_in;i++) if(idxn_in[i]>=0) this->idxn[count++] = idxn_in[i];
+					count = 0;
+					for(int i=0;i<m_in;i++){
+						if(idxm_in[i]>=0){
+							for(int j=0;j<n_in;j++){
+								if(idxn_in[j]>=0){
+									this->values[count++] = values_in[i*n_in+j];
+								}
+							}
+						}
+					}
+				}
+			}
+			else{
+				/*Set both as 0 to save time*/
+				this->m = 0;
+				this->n = 0;
+			}
+		} /*}}}*/
+		Bucket(int m_in,int* idxm_in,doubletype* values_in,InsMode mode_in){ /*{{{*/ 
+			this->Initialize();
+
+			/*Check whether we have negative indices?*/
+			int numneg = 0;
+			for(int i=0;i<m_in;i++) if(idxm_in[i]<0) numneg++;
+
+			this->type=VECTOR_BUCKET; 
+			this->m=m_in-numneg;
+			this->mode=mode_in;
 			if(this->m){
-				this->idxm=xNew<int>(this->m); 
-				xMemCpy(this->idxm,idxmin,this->m);
-			}
-			if(this->n){
-				this->idxn=xNew<int>(this->n); 
-				xMemCpy(this->idxn,idxnin,this->n);
-			}
-			if(this->m*this->n){
-				this->values=xNew<doubletype>(this->n*this->m);
-				xMemCpy(this->values,valuesin,this->n*this->m);
-			}
-		} /*}}}*/
-		Bucket(int min,int* idxmin,doubletype* valuesin,InsMode modein){ /*{{{*/ 
-			this->Initialize();
-
-			this->type=VECTOR_BUCKET; 
-			this->m=min;
-			this->mode=modein;
-			if(this->m){
-				this->idxm=xNew<int>(this->m); 
-				xMemCpy(this->idxm,idxmin,this->m);
-
+				this->idxm=xNew<int>(this->m);
 				this->values=xNew<doubletype>(this->m);
-				xMemCpy(this->values,valuesin,this->m);
+
+				if(numneg==0){
+					xMemCpy(this->idxm,idxm_in,this->m);
+					xMemCpy(this->values,values_in,this->m);
+				}
+				else{
+					int count = 0;
+					for(int i=0;i<m_in;i++){
+						if(idxm_in[i]>=0){
+							this->idxm[count]   = idxm_in[i];
+							this->values[count] = values_in[i];
+							count++;
+						}
+					}
+				}
 			}
 		} /*}}}*/
@@ -88,5 +129,5 @@
 		/*object virtual functions definitions:*/
 		void    Echo(){ /*{{{*/
-			_printf_("Bucket echo (cpu #: "<<IssmComm::GetRank()<<")\n");
+			_printf_("Bucket echo (cpu #"<<IssmComm::GetRank()<<")\n");
 			_printf_("bucket type: " << type << "\n");
 			_printf_("num rows: "<<this->m<<" num cols: "<<this->n << "\n");
@@ -95,5 +136,5 @@
 			int i,j;
 
-			_printf_("Bucket echo (cpu #: "<<IssmComm::GetRank()<<")\n");
+			_printf_("Bucket echo (cpu #"<<IssmComm::GetRank()<<")\n");
 			_printf_("bucket type: " << type << "\n");
 			_printf_("num rows: "<<this->m<<" num cols: "<<this->n << "\n");
Index: issm/trunk/src/c/toolkits/issm/IssmAbsVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmAbsVec.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmAbsVec.h	(revision 26744)
@@ -52,4 +52,5 @@
 		virtual void PointwiseMult(IssmAbsVec* x,IssmAbsVec* y)=0;
 		virtual void Pow(doubletype scale_factor)=0;
+		virtual void Sum(doubletype* pvalue)=0;
 };
 
Index: issm/trunk/src/c/toolkits/issm/IssmDenseMat.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmDenseMat.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmDenseMat.h	(revision 26744)
@@ -161,4 +161,6 @@
 					break;
 			}
+
+			return 0.;
 		}
 		/*}}}*/
@@ -230,8 +232,20 @@
 			switch(mode){
 				case ADD_VAL:
-					for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]+=values[n*i+j];
+					for(i=0;i<m;i++){
+						if(idxm[i]<0) continue;
+						for(j=0;j<n;j++){
+							if(idxn[j]<0) continue;
+							this->matrix[N*idxm[i]+idxn[j]]+=values[n*i+j];
+						}
+					}
 					break;
 				case INS_VAL:
-					for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]=values[n*i+j];
+					for(i=0;i<m;i++){
+						if(idxm[i]<0) continue;
+						for(j=0;j<n;j++){
+							if(idxn[j]<0) continue;
+							this->matrix[N*idxm[i]+idxn[j]]=values[n*i+j];
+						}
+					}
 					break;
 				default:
Index: issm/trunk/src/c/toolkits/issm/IssmMpiDenseMat.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmMpiDenseMat.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmMpiDenseMat.h	(revision 26744)
@@ -339,4 +339,6 @@
 					break;
 			}
+
+			return 0.;
 		}
 		/*}}}*/
Index: issm/trunk/src/c/toolkits/issm/IssmMpiSparseMat.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 26744)
@@ -90,5 +90,5 @@
 		/*}}}*/
 		void Init(int Min,int Nin){/*{{{*/
-			
+
 			this->buckets=new DataSet();
 
@@ -288,5 +288,5 @@
 				}
 			}
-					
+
 			/*Plug into matrix: */
 			for(int i=0;i<this->m;i++) this->matrix[i]->SetValues(numvalues_perrow[i],cols_perrow[i],values_perrow[i],mods_perrow[i]);
@@ -362,4 +362,6 @@
 					break;
 			}
+
+			return 0.;
 		}
 		/*}}}*/
Index: issm/trunk/src/c/toolkits/issm/IssmMpiVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmMpiVec.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmMpiVec.h	(revision 26744)
@@ -444,5 +444,4 @@
 			comm=IssmComm::GetComm();
 			num_procs=IssmComm::GetSize();
-
 
 			/*Allocate: */
@@ -528,4 +527,5 @@
 					break;
 			}
+			return 0.;
 		}
 		/*}}}*/
@@ -592,4 +592,8 @@
 			for(i=0;i<this->M;i++)this->vector[i]=pow(this->vector[i],scale_factor);
 
+		}
+		/*}}}*/
+		void Sum(doubletype* pvalue){/*{{{*/
+			_error_("not support yet!");
 		}
 		/*}}}*/
Index: issm/trunk/src/c/toolkits/issm/IssmSeqVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmSeqVec.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmSeqVec.h	(revision 26744)
@@ -101,8 +101,8 @@
 			switch(mode){
 				case ADD_VAL:
-					for(i=0;i<ssize;i++) this->vector[list[i]]+=values[i];
+					for(i=0;i<ssize;i++) if(list[i]>=0) this->vector[list[i]]+=values[i];
 					break;
 				case INS_VAL:
-					for(i=0;i<ssize;i++) this->vector[list[i]]=values[i];
+					for(i=0;i<ssize;i++) if(list[i]>=0) this->vector[list[i]]=values[i];
 					break;
 				default:
@@ -113,5 +113,7 @@
 		}
 		/*}}}*/
-		void SetValue(int dof, doubletype value, InsMode mode){/*{{{*/
+		void SetValue(int dof, doubletype value,InsMode mode){/*{{{*/
+
+			_assert_(dof>=0);
 
 			switch(mode){
@@ -263,4 +265,6 @@
 					break;
 			}
+
+			return 0.;
 		}
 		/*}}}*/
@@ -324,4 +328,12 @@
 		}
 		/*}}}*/
+		void Sum(doubletype* pvalue){/*{{{*/
+
+			doubletype value=0;
+			int i;
+			for(i=0;i<this->M;i++)value+=this->vector[i];
+			*pvalue=value;
+		}
+		/*}}}*/
 
 };
Index: issm/trunk/src/c/toolkits/issm/IssmVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmVec.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/IssmVec.h	(revision 26744)
@@ -220,4 +220,8 @@
 		}
 		/*}}}*/
+		void Sum(doubletype*  pvalue){/*{{{*/
+			vector->Sum(pvalue);
+		}
+		/*}}}*/
 };
 
Index: issm/trunk/src/c/toolkits/issm/SparseRow.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/SparseRow.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/issm/SparseRow.h	(revision 26744)
@@ -19,5 +19,5 @@
 		int*        indices;
 		doubletype* values;
-		
+
 		/*SparseRow constructors, destructors*/
 		SparseRow(){ /*{{{*/
@@ -28,5 +28,5 @@
 		} /*}}}*/
 		SparseRow(int in_M){/*{{{*/
-			
+
 			M=in_M;
 			ncols=0;
@@ -87,5 +87,5 @@
 			indices=xNew<int>(ncols); _assert_(indices);
 			values=xNewZeroInit<doubletype>(ncols);  _assert_(values);
-			
+
 			count=0;
 			for(i=0;i<numvalues;i++){
@@ -96,5 +96,5 @@
 				}
 			}
-		
+
 			if(count!=ncols)_error_("counter problem during set values operations");
 		} /*}}}*/
@@ -132,5 +132,5 @@
 				mult+=values[i]*X[indices[i]];
 			}
-			
+
 			return mult;
 		}
Index: issm/trunk/src/c/toolkits/mpi/issmmpi.h
===================================================================
--- issm/trunk/src/c/toolkits/mpi/issmmpi.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/mpi/issmmpi.h	(revision 26744)
@@ -31,7 +31,19 @@
 			//#define AMPI_ADOUBLE TOOL::MPI_TYPE
 			//
+			//#include <codi/externals/codiMpiTypes.hpp>
+			//using MpiTypes = CoDiMpiTypes<IssmDouble>;
 			/*New implementation*/
+			#if _CODIPACK_MAJOR_==2
+			#include <codi/tools/mpi/codiMpiTypes.hpp>
+			using MpiTypes = codi::CoDiMpiTypes<IssmDouble>;
+
+			#elif _CODIPACK_MAJOR_==1
 			#include <codi/externals/codiMpiTypes.hpp>
 			using MpiTypes = CoDiMpiTypes<IssmDouble>;
+
+			#else
+			#error "_CODIPACK_MAJOR_ not supported"
+			#endif
+
 			extern MpiTypes* mpiTypes;
 			#define AMPI_ADOUBLE mpiTypes->MPI_TYPE
Index: issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp
===================================================================
--- issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 26744)
@@ -485,19 +485,19 @@
 
 #ifdef _HAVE_CODIPACK_
-void MumpsSolve_codi_b(void* tape_in,void* data_in,void* ra) {/*{{{*/
+#if _CODIPACK_MAJOR_==2
+using Tape = typename IssmDouble::Tape;
+using AccessInterface = codi::VectorAccessInterface<typename Tape::Real, typename Tape::Identifier>;
+void MumpsSolve_codi_b(Tape* tape, void* data_in, AccessInterface* ra) {/*{{{*/
 
 	/*recast data_in and tape*/
-  codi::DataStore* data = (codi::DataStore*)data_in;
-  //IssmDouble::TapeType& tape = (IssmDouble::TapeType&)tape_in;
-  IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
-
+  codi::ExternalFunctionUserData* data = (codi::ExternalFunctionUserData*)data_in;
 
   IssmDouble::Real* valueATrans;
-  IssmDouble::GradientData* indexATrans;
+  IssmDouble::Identifier* indexATrans;
   int* irnATrans;
   int* jcnATrans;
-  IssmDouble::GradientData* indexB;
+  IssmDouble::Identifier* indexB;
   IssmDouble::Real* valueX;
-  IssmDouble::GradientData* indexX;
+  IssmDouble::Identifier* indexX;
   int n;
   int nnz;
@@ -518,11 +518,11 @@
 
   // create the adjoint vector for x and reset the adjoint values on the tape
-  IssmDouble::GradientValue* adjX = xNew<IssmDouble::GradientValue>(n);
-  getVectorAdjoint(tape, indexX, adjX, n);
+  IssmDouble::Gradient* adjX = xNew<IssmDouble::Gradient>(n);
+  getVectorAdjoint(*tape, indexX, adjX, n);
 
   MumpsSolve(n, nnz, local_nnz, irnATrans, jcnATrans, valueATrans, adjX, parameters);
   // adjX contains now the solution
 
-  updateVectorAdjoint(tape, indexB, adjX, n);
+  updateVectorAdjoint(*tape, indexB, adjX, n);
 
   // bcast dp_y (the solution of the forward system)
@@ -534,5 +534,5 @@
     // we access the transposed matrix here because we stored the indices in a transposed way
     // -1 is substracted because jcn and irn are stored with fortran indexing
-    updateAdjoint(tape, indexATrans[i], -adjX[jcnATrans[i]-1]*valueX[irnATrans[i]-1]);
+    updateAdjoint(*tape, indexATrans[i], -adjX[jcnATrans[i]-1]*valueX[irnATrans[i]-1]);
   }
 
@@ -540,16 +540,16 @@
 }
 /*}}}*/
-void MumpsSolve_codi_delete(void* tape_in,void* data_in) {/*{{{*/
+void MumpsSolve_codi_delete(Tape* tape,void* data_in) {/*{{{*/
 
 	/*recast data_in*/
-	codi::DataStore* data = (codi::DataStore*)data_in;
+	codi::ExternalFunctionUserData* data = (codi::ExternalFunctionUserData*)data_in;
 
   IssmDouble::Real* valueATrans;
-  IssmDouble::GradientData* indexATrans;
+  IssmDouble::Identifier* indexATrans;
   int* irnATrans;
   int* jcnATrans;
-  IssmDouble::GradientData* indexB;
+  IssmDouble::Identifier* indexB;
   IssmDouble::Real* valueX;
-  IssmDouble::GradientData* indexX;
+  IssmDouble::Identifier* indexX;
   int n;
   int nnz;
@@ -581,13 +581,13 @@
 /*}}}*/
 void MumpsSolve(int n,int nnz,int local_nnz,int* irn_loc,int* jcn_loc,IssmDouble *a_loc,IssmDouble *rhs,Parameters* parameters){/*{{{*/
-  IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
-  codi::DataStore* dataHandler = NULL;
+  IssmDouble::Tape& tape = IssmDouble::getTape();
+  codi::ExternalFunctionUserData* dataHandler = NULL;
 
   if(tape.isActive()) {
-    dataHandler = new codi::DataStore();
+    dataHandler = new codi::ExternalFunctionUserData();
 
     // create the index and double vector for the matrix
     IssmDouble::Real* valueATrans = xNew<IssmDouble::Real>(local_nnz);
-    IssmDouble::GradientData* indexATrans = xNew<IssmDouble::GradientData>(local_nnz);
+    IssmDouble::Identifier* indexATrans = xNew<IssmDouble::Identifier>(local_nnz);
     int* irnATrans = xNew<int>(local_nnz);
     int* jcnATrans = xNew<int>(local_nnz);
@@ -601,5 +601,5 @@
 
     // create the index vector for a (primal values are not needed for a)
-    IssmDouble::GradientData* indexB = xNew<IssmDouble::GradientData>(n);
+    IssmDouble::Identifier* indexB = xNew<IssmDouble::Identifier>(n);
     getVectorGradData(rhs, indexB, n);
 
@@ -626,5 +626,5 @@
   if(tape.isActive()) {
     // create the index vector X and register x as active variables
-    IssmDouble::GradientData* indexX = xNew<IssmDouble::GradientData>(n);
+    IssmDouble::Identifier* indexX = xNew<IssmDouble::Identifier>(n);
     registerVector(rhs, indexX, n);
 
@@ -638,6 +638,5 @@
     dataHandler->addData(parameters); // we assume here that parameters is still intact when the reverse run is called
 
-	 //tape.pushExternalFunction(&MumpsSolve_codi_b, dataHandler, &MumpsSolve_codi_delete);
-    tape.pushExternalFunctionHandle(&MumpsSolve_codi_b,(void*)dataHandler, &MumpsSolve_codi_delete);
+	 tape.pushExternalFunction(codi::ExternalFunction<Tape>::create(&MumpsSolve_codi_b,(void*)dataHandler, &MumpsSolve_codi_delete));
   }
   else{
@@ -649,3 +648,171 @@
 }
 /*}}}*/
-#endif
+#elif _CODIPACK_MAJOR_==1
+void MumpsSolve_codi_b(void* tape_in,void* data_in,void* ra) {/*{{{*/
+
+	/*recast data_in and tape*/
+	codi::DataStore* data = (codi::DataStore*)data_in;
+	//IssmDouble::TapeType& tape = (IssmDouble::TapeType&)tape_in;
+	IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
+
+
+	IssmDouble::Real* valueATrans;
+	IssmDouble::GradientData* indexATrans;
+	int* irnATrans;
+	int* jcnATrans;
+	IssmDouble::GradientData* indexB;
+	IssmDouble::Real* valueX;
+	IssmDouble::GradientData* indexX;
+	int n;
+	int nnz;
+	int local_nnz;
+	Parameters* parameters;
+
+	data->getData(valueATrans);
+	data->getData(indexATrans);
+	data->getData(irnATrans);
+	data->getData(jcnATrans);
+	data->getData(indexB);
+	data->getData(valueX);
+	data->getData(indexX);
+	data->getData(n);
+	data->getData(nnz);
+	data->getData(local_nnz);
+	data->getData(parameters);
+
+	// create the adjoint vector for x and reset the adjoint values on the tape
+	IssmDouble::GradientValue* adjX = xNew<IssmDouble::GradientValue>(n);
+	getVectorAdjoint(tape, indexX, adjX, n);
+
+	MumpsSolve(n, nnz, local_nnz, irnATrans, jcnATrans, valueATrans, adjX, parameters);
+	// adjX contains now the solution
+
+	updateVectorAdjoint(tape, indexB, adjX, n);
+
+	// bcast dp_y (the solution of the forward system)
+	ISSM_MPI_Bcast(valueX,n,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm());
+	// bcast the adjoint of the right-hand-side, i.e. this solution
+	ISSM_MPI_Bcast(adjX,n,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm());
+
+	for(int i=0; i<local_nnz; ++i) {
+		// we access the transposed matrix here because we stored the indices in a transposed way
+		// -1 is substracted because jcn and irn are stored with fortran indexing
+		updateAdjoint(tape, indexATrans[i], -adjX[jcnATrans[i]-1]*valueX[irnATrans[i]-1]);
+	}
+
+	xDelete(adjX);
+}
+/*}}}*/
+void MumpsSolve_codi_delete(void* tape_in,void* data_in) {/*{{{*/
+
+	/*recast data_in*/
+	codi::DataStore* data = (codi::DataStore*)data_in;
+
+	IssmDouble::Real* valueATrans;
+	IssmDouble::GradientData* indexATrans;
+	int* irnATrans;
+	int* jcnATrans;
+	IssmDouble::GradientData* indexB;
+	IssmDouble::Real* valueX;
+	IssmDouble::GradientData* indexX;
+	int n;
+	int nnz;
+	int local_nnz;
+	Parameters* parameters;
+
+	data->getData(valueATrans);
+	data->getData(indexATrans);
+	data->getData(irnATrans);
+	data->getData(jcnATrans);
+	data->getData(indexB);
+	data->getData(valueX);
+	data->getData(indexX);
+	data->getData(n);
+	data->getData(nnz);
+	data->getData(local_nnz);
+	data->getData(parameters);
+
+	xDelete(valueATrans);
+	xDelete(indexATrans);
+	xDelete(irnATrans);
+	xDelete(jcnATrans);
+	xDelete(indexB);
+	xDelete(valueX);
+	xDelete(indexX);
+
+	delete data;
+}
+/*}}}*/
+void MumpsSolve(int n,int nnz,int local_nnz,int* irn_loc,int* jcn_loc,IssmDouble *a_loc,IssmDouble *rhs,Parameters* parameters){/*{{{*/
+	IssmDouble::TapeType& tape = IssmDouble::getGlobalTape();
+	codi::DataStore* dataHandler = NULL;
+
+	if(tape.isActive()) {
+		dataHandler = new codi::DataStore();
+
+		// create the index and double vector for the matrix
+		IssmDouble::Real* valueATrans = xNew<IssmDouble::Real>(local_nnz);
+		IssmDouble::GradientData* indexATrans = xNew<IssmDouble::GradientData>(local_nnz);
+		int* irnATrans = xNew<int>(local_nnz);
+		int* jcnATrans = xNew<int>(local_nnz);
+
+		// read the data for the matrix A in a transposed fashion
+		for (int i=0; i<local_nnz; ++i) {
+			getPrimalAndGradData(a_loc[i], valueATrans[i], indexATrans[i]);
+			irnATrans[i]=jcn_loc[i];  // transposed store
+			jcnATrans[i]=irn_loc[i];  // transposed store
+		}
+
+		// create the index vector for a (primal values are not needed for a)
+		IssmDouble::GradientData* indexB = xNew<IssmDouble::GradientData>(n);
+		getVectorGradData(rhs, indexB, n);
+
+		dataHandler->addData(valueATrans);
+		dataHandler->addData(indexATrans);
+		dataHandler->addData(irnATrans);
+		dataHandler->addData(jcnATrans);
+		dataHandler->addData(indexB);
+	}
+
+	// unpack the primal values from the matrix and the vector
+	IssmDouble::Real* valueA = xNew<IssmDouble::Real>(local_nnz);
+	IssmDouble::Real* valueB = xNew<IssmDouble::Real>(n);
+	// read the data from A and B
+	getVectorPrimal(a_loc, valueA, local_nnz);
+	getVectorPrimal(rhs, valueB, n);
+
+	MumpsSolve(n, nnz, local_nnz, irn_loc, jcn_loc, valueA, valueB, parameters);
+	// valueB contains now the solution
+
+	// pack the values into rhs
+	setVectorPrimal(rhs, valueB, n);
+
+	if(tape.isActive()) {
+		// create the index vector X and register x as active variables
+		IssmDouble::GradientData* indexX = xNew<IssmDouble::GradientData>(n);
+		registerVector(rhs, indexX, n);
+
+		dataHandler->addData(valueB); // contains the values from x
+		dataHandler->addData(indexX);
+
+		// store other arguments
+		dataHandler->addData(n);
+		dataHandler->addData(nnz);
+		dataHandler->addData(local_nnz);
+		dataHandler->addData(parameters); // we assume here that parameters is still intact when the reverse run is called
+
+		//tape.pushExternalFunction(&MumpsSolve_codi_b, dataHandler, &MumpsSolve_codi_delete);
+		tape.pushExternalFunctionHandle(&MumpsSolve_codi_b,(void*)dataHandler, &MumpsSolve_codi_delete);
+	}
+	else{
+		// if the tape is active valueB is stored in the dataHandler and deleted in the reverse sweep
+		xDelete(valueB);
+	}
+
+	xDelete(valueA);
+}
+/*}}}*/
+#else
+#error "_CODIPACK_MAJOR_ not supported"
+#endif
+#endif
Index: issm/trunk/src/c/toolkits/objects/Matrix.h
===================================================================
--- issm/trunk/src/c/toolkits/objects/Matrix.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/objects/Matrix.h	(revision 26744)
@@ -266,5 +266,5 @@
 		}
 		/*}}}*/
-		doubletype* ToSerial(void){/*{{{*/
+		doubletype* ToMPISerial0(void){/*{{{*/
 
 			doubletype* output=NULL;
@@ -272,9 +272,9 @@
 			if(type==PetscMatType){
 				#ifdef _HAVE_PETSC_
-				output=this->pmatrix->ToSerial();
-				#endif
-			}
-			else{
-				output=this->imatrix->ToSerial();
+				output=this->pmatrix->ToMPISerial0();
+				#endif
+			}
+			else{
+				output=this->imatrix->ToMPISerial0();
 			}
 
@@ -282,4 +282,20 @@
 		}
 		/*}}}*/
+		doubletype* ToMPISerial(void){/*{{{*/
+
+			doubletype* output=NULL;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				output=this->pmatrix->ToMPISerial();
+				#endif
+			}
+			else{
+				_error_("not implemented yet!");
+			}
+
+			return output;
+		}
+		/*}}}*/
 		void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){/*{{{*/
 
@@ -307,8 +323,6 @@
 		}
 		/*}}}*/
-		/*
-		* sets all values to 0 but keeps the structure of a sparse matrix
-		*/
 		void SetZero(void) {/*{{{*/
+			// sets all values to 0 but keeps the structure of a sparse matrix
 			if(type==PetscMatType){
 				#ifdef _HAVE_PETSC_
Index: issm/trunk/src/c/toolkits/objects/Vector.h
===================================================================
--- issm/trunk/src/c/toolkits/objects/Vector.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/objects/Vector.h	(revision 26744)
@@ -406,4 +406,15 @@
 		}
 		/*}}}*/
-};
+void Sum(doubletype* pvalue){ /*{{{*/
+	_assert_(this);/*{{{*/
+
+	if(type==PetscVecType){
+		#ifdef _HAVE_PETSC_
+		this->pvector->Sum(pvalue);
+		#endif
+	}
+	else this->ivector->Sum(pvalue);
+}
+/*}}}*/
+}; /*}}}*/
 #endif //#ifndef _VECTOR_H_
Index: issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 26744)
@@ -171,9 +171,16 @@
 }
 /*}}}*/
-IssmDouble* PetscMat::ToSerial(void){/*{{{*/
+IssmDouble* PetscMat::ToMPISerial(void){/*{{{*/
 
 	 IssmDouble* output=NULL;
-
-	 MatToSerial(&output,this->matrix,IssmComm::GetComm());
+	 MatToMPISerial(&output,this->matrix,IssmComm::GetComm(),true);
+	 return output;
+
+}
+/*}}}*/
+IssmDouble* PetscMat::ToMPISerial0(void){/*{{{*/
+
+	 IssmDouble* output=NULL;
+	 MatToMPISerial(&output,this->matrix,IssmComm::GetComm(),false);
 	 return output;
 
Index: issm/trunk/src/c/toolkits/petsc/objects/PetscMat.h
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscMat.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscMat.h	(revision 26744)
@@ -49,5 +49,6 @@
 		void MatMult(PetscVec* X,PetscVec* AX);
 		PetscMat* Duplicate(void);
-		IssmDouble* ToSerial(void);
+		IssmDouble* ToMPISerial(void);
+		IssmDouble* ToMPISerial0(void);
 		void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode);
 		void Convert(MatrixType type);
Index: issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 26744)
@@ -37,4 +37,5 @@
 	VecSetSizes(this->vector,m,M);
 	VecSetFromOptions(this->vector);
+	VecSetOption(this->vector,VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE);
 	VecSet(this->vector,0.0);
 
@@ -249,4 +250,11 @@
 }
 /*}}}*/
+void PetscVec::Sum(IssmDouble* pvalue){/*{{{*/
+
+	_assert_(this->vector);
+	VecSum(this->vector,pvalue);
+
+}
+/*}}}*/
 IssmDouble PetscVec::Dot(PetscVec* input){/*{{{*/
 
Index: issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h	(revision 26744)
@@ -58,4 +58,5 @@
 		void        Scale(IssmDouble scale_factor);
 		void        Pow(IssmDouble scale_factor);
+		void        Sum(IssmDouble* pvalue);
 		void        PointwiseDivide(PetscVec* x,PetscVec* y);
 		void        PointwiseMult(PetscVec* x,PetscVec* y);
Index: issm/trunk/src/c/toolkits/petsc/patches/MatToMPISerial.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/MatToMPISerial.cpp	(revision 26744)
+++ issm/trunk/src/c/toolkits/petsc/patches/MatToMPISerial.cpp	(revision 26744)
@@ -0,0 +1,96 @@
+/*!\file MatToMPISerial.cpp
+ * \brief gather a Petsc Mat matrix onto all cpus
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../petscincludes.h"
+#include "../../../shared/shared.h"
+
+void MatToMPISerial(double** poutmatrix,Mat matrix,ISSM_MPI_Comm comm,bool broadcast){
+
+	int i;
+	int my_rank;
+	int num_procs;
+
+	/*Petsc variables*/
+	PetscInt lower_row,upper_row; 
+	int range;
+	int M,N; //size of matrix
+	ISSM_MPI_Status status;
+	int* idxm=NULL;
+	int* idxn=NULL; 
+	double* local_matrix=NULL; /*matrix local to each node used for temporary holding matrix values*/
+	int buffer[3];
+
+	/*recover my_rank and num_procs:*/
+	ISSM_MPI_Comm_size(comm,&num_procs);
+	ISSM_MPI_Comm_rank(comm,&my_rank);
+
+	/*Output*/
+	double* outmatrix=NULL;
+
+	/*get matrix size: */
+	MatGetSize(matrix,&M,&N);
+
+	/*partition: */
+	MatGetOwnershipRange(matrix,&lower_row,&upper_row);    
+	upper_row--; 
+	range=upper_row-lower_row+1;
+
+	/*Local and global allocation*/
+	if(broadcast || my_rank==0){ 
+		outmatrix=xNew<double>(M*N);
+	}
+
+	if (range){
+		local_matrix=xNew<double>(N*range);
+		idxm=xNew<int>(range);  
+		idxn=xNew<int>(N);  
+
+		for (i=0;i<N;i++){
+			*(idxn+i)=i;
+		}
+		for (i=0;i<range;i++){
+			*(idxm+i)=lower_row+i;
+		}
+
+		MatGetValues(matrix,range,idxm,N,idxn,local_matrix);     
+	}
+
+	/*Now each node holds its local_matrix containing range rows. 
+	 * We send these rows to the matrix on node 0*/
+
+	for (i=1;i<num_procs;i++){
+		if (my_rank==i){ 
+			buffer[0]=my_rank;
+			buffer[1]=lower_row;
+			buffer[2]=range;
+			ISSM_MPI_Send(buffer,3,ISSM_MPI_INT,0,1,comm);   
+			if (range)ISSM_MPI_Send(local_matrix,N*range,ISSM_MPI_PDOUBLE,0,1,comm); 
+		}
+		if (my_rank==0){
+			ISSM_MPI_Recv(buffer,3,ISSM_MPI_INT,i,1,comm,&status); 
+			if (buffer[2])ISSM_MPI_Recv(outmatrix+(buffer[1]*N),N*buffer[2],ISSM_MPI_PDOUBLE,i,1,comm,&status);
+		}
+	} 
+	if (my_rank==0){ 
+		//Still have the local_matrix on node 0 to take care of.
+		if (range) memcpy(outmatrix,local_matrix,N*range*sizeof(double));
+	} 
+
+	if(broadcast){
+		/*Broadcast:*/
+		ISSM_MPI_Bcast(outmatrix,M*N,ISSM_MPI_PDOUBLE,0,comm);
+	}
+
+	/*Assign output pointer: */
+	xDelete<int>(idxm);
+	xDelete<int>(idxn);
+	xDelete<double>(local_matrix);
+	*poutmatrix=outmatrix;
+}
Index: issm/trunk/src/c/toolkits/petsc/patches/MatToSerial.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/MatToSerial.cpp	(revision 25994)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*!\file MatToSerial.cpp
- * \brief gather a Petsc Mat matrix onto cpu 0
- */
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "../petscincludes.h"
-#include "../../../shared/shared.h"
-
-void MatToSerial(double** poutmatrix,Mat matrix,ISSM_MPI_Comm comm){
-
-	int i;
-	int my_rank;
-	int num_procs;
-
-	/*Petsc variables*/
-	PetscInt lower_row,upper_row; 
-	int range;
-	int M,N; //size of matrix
-	ISSM_MPI_Status status;
-	int* idxm=NULL;
-	int* idxn=NULL; 
-	double* local_matrix=NULL; /*matrix local to each node used for temporary holding matrix values*/
-	int buffer[3];
-
-	/*recover my_rank and num_procs:*/
-	ISSM_MPI_Comm_size(comm,&num_procs);
-	ISSM_MPI_Comm_rank(comm,&my_rank);
-
-	/*Output*/
-	double* outmatrix=NULL;
-
-	/*get matrix size: */
-	MatGetSize(matrix,&M,&N);
-
-	/*partition: */
-	MatGetOwnershipRange(matrix,&lower_row,&upper_row);    
-	upper_row--; 
-	range=upper_row-lower_row+1;
-
-	/*Local and global allocation*/
-	if (my_rank==0)outmatrix=xNew<double>(M*N);
-
-	if (range){
-		local_matrix=xNew<double>(N*range);
-		idxm=xNew<int>(range);  
-		idxn=xNew<int>(N);  
-
-		for (i=0;i<N;i++){
-			*(idxn+i)=i;
-		}
-		for (i=0;i<range;i++){
-			*(idxm+i)=lower_row+i;
-		}
-
-		MatGetValues(matrix,range,idxm,N,idxn,local_matrix);     
-	}
-
-	/*Now each node holds its local_matrix containing range rows. 
-	 * We send these rows to the matrix on node 0*/
-
-	for (i=1;i<num_procs;i++){
-		if (my_rank==i){ 
-			buffer[0]=my_rank;
-			buffer[1]=lower_row;
-			buffer[2]=range;
-			ISSM_MPI_Send(buffer,3,ISSM_MPI_INT,0,1,comm);   
-			if (range)ISSM_MPI_Send(local_matrix,N*range,ISSM_MPI_PDOUBLE,0,1,comm); 
-		}
-		if (my_rank==0){
-			ISSM_MPI_Recv(buffer,3,ISSM_MPI_INT,i,1,comm,&status); 
-			if (buffer[2])ISSM_MPI_Recv(outmatrix+(buffer[1]*N),N*buffer[2],ISSM_MPI_PDOUBLE,i,1,comm,&status);
-		}
-	} 
-	if (my_rank==0){ 
-		//Still have the local_matrix on node 0 to take care of.
-		memcpy(outmatrix,local_matrix,N*range*sizeof(double));
-	} 
-
-	/*Assign output pointer: */
-	*poutmatrix=outmatrix;
-	xDelete<int>(idxm);
-	xDelete<int>(idxn);
-	xDelete<double>(local_matrix);
-}
Index: issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp	(revision 26744)
@@ -111,4 +111,5 @@
 	MatSetSizes(outmatrix,m,n,M,N);
 	MatSetFromOptions(outmatrix);
+	MatSetOption(outmatrix,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE);
 
 	/*preallocation  according to type: */
Index: issm/trunk/src/c/toolkits/petsc/patches/NewVec.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/NewVec.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/patches/NewVec.cpp	(revision 26744)
@@ -35,4 +35,5 @@
 	VecSetSizes(vector,local_size,PETSC_DECIDE); 
 	VecSetFromOptions(vector); 
+	VecSetOption(vector,VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE);
 
 	return vector;
Index: issm/trunk/src/c/toolkits/petsc/patches/VecToMPISerial.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/VecToMPISerial.cpp	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/patches/VecToMPISerial.cpp	(revision 26744)
@@ -82,5 +82,5 @@
 	if (my_rank==0){ 
 		//Still have the local_vector on node 0 to take care of.
-		if (range)memcpy(gathered_vector+lower_row,local_vector,range*sizeof(double));
+		if (range) memcpy(gathered_vector+lower_row,local_vector,range*sizeof(double));
 	}
 
Index: issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h
===================================================================
--- issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h	(revision 25994)
+++ issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h	(revision 26744)
@@ -27,9 +27,8 @@
 void VecFree(Vec* pvec);
 void KSPFree(KSP* pksp);
-int MatPartition(Mat* poutmatrix,Mat matrixA,double* row_partition_vector,int row_partition_vector_size ,
-		double* col_partition_vector,int col_partition_vector_size);
+int MatPartition(Mat* poutmatrix,Mat matrixA,double* row_partition_vector,int row_partition_vector_size, double* col_partition_vector,int col_partition_vector_size);
 void PetscOptionsDetermineSolverType(int* psolver_type);
 void MatMultPatch(Mat A,Vec X, Vec AX,ISSM_MPI_Comm comm);
-void MatToSerial(double** poutmatrix,Mat matrix,ISSM_MPI_Comm comm);
+void MatToMPISerial(double** poutmatrix,Mat matrix,ISSM_MPI_Comm comm,bool broadcast=true);
 Vec  SerialToVec(double* vector,int vector_size);
 InsertMode ISSMToPetscInsertMode(InsMode mode);
Index: issm/trunk/src/jl/core/analyses/analysis.jl
===================================================================
--- issm/trunk/src/jl/core/analyses/analysis.jl	(revision 26744)
+++ issm/trunk/src/jl/core/analyses/analysis.jl	(revision 26744)
@@ -0,0 +1,2 @@
+#Analysis class definitions
+abstract type Analysis end
Index: issm/trunk/src/jl/core/analyses/masstransportanalysis.jl
===================================================================
--- issm/trunk/src/jl/core/analyses/masstransportanalysis.jl	(revision 26744)
+++ issm/trunk/src/jl/core/analyses/masstransportanalysis.jl	(revision 26744)
@@ -0,0 +1,275 @@
+#MasstransportAnalysis class definition
+struct MasstransportAnalysis <: Analysis#{{{
+end #}}}
+
+#Model Processing
+function CreateConstraints(analysis::MasstransportAnalysis,constraints::Vector{Constraint},md::model) #{{{
+
+	#load constraints from model
+	spcthickness = md.masstransport.spcthickness
+
+	count = 1
+	for i in 1:md.mesh.numberofvertices
+		if ~isnan(spcthickness[i])
+			push!(constraints,Constraint(count,i,1,spcthickness[i]))
+			count+=1
+		end
+	end
+
+end#}}}
+function CreateNodes(analysis::MasstransportAnalysis,nodes::Vector{Node},md::model) #{{{
+
+	numdof = 1
+	for i in 1:md.mesh.numberofvertices
+		push!(nodes,Node(i,i,true,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof)))
+	end
+end#}}}
+function UpdateElements(analysis::MasstransportAnalysis,elements::Vector{Tria}, inputs::Inputs, md::model) #{{{
+
+	#Provide node indices to element
+	for i in 1:md.mesh.numberofelements
+		Update(elements[i],inputs,i,md,P1Enum)
+	end
+
+	#Add necessary inputs to perform this analysis
+	FetchDataToInput(md,inputs,elements,md.geometry.thickness,ThicknessEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.surface,SurfaceEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.base,BaseEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.bed,BedEnum)
+	FetchDataToInput(md,inputs,elements,md.basalforcings.groundedice_melting_rate./md.constants.yts,BasalforcingsGroundediceMeltingRateEnum)
+	FetchDataToInput(md,inputs,elements,md.basalforcings.floatingice_melting_rate./md.constants.yts,BasalforcingsFloatingiceMeltingRateEnum)
+	FetchDataToInput(md,inputs,elements,md.smb.mass_balance./md.constants.yts,SmbMassBalanceEnum)
+	FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum)
+	FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum)
+	FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum)
+	FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum)
+
+end#}}}
+function UpdateParameters(analysis::MasstransportAnalysis,parameters::Parameters,md::model) #{{{
+
+	AddParam(parameters, md.masstransport.min_thickness, MasstransportMinThicknessEnum)
+	AddParam(parameters, md.masstransport.stabilization, MasstransportStabilizationEnum)
+
+end#}}}
+
+#Finite Element Analysis
+function Core(analysis::MasstransportAnalysis,femmodel::FemModel)# {{{
+
+	println("   computing mass transport")
+	SetCurrentConfiguration!(femmodel, analysis)
+
+	InputDuplicatex(femmodel, ThicknessEnum, ThicknessOldEnum)
+	InputDuplicatex(femmodel, BaseEnum, BaseOldEnum)
+	InputDuplicatex(femmodel, SurfaceEnum, SurfaceOldEnum)
+
+	solutionsequence_linear(femmodel,analysis)
+
+	#Save output
+	RequestedOutputsx(femmodel, [ThicknessEnum, SurfaceEnum, BaseEnum])
+
+end #}}}
+function CreateKMatrix(analysis::MasstransportAnalysis,element::Tria)# {{{
+
+	#Return if there is no ice in this element
+	if(!IsIceInElement(element)) return end
+
+	#Internmediaries
+	numnodes = 3
+	
+	#Initialize Element matrix and basis function derivatives
+	Ke = ElementMatrix(element.nodes)
+	dbasis = Matrix{Float64}(undef,numnodes,2)
+	basis  = Vector{Float64}(undef,numnodes)
+
+	#Retrieve all inputs and parameters
+	xyz_list = GetVerticesCoordinates(element.vertices)
+	vx_input      = GetInput(element, VxEnum)
+	vy_input      = GetInput(element, VyEnum)
+	dt            = FindParam(element, TimesteppingTimeStepEnum)
+	stabilization = FindParam(element, MasstransportStabilizationEnum)
+
+	h = CharacteristicLength(element)
+
+	#Start integrating
+	gauss = GaussTria(2)
+	for ig in 1:gauss.numgauss
+
+		Jdet = JacobianDeterminant(xyz_list, gauss)
+		NodalFunctionsDerivatives(element, dbasis, xyz_list, gauss)
+		NodalFunctions(element, basis, gauss, ig, P1Enum)
+
+      #Transient term
+		for i in 1:numnodes
+			for j in 1:numnodes
+				Ke.values[i ,j] += gauss.weights[ig]*Jdet*basis[i]*basis[j]
+			end
+		end
+
+      #Advection term
+		vx  = GetInputValue(vx_input, gauss, ig)
+      vy  = GetInputValue(vy_input, gauss, ig)
+		dvx = GetInputDerivativeValue(vx_input, xyz_list, gauss, ig)
+      dvy = GetInputDerivativeValue(vy_input, xyz_list, gauss, ig)
+      for i in 1:numnodes
+         for j in 1:numnodes
+            #\phi_i \phi_j \nabla\cdot v
+            Ke.values[i ,j] += dt*gauss.weights[ig]*Jdet*basis[i]*basis[j]*(dvx[1] + dvy[2])
+            #\phi_i v\cdot\nabla\phi_j
+            Ke.values[i ,j] += dt*gauss.weights[ig]*Jdet*basis[i]*(vx*dbasis[j,1] + vy*dbasis[j,2])
+         end
+      end
+
+		#Stabilization
+		if(stabilization==0)
+			#do nothing
+		elseif (stabilization==1)
+			vx = GetInputAverageValue(vx_input)
+			vy = GetInputAverageValue(vy_input)
+			D  = dt*gauss.weights[ig]*Jdet*[h/2*abs(vx) 0; 0 h/2*abs(vy)]
+			for i in 1:numnodes; for j in 1:numnodes
+					Ke.values[i ,j] += (dbasis[i,1]*(D[1,1]*dbasis[j,1] + D[1,2]*dbasis[j,2]) +
+											  dbasis[i,2]*(D[2,1]*dbasis[j,1] + D[2,2]*dbasis[j,2]))
+			end end
+		else
+			error("Stabilization ",stabilization, " not supported yet")
+		end
+	end
+
+	return Ke
+end #}}}
+function CreatePVector(analysis::MasstransportAnalysis,element::Tria)# {{{
+
+	#Return if there is no ice in this element
+	if(!IsIceInElement(element)) return end
+
+	#Internmediaries
+	numnodes = 3
+
+	#Initialize Element vectro and basis functions
+	pe = ElementVector(element.nodes)
+	basis = Vector{Float64}(undef,numnodes)
+
+	#Retrieve all inputs and parameters
+	xyz_list = GetVerticesCoordinates(element.vertices)
+	H_input         = GetInput(element, ThicknessEnum)
+	gmb_input       = GetInput(element, BasalforcingsGroundediceMeltingRateEnum)
+	fmb_input       = GetInput(element, BasalforcingsFloatingiceMeltingRateEnum)
+   smb_input       = GetInput(element, SmbMassBalanceEnum)
+	olevelset_input = GetInput(element, MaskOceanLevelsetEnum)
+	dt            = FindParam(element, TimesteppingTimeStepEnum)
+	stabilization = FindParam(element, MasstransportStabilizationEnum)
+
+   #How much is actually grounded?
+	phi=GetGroundedPortion(element, xyz_list)
+
+	#Start integrating
+	gauss = GaussTria(3)
+	for ig in 1:gauss.numgauss
+
+		Jdet = JacobianDeterminant(xyz_list, gauss)
+		NodalFunctions(element, basis, gauss, ig, P1Enum)
+
+		smb = GetInputValue(smb_input, gauss, ig)
+      H   = GetInputValue(H_input, gauss, ig)
+
+      #Only apply melt on fully floating cells
+      if(phi<0.00000001)
+         mb = GetInputValue(fmb_input, gauss, ig)
+      else
+         mb = GetInputValue(gmb_input, gauss, ig)
+      end
+
+		for i in 1:numnodes
+         pe.values[i] += gauss.weights[ig]*Jdet*(H + dt*(smb - mb))*basis[i]
+		end
+	end
+
+	return pe
+end #}}}
+function GetSolutionFromInputs(analysis::MasstransportAnalysis,ug::IssmVector,element::Tria) #{{{
+
+	#Get dofs for this finite element
+	doflist = GetDofList(element,GsetEnum)
+	@assert length(doflist)==3
+
+	#Fetch inputs
+	thickness_input = GetInput(element, ThicknessEnum)
+
+	#Loop over each node and enter solution in ug
+	count = 0
+	gauss=GaussTria(P1Enum)
+	for i in 1:gauss.numgauss
+		thickness = GetInputValue(thickness_input, gauss, i)
+
+		count += 1
+		ug.vector[doflist[count]] = thickness
+	end
+
+	#Make sure we reached all the values
+	@assert count==length(doflist)
+
+end#}}}
+function InputUpdateFromSolution(analysis::MasstransportAnalysis,ug::Vector{Float64},element::Tria) #{{{
+
+	#Get dofs for this finite element
+	doflist = GetDofList(element,GsetEnum)
+
+	#Get solution vector for this element
+	numdof   = 3
+	values = Vector{Float64}(undef,numdof)
+	for i in 1:numdof values[i]=ug[doflist[i]] end
+
+	#Get some parameters
+	rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
+	rho_ice   = FindParam(element, MaterialsRhoIceEnum)
+	H_min     = FindParam(element, MasstransportMinThicknessEnum)
+
+	#Now split solution vector into x and y components
+	numnodes = 3
+	thickness  = Vector{Float64}(undef,numnodes)
+	for i in 1:numnodes 
+		thickness[i]=values[i] 
+		@assert isfinite(thickness[i])
+
+		#Enforce minimum thickness
+		if(thickness[i]<H_min)
+			thickness[i] = H_min
+		end
+	end
+	AddInput(element, ThicknessEnum,  thickness,  P1Enum)
+
+	#Update bed and surface accordingly
+	newthickness = Vector{Float64}(undef,3)
+	oldthickness = Vector{Float64}(undef,3)
+	oldbase      = Vector{Float64}(undef,3)
+	oldsurface   = Vector{Float64}(undef,3)
+	phi          = Vector{Float64}(undef,3)
+	bed          = Vector{Float64}(undef,3)
+	GetInputListOnVertices!(element, newthickness, ThicknessEnum)
+   GetInputListOnVertices!(element, oldthickness, ThicknessOldEnum)
+   GetInputListOnVertices!(element, oldbase, BaseOldEnum)
+   GetInputListOnVertices!(element, oldsurface, SurfaceOldEnum)
+   GetInputListOnVertices!(element, phi, MaskOceanLevelsetEnum)
+	GetInputListOnVertices!(element, bed, BedEnum)
+   sealevel = zeros(3)
+	newsurface = Vector{Float64}(undef,3)
+	newbase    = Vector{Float64}(undef,3)
+
+   for i in 1:3
+      if(phi[i]>0.)
+         #this is grounded ice: just add thickness to base.
+         newsurface[i] = bed[i]+newthickness[i] #surface = bed + newthickness
+         newbase[i]    = bed[i]                 #new base at new bed
+      else
+         #this is an ice shelf: hydrostatic equilibrium
+         newsurface[i] = newthickness[i]*(1-rho_ice/rho_water) + sealevel[i]
+         newbase[i]    = newthickness[i]*(-rho_ice/rho_water)  + sealevel[i]
+      end
+   end
+
+	AddInput(element, SurfaceEnum, newsurface, P1Enum)
+	AddInput(element, BaseEnum,    newbase,    P1Enum)
+end#}}}
+function UpdateConstraints(analysis::MasstransportAnalysis, femmodel::FemModel) #{{{
+	SetActiveNodesLSMx(femmodel)
+end#}}}
Index: issm/trunk/src/jl/core/analyses/stressbalanceanalysis.jl
===================================================================
--- issm/trunk/src/jl/core/analyses/stressbalanceanalysis.jl	(revision 26744)
+++ issm/trunk/src/jl/core/analyses/stressbalanceanalysis.jl	(revision 26744)
@@ -0,0 +1,279 @@
+#StressbalanceAnalysis class definition
+struct StressbalanceAnalysis <: Analysis#{{{
+end #}}}
+
+#Model Processing
+function CreateConstraints(analysis::StressbalanceAnalysis,constraints::Vector{Constraint},md::model) #{{{
+
+	#load constraints from model
+	spcvx = md.stressbalance.spcvx
+	spcvy = md.stressbalance.spcvy
+
+	count = 1
+	for i in 1:md.mesh.numberofvertices
+		if ~isnan(spcvx[i])
+			push!(constraints,Constraint(count,i,1,spcvx[i]/md.constants.yts))
+			count+=1
+		end
+		if ~isnan(spcvy[i])
+			push!(constraints,Constraint(count,i,2,spcvy[i]/md.constants.yts))
+			count+=1
+		end
+	end
+
+end#}}}
+function CreateNodes(analysis::StressbalanceAnalysis,nodes::Vector{Node},md::model) #{{{
+
+	numdof = 2
+	for i in 1:md.mesh.numberofvertices
+		push!(nodes,Node(i,i,true,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof)))
+	end
+end#}}}
+function UpdateElements(analysis::StressbalanceAnalysis,elements::Vector{Tria}, inputs::Inputs, md::model) #{{{
+
+	#Provide node indices to element
+	for i in 1:md.mesh.numberofelements
+		Update(elements[i],inputs,i,md,P1Enum)
+	end
+
+	#Add necessary inputs to perform this analysis
+	FetchDataToInput(md,inputs,elements,md.materials.rheology_B,MaterialsRheologyBEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.thickness,ThicknessEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.surface,SurfaceEnum)
+	FetchDataToInput(md,inputs,elements,md.geometry.base,BaseEnum)
+	FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum)
+	FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum)
+	FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum)
+	FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum)
+
+	#Deal with friction
+	if typeof(md.friction)==BuddFriction
+		FetchDataToInput(md,inputs,elements,md.friction.coefficient,FrictionCoefficientEnum)
+	else
+		error("Friction ", typeof(md.friction), " not supported yet")
+	end
+
+end#}}}
+function UpdateParameters(analysis::StressbalanceAnalysis,parameters::Parameters,md::model) #{{{
+	AddParam(parameters,md.stressbalance.restol,StressbalanceRestolEnum)
+	AddParam(parameters,md.stressbalance.reltol,StressbalanceReltolEnum)
+	AddParam(parameters,md.stressbalance.abstol,StressbalanceAbstolEnum)
+	AddParam(parameters,md.stressbalance.maxiter,StressbalanceMaxiterEnum)
+
+	#Deal with friction
+	if typeof(md.friction)==BuddFriction
+		AddParam(parameters, 1, FrictionLawEnum)
+	else
+		error("Friction ", typeof(md.friction), " not supported yet")
+	end
+end#}}}
+
+#Finite Element Analysis
+function Core(analysis::StressbalanceAnalysis,femmodel::FemModel)# {{{
+
+	#Set current analysis to Stressnalance
+	SetCurrentConfiguration!(femmodel, analysis)
+
+	#Fetch parameters relevant to solution sequence
+	maxiter = FindParam(femmodel.parameters,StressbalanceMaxiterEnum)
+	restol  = FindParam(femmodel.parameters,StressbalanceRestolEnum)
+	reltol  = FindParam(femmodel.parameters,StressbalanceReltolEnum)
+	abstol  = FindParam(femmodel.parameters,StressbalanceAbstolEnum)
+
+	#Call solution sequence to compute new speeds
+	println("   computing stress balance");
+	solutionsequence_nonlinear(femmodel,analysis,maxiter,restol,reltol,abstol)
+
+	#Save output
+	RequestedOutputsx(femmodel, [VxEnum,VyEnum,VelEnum])
+
+end #}}}
+function CreateKMatrix(analysis::StressbalanceAnalysis,element::Tria)# {{{
+
+	if(!IsIceInElement(element)) return end
+
+	#Internmediaries
+	numnodes = 3
+	
+	#Initialize Element matrix and basis function derivatives
+	Ke = ElementMatrix(element.nodes)
+	dbasis = Matrix{Float64}(undef,numnodes,2)
+
+	#Retrieve all inputs and parameters
+	xyz_list = GetVerticesCoordinates(element.vertices)
+	H_input  = GetInput(element, ThicknessEnum)
+
+	#Prepare material object
+	material = Matice(element)
+	
+	#Start integrating
+	gauss = GaussTria(2)
+	for ig in 1:gauss.numgauss
+
+		Jdet = JacobianDeterminant(xyz_list, gauss)
+		NodalFunctionsDerivatives(element,dbasis,xyz_list,gauss)
+
+		H  = GetInputValue(H_input, gauss, ig)
+		mu = ViscositySSA(material, xyz_list, gauss, ig)
+
+		for i in 1:numnodes
+			for j in 1:numnodes
+				Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*mu*H*(4*dbasis[j,1]*dbasis[i,1] + dbasis[j,2]*dbasis[i,2])
+				Ke.values[2*i-1,2*j  ] += gauss.weights[ig]*Jdet*mu*H*(2*dbasis[j,2]*dbasis[i,1] + dbasis[j,1]*dbasis[i,2])
+				Ke.values[2*i  ,2*j-1] += gauss.weights[ig]*Jdet*mu*H*(2*dbasis[j,1]*dbasis[i,2] + dbasis[j,2]*dbasis[i,1])
+				Ke.values[2*i  ,2*j  ] += gauss.weights[ig]*Jdet*mu*H*(4*dbasis[j,2]*dbasis[i,2] + dbasis[j,1]*dbasis[i,1])
+			end
+		end
+	end
+
+	#Add basal friction
+	phi=GetGroundedPortion(element, xyz_list)
+
+	if(phi>0)
+		basis = Vector{Float64}(undef,numnodes)
+		friction = CoreFriction(element)
+
+		#Start integrating
+		gauss = GaussTria(2)
+		for ig in 1:gauss.numgauss
+
+			Jdet = JacobianDeterminant(xyz_list, gauss)
+			NodalFunctions(element, basis, gauss, ig, P1Enum)
+
+			alpha2 = Alpha2(friction, gauss, ig)
+
+			for i in 1:numnodes
+				for j in 1:numnodes
+					Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j]
+					Ke.values[2*i  ,2*j  ] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j]
+				end
+			end
+		end
+	end
+
+	return Ke
+end #}}}
+function CreatePVector(analysis::StressbalanceAnalysis,element::Tria)# {{{
+
+	if(!IsIceInElement(element)) return end
+
+	#Internmediaries
+	numnodes = 3
+
+	#Initialize Element vectro and basis functions
+	pe = ElementVector(element.nodes)
+	basis = Vector{Float64}(undef,numnodes)
+
+	#Retrieve all inputs and parameters
+	xyz_list = GetVerticesCoordinates(element.vertices)
+	H_input  = GetInput(element, ThicknessEnum)
+	s_input  = GetInput(element, SurfaceEnum)
+	rho_ice  = FindParam(element, MaterialsRhoIceEnum)
+	g        = FindParam(element, ConstantsGEnum)
+
+	#Start integrating
+	gauss = GaussTria(2)
+	for ig in 1:gauss.numgauss
+
+		Jdet = JacobianDeterminant(xyz_list, gauss)
+		NodalFunctions(element, basis, gauss, ig, P1Enum)
+
+		H  = GetInputValue(H_input, gauss, ig)
+		ds = GetInputDerivativeValue(s_input, xyz_list, gauss, ig)
+
+		for i in 1:numnodes
+			pe.values[2*i-1] += -gauss.weights[ig]*Jdet*rho_ice*g*H*ds[1]*basis[i]
+			pe.values[2*i  ] += -gauss.weights[ig]*Jdet*rho_ice*g*H*ds[2]*basis[i]
+		end
+	end
+
+	if(IsIcefront(element))
+
+		#Get additional parameters and inputs
+		b_input   = GetInput(element, BaseEnum)
+		rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
+
+		#Get normal and ice front coordinates
+		xyz_list_front = Matrix{Float64}(undef,2,3)
+		GetIcefrontCoordinates!(element, xyz_list_front, xyz_list, MaskIceLevelsetEnum)
+		nx, ny = NormalSection(element, xyz_list_front)
+
+		gauss = GaussTria(element, xyz_list, xyz_list_front, 3)
+		for ig in 1:gauss.numgauss
+
+			Jdet = JacobianDeterminantSurface(xyz_list_front, gauss)
+			NodalFunctions(element, basis, gauss, ig, P1Enum)
+
+			H  = GetInputValue(H_input, gauss, ig)
+			b  = GetInputValue(b_input, gauss, ig)
+			sl = 0
+
+			term = 0.5*g*rho_ice*H^2 + 0.5*g*rho_water*(min(0, H+b-sl)^2 - min(0, b-sl)^2)
+
+			for i in 1:numnodes
+				pe.values[2*i-1] += gauss.weights[ig]*Jdet*term*nx*basis[i]
+				pe.values[2*i  ] += gauss.weights[ig]*Jdet*term*ny*basis[i]
+			end
+		end
+	end
+
+	return pe
+end #}}}
+function GetSolutionFromInputs(analysis::StressbalanceAnalysis,ug::IssmVector,element::Tria) #{{{
+
+	#Get dofs for this finite element
+	doflist = GetDofList(element,GsetEnum)
+	@assert length(doflist)==6
+
+	#Fetch inputs
+	vx_input = GetInput(element, VxEnum)
+	vy_input = GetInput(element, VyEnum)
+
+	#Loop over each node and enter solution in ug
+	count = 0
+	gauss=GaussTria(P1Enum)
+	for i in 1:gauss.numgauss
+		vx = GetInputValue(vx_input, gauss, i)
+		vy = GetInputValue(vy_input, gauss, i)
+
+		count += 1
+		ug.vector[doflist[count]] = vx
+		count += 1
+		ug.vector[doflist[count]] = vy
+	end
+
+	#Make sure we reached all the values
+	@assert count==length(doflist)
+
+end#}}}
+function InputUpdateFromSolution(analysis::StressbalanceAnalysis,ug::Vector{Float64},element::Tria) #{{{
+
+	#Get dofs for this finite element
+	doflist = GetDofList(element,GsetEnum)
+
+	#Get solution vector for this element
+	numdof   = 3*2
+	values = Vector{Float64}(undef,numdof)
+	for i in 1:numdof values[i]=ug[doflist[i]] end
+
+	#Now split solution vector into x and y components
+	numnodes = 3
+	vx  = Vector{Float64}(undef,numnodes)
+	vy  = Vector{Float64}(undef,numnodes)
+	vel = Vector{Float64}(undef,numnodes)
+	for i in 1:numnodes 
+		vx[i]=values[2*i-1] 
+		vy[i]=values[2*i] 
+		@assert isfinite(vx[i])
+		@assert isfinite(vy[i])
+
+		vel[i] =sqrt(vx[i]^2 + vy[i]^2)
+	end
+
+	AddInput(element, VxEnum,  vx,  P1Enum)
+	AddInput(element, VyEnum,  vy,  P1Enum)
+	AddInput(element, VelEnum, vel, P1Enum)
+end#}}}
+function UpdateConstraints(analysis::StressbalanceAnalysis, femmodel::FemModel) #{{{
+	SetActiveNodesLSMx(femmodel)
+end#}}}
Index: issm/trunk/src/jl/core/analyses/transientanalysis.jl
===================================================================
--- issm/trunk/src/jl/core/analyses/transientanalysis.jl	(revision 26744)
+++ issm/trunk/src/jl/core/analyses/transientanalysis.jl	(revision 26744)
@@ -0,0 +1,40 @@
+#TransientAnalysis class definition
+struct TransientAnalysis <: Analysis#{{{
+end #}}}
+
+function UpdateParameters(analysis::TransientAnalysis,parameters::Parameters,md::model) #{{{
+
+	AddParam(parameters, md.constants.yts, ConstantsYtsEnum)
+	AddParam(parameters, md.timestepping.start_time*md.constants.yts, TimeEnum)
+	AddParam(parameters, md.timestepping.final_time*md.constants.yts, TimesteppingFinalTimeEnum)
+	AddParam(parameters, md.timestepping.time_step*md.constants.yts,  TimesteppingTimeStepEnum)
+	AddParam(parameters, md.transient.isstressbalance, TransientIsstressbalanceEnum)
+	AddParam(parameters, md.transient.ismasstransport, TransientIsmasstransportEnum)
+
+end#}}}
+function Core(analysis::TransientAnalysis,femmodel::FemModel)# {{{
+
+	step      = FindParam(femmodel.parameters, StepEnum)
+	time      = FindParam(femmodel.parameters, TimeEnum)
+	finaltime = FindParam(femmodel.parameters, TimesteppingFinalTimeEnum)
+	yts       = FindParam(femmodel.parameters, ConstantsYtsEnum)
+	dt        = FindParam(femmodel.parameters, TimesteppingTimeStepEnum)
+
+	isstressbalance = FindParam(femmodel.parameters, TransientIsstressbalanceEnum)
+   ismasstransport = FindParam(femmodel.parameters, TransientIsmasstransportEnum)
+
+   while(time < finaltime - (yts*eps(Float64))) #make sure we run up to finaltime.
+
+		time+=dt
+		AddParam(femmodel.parameters, time, TimeEnum)
+		AddParam(femmodel.parameters, step, StepEnum)
+		println("iteration ", step, "/", Int(ceil((finaltime-time)/dt))+step," time [yr]: ", time/yts, " (time step: ",  dt/yts, " [yr])")
+
+      if(isstressbalance) Core(StressbalanceAnalysis(), femmodel) end
+      if(ismasstransport) Core(MasstransportAnalysis(), femmodel) end
+		MigrateGroundinglinex(femmodel)
+
+		step+=1
+   end
+
+end #}}}
Index: issm/trunk/src/jl/core/constraints.jl
===================================================================
--- issm/trunk/src/jl/core/constraints.jl	(revision 26744)
+++ issm/trunk/src/jl/core/constraints.jl	(revision 26744)
@@ -0,0 +1,18 @@
+#Constraint class definition
+struct Constraint #{{{
+	id::Int64
+	nodeid::Int64
+	dof::Int8
+	value::Float64
+end# }}}
+
+#Constraint functions
+function ConstrainNode(constraint::Constraint,nodes::Vector{Node},parameters::Parameters) #{{{
+
+	#Chase through nodes and find the node to which this SpcStatic apply
+	node = nodes[constraint.nodeid]
+
+	#Apply Constraint
+	ApplyConstraint(node, constraint.dof, constraint.value)
+
+end# }}}
Index: issm/trunk/src/jl/core/elementmatrix.jl
===================================================================
--- issm/trunk/src/jl/core/elementmatrix.jl	(revision 26744)
+++ issm/trunk/src/jl/core/elementmatrix.jl	(revision 26744)
@@ -0,0 +1,117 @@
+mutable struct ElementMatrix#{{{
+	nrows::Int64
+	gglobaldoflist::Vector{Int64}
+	fglobaldoflist::Vector{Int64}
+	sglobaldoflist::Vector{Int64}
+	values::Matrix{Float64}
+end #}}}
+function ElementMatrix(nodes::Vector{Node})#{{{
+
+	#Get matrix size
+	nrows = NumberOfDofs(nodes,GsetEnum)
+
+	#Initialize element matrix with zeros
+	values = zeros(nrows,nrows)
+
+	#Get dof lists
+	gglobaldoflist=GetGlobalDofList(nodes,nrows,GsetEnum)
+	fglobaldoflist=GetGlobalDofList(nodes,nrows,FsetEnum)
+	sglobaldoflist=GetGlobalDofList(nodes,nrows,SsetEnum)
+
+	return ElementMatrix(nrows,gglobaldoflist,fglobaldoflist,sglobaldoflist,values)
+end#}}}
+function Base.show(io::IO, this::ElementMatrix)# {{{
+
+	println(io,"ElementMatrix:")
+	println(io,"   nrows: ",this.nrows)
+	println(io,"   gglobaldoflist: ",this.gglobaldoflist)
+	println(io,"   fglobaldoflist: ",this.fglobaldoflist)
+	println(io,"   sglobaldoflist: ",this.sglobaldoflist)
+	print(io,"   values: ")
+	display(this.values)
+end# }}}
+function AddToGlobal!(Ke::ElementMatrix,Kff::IssmMatrix,Kfs::IssmMatrix)#{{{
+
+	#First check that the element matrix looks alright
+	CheckConsistency(Ke)
+
+	#See if we need to do anything
+	is_fset = false
+	is_sset = false
+	for i in 1:Ke.nrows
+		if(Ke.fglobaldoflist[i]>0) is_fset = true end
+		if(Ke.sglobaldoflist[i]>0) is_sset = true end
+	end
+
+	if is_fset
+		AddValues!(Kff,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.fglobaldoflist,Ke.values)
+	end
+	if is_sset
+		AddValues!(Kfs,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.sglobaldoflist,Ke.values)
+	end
+
+end#}}}
+function CheckConsistency(Ke::ElementMatrix)#{{{
+
+	for i in 1:Ke.nrows
+		for j in 1:Ke.nrows
+			if(isnan(Ke.values[i,j])) error("NaN found in Element Matrix") end
+			if(isinf(Ke.values[i,j])) error("Inf found in Element Matrix") end
+			if(abs(Ke.values[i,j])>1.e+50) error("Element Matrix values exceeds 1.e+50") end
+		end
+	end
+end#}}}
+
+mutable struct ElementVector#{{{
+	nrows::Int64
+	fglobaldoflist::Vector{Int64}
+	values::Vector{Float64}
+end #}}}
+function ElementVector(nodes::Vector{Node})#{{{
+
+	#Get matrix size
+	nrows = NumberOfDofs(nodes,GsetEnum)
+
+	#Initialize element matrix with zeros
+	values = zeros(nrows)
+
+	#Get dof list
+	fglobaldoflist=GetGlobalDofList(nodes,nrows,FsetEnum)
+
+	return ElementVector(nrows,fglobaldoflist,values)
+end#}}}
+function Base.show(io::IO, this::ElementVector)# {{{
+
+	println(io,"ElementVector:")
+	println(io,"   nrows: ",this.nrows)
+	println(io,"   fglobaldoflist: ",this.fglobaldoflist)
+	print(io,"   values: ")
+	display(this.values)
+end# }}}
+function AddToGlobal!(pe::ElementVector,pf::IssmVector)#{{{
+
+	#First check that the element matrix looks alright
+	CheckConsistency(pe)
+
+	#See if we need to do anything
+	is_fset = false
+	for i in 1:pe.nrows
+		if(pe.fglobaldoflist[i]>0)
+			is_fset = true 
+			break
+		end
+	end
+
+	if is_fset
+		AddValues!(pf,pe.nrows,pe.fglobaldoflist,pe.values)
+	end
+
+end#}}}
+function CheckConsistency(pe::ElementVector)#{{{
+
+	for i in 1:pe.nrows
+		if(isnan(pe.values[i])) error("NaN found in Element Vector") end
+		if(isinf(pe.values[i])) error("Inf found in Element Vector") end
+		if(abs(pe.values[i])>1.e+50) error("Element Vector values exceeds 1.e+50") end
+	end
+end#}}}
Index: issm/trunk/src/jl/core/elements.jl
===================================================================
--- issm/trunk/src/jl/core/elements.jl	(revision 26744)
+++ issm/trunk/src/jl/core/elements.jl	(revision 26744)
@@ -0,0 +1,489 @@
+#Tria class definition
+mutable struct Tria #{{{
+	sid::Int64
+	pid::Int64
+
+	#vertexids::Int64[3]
+	#vertices::Vertex[3]
+	vertexids::Vector{Int64}
+	vertices::Vector{Vertex}
+
+	nodes::Vector{Node}
+	nodes_list::Vector{Vector{Node}}
+	nodes_ids_list::Vector{Vector{Int64}}
+
+	parameters::Parameters
+	inputs::Inputs
+end# }}}
+function Tria(sid::Int64, pid::Int64, vertexids::Vector{Int64}) #{{{
+
+	#This is the default constructor, at this point we don't have much information
+	tempparams   = Parameters(Dict{IssmEnum,Parameter}())
+	tempinputs   = Inputs(-1,-1,Dict{IssmEnum,Input}())
+	return Tria(sid, pid,
+					vertexids, Vector{Vertex}(undef,3),
+					Vector{Node}(undef,0), Vector{Vector{Node}}(undef,0), Vector{Vector{Int64}}(undef,0),
+					tempparams, tempinputs)
+
+end #}}}
+
+#Element functions
+function InputCreate(element::Tria,inputs::Inputs,data::Vector{Float64},enum::IssmEnum) #{{{
+	if size(data,1)==inputs.numberofelements
+		SetTriaInput(inputs,enum,P0Enum,element.sid,data[element.sid])
+	elseif size(data,1)==inputs.numberofvertices
+		SetTriaInput(inputs,enum,P1Enum,element.vertexids,data[element.vertexids])
+	else
+		error("size ",size(data,1)," not supported yet");
+	end
+end #}}}
+function AddInput(element::Tria,inputenum::IssmEnum,data::Vector{Float64},interpolation::IssmEnum) #{{{
+	if interpolation==P1Enum
+		@assert length(data)==3
+		SetTriaInput(element.inputs,inputenum,P1Enum,element.vertexids,data)
+	else
+		error("interpolation ", interpolation, " not supported yet");
+	end
+end #}}}
+function InputUpdateFromVector(element::Tria, vector::Vector{Float64}, enum::IssmEnum, layout::IssmEnum) #{{{
+
+	lidlist = element.vertexids
+	data = Vector{Float64}(undef, 3)
+
+	if(layout==VertexSIdEnum)
+		for i in 1:3
+			data[i] = vector[element.vertices[i].sid]
+			@assert isfinite(data[i])
+		end
+		SetTriaInput(element.inputs, enum, P1Enum, lidlist, data)
+	else
+		error("layout ", layout, " not supported yet");
+	end
+end #}}}
+function Update(element::Tria, inputs::Inputs, index::Int64, md::model, finiteelement::IssmEnum) #{{{
+
+	if finiteelement==P1Enum
+		numnodes = 3
+		nodeids    = Vector{Int64}(undef,numnodes)
+		nodeids[1] = md.mesh.elements[index,1]
+		nodeids[2] = md.mesh.elements[index,2]
+		nodeids[3] = md.mesh.elements[index,3]
+
+		push!(element.nodes_ids_list, nodeids)
+		push!(element.nodes_list, Vector{Node}(undef, numnodes))
+	else
+		error("not supported yet")
+	end
+end #}}}
+function Configure(element::Tria,nodes::Vector{Node},vertices::Vector{Vertex},parameters::Parameters,inputs::Inputs,index::Int64) # {{{
+
+   #Configure vertices
+   for i in 1:3
+		element.vertices[i] = vertices[element.vertexids[i]]
+   end
+
+	#Configure nodes (assuming P1 finite elements)
+	nodes_list     = element.nodes_list[index]
+	nodes_ids_list = element.nodes_ids_list[index]
+	for i in 1:3
+		nodes_list[i] = nodes[nodes_ids_list[i]]
+	end
+
+	#Point to real datasets
+	element.nodes      = element.nodes_list[index]
+	element.parameters = parameters
+	element.inputs     = inputs
+	
+end # }}}
+function GetDofList(element::Tria,setenum::IssmEnum) # {{{
+
+	#Define number of nodes
+	numnodes = 3
+
+	#Determine size of doflist
+	numdofs = 0
+	for i in 1:numnodes
+		numdofs += GetNumberOfDofs(element.nodes[i],GsetEnum)
+	end
+
+	#Allocate doflist vector
+	doflist = Vector{Int64}(undef,numdofs)
+
+	#enter dofs in doflist vector
+	count = 0
+	for i in 1:numnodes
+		count = GetDofList(element.nodes[i],doflist,count,GsetEnum)
+	end
+
+	return doflist
+end # }}}
+function GetInput(element::Tria,enum::IssmEnum) # {{{
+
+	input = GetInput(element.inputs,enum)
+	InputServe!(element,input)
+	return input
+
+end # }}}
+function GetInputListOnNodes!(element::Tria, vector::Vector{Float64}, enum::IssmEnum) # {{{
+
+	#Get Input first 
+	input = GetInput(element, enum)
+
+	#Get value at each vertex (i.e. P1 Nodes)
+	gauss=GaussTria(P1Enum)
+	for i in 1:gauss.numgauss
+		vector[i] = GetInputValue(input, gauss, i)
+	end
+
+end # }}}
+function GetInputListOnVertices!(element::Tria, vector::Vector{Float64}, enum::IssmEnum) # {{{
+
+	#Get Input first 
+	input = GetInput(element, enum)
+
+	#Get value at each vertex (i.e. P1 Nodes)
+	gauss=GaussTria(P1Enum)
+	for i in 1:gauss.numgauss
+		vector[i] = GetInputValue(input, gauss, i)
+	end
+
+end # }}}
+function FindParam(element::Tria,enum::IssmEnum) # {{{
+
+	return FindParam(element.parameters, enum)
+
+end # }}}
+function InputServe!(element::Tria,input::ElementInput) # {{{
+
+	if input.interp==P0Enum
+		input.element_values[1] = input.values[element.sid]
+	elseif input.interp==P1Enum
+		for i in 1:3
+			input.element_values[i] = input.values[element.vertices[i].sid]
+		end
+	else
+		error("interpolation ",input.interp," not supported yet")
+	end
+
+end # }}}
+function GetGroundedPortion(element::Tria, xyz_list::Matrix{Float64}) #{{{
+
+	level = Vector{Float64}(undef,3)
+	GetInputListOnVertices!(element, level, MaskOceanLevelsetEnum)
+
+	#Be sure that values are not zero
+	epsilon = 1.e-15
+	for i in 1:3
+		if(level[i]==0.) level[i]=level[i]+epsilon end
+	end
+
+	if level[1]>0 && level[2]>0 && level[3]>0
+      #Completely grounded
+		phi = 1.0
+   elseif level[1]<0 && level[2]<0 && level[3]<0
+      #Completely floating
+      phi = 0.0
+   else
+		#Partially floating,
+		if(level[1]*level[2]>0) #Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
+			s1=level[3]/(level[3]-level[2]);
+			s2=level[3]/(level[3]-level[1]);
+		elseif(level[2]*level[3]>0) #Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+			s1=level[1]/(level[1]-level[2]);
+			s2=level[1]/(level[1]-level[3]);
+		elseif(level[1]*level[3]>0) #Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+			s1=level[2]/(level[2]-level[1]);
+			s2=level[2]/(level[2]-level[3]);
+		else
+			error("not supposed to be here...")
+		end
+
+		if(level[1]*level[2]*level[3]>0)
+			phi = s1*s2
+		else
+			phi = (1-s1*s2)
+		end
+	end
+
+	return phi
+end#}}}
+function IsIcefront(element::Tria) #{{{
+
+	level = Vector{Float64}(undef,3)
+	GetInputListOnVertices!(element, level, MaskIceLevelsetEnum)
+
+	nbice = 0
+	for i in 1:3
+		if(level[i]<0.) nbice+=1 end
+	end
+
+	if(nbice==1)
+		return true
+	else
+		return false
+	end
+end#}}}
+function IsIceInElement(element::Tria) #{{{
+	#We consider that an element has ice if at least one of its nodes has a negative level set
+
+	input=GetInput(element, MaskIceLevelsetEnum)
+
+	if GetInputMin(input)<0
+		return true
+	else
+		return false
+	end
+
+end#}}}
+function GetIcefrontCoordinates!(element::Tria, xyz_front::Matrix{Float64}, xyz_list::Matrix{Float64}, levelsetenum::IssmEnum) #{{{
+
+	#Intermediaries
+	level        = Vector{Float64}(undef,3)
+	indicesfront = Vector{Int64}(undef,3)
+
+	#Recover value of levelset for all vertices
+	GetInputListOnVertices!(element, level, levelsetenum)
+
+	#Get nodes where there is no ice
+	num_frontnodes = 0
+	for i in 1:3
+		if(level[i]>=0.)
+			num_frontnodes += 1
+			indicesfront[num_frontnodes] = i
+		end
+	end
+	@assert num_frontnodes==2
+
+	#Arrange order of frontnodes such that they are oriented counterclockwise
+	NUMVERTICES = 3
+	if((NUMVERTICES+indicesfront[1]-indicesfront[2])%NUMVERTICES != NUMVERTICES-1)
+		index=indicesfront[1]
+		indicesfront[1]=indicesfront[2]
+		indicesfront[2]=index
+	end
+
+	#Return nodes
+	xyz_front[1,:]=xyz_list[indicesfront[1],:]
+	xyz_front[2,:]=xyz_list[indicesfront[2],:]
+
+end#}}}
+function GetArea(element::Tria)#{{{
+
+	#Get xyz list
+	xyz_list = GetVerticesCoordinates(element.vertices)
+	x1 = xyz_list[1,1]; y1 = xyz_list[1,2]
+	x2 = xyz_list[2,1]; y2 = xyz_list[2,2]
+	x3 = xyz_list[3,1]; y3 = xyz_list[3,2]
+
+	@assert x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1>0
+	return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2
+end#}}}
+function NormalSection(element::Tria, xyz_front::Matrix{Float64}) #{{{
+
+	#Build output pointing vector
+	nx =  xyz_front[2,2] - xyz_front[1,2]
+	ny = -xyz_front[2,1] + xyz_front[1,1]
+
+	#normalize
+	norm = sqrt(nx^2 + ny^2)
+	nx = nx/norm
+	ny = ny/norm
+
+	return nx, ny
+end#}}}
+function CharacteristicLength(element::Tria) #{{{
+
+	return sqrt(2*GetArea(element))
+end#}}}
+function MigrateGroundingLine(element::Tria) #{{{
+
+	h = Vector{Float64}(undef,3)
+	s = Vector{Float64}(undef,3)
+	b = Vector{Float64}(undef,3)
+	r = Vector{Float64}(undef,3)
+	phi = Vector{Float64}(undef,3)
+	sl = zeros(3)
+	GetInputListOnVertices!(element, h, ThicknessEnum)
+	GetInputListOnVertices!(element, s, SurfaceEnum)
+	GetInputListOnVertices!(element, b, BaseEnum)
+	GetInputListOnVertices!(element, r, BedEnum)
+	#GetInputListOnVertices(element, sl, SealevelEnum)
+	GetInputListOnVertices!(element, phi, MaskOceanLevelsetEnum)
+
+
+	rho_water   = FindParam(element, MaterialsRhoSeawaterEnum)
+	rho_ice     = FindParam(element, MaterialsRhoIceEnum)
+	density     = rho_ice/rho_water
+
+	for i in 1:3
+
+		if(phi[i]<=0)
+			#reground if base is below bed
+			if(b[i]<=r[i])
+				b[i] = r[i]
+				s[i] = b[i]+h[i]
+			end
+		else
+			bed_hydro=-density*h[i]+sl[i];
+			if (bed_hydro>r[i])
+				#Unground only if the element is connected to the ice shelf
+				s[i] = (1-density)*h[i]+sl[i]
+				b[i] = -density*h[i]+sl[i]
+			end
+		end
+
+		#recalculate phi
+		phi[i]=h[i]+(r[i]-sl[i])/density
+	end
+
+	#Update inputs
+	AddInput(element,MaskOceanLevelsetEnum,phi,P1Enum)
+	AddInput(element,SurfaceEnum,s,P1Enum)
+	AddInput(element,BaseEnum,b,P1Enum)
+
+end#}}}
+
+#Finite Element stuff
+function JacobianDeterminant(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{
+
+	#Get Jacobian Matrix
+	J = Jacobian(xyz_list)
+
+	#Get its determinant
+	Jdet = Matrix2x2Determinant(J)
+
+	#check and return
+	if(Jdet<0) error("negative Jacobian Determinant") end
+	return Jdet
+
+end#}}}
+function JacobianDeterminantSurface(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{
+
+	x1 = xyz_list[1,1]; y1 = xyz_list[1,2]
+	x2 = xyz_list[2,1]; y2 = xyz_list[2,2]
+	Jdet = .5*sqrt((x2-x1)^2 + (y2-y1)^2)
+
+	#check and return
+	if(Jdet<0) error("negative Jacobian Determinant") end
+	return Jdet
+
+end#}}}
+function Jacobian(xyz_list::Matrix{Float64}) #{{{
+
+	J = Matrix{Float64}(undef,2,2)
+
+	x1 = xyz_list[1,1]
+	y1 = xyz_list[1,2]
+	x2 = xyz_list[2,1]
+	y2 = xyz_list[2,2]
+	x3 = xyz_list[3,1]
+	y3 = xyz_list[3,2]
+
+	J[1,1] = .5*(x2-x1)
+	J[1,2] = .5*(y2-y1)
+	J[2,1] = sqrt(3)/6*(2*x3 -x1 -x2)
+	J[2,2] = sqrt(3)/6*(2*y3 -y1 -y2)
+
+	return J
+end#}}}
+function JacobianInvert(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{
+
+	#Get Jacobian matrix
+	J = Jacobian(xyz_list)
+
+	#Get its determinant
+	Jinv = Matrix2x2Invert(J)
+
+	return Jinv
+end#}}}
+function NodalFunctions(element::Tria,basis::Vector{Float64}, gauss::GaussTria, ig::Int64, finiteelement::IssmEnum) #{{{
+
+	if(finiteelement==P0Enum)
+		#Nodal function 1
+		basis[1]= 1
+	elseif(finiteelement==P1Enum)
+		basis[1] = gauss.coords1[ig]
+		basis[2] = gauss.coords2[ig]
+		basis[3] = gauss.coords3[ig]
+	else
+		error("Element type ",finiteelement," not supported yet")
+	end
+
+
+end#}}}
+function NodalFunctionsDerivatives(element::Tria,dbasis::Matrix{Float64},xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{
+
+	#Get nodal function derivatives in reference element
+	dbasis_ref = Matrix{Float64}(undef,3,2)
+	NodalFunctionsDerivativesReferenceTria(dbasis_ref,gauss,P1Enum)
+
+	#Get invert of the Jacobian
+	Jinv = JacobianInvert(xyz_list,gauss)
+
+	#Build dbasis:
+	#[ dNi/dx ] = Jinv * [dNhat_i/dr]
+	#[ dNi/dy ] =        [dNhat_i/ds]
+	for i in 1:3
+		dbasis[i,1] = Jinv[1,1]*dbasis_ref[i,1]+Jinv[1,2]*dbasis_ref[i,2]
+		dbasis[i,2] = Jinv[2,1]*dbasis_ref[i,1]+Jinv[2,2]*dbasis_ref[i,2]
+	end
+
+end#}}}
+function NodalFunctionsDerivativesReferenceTria(dbasis::Matrix{Float64}, gauss::GaussTria, finiteelement::IssmEnum) #{{{
+
+	if(finiteelement==P0Enum)
+		#Nodal function 1
+		dbasis[1,1]= 0
+		dbasis[1,2]= 0
+
+	elseif(finiteelement==P1Enum)
+		#Nodal function 1
+		dbasis[1,1]= -.5
+		dbasis[1,2]= -sqrt(3)/6
+		#Nodal function 2
+		dbasis[2,1]= .5
+		dbasis[2,2]= -sqrt(3)/6
+		#Nodal function 3
+		dbasis[3,1]= 0
+		dbasis[3,2]= sqrt(3)/3
+	else
+		error("Element type ",finiteelement," not supported yet")
+	end
+end#}}}
+function NumberofNodesTria(finiteelement) #{{{
+
+	if    (finiteelement==P0Enum) return 0
+	elseif(finiteelement==P1Enum) return 3
+	else
+		error("Element type ",finiteelement," not supported yet")
+	end
+end#}}}
+function GaussTria(element::Tria, xyz_list::Matrix{Float64}, xyz_list_front::Matrix{Float64}, order::Int64) #{{{
+
+	area_coordinates = Matrix{Float64}(undef,2,3)
+	GetAreaCoordinates!(element, area_coordinates, xyz_list_front, xyz_list)
+
+	return GaussTria(area_coordinates, order)
+end# }}}
+function GetAreaCoordinates!(element::Tria, area_coordinates::Matrix{Float64}, xyz_zero::Matrix{Float64}, xyz_list::Matrix{Float64})#{{{
+
+	numpoints = size(area_coordinates,1)
+	area = GetArea(element)
+
+	#Copy original xyz_list
+	xyz_bis=copy(xyz_list)
+	for i in 1:numpoints
+		for j in 1:3
+
+			#Change appropriate line
+			xyz_bis[j,:] = xyz_zero[i,:]
+
+			#Compute area fraction
+			area_portion=abs(xyz_bis[2,1]*xyz_bis[3,2] - xyz_bis[2,2]*xyz_bis[3,1] + xyz_bis[1,1]*xyz_bis[2,2] - xyz_bis[1,2]*xyz_bis[2,1] + xyz_bis[3,1]*xyz_bis[1,2] - xyz_bis[3,2]*xyz_bis[1,1])/2
+			area_coordinates[i,j] = area_portion/area
+
+			#reinitialize xyz_list
+			xyz_bis[j,:] = xyz_list[j,:]
+		end
+	end
+end #}}}
Index: issm/trunk/src/jl/core/femmodel.jl
===================================================================
--- issm/trunk/src/jl/core/femmodel.jl	(revision 26744)
+++ issm/trunk/src/jl/core/femmodel.jl	(revision 26744)
@@ -0,0 +1,40 @@
+#femmodel class definition
+mutable struct FemModel #{{{
+	analyses::Vector{Analysis}
+	elements::Vector{Tria}
+	vertices::Vector{Vertex}
+
+	nodes::Vector{Node}
+	nodes_list::Vector{Vector{Node}}
+
+	parameters::Parameters
+	inputs::Inputs
+
+	constraints::Vector{Constraint}
+	constraints_list::Vector{Vector{Constraint}}
+
+	#loads::Vector{Loads}
+
+	results::Vector{Result}
+end#}}}
+
+#femmodel functions
+function SetCurrentConfiguration!(femmodel::FemModel, analysis::Analysis) #{{{
+
+	#Find the index of this analysis
+	index = -1
+	for i in 1:length(femmodel.analyses)
+		if(typeof(femmodel.analyses[i]) == typeof(analysis)) index = i end
+	end
+	if(index<1) error("Could not find analysis ",analysis, " in femmodel") end
+
+	#Plug right nodes onto element
+	for i in 1:length(femmodel.elements)
+		femmodel.elements[i].nodes = femmodel.elements[i].nodes_list[index]
+	end
+
+	#Plug in nodes and other datasets
+	femmodel.nodes       = femmodel.nodes_list[index]
+	femmodel.constraints = femmodel.constraints_list[index]
+
+end#}}}
Index: issm/trunk/src/jl/core/friction.jl
===================================================================
--- issm/trunk/src/jl/core/friction.jl	(revision 26744)
+++ issm/trunk/src/jl/core/friction.jl	(revision 26744)
@@ -0,0 +1,43 @@
+#Friction class definition
+
+abstract type CoreFriction end
+struct CoreBuddFriction#{{{
+	H_input::ElementInput
+	b_input::ElementInput
+	c_input::ElementInput
+	rho_ice::Float64
+	rho_water::Float64
+	g::Float64
+end# }}}
+function CoreFriction(element::Tria) #{{{
+
+	frictionlaw = FindParam(element, FrictionLawEnum)
+
+	if frictionlaw==1
+		H_input  = GetInput(element, ThicknessEnum)
+		b_input  = GetInput(element, BaseEnum)
+		c_input  = GetInput(element, FrictionCoefficientEnum)
+
+		rho_ice   = FindParam(element, MaterialsRhoIceEnum)
+		rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
+		g         = FindParam(element, ConstantsGEnum)
+
+		return CoreBuddFriction(H_input, b_input, c_input, rho_ice, rho_water, g)
+	else
+		error("Friction ",typeof(md.friction)," not supported yet")
+	end
+end#}}}
+
+#vertices functions
+function Alpha2(friction::CoreBuddFriction, gauss::GaussTria, i::Int64) #{{{
+
+	#Get effective pressure
+	H = GetInputValue(friction.H_input, gauss, i)
+	b = GetInputValue(friction.b_input, gauss, i)
+	c = GetInputValue(friction.c_input, gauss, i)
+	N = friction.rho_ice*friction.g*H + friction.rho_water*friction.g*b
+
+	if(N<0) N=0 end
+
+	return c^2*N
+end #}}}
Index: issm/trunk/src/jl/core/gauss.jl
===================================================================
--- issm/trunk/src/jl/core/gauss.jl	(revision 26744)
+++ issm/trunk/src/jl/core/gauss.jl	(revision 26744)
@@ -0,0 +1,113 @@
+#Gauss class definition
+struct GaussTria #{{{
+	numgauss::Int64
+	weights::Vector{Float64}
+	coords1::Vector{Float64}
+	coords2::Vector{Float64}
+	coords3::Vector{Float64}
+end #}}}
+function Base.show(io::IO, this::GaussTria)# {{{
+
+	println(io,"GaussTria:")
+	println(io,"   numgauss: ",this.numgauss)
+	println(io,"   weights:  ",this.weights)
+	println(io,"   coords1:  ",this.coords1)
+	println(io,"   coords2:  ",this.coords2)
+	println(io,"   coords3:  ",this.coords3)
+end# }}}
+
+#Gauss constructor
+function GaussTria(order::Int64) #{{{
+
+	#=Gauss quadrature points for the triangle.
+	Higher-order points from D.A. Dunavant, "High Degree Efficient
+	Symmetrical Gaussian Quadrature Rules for the Triangle", IJNME,
+	Vol. 21, pp. 1129-1148 (1985), as transcribed for Probe rules3.=#
+
+	if(order==1)
+		npoints = 1
+		weights = [1.732050807568877]
+		coords1 = [0.333333333333333]
+		coords2 = [0.333333333333333]
+		coords3 = [0.333333333333333]
+	elseif(order==2)
+		npoints = 3
+		weights = [0.577350269189625; 0.577350269189625; 0.577350269189625]
+		coords1 = [0.666666666666667; 0.166666666666667; 0.166666666666667]
+		coords2 = [0.166666666666667; 0.666666666666667; 0.166666666666667]
+		coords3 = [0.166666666666667; 0.166666666666667; 0.666666666666667]
+	elseif(order==3)
+		npoints = 4
+		weights = [-0.974278579257493; 0.902109795608790; 0.902109795608790; 0.902109795608790]
+		coords1 = [ 0.333333333333333; 0.600000000000000; 0.200000000000000; 0.200000000000000]
+		coords2 = [ 0.333333333333333; 0.200000000000000; 0.600000000000000; 0.200000000000000]
+		coords3 = [ 0.333333333333333; 0.200000000000000; 0.200000000000000; 0.600000000000000]
+	else
+		error("order ",order," not supported yet");
+	end
+
+	return GaussTria(npoints,weights,coords1,coords2,coords3)
+end# }}}
+function GaussTria(finiteelement::IssmEnum) #{{{
+
+	if(finiteelement==P0Enum)
+		npoints = 1
+		weights = [1.]
+		coords1 = [0.333333333333333]
+		coords2 = [0.333333333333333]
+		coords3 = [0.333333333333333]
+	elseif(finiteelement==P1Enum)
+			npoints = 3
+			weights = 0.333333333333333*ones(3)
+			coords1 = [1.; 0.; 0.]
+			coords2 = [0.; 1.; 0.]
+			coords3 = [0.; 0.; 1.]
+	else
+		error("finite element ", finiteelement," not supported yet");
+	end
+
+	return GaussTria(npoints,weights,coords1,coords2,coords3)
+end# }}}
+function GaussTria(area_coordinates::Matrix{Float64}, order::Int64) #{{{
+	#=Gauss-Legendre quadrature points.
+
+	The recurrence coefficients for Legendre polynomials on (-1,1)
+	are defined (from the ORTHPOL subroutine RECUR with ipoly=1) as:
+
+	alpha(i)=0.
+	beta (i)=1./(4.-1./(i-1)^2))
+
+	For degree p, the required number of Gauss-Legendre points is
+	n>=(p+1)/2.=#
+
+	if(order==1)
+		npoint  = 1
+		weights = [2.000000000000000]
+		coords  = [0.000000000000000]
+	elseif(order==2)
+		npoints = 2
+		weights = [1.000000000000000, 1.000000000000000]
+		coords  = [-0.577350269189626, 0.577350269189626]
+	elseif(order==3)
+		npoints = 3
+		weights = [0.555555555555556, 0.888888888888889, 0.555555555555556]
+		coords  = [-0.774596669241483, 0.000000000000000, 0.774596669241483]
+	elseif(order==4)
+		npoints = 4
+		weights = [0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454]
+		coords  = [-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053]
+	else
+      error("order ",order," not supported yet");
+	end
+
+   coords1  = Vector{Float64}(undef,npoints)
+   coords2  = Vector{Float64}(undef,npoints)
+   coords3  = Vector{Float64}(undef,npoints)
+   for i in 1:npoints
+      coords1[i]  = 0.5*(area_coordinates[1,1]+area_coordinates[2,1]) + 0.5*coords[i]*(area_coordinates[2,1]-area_coordinates[1,1]);
+      coords2[i]  = 0.5*(area_coordinates[1,2]+area_coordinates[2,2]) + 0.5*coords[i]*(area_coordinates[2,2]-area_coordinates[1,2]);
+      coords3[i]  = 0.5*(area_coordinates[1,3]+area_coordinates[2,3]) + 0.5*coords[i]*(area_coordinates[2,3]-area_coordinates[1,3]);
+   end
+
+	return GaussTria(npoints, weights, coords1, coords2, coords3)
+end# }}}
Index: issm/trunk/src/jl/core/inputs.jl
===================================================================
--- issm/trunk/src/jl/core/inputs.jl	(revision 26744)
+++ issm/trunk/src/jl/core/inputs.jl	(revision 26744)
@@ -0,0 +1,167 @@
+#Input class definition
+abstract type Input end
+struct BoolInput <: Input#{{{
+	enum::IssmEnum
+	values::Matrix{Bool}
+end# }}}
+struct IntInput <: Input#{{{
+	enum::IssmEnum
+	values::Matrix{Int64}
+end# }}}
+struct ElementInput <: Input#{{{
+	enum::IssmEnum
+	interp::IssmEnum
+	values::Vector{Float64}
+	element_values::Vector{Float64}
+end# }}}
+
+#Inputs dataset definition
+mutable struct Inputs #{{{
+	numberofelements::Int64
+	numberofvertices::Int64
+	lookup::Dict{IssmEnum,Input}
+end# }}}
+
+#Inputs functions
+function GetInput(inputs::Inputs,enum::IssmEnum) #{{{
+
+	#Does this input exist
+	if !haskey(inputs.lookup,enum)
+		error("Input ",enum," not found")
+	end
+
+	#return input
+	return inputs.lookup[enum]
+
+end#}}}
+function SetInput(inputs::Inputs,enum::IssmEnum,index::Int64,value::Bool) #{{{
+
+	#Does this input exist
+	if !haskey(inputs.lookup,enum)
+		#it does not exist yet, we need to create it...
+		@assert inputs.numberofelements > 0
+		input = BoolInput(enum,zeros(Bool,inputs.numberofelements))
+		inputs.lookup[enum] = BoolInput(enum,zeros(Bool,inputs.numberofelements))
+	end
+
+	#Get this input and check type
+	input = inputs.lookup[enum]
+	if typeof(input)!=BoolInput error("not consistent") end
+
+	#set value
+	@assert index>0 && index<=inputs.numberofelements
+	input.values[index] = value
+end#}}}
+function SetTriaInput(inputs::Inputs,enum::IssmEnum,interp::IssmEnum,index::Int64,value::Float64) #{{{
+
+	#Does this input exist
+	if !haskey(inputs.lookup,enum)
+		#it does not exist yet, we need to create it...
+		@assert inputs.numberofelements > 0
+		if interp==P0Enum
+			inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofelements),Vector{Float64}(undef,1))
+		elseif interp==P1Enum
+			inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3))
+		else
+			error("not supported yet")
+		end
+	end
+
+	#Get this input and check type
+	input = inputs.lookup[enum]
+	if typeof(input)!=ElementInput error("input type not consistent") end
+	if interp!=input.interp        error("input interpolations not consistent") end
+
+	#set value
+	input.values[index] = value
+end#}}}
+function SetTriaInput(inputs::Inputs,enum::IssmEnum,interp::IssmEnum,indices::Vector{Int64},values::Vector{Float64}) #{{{
+
+	#Does this input exist
+	if !haskey(inputs.lookup,enum)
+		#it does not exist yet, we need to create it...
+		@assert inputs.numberofvertices>0
+		if interp==P1Enum
+			inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3))
+		else
+			error("not supported yet")
+		end
+	end
+
+	#Get this input and check type
+	input = inputs.lookup[enum]
+	if typeof(input)!=ElementInput error("input type not consistent") end
+	if interp!=input.interp        error("input interpolations not consistent") end
+
+	#set value
+	input.values[indices] = values
+end#}}}
+function GetInputAverageValue(input::ElementInput) #{{{
+
+	numnodes = NumberofNodesTria(input.interp)
+	value = 0.0
+
+	for i in 1:numnodes
+		value+=input.element_values[i]
+	end
+
+	return value/numnodes
+
+end#}}}
+function GetInputMin(input::ElementInput) #{{{
+
+	return minimum(input.element_values)
+
+end#}}}
+function GetInputValue(input::ElementInput,gauss::GaussTria,i::Int64) #{{{
+
+	if input.interp==P0Enum
+		return input.element_values[1]
+	elseif input.interp==P1Enum
+		value = input.element_values[1]*gauss.coords1[i] +  input.element_values[2]*gauss.coords2[i] +  input.element_values[3]*gauss.coords3[i]
+	else
+		error("not implemented yet")
+	end
+
+	return value
+
+end#}}}
+function GetInputDerivativeValue(input::ElementInput,xyz_list::Matrix{Float64},gauss::GaussTria,i::Int64) #{{{
+
+	#Get nodal function derivatives in reference element
+	numnodes = NumberofNodesTria(input.interp)
+	dbasis_ref = Matrix{Float64}(undef,numnodes,2)
+	NodalFunctionsDerivativesReferenceTria(dbasis_ref,gauss,input.interp)
+
+	#Get invert of the Jacobian
+	Jinv = JacobianInvert(xyz_list,gauss)
+
+	#Build dbasis:
+	#[ dNi/dx ] = Jinv * [dNhat_i/dr]
+	#[ dNi/dy ] =        [dNhat_i/ds]
+	dbasis = Matrix{Float64}(undef,numnodes,2)
+	for i in 1:3
+		dbasis[i,1] = Jinv[1,1]*dbasis_ref[i,1]+Jinv[1,2]*dbasis_ref[i,2]
+		dbasis[i,2] = Jinv[2,1]*dbasis_ref[i,1]+Jinv[2,2]*dbasis_ref[i,2]
+	end
+
+	#Get derivatives: dp/dx dp/dy
+	dp = [0.0;0.0]
+	for i in 1:3
+		dp[1] += dbasis[i,1]*input.element_values[i]
+		dp[2] += dbasis[i,2]*input.element_values[i]
+	end
+
+	return dp
+
+end#}}}
+function DuplicateInput(inputs::Inputs, old::IssmEnum, new::IssmEnum)#{{{
+
+	#Fetch input that needs to be copied
+	oldinput = inputs.lookup[old]
+
+	if typeof(oldinput)==ElementInput
+		inputs.lookup[new] = ElementInput(new, oldinput.interp, copy(oldinput.values), copy(oldinput.element_values))
+	end
+
+end#}}}
Index: issm/trunk/src/jl/core/issmenums.jl
===================================================================
--- issm/trunk/src/jl/core/issmenums.jl	(revision 26744)
+++ issm/trunk/src/jl/core/issmenums.jl	(revision 26744)
@@ -0,0 +1,3111 @@
+#   WARNING: DO NOT MODIFY THIS FILE
+#            this file has been automatically generated by Synchronize.sh
+#            Please read README for more information
+
+@enum IssmEnum begin
+	ParametersSTARTEnum
+	AdolcParamEnum
+	AmrDeviatoricErrorGroupThresholdEnum
+	AmrDeviatoricErrorMaximumEnum
+	AmrDeviatoricErrorResolutionEnum
+	AmrDeviatoricErrorThresholdEnum
+	AmrErrEnum
+	AmrFieldEnum
+	AmrGradationEnum
+	AmrGroundingLineDistanceEnum
+	AmrGroundingLineResolutionEnum
+	AmrHmaxEnum
+	AmrHminEnum
+	AmrIceFrontDistanceEnum
+	AmrIceFrontResolutionEnum
+	AmrKeepMetricEnum
+	AmrLagEnum
+	AmrLevelMaxEnum
+	AmrRestartEnum
+	AmrThicknessErrorGroupThresholdEnum
+	AmrThicknessErrorMaximumEnum
+	AmrThicknessErrorResolutionEnum
+	AmrThicknessErrorThresholdEnum
+	AmrTypeEnum
+	AnalysisCounterEnum
+	AnalysisTypeEnum
+	AugmentedLagrangianREnum
+	AugmentedLagrangianRholambdaEnum
+	AugmentedLagrangianRhopEnum
+	AugmentedLagrangianRlambdaEnum
+	AugmentedLagrangianThetaEnum
+	AutodiffCbufsizeEnum
+	AutodiffDependentObjectsEnum
+	AutodiffDriverEnum
+	AutodiffFosForwardIndexEnum
+	AutodiffFosReverseIndexEnum
+	AutodiffFovForwardIndicesEnum
+	AutodiffGcTriggerMaxSizeEnum
+	AutodiffGcTriggerRatioEnum
+	AutodiffIsautodiffEnum
+	AutodiffLbufsizeEnum
+	AutodiffNumDependentsEnum
+	AutodiffNumIndependentsEnum
+	AutodiffObufsizeEnum
+	AutodiffTapeAllocEnum
+	AutodiffTbufsizeEnum
+	AutodiffXpEnum
+	BalancethicknessStabilizationEnum
+	BarystaticContributionsEnum
+	BasalforcingsBottomplumedepthEnum
+	BasalforcingsCrustthicknessEnum
+	BasalforcingsDeepwaterElevationEnum
+	BasalforcingsDeepwaterMeltingRateEnum
+	BasalforcingsDtbgEnum
+	BasalforcingsEnum
+	BasalforcingsIsmip6AverageTfEnum
+	BasalforcingsIsmip6BasinAreaEnum
+	BasalforcingsIsmip6DeltaTEnum
+	BasalforcingsIsmip6Gamma0Enum
+	BasalforcingsIsmip6IsLocalEnum
+	BasalforcingsIsmip6NumBasinsEnum
+	BasalforcingsIsmip6TfDepthsEnum
+	BasalforcingsLowercrustheatEnum
+	BasalforcingsMantleconductivityEnum
+	BasalforcingsNusseltEnum
+	BasalforcingsPicoAverageOverturningEnum
+	BasalforcingsPicoAverageSalinityEnum
+	BasalforcingsPicoAverageTemperatureEnum
+	BasalforcingsPicoBoxAreaEnum
+	BasalforcingsPicoFarOceansalinityEnum
+	BasalforcingsPicoFarOceantemperatureEnum
+	BasalforcingsPicoGammaTEnum
+	BasalforcingsPicoIsplumeEnum
+	BasalforcingsPicoMaxboxcountEnum
+	BasalforcingsPicoNumBasinsEnum
+	BasalforcingsPlumeradiusEnum
+	BasalforcingsPlumexEnum
+	BasalforcingsPlumeyEnum
+	BasalforcingsThresholdThicknessEnum
+	BasalforcingsTopplumedepthEnum
+	BasalforcingsUppercrustheatEnum
+	BasalforcingsUppercrustthicknessEnum
+	BasalforcingsUpperdepthMeltEnum
+	BasalforcingsUpperwaterElevationEnum
+	BasalforcingsUpperwaterMeltingRateEnum
+	CalvingCrevasseDepthEnum
+	CalvingCrevasseThresholdEnum
+	CalvingHeightAboveFloatationEnum
+	CalvingLawEnum
+	CalvingMinthicknessEnum
+	ConfigurationTypeEnum
+	ConstantsGEnum
+	ConstantsNewtonGravityEnum
+	ConstantsReferencetemperatureEnum
+	ConstantsYtsEnum
+	ControlInputSizeMEnum
+	ControlInputSizeNEnum
+	ControlInputInterpolationEnum
+	CumBslcEnum
+	CumBslcIceEnum
+	CumBslcHydroEnum
+	CumBslcOceanEnum
+	CumBslcIcePartitionEnum
+	CumBslcHydroPartitionEnum
+	CumBslcOceanPartitionEnum
+	CumGmtslcEnum
+	CumGmslcEnum
+	DamageC1Enum
+	DamageC2Enum
+	DamageC3Enum
+	DamageC4Enum
+	DamageEnum
+	DamageEquivStressEnum
+	DamageEvolutionNumRequestedOutputsEnum
+	DamageEvolutionRequestedOutputsEnum
+	DamageHealingEnum
+	DamageKappaEnum
+	DamageLawEnum
+	DamageMaxDamageEnum
+	DamageStabilizationEnum
+	DamageStressThresholdEnum
+	DamageStressUBoundEnum
+	DebugProfilingEnum
+	DomainDimensionEnum
+	DomainTypeEnum
+	DslModelEnum
+	DslModelidEnum
+	DslNummodelsEnum
+	SolidearthIsExternalEnum
+	SolidearthExternalNatureEnum
+	SolidearthExternalModelidEnum
+	SolidearthExternalNummodelsEnum
+	SolidearthSettingsComputeBpGrdEnum
+	EarthIdEnum
+	ElasticEnum
+	EplZigZagCounterEnum
+	EsaHElasticEnum
+	EsaHemisphereEnum
+	EsaRequestedOutputsEnum
+	EsaUElasticEnum
+	ExtrapolationVariableEnum
+	FemModelCommEnum
+	FieldsEnum
+	FlowequationFeFSEnum
+	FlowequationIsFSEnum
+	FlowequationIsHOEnum
+	FlowequationIsL1L2Enum
+	FlowequationIsMLHOEnum
+	FlowequationIsSIAEnum
+	FlowequationIsSSAEnum
+	FlowequationIsNitscheEnum
+	FeFSNitscheGammaEnum
+	FrictionCouplingEnum
+	FrictionDeltaEnum
+	FrictionEffectivePressureLimitEnum
+	FrictionFEnum
+	FrictionGammaEnum
+	FrictionLawEnum
+	FrictionPseudoplasticityExponentEnum
+	FrictionThresholdSpeedEnum
+	FrictionVoidRatioEnum
+	FrontalForcingsBasinIcefrontAreaEnum
+	FrontalForcingsAutoregressionInitialTimeEnum
+	FrontalForcingsAutoregressionTimestepEnum
+	FrontalForcingsAutoregressiveOrderEnum
+	FrontalForcingsBeta0Enum
+	FrontalForcingsBeta1Enum
+	FrontalForcingsNumberofBasinsEnum
+	FrontalForcingsParamEnum
+	FrontalForcingsPhiEnum
+	GrdModelEnum
+	GroundinglineFrictionInterpolationEnum
+	GroundinglineMeltInterpolationEnum
+	GroundinglineMigrationEnum
+	HydrologyAveragingEnum
+	HydrologyCavitySpacingEnum
+	HydrologyChannelConductivityEnum
+	HydrologyChannelSheetWidthEnum
+	HydrologyEnglacialVoidRatioEnum
+	HydrologyIschannelsEnum
+	HydrologyMeltFlagEnum
+	HydrologyModelEnum
+	HydrologyNumRequestedOutputsEnum
+	HydrologyPressureMeltCoefficientEnum
+	HydrologyRelaxationEnum
+	HydrologyRequestedOutputsEnum
+	HydrologySedimentKmaxEnum
+	HydrologyStepsPerStepEnum
+	HydrologyStorageEnum
+	HydrologydcEplColapseThicknessEnum
+	HydrologydcEplConductivityEnum
+	HydrologydcEplInitialThicknessEnum
+	HydrologydcEplLayerCompressibilityEnum
+	HydrologydcEplMaxThicknessEnum
+	HydrologydcEplPoreWaterMassEnum
+	HydrologydcEplThickCompEnum
+	HydrologydcEplflipLockEnum
+	HydrologydcIsefficientlayerEnum
+	HydrologydcLeakageFactorEnum
+	HydrologydcMaxIterEnum
+	HydrologydcPenaltyFactorEnum
+	HydrologydcPenaltyLockEnum
+	HydrologydcRelTolEnum
+	HydrologydcSedimentlimitEnum
+	HydrologydcSedimentlimitFlagEnum
+	HydrologydcSedimentLayerCompressibilityEnum
+	HydrologydcSedimentPoreWaterMassEnum
+	HydrologydcSedimentPorosityEnum
+	HydrologydcSedimentThicknessEnum
+	HydrologydcTransferFlagEnum
+	HydrologydcUnconfinedFlagEnum
+	HydrologyshreveStabilizationEnum
+	IcecapToEarthCommEnum
+	IndexEnum
+	InputFileNameEnum
+	DirectoryNameEnum
+	IndicesEnum
+	InputToDepthaverageInEnum
+	InputToDepthaverageOutEnum
+	InputToExtrudeEnum
+	InputToL2ProjectEnum
+	InputToSmoothEnum
+	InversionAlgorithmEnum
+	InversionControlParametersEnum
+	InversionControlScalingFactorsEnum
+	InversionCostFunctionsEnum
+	InversionDxminEnum
+	InversionGatolEnum
+	InversionGradientScalingEnum
+	InversionGrtolEnum
+	InversionGttolEnum
+	InversionIncompleteAdjointEnum
+	InversionIscontrolEnum
+	InversionMaxiterEnum
+	InversionMaxiterPerStepEnum
+	InversionMaxstepsEnum
+	InversionNstepsEnum
+	InversionNumControlParametersEnum
+	InversionNumCostFunctionsEnum
+	InversionStepThresholdEnum
+	InversionTypeEnum
+	IvinsEnum
+	IsSlcCouplingEnum
+	LevelsetKillIcebergsEnum
+	LevelsetReinitFrequencyEnum
+	LevelsetStabilizationEnum
+	LockFileNameEnum
+	LoveAllowLayerDeletionEnum
+	LoveCoreMantleBoundaryEnum
+	LoveEarthMassEnum
+	LoveForcingTypeEnum
+	LoveFrequenciesEnum
+	LoveIsTemporalEnum
+	LoveG0Enum
+	LoveGravitationalConstantEnum
+	LoveInnerCoreBoundaryEnum
+	LoveComplexComputationEnum
+	LoveIntStepsPerLayerEnum
+	LoveKernelsEnum
+	LoveMu0Enum
+	LoveNfreqEnum
+	LoveNTemporalIterationsEnum
+	LoveNYiEquationsEnum
+	LoveR0Enum
+	LoveShNmaxEnum
+	LoveShNminEnum
+	LoveStartingLayerEnum
+	LoveUnderflowTolEnum
+	MassFluxSegmentsEnum
+	MassFluxSegmentsPresentEnum
+	MasstransportHydrostaticAdjustmentEnum
+	MasstransportIsfreesurfaceEnum
+	MasstransportMinThicknessEnum
+	MasstransportNumRequestedOutputsEnum
+	MasstransportPenaltyFactorEnum
+	MasstransportRequestedOutputsEnum
+	MasstransportStabilizationEnum
+	MaterialsBetaEnum
+	MaterialsEarthDensityEnum
+	MaterialsEffectiveconductivityAveragingEnum
+	MaterialsHeatcapacityEnum
+	MaterialsLatentheatEnum
+	MaterialsMeltingpointEnum
+	MaterialsMixedLayerCapacityEnum
+	MaterialsMuWaterEnum
+	MaterialsRheologyLawEnum
+	MaterialsRhoFreshwaterEnum
+	MaterialsRhoIceEnum
+	MaterialsRhoSeawaterEnum
+	MaterialsTemperateiceconductivityEnum
+	MaterialsThermalExchangeVelocityEnum
+	MaterialsThermalconductivityEnum
+	MeltingOffsetEnum
+	MeshAverageVertexConnectivityEnum
+	MeshElementtypeEnum
+	MeshNumberoflayersEnum
+	MeshNumberofverticesEnum
+	MeshNumberofelementsEnum
+	MigrationMaxEnum
+	ModelIdEnum
+	NbinsEnum
+	NodesEnum
+	NumModelsEnum
+	OceanGridNxEnum
+	OceanGridNyEnum
+	OceanGridXEnum
+	OceanGridYEnum
+	OutputBufferPointerEnum
+	OutputBufferSizePointerEnum
+	OutputFileNameEnum
+	OutputFilePointerEnum
+	OutputdefinitionEnum
+	QmuErrNameEnum
+	QmuInNameEnum
+	QmuIsdakotaEnum
+	QmuOutNameEnum
+	QmuOutputEnum
+	QmuCurrEvalIdEnum
+	QmuNsampleEnum
+	QmuResponsedescriptorsEnum
+	QmuVariableDescriptorsEnum
+	QmuVariablePartitionsEnum
+	QmuVariablePartitionsNpartEnum
+	QmuVariablePartitionsNtEnum
+	QmuResponsePartitionsEnum
+	QmuResponsePartitionsNpartEnum
+	QmuStatisticsEnum
+	QmuNumstatisticsEnum
+	QmuNdirectoriesEnum
+	QmuNfilesPerDirectoryEnum
+	QmuStatisticsMethodEnum
+	QmuMethodsEnum
+	RestartFileNameEnum
+	ResultsEnum
+	RootPathEnum
+	ModelnameEnum
+	SamplingAlphaEnum
+	SamplingPhiEnum
+	SamplingNumRequestedOutputsEnum
+	SamplingRequestedOutputsEnum
+	SamplingRobinEnum
+	SamplingSeedEnum
+	SamplingTauEnum
+	SaveResultsEnum
+	SolidearthPartitionIceEnum
+	SolidearthPartitionHydroEnum
+	SolidearthPartitionOceanEnum
+	SolidearthNpartIceEnum
+	SolidearthNpartOceanEnum
+	SolidearthNpartHydroEnum
+	SolidearthPlanetRadiusEnum
+	SolidearthPlanetAreaEnum
+	SolidearthSettingsAbstolEnum
+	SolidearthSettingsCrossSectionShapeEnum
+	RotationalAngularVelocityEnum
+	SolidearthSettingsElasticEnum
+	SolidearthSettingsViscousEnum
+	SealevelchangeGeometryDoneEnum
+	SealevelchangeViscousNumStepsEnum
+	SealevelchangeViscousTimesEnum
+	SealevelchangeViscousIndexEnum
+	RotationalEquatorialMoiEnum
+	TidalLoveHEnum
+	TidalLoveKEnum
+	TidalLoveLEnum
+	TidalLoveK2SecularEnum
+	LoadLoveHEnum
+	LoadLoveKEnum
+	LoadLoveLEnum
+	LoveTimeFreqEnum
+	LoveIsTimeEnum
+	SealevelchangeGSelfAttractionEnum
+	SealevelchangeGViscoElasticEnum
+	SolidearthSettingsSealevelLoadingEnum
+	SolidearthSettingsGRDEnum
+	SolidearthSettingsRunFrequencyEnum
+	SolidearthSettingsTimeAccEnum
+	SealevelchangeHViscoElasticEnum
+	SolidearthSettingsHorizEnum
+	SolidearthSettingsMaxiterEnum
+	SolidearthSettingsGrdOceanEnum
+	SolidearthSettingsOceanAreaScalingEnum
+	StochasticForcingCovarianceEnum
+	StochasticForcingDefaultDimensionEnum
+	StochasticForcingDimensionsEnum
+	StochasticForcingFieldsEnum
+	StochasticForcingIsEffectivePressureEnum
+	StochasticForcingIsStochasticForcingEnum
+	StochasticForcingIsWaterPressureEnum
+	StochasticForcingNumFieldsEnum
+	StochasticForcingRandomflagEnum
+	RotationalPolarMoiEnum
+	SolidearthSettingsReltolEnum
+	SealevelchangeRequestedOutputsEnum
+	SolidearthSettingsSelfAttractionEnum
+	SolidearthSettingsRotationEnum
+	SolidearthSettingsMaxSHCoeffEnum
+	SealevelchangeRunCountEnum
+	SealevelchangeTransitionsEnum
+	SealevelchangeUViscoElasticEnum
+	SettingsIoGatherEnum
+	SettingsNumResultsOnNodesEnum
+	SettingsOutputFrequencyEnum
+	SettingsCheckpointFrequencyEnum
+	SettingsResultsOnNodesEnum
+	SettingsSbCouplingFrequencyEnum
+	SettingsSolverResidueThresholdEnum
+	SettingsWaitonlockEnum
+	SmbAIceEnum
+	SmbAIdxEnum
+	SmbASnowEnum
+	SmbAccualtiEnum
+	SmbAccugradEnum
+	SmbAccurefEnum
+	SmbAdThreshEnum
+	SmbAutoregressionInitialTimeEnum
+	SmbAutoregressionTimestepEnum
+	SmbAutoregressiveOrderEnum
+	SmbAveragingEnum
+	SmbBeta0Enum
+	SmbBeta1Enum
+	SmbDesfacEnum
+	SmbDpermilEnum
+	SmbDsnowIdxEnum
+	SmbCldFracEnum
+	SmbDelta18oEnum
+	SmbDelta18oSurfaceEnum
+	SmbDenIdxEnum
+	SmbDtEnum
+	SmbEnum
+	SmbEIdxEnum
+	SmbFEnum
+	SmbInitDensityScalingEnum
+	SmbIsaccumulationEnum
+	SmbIsalbedoEnum
+	SmbIsconstrainsurfaceTEnum
+	SmbIsd18opdEnum
+	SmbIsdelta18oEnum
+	SmbIsdensificationEnum
+	SmbIsdeltaLWupEnum
+	SmbIsfirnwarmingEnum
+	SmbIsgraingrowthEnum
+	SmbIsmeltEnum
+	SmbIsmungsmEnum
+	SmbIsprecipscaledEnum
+	SmbIssetpddfacEnum
+	SmbIsshortwaveEnum
+	SmbIstemperaturescaledEnum
+	SmbIsthermalEnum
+	SmbIsturbulentfluxEnum
+	SmbKEnum
+	SmbNumBasinsEnum
+	SmbNumRequestedOutputsEnum
+	SmbPfacEnum
+	SmbPhiEnum
+	SmbRdlEnum
+	SmbRequestedOutputsEnum
+	SmbRlapsEnum
+	SmbRlapslgmEnum
+	SmbRunoffaltiEnum
+	SmbRunoffgradEnum
+	SmbRunoffrefEnum
+	SmbSealevEnum
+	SmbStepsPerStepEnum
+	SmbSwIdxEnum
+	SmbT0dryEnum
+	SmbT0wetEnum
+	SmbTeThreshEnum
+	SmbTdiffEnum
+	SmbThermoDeltaTScalingEnum
+	SmbTemperaturesReconstructedYearsEnum
+	SmbPrecipitationsReconstructedYearsEnum
+	SmoothThicknessMultiplierEnum
+	SolutionTypeEnum
+	SteadystateMaxiterEnum
+	SteadystateNumRequestedOutputsEnum
+	SteadystateReltolEnum
+	SteadystateRequestedOutputsEnum
+	StepEnum
+	StepsEnum
+	StressbalanceAbstolEnum
+	StressbalanceFSreconditioningEnum
+	StressbalanceIsnewtonEnum
+	StressbalanceMaxiterEnum
+	StressbalanceNumRequestedOutputsEnum
+	StressbalancePenaltyFactorEnum
+	StressbalanceReltolEnum
+	StressbalanceRequestedOutputsEnum
+	StressbalanceRestolEnum
+	StressbalanceRiftPenaltyThresholdEnum
+	StressbalanceShelfDampeningEnum
+	ThermalIsdrainicecolumnEnum
+	ThermalIsdynamicbasalspcEnum
+	ThermalIsenthalpyEnum
+	ThermalMaxiterEnum
+	ThermalNumRequestedOutputsEnum
+	ThermalPenaltyFactorEnum
+	ThermalPenaltyLockEnum
+	ThermalPenaltyThresholdEnum
+	ThermalReltolEnum
+	ThermalRequestedOutputsEnum
+	ThermalStabilizationEnum
+	ThermalWatercolumnUpperlimitEnum
+	TimeEnum
+	TimesteppingCflCoefficientEnum
+	TimesteppingCouplingTimeEnum
+	TimesteppingFinalTimeEnum
+	TimesteppingInterpForcingEnum
+	TimesteppingCycleForcingEnum
+	TimesteppingStartTimeEnum
+	TimesteppingTimeStepEnum
+	TimesteppingTimeStepMaxEnum
+	TimesteppingTimeStepMinEnum
+	TimesteppingTypeEnum
+	ToMITgcmCommEnum
+	ToolkitsFileNameEnum
+	ToolkitsOptionsAnalysesEnum
+	ToolkitsOptionsStringsEnum
+	ToolkitsTypesEnum
+	TransientAmrFrequencyEnum
+	TransientIsdamageevolutionEnum
+	TransientIsesaEnum
+	TransientIsgiaEnum
+	TransientIsgroundinglineEnum
+	TransientIshydrologyEnum
+	TransientIsmasstransportEnum
+	TransientIsoceantransportEnum
+	TransientIsmovingfrontEnum
+	TransientIsoceancouplingEnum
+	TransientIssamplingEnum
+	TransientIsslcEnum
+	TransientIssmbEnum
+	TransientIsstressbalanceEnum
+	TransientIsthermalEnum
+	TransientNumRequestedOutputsEnum
+	TransientRequestedOutputsEnum
+	VelocityEnum
+	XxeEnum
+	YyeEnum
+	ZzeEnum
+	AreaeEnum
+	WorldCommEnum
+	ParametersENDEnum
+	InputsSTARTEnum
+	AccumulatedDeltaBottomPressureEnum
+	AccumulatedDeltaIceThicknessEnum
+	AccumulatedDeltaTwsEnum
+	AdjointEnum
+	AdjointpEnum
+	AdjointxEnum
+	AdjointxBaseEnum
+	AdjointxShearEnum
+	AdjointyEnum
+	AdjointyBaseEnum
+	AdjointyShearEnum
+	AdjointzEnum
+	AirEnum
+	ApproximationEnum
+	BalancethicknessMisfitEnum
+	BalancethicknessOmega0Enum
+	BalancethicknessOmegaEnum
+	BalancethicknessSpcthicknessEnum
+	BalancethicknessThickeningRateEnum
+	BasalCrevasseEnum
+	BasalforcingsFloatingiceMeltingRateEnum
+	BasalforcingsGeothermalfluxEnum
+	BasalforcingsGroundediceMeltingRateEnum
+	BasalforcingsPerturbationMeltingRateEnum
+	BasalforcingsIsmip6BasinIdEnum
+	BasalforcingsIsmip6TfEnum
+	BasalforcingsIsmip6TfShelfEnum
+	BasalforcingsIsmip6MeltAnomalyEnum
+	BasalforcingsMeltrateFactorEnum
+	BasalforcingsOceanSalinityEnum
+	BasalforcingsOceanTempEnum
+	BasalforcingsPicoBasinIdEnum
+	BasalforcingsPicoBoxIdEnum
+	BasalforcingsPicoOverturningCoeffEnum
+	BasalforcingsPicoSubShelfOceanOverturningEnum
+	BasalforcingsPicoSubShelfOceanSalinityEnum
+	BasalforcingsPicoSubShelfOceanTempEnum
+	BasalStressxEnum
+	BasalStressyEnum
+	BasalStressEnum
+	BaseEnum
+	BaseOldEnum
+	BaseSlopeXEnum
+	BaseSlopeYEnum
+	BaselineBasalforcingsFloatingiceMeltingRateEnum
+	BaselineCalvingCalvingrateEnum
+	BaselineFrictionEffectivePressureEnum
+	BedEnum
+	BedGRDEnum
+	BedEastEnum
+	BedEastGRDEnum
+	BedNorthEnum
+	BedNorthGRDEnum
+	BedSlopeXEnum
+	BedSlopeYEnum
+	BottomPressureEnum
+	BottomPressureOldEnum
+	CalvingCalvingrateEnum
+	CalvingHabFractionEnum
+	CalvingMeltingrateEnum
+	CalvingStressThresholdFloatingiceEnum
+	CalvingStressThresholdGroundediceEnum
+	CalvinglevermannCoeffEnum
+	CalvingratexAverageEnum
+	CalvingratexEnum
+	CalvingrateyAverageEnum
+	CalvingrateyEnum
+	CalvingFluxLevelsetEnum
+	CalvingMeltingFluxLevelsetEnum
+	ConvergedEnum
+	CrevasseDepthEnum
+	DamageDEnum
+	DamageDOldEnum
+	DamageDbarEnum
+	DamageDbarOldEnum
+	DamageFEnum
+	DegreeOfChannelizationEnum
+	DepthBelowSurfaceEnum
+	DeltaIceThicknessEnum
+	DeltaTwsEnum
+	DeltaBottomPressureEnum
+	DeltaDslEnum
+	DslOldEnum
+	DslEnum
+	DeltaStrEnum
+	StrOldEnum
+	StrEnum
+	DeviatoricStresseffectiveEnum
+	DeviatoricStressxxEnum
+	DeviatoricStressxyEnum
+	DeviatoricStressxzEnum
+	DeviatoricStressyyEnum
+	DeviatoricStressyzEnum
+	DeviatoricStresszzEnum
+	DeviatoricStress1Enum
+	DeviatoricStress2Enum
+	DistanceToCalvingfrontEnum
+	DistanceToGroundinglineEnum
+	Domain2DhorizontalEnum
+	Domain2DverticalEnum
+	Domain3DEnum
+	DragCoefficientAbsGradientEnum
+	DrivingStressXEnum
+	DrivingStressYEnum
+	DummyEnum
+	EffectivePressureEnum
+	EffectivePressureSubstepEnum
+	EffectivePressureTransientEnum
+	EnthalpyEnum
+	EnthalpyPicardEnum
+	EplHeadEnum
+	EplHeadOldEnum
+	EplHeadSlopeXEnum
+	EplHeadSlopeYEnum
+	EplHeadSubstepEnum
+	EplHeadTransientEnum
+	EsaEmotionEnum
+	EsaNmotionEnum
+	EsaRotationrateEnum
+	EsaStrainratexxEnum
+	EsaStrainratexyEnum
+	EsaStrainrateyyEnum
+	EsaUmotionEnum
+	EsaXmotionEnum
+	EsaYmotionEnum
+	EtaDiffEnum
+	FlowequationBorderFSEnum
+	FrictionAsEnum
+	FrictionCEnum
+	FrictionCmaxEnum
+	FrictionCoefficientEnum
+	FrictionCoefficientcoulombEnum
+	FrictionEffectivePressureEnum
+	FrictionMEnum
+	FrictionPEnum
+	FrictionPressureAdjustedTemperatureEnum
+	FrictionQEnum
+	FrictionSedimentCompressibilityCoefficientEnum
+	FrictionTillFrictionAngleEnum
+	FrictionWaterLayerEnum
+	FrictionfEnum
+	FrontalForcingsBasinIdEnum
+	FrontalForcingsSubglacialDischargeEnum
+	FrontalForcingsThermalForcingEnum
+	GeometryHydrostaticRatioEnum
+	NGiaEnum
+	NGiaRateEnum
+	UGiaEnum
+	UGiaRateEnum
+	GradientEnum
+	GroundinglineHeightEnum
+	HydraulicPotentialEnum
+	HydraulicPotentialOldEnum
+	HydrologyBasalFluxEnum
+	HydrologyBumpHeightEnum
+	HydrologyBumpSpacingEnum
+	HydrologydcBasalMoulinInputEnum
+	HydrologydcEplThicknessEnum
+	HydrologydcEplThicknessOldEnum
+	HydrologydcEplThicknessSubstepEnum
+	HydrologydcEplThicknessTransientEnum
+	HydrologydcMaskEplactiveEltEnum
+	HydrologydcMaskEplactiveNodeEnum
+	HydrologydcMaskThawedEltEnum
+	HydrologydcMaskThawedNodeEnum
+	HydrologydcSedimentTransmitivityEnum
+	HydrologyDrainageRateEnum
+	HydrologyEnglacialInputEnum
+	HydrologyGapHeightEnum
+	HydrologyGapHeightXEnum
+	HydrologyGapHeightXXEnum
+	HydrologyGapHeightYEnum
+	HydrologyGapHeightYYEnum
+	HydrologyHeadEnum
+	HydrologyHeadOldEnum
+	HydrologyMoulinInputEnum
+	HydrologyNeumannfluxEnum
+	HydrologyReynoldsEnum
+	HydrologySheetConductivityEnum
+	HydrologySheetThicknessEnum
+	HydrologySheetThicknessOldEnum
+	HydrologyTwsEnum
+	HydrologyTwsSpcEnum
+	HydrologyTwsAnalysisEnum
+	HydrologyWatercolumnMaxEnum
+	HydrologyWaterVxEnum
+	HydrologyWaterVyEnum
+	IceEnum
+	IceMaskNodeActivationEnum
+	InputEnum
+	InversionCostFunctionsCoefficientsEnum
+	InversionSurfaceObsEnum
+	InversionThicknessObsEnum
+	InversionVelObsEnum
+	InversionVxObsEnum
+	InversionVyObsEnum
+	LevelsetfunctionSlopeXEnum
+	LevelsetfunctionSlopeYEnum
+	LevelsetObservationEnum
+	LoadingforceXEnum
+	LoadingforceYEnum
+	LoadingforceZEnum
+	MaskOceanLevelsetEnum
+	MaskIceLevelsetEnum
+	MaskIceRefLevelsetEnum
+	MasstransportSpcthicknessEnum
+	MaterialsRheologyBEnum
+	MaterialsRheologyBbarEnum
+	MaterialsRheologyEEnum
+	MaterialsRheologyEbarEnum
+	MaterialsRheologyEcEnum
+	MaterialsRheologyEcbarEnum
+	MaterialsRheologyEsEnum
+	MaterialsRheologyEsbarEnum
+	MaterialsRheologyNEnum
+	MeshScaleFactorEnum
+	MeshVertexonbaseEnum
+	MeshVertexonboundaryEnum
+	MeshVertexonsurfaceEnum
+	MisfitEnum
+	MovingFrontalVxEnum
+	MovingFrontalVyEnum
+	NeumannfluxEnum
+	NewDamageEnum
+	NodeEnum
+	OmegaAbsGradientEnum
+	OceantransportSpcbottompressureEnum
+	OceantransportSpcstrEnum
+	OceantransportSpcdslEnum
+	P0Enum
+	P1Enum
+	PartitioningEnum
+	PressureEnum
+	RadarEnum
+	RadarAttenuationMacGregorEnum
+	RadarAttenuationWolffEnum
+	RadarIcePeriodEnum
+	RadarPowerMacGregorEnum
+	RadarPowerWolffEnum
+	RheologyBAbsGradientEnum
+	RheologyBInitialguessEnum
+	RheologyBInitialguessMisfitEnum
+	RheologyBbarAbsGradientEnum
+	SampleEnum
+	SamplingBetaEnum
+	SamplingKappaEnum
+	SealevelEnum
+	SealevelGRDEnum
+	SealevelBarystaticMaskEnum
+	SealevelBarystaticIceMaskEnum
+	SealevelBarystaticIceWeightsEnum
+	SealevelBarystaticIceAreaEnum
+	SealevelBarystaticIceLatbarEnum
+	SealevelBarystaticIceLongbarEnum
+	SealevelBarystaticIceLoadEnum
+	SealevelBarystaticHydroMaskEnum
+	SealevelBarystaticHydroWeightsEnum
+	SealevelBarystaticHydroAreaEnum
+	SealevelBarystaticHydroLatbarEnum
+	SealevelBarystaticHydroLongbarEnum
+	SealevelBarystaticHydroLoadEnum
+	SealevelBarystaticBpMaskEnum
+	SealevelBarystaticBpWeightsEnum
+	SealevelBarystaticBpAreaEnum
+	SealevelBarystaticBpLoadEnum
+	SealevelBarystaticOceanMaskEnum
+	SealevelBarystaticOceanWeightsEnum
+	SealevelBarystaticOceanAreaEnum
+	SealevelBarystaticOceanLatbarEnum
+	SealevelBarystaticOceanLongbarEnum
+	SealevelBarystaticOceanLoadEnum
+	SealevelNEsaEnum
+	SealevelNEsaRateEnum
+	SealevelRSLEnum
+	BslcEnum
+	BslcIceEnum
+	BslcHydroEnum
+	BslcOceanEnum
+	BslcRateEnum
+	GmtslcEnum
+	SealevelGrotm1Enum
+	SealevelGrotm2Enum
+	SealevelGrotm3Enum
+	SealevelGUrotm1Enum
+	SealevelGUrotm2Enum
+	SealevelGUrotm3Enum
+	SealevelGNrotm1Enum
+	SealevelGNrotm2Enum
+	SealevelGNrotm3Enum
+	SealevelGErotm1Enum
+	SealevelGErotm2Enum
+	SealevelGErotm3Enum
+	SealevelRSLBarystaticEnum
+	SealevelRSLRateEnum
+	SealevelUGrdEnum
+	SealevelNGrdEnum
+	SealevelUEastEsaEnum
+	SealevelUNorthEsaEnum
+	SealevelchangeIndicesEnum
+	SealevelchangeGEnum
+	SealevelchangeGUEnum
+	SealevelchangeGEEnum
+	SealevelchangeGNEnum
+	SealevelchangeGsubelOceanEnum
+	SealevelchangeGUsubelOceanEnum
+	SealevelchangeGEsubelOceanEnum
+	SealevelchangeGNsubelOceanEnum
+	SealevelchangeGsubelIceEnum
+	SealevelchangeGUsubelIceEnum
+	SealevelchangeGEsubelIceEnum
+	SealevelchangeGNsubelIceEnum
+	SealevelchangeGsubelHydroEnum
+	SealevelchangeGUsubelHydroEnum
+	SealevelchangeGEsubelHydroEnum
+	SealevelchangeGNsubelHydroEnum
+	SealevelchangeViscousRSLEnum
+	SealevelchangeViscousUEnum
+	SealevelchangeViscousNEnum
+	SealevelchangeViscousEEnum
+	SedimentHeadEnum
+	SedimentHeadOldEnum
+	SedimentHeadSubstepEnum
+	SedimentHeadTransientEnum
+	SedimentHeadResidualEnum
+	SedimentHeadStackedEnum
+	SigmaNNEnum
+	SigmaVMEnum
+	SmbAccumulatedECEnum
+	SmbAccumulatedMassBalanceEnum
+	SmbAccumulatedMeltEnum
+	SmbAccumulatedPrecipitationEnum
+	SmbAccumulatedRainEnum
+	SmbAccumulatedRefreezeEnum
+	SmbAccumulatedRunoffEnum
+	SmbAEnum
+	SmbAdiffEnum
+	SmbAValueEnum
+	SmbAccumulationEnum
+	SmbAdiffiniEnum
+	SmbAiniEnum
+	SmbAutoregressionNoiseEnum
+	SmbBasinsIdEnum
+	SmbBMaxEnum
+	SmbBMinEnum
+	SmbBNegEnum
+	SmbBPosEnum
+	SmbCEnum
+	SmbCcsnowValueEnum
+	SmbCciceValueEnum
+	SmbCotValueEnum
+	SmbDEnum
+	SmbDailyairdensityEnum
+	SmbDailyairhumidityEnum
+	SmbDailydlradiationEnum
+	SmbDailydsradiationEnum
+	SmbDailypressureEnum
+	SmbDailyrainfallEnum
+	SmbDailysnowfallEnum
+	SmbDailytemperatureEnum
+	SmbDailywindspeedEnum
+	SmbDiniEnum
+	SmbDlwrfEnum
+	SmbDulwrfValueEnum
+	SmbDswrfEnum
+	SmbDswdiffrfEnum
+	SmbDzAddEnum
+	SmbDzEnum
+	SmbDzMinEnum
+	SmbDzTopEnum
+	SmbDziniEnum
+	SmbEAirEnum
+	SmbECEnum
+	SmbECDtEnum
+	SmbECiniEnum
+	SmbElaEnum
+	SmbEvaporationEnum
+	SmbFACEnum
+	SmbGdnEnum
+	SmbGdniniEnum
+	SmbGspEnum
+	SmbGspiniEnum
+	SmbHrefEnum
+	SmbIsInitializedEnum
+	SmbMAddEnum
+	SmbMassBalanceEnum
+	SmbMassBalanceSubstepEnum
+	SmbMassBalanceTransientEnum
+	SmbMeanLHFEnum
+	SmbMeanSHFEnum
+	SmbMeanULWEnum
+	SmbMeltEnum
+	SmbMonthlytemperaturesEnum
+	SmbMSurfEnum
+	SmbNetLWEnum
+	SmbNetSWEnum
+	SmbPAirEnum
+	SmbPEnum
+	SmbPddfacIceEnum
+	SmbPddfacSnowEnum
+	SmbPrecipitationEnum
+	SmbPrecipitationsAnomalyEnum
+	SmbPrecipitationsLgmEnum
+	SmbPrecipitationsPresentdayEnum
+	SmbPrecipitationsReconstructedEnum
+	SmbRainEnum
+	SmbReEnum
+	SmbRefreezeEnum
+	SmbReiniEnum
+	SmbRunoffEnum
+	SmbRunoffSubstepEnum
+	SmbRunoffTransientEnum
+	SmbS0gcmEnum
+	SmbS0pEnum
+	SmbS0tEnum
+	SmbSizeiniEnum
+	SmbSmbCorrEnum
+	SmbSmbrefEnum
+	SmbSzaValueEnum
+	SmbTEnum
+	SmbTaEnum
+	SmbTeValueEnum
+	SmbTemperaturesAnomalyEnum
+	SmbTemperaturesLgmEnum
+	SmbTemperaturesPresentdayEnum
+	SmbTemperaturesReconstructedEnum
+	SmbTiniEnum
+	SmbTmeanEnum
+	SmbTzEnum
+	SmbValuesAutoregressionEnum
+	SmbVEnum
+	SmbVmeanEnum
+	SmbVzEnum
+	SmbWEnum
+	SmbWAddEnum
+	SmbWiniEnum
+	SmbZMaxEnum
+	SmbZMinEnum
+	SmbZTopEnum
+	SmbZYEnum
+	SolidearthExternalDisplacementEastRateEnum
+	SolidearthExternalDisplacementNorthRateEnum
+	SolidearthExternalDisplacementUpRateEnum
+	SolidearthExternalGeoidRateEnum
+	StochasticForcingDefaultIdEnum
+	StrainRateeffectiveEnum
+	StrainRateparallelEnum
+	StrainRateperpendicularEnum
+	StrainRatexxEnum
+	StrainRatexyEnum
+	StrainRatexzEnum
+	StrainRateyyEnum
+	StrainRateyzEnum
+	StrainRatezzEnum
+	StressMaxPrincipalEnum
+	StressTensorxxEnum
+	StressTensorxyEnum
+	StressTensorxzEnum
+	StressTensoryyEnum
+	StressTensoryzEnum
+	StressTensorzzEnum
+	SurfaceAbsMisfitEnum
+	SurfaceAbsVelMisfitEnum
+	AreaEnum
+	SealevelAreaEnum
+	SurfaceAreaEnum
+	SurfaceAverageVelMisfitEnum
+	SurfaceCrevasseEnum
+	SurfaceEnum
+	SurfaceOldEnum
+	SurfaceLogVelMisfitEnum
+	SurfaceLogVxVyMisfitEnum
+	SurfaceObservationEnum
+	SurfaceRelVelMisfitEnum
+	SurfaceSlopeXEnum
+	SurfaceSlopeYEnum
+	TemperatureEnum
+	TemperaturePDDEnum
+	TemperaturePicardEnum
+	TemperatureSEMICEnum
+	ThermalforcingAutoregressionNoiseEnum
+	ThermalforcingValuesAutoregressionEnum
+	ThermalSpctemperatureEnum
+	ThicknessAbsGradientEnum
+	ThicknessAbsMisfitEnum
+	ThicknessAcrossGradientEnum
+	ThicknessAlongGradientEnum
+	ThicknessEnum
+	ThicknessOldEnum
+	ThicknessPositiveEnum
+	ThicknessResidualEnum
+	TransientAccumulatedDeltaIceThicknessEnum
+	VelEnum
+	VxAverageEnum
+	VxBaseEnum
+	VxEnum
+	VxMeshEnum
+	VxObsEnum
+	VxShearEnum
+	VxSurfaceEnum
+	VyAverageEnum
+	VyBaseEnum
+	VyEnum
+	VyMeshEnum
+	VyObsEnum
+	VyShearEnum
+	VySurfaceEnum
+	VzEnum
+	VzFSEnum
+	VzHOEnum
+	VzMeshEnum
+	VzSSAEnum
+	WaterColumnOldEnum
+	WatercolumnEnum
+	WaterfractionDrainageEnum
+	WaterfractionDrainageIntegratedEnum
+	WaterfractionEnum
+	WaterheightEnum
+	FrictionWaterPressureEnum
+	FrictionWaterPressureNoiseEnum
+	WeightsLevelsetObservationEnum
+	WeightsSurfaceObservationEnum
+	OldAccumulatedDeltaBottomPressureEnum
+	OldAccumulatedDeltaIceThicknessEnum
+	OldAccumulatedDeltaTwsEnum
+	Outputdefinition1Enum
+	Outputdefinition10Enum
+	Outputdefinition11Enum
+	Outputdefinition12Enum
+	Outputdefinition13Enum
+	Outputdefinition14Enum
+	Outputdefinition15Enum
+	Outputdefinition16Enum
+	Outputdefinition17Enum
+	Outputdefinition18Enum
+	Outputdefinition19Enum
+	Outputdefinition20Enum
+	Outputdefinition21Enum
+	Outputdefinition22Enum
+	Outputdefinition23Enum
+	Outputdefinition24Enum
+	Outputdefinition25Enum
+	Outputdefinition26Enum
+	Outputdefinition27Enum
+	Outputdefinition28Enum
+	Outputdefinition29Enum
+	Outputdefinition2Enum
+	Outputdefinition30Enum
+	Outputdefinition31Enum
+	Outputdefinition32Enum
+	Outputdefinition33Enum
+	Outputdefinition34Enum
+	Outputdefinition35Enum
+	Outputdefinition36Enum
+	Outputdefinition37Enum
+	Outputdefinition38Enum
+	Outputdefinition39Enum
+	Outputdefinition3Enum
+	Outputdefinition40Enum
+	Outputdefinition41Enum
+	Outputdefinition42Enum
+	Outputdefinition43Enum
+	Outputdefinition44Enum
+	Outputdefinition45Enum
+	Outputdefinition46Enum
+	Outputdefinition47Enum
+	Outputdefinition48Enum
+	Outputdefinition49Enum
+	Outputdefinition4Enum
+	Outputdefinition50Enum
+	Outputdefinition51Enum
+	Outputdefinition52Enum
+	Outputdefinition53Enum
+	Outputdefinition54Enum
+	Outputdefinition55Enum
+	Outputdefinition56Enum
+	Outputdefinition57Enum
+	Outputdefinition58Enum
+	Outputdefinition59Enum
+	Outputdefinition5Enum
+	Outputdefinition60Enum
+	Outputdefinition61Enum
+	Outputdefinition62Enum
+	Outputdefinition63Enum
+	Outputdefinition64Enum
+	Outputdefinition65Enum
+	Outputdefinition66Enum
+	Outputdefinition67Enum
+	Outputdefinition68Enum
+	Outputdefinition69Enum
+	Outputdefinition6Enum
+	Outputdefinition70Enum
+	Outputdefinition71Enum
+	Outputdefinition72Enum
+	Outputdefinition73Enum
+	Outputdefinition74Enum
+	Outputdefinition75Enum
+	Outputdefinition76Enum
+	Outputdefinition77Enum
+	Outputdefinition78Enum
+	Outputdefinition79Enum
+	Outputdefinition7Enum
+	Outputdefinition80Enum
+	Outputdefinition81Enum
+	Outputdefinition82Enum
+	Outputdefinition83Enum
+	Outputdefinition84Enum
+	Outputdefinition85Enum
+	Outputdefinition86Enum
+	Outputdefinition87Enum
+	Outputdefinition88Enum
+	Outputdefinition89Enum
+	Outputdefinition8Enum
+	Outputdefinition90Enum
+	Outputdefinition91Enum
+	Outputdefinition92Enum
+	Outputdefinition93Enum
+	Outputdefinition94Enum
+	Outputdefinition95Enum
+	Outputdefinition96Enum
+	Outputdefinition97Enum
+	Outputdefinition98Enum
+	Outputdefinition99Enum
+	Outputdefinition9Enum
+	Outputdefinition100Enum
+	InputsENDEnum
+	AbsoluteEnum
+	AdaptiveTimesteppingEnum
+	AdjointBalancethickness2AnalysisEnum
+	AdjointBalancethicknessAnalysisEnum
+	AdjointHorizAnalysisEnum
+	AggressiveMigrationEnum
+	AmrBamgEnum
+	AmrNeopzEnum
+	AndroidFrictionCoefficientEnum
+	ArrheniusEnum
+	AutodiffJacobianEnum
+	Balancethickness2AnalysisEnum
+	Balancethickness2SolutionEnum
+	BalancethicknessAnalysisEnum
+	BalancethicknessApparentMassbalanceEnum
+	BalancethicknessSoftAnalysisEnum
+	BalancethicknessSoftSolutionEnum
+	BalancethicknessSolutionEnum
+	BalancevelocityAnalysisEnum
+	BalancevelocitySolutionEnum
+	BasalforcingsIsmip6Enum
+	BasalforcingsPicoEnum
+	BeckmannGoosseFloatingMeltRateEnum
+	BedSlopeSolutionEnum
+	BoolExternalResultEnum
+	BoolInputEnum
+	IntInputEnum
+	DoubleInputEnum
+	BoolParamEnum
+	BoundaryEnum
+	BuddJackaEnum
+	CalvingDev2Enum
+	CalvingHabEnum
+	CalvingLevermannEnum
+	CalvingVonmisesEnum
+	CfdragcoeffabsgradEnum
+	CfsurfacelogvelEnum
+	CfsurfacesquareEnum
+	CflevelsetmisfitEnum
+	ChannelEnum
+	ChannelAreaEnum
+	ChannelAreaOldEnum
+	ChannelDischargeEnum
+	ClosedEnum
+	ColinearEnum
+	ConstraintsEnum
+	ContactEnum
+	ContourEnum
+	ContoursEnum
+	ControlInputEnum
+	ControlInputGradEnum
+	ControlInputMaxsEnum
+	ControlInputMinsEnum
+	ControlInputValuesEnum
+	CrouzeixRaviartEnum
+	CuffeyEnum
+	CuffeyTemperateEnum
+	DamageEvolutionAnalysisEnum
+	DamageEvolutionSolutionEnum
+	DataSetEnum
+	DataSetParamEnum
+	DatasetInputEnum
+	DefaultAnalysisEnum
+	DefaultCalvingEnum
+	DenseEnum
+	DependentObjectEnum
+	DepthAverageAnalysisEnum
+	DeviatoricStressErrorEstimatorEnum
+	DivergenceEnum
+	Domain3DsurfaceEnum
+	DoubleArrayInputEnum
+	ArrayInputEnum
+	DoubleExternalResultEnum
+	DoubleMatArrayParamEnum
+	DoubleMatExternalResultEnum
+	DoubleMatParamEnum
+	DoubleParamEnum
+	DoubleVecParamEnum
+	ElementEnum
+	ElementHookEnum
+	ElementSIdEnum
+	EnthalpyAnalysisEnum
+	EsaAnalysisEnum
+	EsaSolutionEnum
+	EsaTransitionsEnum
+	ExternalResultEnum
+	ExtrapolationAnalysisEnum
+	ExtrudeFromBaseAnalysisEnum
+	ExtrudeFromTopAnalysisEnum
+	FSApproximationEnum
+	FSSolverEnum
+	FSpressureEnum
+	FSvelocityEnum
+	FemModelEnum
+	FileParamEnum
+	FixedTimesteppingEnum
+	FloatingAreaEnum
+	FloatingAreaScaledEnum
+	FloatingMeltRateEnum
+	FreeEnum
+	FreeSurfaceBaseAnalysisEnum
+	FreeSurfaceTopAnalysisEnum
+	FrontalForcingsDefaultEnum
+	FrontalForcingsRignotEnum
+	FrontalForcingsRignotAutoregressionEnum
+	FsetEnum
+	FullMeltOnPartiallyFloatingEnum
+	GLheightadvectionAnalysisEnum
+	GaussPentaEnum
+	GaussSegEnum
+	GaussTetraEnum
+	GaussTriaEnum
+	GenericOptionEnum
+	GenericParamEnum
+	GenericExternalResultEnum
+	Gradient1Enum
+	Gradient2Enum
+	Gradient3Enum
+	Gradient4Enum
+	GroundedAreaEnum
+	GroundedAreaScaledEnum
+	GroundingOnlyEnum
+	GroundinglineMassFluxEnum
+	GsetEnum
+	GslEnum
+	HOApproximationEnum
+	HOFSApproximationEnum
+	HookEnum
+	HydrologyDCEfficientAnalysisEnum
+	HydrologyDCInefficientAnalysisEnum
+	HydrologyGlaDSAnalysisEnum
+	HydrologyGlaDSEnum
+	HydrologyPismAnalysisEnum
+	HydrologyShaktiAnalysisEnum
+	HydrologyShreveAnalysisEnum
+	HydrologySolutionEnum
+	HydrologydcEnum
+	HydrologypismEnum
+	HydrologyshaktiEnum
+	HydrologyshreveEnum
+	IceMassEnum
+	IceMassScaledEnum
+	IceVolumeAboveFloatationEnum
+	IceVolumeAboveFloatationScaledEnum
+	IceVolumeEnum
+	IceVolumeScaledEnum
+	IcefrontMassFluxEnum
+	IcefrontMassFluxLevelsetEnum
+	IncrementalEnum
+	IndexedEnum
+	IntExternalResultEnum
+	ElementInputEnum
+	IntMatExternalResultEnum
+	IntMatParamEnum
+	IntParamEnum
+	IntVecParamEnum
+	InputsEnum
+	InternalEnum
+	IntersectEnum
+	InversionVzObsEnum
+	JEnum
+	L1L2ApproximationEnum
+	MLHOApproximationEnum
+	L2ProjectionBaseAnalysisEnum
+	L2ProjectionEPLAnalysisEnum
+	LACrouzeixRaviartEnum
+	LATaylorHoodEnum
+	LambdaSEnum
+	LevelsetAnalysisEnum
+	LevelsetfunctionPicardEnum
+	LinearFloatingMeltRateEnum
+	LliboutryDuvalEnum
+	LoadsEnum
+	LoveAnalysisEnum
+	LoveHiEnum
+	LoveHrEnum
+	LoveKernelsImagEnum
+	LoveKernelsRealEnum
+	LoveKiEnum
+	LoveKrEnum
+	LoveLiEnum
+	LoveLrEnum
+	LoveSolutionEnum
+	MINIEnum
+	MINIcondensedEnum
+	MantlePlumeGeothermalFluxEnum
+	MassFluxEnum
+	MassconEnum
+	MassconaxpbyEnum
+	MassfluxatgateEnum
+	MasstransportAnalysisEnum
+	MasstransportSolutionEnum
+	MatdamageiceEnum
+	MatenhancediceEnum
+	MaterialsEnum
+	MatestarEnum
+	MaticeEnum
+	MatlithoEnum
+	MathydroEnum
+	MatrixParamEnum
+	MaxAbsVxEnum
+	MaxAbsVyEnum
+	MaxAbsVzEnum
+	MaxDivergenceEnum
+	MaxVelEnum
+	MaxVxEnum
+	MaxVyEnum
+	MaxVzEnum
+	MelangeEnum
+	MeltingAnalysisEnum
+	MeshElementsEnum
+	MeshXEnum
+	MeshYEnum
+	MinVelEnum
+	MinVxEnum
+	MinVyEnum
+	MinVzEnum
+	MismipFloatingMeltRateEnum
+	MoulinEnum
+	MpiDenseEnum
+	MpiEnum
+	MpiSparseEnum
+	MumpsEnum
+	NoFrictionOnPartiallyFloatingEnum
+	NoMeltOnPartiallyFloatingEnum
+	NodalEnum
+	NodalvalueEnum
+	NodeSIdEnum
+	NoneApproximationEnum
+	NoneEnum
+	NumberedcostfunctionEnum
+	NyeCO2Enum
+	NyeH2OEnum
+	NumericalfluxEnum
+	OceantransportAnalysisEnum
+	OceantransportSolutionEnum
+	OldGradientEnum
+	OneLayerP4zEnum
+	OpenEnum
+	OptionEnum
+	ParamEnum
+	ParametersEnum
+	P0ArrayEnum
+	P0DGEnum
+	P1DGEnum
+	P1P1Enum
+	P1P1GLSEnum
+	P1bubbleEnum
+	P1bubblecondensedEnum
+	P1xP2Enum
+	P1xP3Enum
+	P1xP4Enum
+	P2Enum
+	P2bubbleEnum
+	P2bubblecondensedEnum
+	P2xP1Enum
+	P2xP4Enum
+	PatersonEnum
+	PengridEnum
+	PenpairEnum
+	PentaEnum
+	PentaInputEnum
+	ProfilerEnum
+	ProfilingCurrentFlopsEnum
+	ProfilingCurrentMemEnum
+	ProfilingSolutionTimeEnum
+	RegionaloutputEnum
+	RegularEnum
+	RecoveryAnalysisEnum
+	RiftfrontEnum
+	SamplingAnalysisEnum
+	SamplingSolutionEnum
+	SIAApproximationEnum
+	SMBautoregressionEnum
+	SMBcomponentsEnum
+	SMBd18opddEnum
+	SMBforcingEnum
+	SMBgcmEnum
+	SMBgembEnum
+	SMBgradientsEnum
+	SMBgradientscomponentsEnum
+	SMBgradientselaEnum
+	SMBhenningEnum
+	SMBmeltcomponentsEnum
+	SMBpddEnum
+	SMBpddSicopolisEnum
+	SMBsemicEnum
+	SSAApproximationEnum
+	SSAFSApproximationEnum
+	SSAHOApproximationEnum
+	ScaledEnum
+	SealevelAbsoluteEnum
+	SealevelEmotionEnum
+	SealevelInertiaTensorXZEnum
+	SealevelInertiaTensorYZEnum
+	SealevelInertiaTensorZZEnum
+	SealevelchangePolarMotionEnum
+	SealevelNmotionEnum
+	SealevelUmotionEnum
+	SealevelchangeAnalysisEnum
+	SegEnum
+	SegInputEnum
+	SegmentEnum
+	SegmentRiftfrontEnum
+	SeparateEnum
+	SeqEnum
+	SmbAnalysisEnum
+	SmbSolutionEnum
+	SmoothAnalysisEnum
+	SoftMigrationEnum
+	SpatialLinearFloatingMeltRateEnum
+	SpcDynamicEnum
+	SpcStaticEnum
+	SpcTransientEnum
+	SsetEnum
+	StatisticsSolutionEnum
+	SteadystateSolutionEnum
+	StressIntensityFactorEnum
+	StressbalanceAnalysisEnum
+	StressbalanceConvergenceNumStepsEnum
+	StressbalanceSIAAnalysisEnum
+	StressbalanceSolutionEnum
+	StressbalanceVerticalAnalysisEnum
+	StringArrayParamEnum
+	StringExternalResultEnum
+	StringParamEnum
+	SubelementFriction1Enum
+	SubelementFriction2Enum
+	SubelementMelt1Enum
+	SubelementMelt2Enum
+	SubelementMigrationEnum
+	SurfaceSlopeSolutionEnum
+	TaylorHoodEnum
+	TetraEnum
+	TetraInputEnum
+	ThermalAnalysisEnum
+	ThermalSolutionEnum
+	ThicknessErrorEstimatorEnum
+	TotalCalvingFluxLevelsetEnum
+	TotalCalvingMeltingFluxLevelsetEnum
+	TotalFloatingBmbEnum
+	TotalFloatingBmbScaledEnum
+	TotalGroundedBmbEnum
+	TotalGroundedBmbScaledEnum
+	TotalSmbEnum
+	TotalSmbScaledEnum
+	TransientArrayParamEnum
+	TransientInputEnum
+	TransientParamEnum
+	TransientSolutionEnum
+	TriaEnum
+	TriaInputEnum
+	UzawaPressureAnalysisEnum
+	VectorParamEnum
+	VertexEnum
+	VertexLIdEnum
+	VertexPIdEnum
+	VertexSIdEnum
+	VerticesEnum
+	ViscousHeatingEnum
+	WaterEnum
+	XTaylorHoodEnum
+	XYEnum
+	XYZEnum
+	BalancethicknessD0Enum
+	BalancethicknessDiffusionCoefficientEnum
+	BilinearInterpEnum
+	CalvingdevCoeffEnum
+	DeviatoricStressEnum
+	EtaAbsGradientEnum
+	MeshZEnum
+	NearestInterpEnum
+	OutputdefinitionListEnum
+	SealevelObsEnum
+	SealevelWeightsEnum
+	StrainRateEnum
+	StressTensorEnum
+	StressbalanceViscosityOvershootEnum
+	SubelementMigration4Enum
+	TimesteppingTimeAdaptEnum
+	TriangleInterpEnum
+	MaximumNumberOfDefinitionsEnum
+end
+
+function EnumToString(enum::IssmEnum)
+	if(enum==ParametersSTARTEnum) return "ParametersSTART" end
+	if(enum==AdolcParamEnum) return "AdolcParam" end
+	if(enum==AmrDeviatoricErrorGroupThresholdEnum) return "AmrDeviatoricErrorGroupThreshold" end
+	if(enum==AmrDeviatoricErrorMaximumEnum) return "AmrDeviatoricErrorMaximum" end
+	if(enum==AmrDeviatoricErrorResolutionEnum) return "AmrDeviatoricErrorResolution" end
+	if(enum==AmrDeviatoricErrorThresholdEnum) return "AmrDeviatoricErrorThreshold" end
+	if(enum==AmrErrEnum) return "AmrErr" end
+	if(enum==AmrFieldEnum) return "AmrField" end
+	if(enum==AmrGradationEnum) return "AmrGradation" end
+	if(enum==AmrGroundingLineDistanceEnum) return "AmrGroundingLineDistance" end
+	if(enum==AmrGroundingLineResolutionEnum) return "AmrGroundingLineResolution" end
+	if(enum==AmrHmaxEnum) return "AmrHmax" end
+	if(enum==AmrHminEnum) return "AmrHmin" end
+	if(enum==AmrIceFrontDistanceEnum) return "AmrIceFrontDistance" end
+	if(enum==AmrIceFrontResolutionEnum) return "AmrIceFrontResolution" end
+	if(enum==AmrKeepMetricEnum) return "AmrKeepMetric" end
+	if(enum==AmrLagEnum) return "AmrLag" end
+	if(enum==AmrLevelMaxEnum) return "AmrLevelMax" end
+	if(enum==AmrRestartEnum) return "AmrRestart" end
+	if(enum==AmrThicknessErrorGroupThresholdEnum) return "AmrThicknessErrorGroupThreshold" end
+	if(enum==AmrThicknessErrorMaximumEnum) return "AmrThicknessErrorMaximum" end
+	if(enum==AmrThicknessErrorResolutionEnum) return "AmrThicknessErrorResolution" end
+	if(enum==AmrThicknessErrorThresholdEnum) return "AmrThicknessErrorThreshold" end
+	if(enum==AmrTypeEnum) return "AmrType" end
+	if(enum==AnalysisCounterEnum) return "AnalysisCounter" end
+	if(enum==AnalysisTypeEnum) return "AnalysisType" end
+	if(enum==AugmentedLagrangianREnum) return "AugmentedLagrangianR" end
+	if(enum==AugmentedLagrangianRholambdaEnum) return "AugmentedLagrangianRholambda" end
+	if(enum==AugmentedLagrangianRhopEnum) return "AugmentedLagrangianRhop" end
+	if(enum==AugmentedLagrangianRlambdaEnum) return "AugmentedLagrangianRlambda" end
+	if(enum==AugmentedLagrangianThetaEnum) return "AugmentedLagrangianTheta" end
+	if(enum==AutodiffCbufsizeEnum) return "AutodiffCbufsize" end
+	if(enum==AutodiffDependentObjectsEnum) return "AutodiffDependentObjects" end
+	if(enum==AutodiffDriverEnum) return "AutodiffDriver" end
+	if(enum==AutodiffFosForwardIndexEnum) return "AutodiffFosForwardIndex" end
+	if(enum==AutodiffFosReverseIndexEnum) return "AutodiffFosReverseIndex" end
+	if(enum==AutodiffFovForwardIndicesEnum) return "AutodiffFovForwardIndices" end
+	if(enum==AutodiffGcTriggerMaxSizeEnum) return "AutodiffGcTriggerMaxSize" end
+	if(enum==AutodiffGcTriggerRatioEnum) return "AutodiffGcTriggerRatio" end
+	if(enum==AutodiffIsautodiffEnum) return "AutodiffIsautodiff" end
+	if(enum==AutodiffLbufsizeEnum) return "AutodiffLbufsize" end
+	if(enum==AutodiffNumDependentsEnum) return "AutodiffNumDependents" end
+	if(enum==AutodiffNumIndependentsEnum) return "AutodiffNumIndependents" end
+	if(enum==AutodiffObufsizeEnum) return "AutodiffObufsize" end
+	if(enum==AutodiffTapeAllocEnum) return "AutodiffTapeAlloc" end
+	if(enum==AutodiffTbufsizeEnum) return "AutodiffTbufsize" end
+	if(enum==AutodiffXpEnum) return "AutodiffXp" end
+	if(enum==BalancethicknessStabilizationEnum) return "BalancethicknessStabilization" end
+	if(enum==BarystaticContributionsEnum) return "BarystaticContributions" end
+	if(enum==BasalforcingsBottomplumedepthEnum) return "BasalforcingsBottomplumedepth" end
+	if(enum==BasalforcingsCrustthicknessEnum) return "BasalforcingsCrustthickness" end
+	if(enum==BasalforcingsDeepwaterElevationEnum) return "BasalforcingsDeepwaterElevation" end
+	if(enum==BasalforcingsDeepwaterMeltingRateEnum) return "BasalforcingsDeepwaterMeltingRate" end
+	if(enum==BasalforcingsDtbgEnum) return "BasalforcingsDtbg" end
+	if(enum==BasalforcingsEnum) return "Basalforcings" end
+	if(enum==BasalforcingsIsmip6AverageTfEnum) return "BasalforcingsIsmip6AverageTf" end
+	if(enum==BasalforcingsIsmip6BasinAreaEnum) return "BasalforcingsIsmip6BasinArea" end
+	if(enum==BasalforcingsIsmip6DeltaTEnum) return "BasalforcingsIsmip6DeltaT" end
+	if(enum==BasalforcingsIsmip6Gamma0Enum) return "BasalforcingsIsmip6Gamma0" end
+	if(enum==BasalforcingsIsmip6IsLocalEnum) return "BasalforcingsIsmip6IsLocal" end
+	if(enum==BasalforcingsIsmip6NumBasinsEnum) return "BasalforcingsIsmip6NumBasins" end
+	if(enum==BasalforcingsIsmip6TfDepthsEnum) return "BasalforcingsIsmip6TfDepths" end
+	if(enum==BasalforcingsLowercrustheatEnum) return "BasalforcingsLowercrustheat" end
+	if(enum==BasalforcingsMantleconductivityEnum) return "BasalforcingsMantleconductivity" end
+	if(enum==BasalforcingsNusseltEnum) return "BasalforcingsNusselt" end
+	if(enum==BasalforcingsPicoAverageOverturningEnum) return "BasalforcingsPicoAverageOverturning" end
+	if(enum==BasalforcingsPicoAverageSalinityEnum) return "BasalforcingsPicoAverageSalinity" end
+	if(enum==BasalforcingsPicoAverageTemperatureEnum) return "BasalforcingsPicoAverageTemperature" end
+	if(enum==BasalforcingsPicoBoxAreaEnum) return "BasalforcingsPicoBoxArea" end
+	if(enum==BasalforcingsPicoFarOceansalinityEnum) return "BasalforcingsPicoFarOceansalinity" end
+	if(enum==BasalforcingsPicoFarOceantemperatureEnum) return "BasalforcingsPicoFarOceantemperature" end
+	if(enum==BasalforcingsPicoGammaTEnum) return "BasalforcingsPicoGammaT" end
+	if(enum==BasalforcingsPicoIsplumeEnum) return "BasalforcingsPicoIsplume" end
+	if(enum==BasalforcingsPicoMaxboxcountEnum) return "BasalforcingsPicoMaxboxcount" end
+	if(enum==BasalforcingsPicoNumBasinsEnum) return "BasalforcingsPicoNumBasins" end
+	if(enum==BasalforcingsPlumeradiusEnum) return "BasalforcingsPlumeradius" end
+	if(enum==BasalforcingsPlumexEnum) return "BasalforcingsPlumex" end
+	if(enum==BasalforcingsPlumeyEnum) return "BasalforcingsPlumey" end
+	if(enum==BasalforcingsThresholdThicknessEnum) return "BasalforcingsThresholdThickness" end
+	if(enum==BasalforcingsTopplumedepthEnum) return "BasalforcingsTopplumedepth" end
+	if(enum==BasalforcingsUppercrustheatEnum) return "BasalforcingsUppercrustheat" end
+	if(enum==BasalforcingsUppercrustthicknessEnum) return "BasalforcingsUppercrustthickness" end
+	if(enum==BasalforcingsUpperdepthMeltEnum) return "BasalforcingsUpperdepthMelt" end
+	if(enum==BasalforcingsUpperwaterElevationEnum) return "BasalforcingsUpperwaterElevation" end
+	if(enum==BasalforcingsUpperwaterMeltingRateEnum) return "BasalforcingsUpperwaterMeltingRate" end
+	if(enum==CalvingCrevasseDepthEnum) return "CalvingCrevasseDepth" end
+	if(enum==CalvingCrevasseThresholdEnum) return "CalvingCrevasseThreshold" end
+	if(enum==CalvingHeightAboveFloatationEnum) return "CalvingHeightAboveFloatation" end
+	if(enum==CalvingLawEnum) return "CalvingLaw" end
+	if(enum==CalvingMinthicknessEnum) return "CalvingMinthickness" end
+	if(enum==ConfigurationTypeEnum) return "ConfigurationType" end
+	if(enum==ConstantsGEnum) return "ConstantsG" end
+	if(enum==ConstantsNewtonGravityEnum) return "ConstantsNewtonGravity" end
+	if(enum==ConstantsReferencetemperatureEnum) return "ConstantsReferencetemperature" end
+	if(enum==ConstantsYtsEnum) return "ConstantsYts" end
+	if(enum==ControlInputSizeMEnum) return "ControlInputSizeM" end
+	if(enum==ControlInputSizeNEnum) return "ControlInputSizeN" end
+	if(enum==ControlInputInterpolationEnum) return "ControlInputInterpolation" end
+	if(enum==CumBslcEnum) return "CumBslc" end
+	if(enum==CumBslcIceEnum) return "CumBslcIce" end
+	if(enum==CumBslcHydroEnum) return "CumBslcHydro" end
+	if(enum==CumBslcOceanEnum) return "CumBslcOcean" end
+	if(enum==CumBslcIcePartitionEnum) return "CumBslcIcePartition" end
+	if(enum==CumBslcHydroPartitionEnum) return "CumBslcHydroPartition" end
+	if(enum==CumBslcOceanPartitionEnum) return "CumBslcOceanPartition" end
+	if(enum==CumGmtslcEnum) return "CumGmtslc" end
+	if(enum==CumGmslcEnum) return "CumGmslc" end
+	if(enum==DamageC1Enum) return "DamageC1" end
+	if(enum==DamageC2Enum) return "DamageC2" end
+	if(enum==DamageC3Enum) return "DamageC3" end
+	if(enum==DamageC4Enum) return "DamageC4" end
+	if(enum==DamageEnum) return "Damage" end
+	if(enum==DamageEquivStressEnum) return "DamageEquivStress" end
+	if(enum==DamageEvolutionNumRequestedOutputsEnum) return "DamageEvolutionNumRequestedOutputs" end
+	if(enum==DamageEvolutionRequestedOutputsEnum) return "DamageEvolutionRequestedOutputs" end
+	if(enum==DamageHealingEnum) return "DamageHealing" end
+	if(enum==DamageKappaEnum) return "DamageKappa" end
+	if(enum==DamageLawEnum) return "DamageLaw" end
+	if(enum==DamageMaxDamageEnum) return "DamageMaxDamage" end
+	if(enum==DamageStabilizationEnum) return "DamageStabilization" end
+	if(enum==DamageStressThresholdEnum) return "DamageStressThreshold" end
+	if(enum==DamageStressUBoundEnum) return "DamageStressUBound" end
+	if(enum==DebugProfilingEnum) return "DebugProfiling" end
+	if(enum==DomainDimensionEnum) return "DomainDimension" end
+	if(enum==DomainTypeEnum) return "DomainType" end
+	if(enum==DslModelEnum) return "DslModel" end
+	if(enum==DslModelidEnum) return "DslModelid" end
+	if(enum==DslNummodelsEnum) return "DslNummodels" end
+	if(enum==SolidearthIsExternalEnum) return "SolidearthIsExternal" end
+	if(enum==SolidearthExternalNatureEnum) return "SolidearthExternalNature" end
+	if(enum==SolidearthExternalModelidEnum) return "SolidearthExternalModelid" end
+	if(enum==SolidearthExternalNummodelsEnum) return "SolidearthExternalNummodels" end
+	if(enum==SolidearthSettingsComputeBpGrdEnum) return "SolidearthSettingsComputeBpGrd" end
+	if(enum==EarthIdEnum) return "EarthId" end
+	if(enum==ElasticEnum) return "Elastic" end
+	if(enum==EplZigZagCounterEnum) return "EplZigZagCounter" end
+	if(enum==EsaHElasticEnum) return "EsaHElastic" end
+	if(enum==EsaHemisphereEnum) return "EsaHemisphere" end
+	if(enum==EsaRequestedOutputsEnum) return "EsaRequestedOutputs" end
+	if(enum==EsaUElasticEnum) return "EsaUElastic" end
+	if(enum==ExtrapolationVariableEnum) return "ExtrapolationVariable" end
+	if(enum==FemModelCommEnum) return "FemModelComm" end
+	if(enum==FieldsEnum) return "Fields" end
+	if(enum==FlowequationFeFSEnum) return "FlowequationFeFS" end
+	if(enum==FlowequationIsFSEnum) return "FlowequationIsFS" end
+	if(enum==FlowequationIsHOEnum) return "FlowequationIsHO" end
+	if(enum==FlowequationIsL1L2Enum) return "FlowequationIsL1L2" end
+	if(enum==FlowequationIsMLHOEnum) return "FlowequationIsMLHO" end
+	if(enum==FlowequationIsSIAEnum) return "FlowequationIsSIA" end
+	if(enum==FlowequationIsSSAEnum) return "FlowequationIsSSA" end
+	if(enum==FlowequationIsNitscheEnum) return "FlowequationIsNitsche" end
+	if(enum==FeFSNitscheGammaEnum) return "FeFSNitscheGamma" end
+	if(enum==FrictionCouplingEnum) return "FrictionCoupling" end
+	if(enum==FrictionDeltaEnum) return "FrictionDelta" end
+	if(enum==FrictionEffectivePressureLimitEnum) return "FrictionEffectivePressureLimit" end
+	if(enum==FrictionFEnum) return "FrictionF" end
+	if(enum==FrictionGammaEnum) return "FrictionGamma" end
+	if(enum==FrictionLawEnum) return "FrictionLaw" end
+	if(enum==FrictionPseudoplasticityExponentEnum) return "FrictionPseudoplasticityExponent" end
+	if(enum==FrictionThresholdSpeedEnum) return "FrictionThresholdSpeed" end
+	if(enum==FrictionVoidRatioEnum) return "FrictionVoidRatio" end
+	if(enum==FrontalForcingsBasinIcefrontAreaEnum) return "FrontalForcingsBasinIcefrontArea" end
+	if(enum==FrontalForcingsAutoregressionInitialTimeEnum) return "FrontalForcingsAutoregressionInitialTime" end
+	if(enum==FrontalForcingsAutoregressionTimestepEnum) return "FrontalForcingsAutoregressionTimestep" end
+	if(enum==FrontalForcingsAutoregressiveOrderEnum) return "FrontalForcingsAutoregressiveOrder" end
+	if(enum==FrontalForcingsBeta0Enum) return "FrontalForcingsBeta0" end
+	if(enum==FrontalForcingsBeta1Enum) return "FrontalForcingsBeta1" end
+	if(enum==FrontalForcingsNumberofBasinsEnum) return "FrontalForcingsNumberofBasins" end
+	if(enum==FrontalForcingsParamEnum) return "FrontalForcingsParam" end
+	if(enum==FrontalForcingsPhiEnum) return "FrontalForcingsPhi" end
+	if(enum==GrdModelEnum) return "GrdModel" end
+	if(enum==GroundinglineFrictionInterpolationEnum) return "GroundinglineFrictionInterpolation" end
+	if(enum==GroundinglineMeltInterpolationEnum) return "GroundinglineMeltInterpolation" end
+	if(enum==GroundinglineMigrationEnum) return "GroundinglineMigration" end
+	if(enum==HydrologyAveragingEnum) return "HydrologyAveraging" end
+	if(enum==HydrologyCavitySpacingEnum) return "HydrologyCavitySpacing" end
+	if(enum==HydrologyChannelConductivityEnum) return "HydrologyChannelConductivity" end
+	if(enum==HydrologyChannelSheetWidthEnum) return "HydrologyChannelSheetWidth" end
+	if(enum==HydrologyEnglacialVoidRatioEnum) return "HydrologyEnglacialVoidRatio" end
+	if(enum==HydrologyIschannelsEnum) return "HydrologyIschannels" end
+	if(enum==HydrologyMeltFlagEnum) return "HydrologyMeltFlag" end
+	if(enum==HydrologyModelEnum) return "HydrologyModel" end
+	if(enum==HydrologyNumRequestedOutputsEnum) return "HydrologyNumRequestedOutputs" end
+	if(enum==HydrologyPressureMeltCoefficientEnum) return "HydrologyPressureMeltCoefficient" end
+	if(enum==HydrologyRelaxationEnum) return "HydrologyRelaxation" end
+	if(enum==HydrologyRequestedOutputsEnum) return "HydrologyRequestedOutputs" end
+	if(enum==HydrologySedimentKmaxEnum) return "HydrologySedimentKmax" end
+	if(enum==HydrologyStepsPerStepEnum) return "HydrologyStepsPerStep" end
+	if(enum==HydrologyStorageEnum) return "HydrologyStorage" end
+	if(enum==HydrologydcEplColapseThicknessEnum) return "HydrologydcEplColapseThickness" end
+	if(enum==HydrologydcEplConductivityEnum) return "HydrologydcEplConductivity" end
+	if(enum==HydrologydcEplInitialThicknessEnum) return "HydrologydcEplInitialThickness" end
+	if(enum==HydrologydcEplLayerCompressibilityEnum) return "HydrologydcEplLayerCompressibility" end
+	if(enum==HydrologydcEplMaxThicknessEnum) return "HydrologydcEplMaxThickness" end
+	if(enum==HydrologydcEplPoreWaterMassEnum) return "HydrologydcEplPoreWaterMass" end
+	if(enum==HydrologydcEplThickCompEnum) return "HydrologydcEplThickComp" end
+	if(enum==HydrologydcEplflipLockEnum) return "HydrologydcEplflipLock" end
+	if(enum==HydrologydcIsefficientlayerEnum) return "HydrologydcIsefficientlayer" end
+	if(enum==HydrologydcLeakageFactorEnum) return "HydrologydcLeakageFactor" end
+	if(enum==HydrologydcMaxIterEnum) return "HydrologydcMaxIter" end
+	if(enum==HydrologydcPenaltyFactorEnum) return "HydrologydcPenaltyFactor" end
+	if(enum==HydrologydcPenaltyLockEnum) return "HydrologydcPenaltyLock" end
+	if(enum==HydrologydcRelTolEnum) return "HydrologydcRelTol" end
+	if(enum==HydrologydcSedimentlimitEnum) return "HydrologydcSedimentlimit" end
+	if(enum==HydrologydcSedimentlimitFlagEnum) return "HydrologydcSedimentlimitFlag" end
+	if(enum==HydrologydcSedimentLayerCompressibilityEnum) return "HydrologydcSedimentLayerCompressibility" end
+	if(enum==HydrologydcSedimentPoreWaterMassEnum) return "HydrologydcSedimentPoreWaterMass" end
+	if(enum==HydrologydcSedimentPorosityEnum) return "HydrologydcSedimentPorosity" end
+	if(enum==HydrologydcSedimentThicknessEnum) return "HydrologydcSedimentThickness" end
+	if(enum==HydrologydcTransferFlagEnum) return "HydrologydcTransferFlag" end
+	if(enum==HydrologydcUnconfinedFlagEnum) return "HydrologydcUnconfinedFlag" end
+	if(enum==HydrologyshreveStabilizationEnum) return "HydrologyshreveStabilization" end
+	if(enum==IcecapToEarthCommEnum) return "IcecapToEarthComm" end
+	if(enum==IndexEnum) return "Index" end
+	if(enum==InputFileNameEnum) return "InputFileName" end
+	if(enum==DirectoryNameEnum) return "DirectoryName" end
+	if(enum==IndicesEnum) return "Indices" end
+	if(enum==InputToDepthaverageInEnum) return "InputToDepthaverageIn" end
+	if(enum==InputToDepthaverageOutEnum) return "InputToDepthaverageOut" end
+	if(enum==InputToExtrudeEnum) return "InputToExtrude" end
+	if(enum==InputToL2ProjectEnum) return "InputToL2Project" end
+	if(enum==InputToSmoothEnum) return "InputToSmooth" end
+	if(enum==InversionAlgorithmEnum) return "InversionAlgorithm" end
+	if(enum==InversionControlParametersEnum) return "InversionControlParameters" end
+	if(enum==InversionControlScalingFactorsEnum) return "InversionControlScalingFactors" end
+	if(enum==InversionCostFunctionsEnum) return "InversionCostFunctions" end
+	if(enum==InversionDxminEnum) return "InversionDxmin" end
+	if(enum==InversionGatolEnum) return "InversionGatol" end
+	if(enum==InversionGradientScalingEnum) return "InversionGradientScaling" end
+	if(enum==InversionGrtolEnum) return "InversionGrtol" end
+	if(enum==InversionGttolEnum) return "InversionGttol" end
+	if(enum==InversionIncompleteAdjointEnum) return "InversionIncompleteAdjoint" end
+	if(enum==InversionIscontrolEnum) return "InversionIscontrol" end
+	if(enum==InversionMaxiterEnum) return "InversionMaxiter" end
+	if(enum==InversionMaxiterPerStepEnum) return "InversionMaxiterPerStep" end
+	if(enum==InversionMaxstepsEnum) return "InversionMaxsteps" end
+	if(enum==InversionNstepsEnum) return "InversionNsteps" end
+	if(enum==InversionNumControlParametersEnum) return "InversionNumControlParameters" end
+	if(enum==InversionNumCostFunctionsEnum) return "InversionNumCostFunctions" end
+	if(enum==InversionStepThresholdEnum) return "InversionStepThreshold" end
+	if(enum==InversionTypeEnum) return "InversionType" end
+	if(enum==IvinsEnum) return "Ivins" end
+	if(enum==IsSlcCouplingEnum) return "IsSlcCoupling" end
+	if(enum==LevelsetKillIcebergsEnum) return "LevelsetKillIcebergs" end
+	if(enum==LevelsetReinitFrequencyEnum) return "LevelsetReinitFrequency" end
+	if(enum==LevelsetStabilizationEnum) return "LevelsetStabilization" end
+	if(enum==LockFileNameEnum) return "LockFileName" end
+	if(enum==LoveAllowLayerDeletionEnum) return "LoveAllowLayerDeletion" end
+	if(enum==LoveCoreMantleBoundaryEnum) return "LoveCoreMantleBoundary" end
+	if(enum==LoveEarthMassEnum) return "LoveEarthMass" end
+	if(enum==LoveForcingTypeEnum) return "LoveForcingType" end
+	if(enum==LoveFrequenciesEnum) return "LoveFrequencies" end
+	if(enum==LoveIsTemporalEnum) return "LoveIsTemporal" end
+	if(enum==LoveG0Enum) return "LoveG0" end
+	if(enum==LoveGravitationalConstantEnum) return "LoveGravitationalConstant" end
+	if(enum==LoveInnerCoreBoundaryEnum) return "LoveInnerCoreBoundary" end
+	if(enum==LoveComplexComputationEnum) return "LoveComplexComputation" end
+	if(enum==LoveIntStepsPerLayerEnum) return "LoveIntStepsPerLayer" end
+	if(enum==LoveKernelsEnum) return "LoveKernels" end
+	if(enum==LoveMu0Enum) return "LoveMu0" end
+	if(enum==LoveNfreqEnum) return "LoveNfreq" end
+	if(enum==LoveNTemporalIterationsEnum) return "LoveNTemporalIterations" end
+	if(enum==LoveNYiEquationsEnum) return "LoveNYiEquations" end
+	if(enum==LoveR0Enum) return "LoveR0" end
+	if(enum==LoveShNmaxEnum) return "LoveShNmax" end
+	if(enum==LoveShNminEnum) return "LoveShNmin" end
+	if(enum==LoveStartingLayerEnum) return "LoveStartingLayer" end
+	if(enum==LoveUnderflowTolEnum) return "LoveUnderflowTol" end
+	if(enum==MassFluxSegmentsEnum) return "MassFluxSegments" end
+	if(enum==MassFluxSegmentsPresentEnum) return "MassFluxSegmentsPresent" end
+	if(enum==MasstransportHydrostaticAdjustmentEnum) return "MasstransportHydrostaticAdjustment" end
+	if(enum==MasstransportIsfreesurfaceEnum) return "MasstransportIsfreesurface" end
+	if(enum==MasstransportMinThicknessEnum) return "MasstransportMinThickness" end
+	if(enum==MasstransportNumRequestedOutputsEnum) return "MasstransportNumRequestedOutputs" end
+	if(enum==MasstransportPenaltyFactorEnum) return "MasstransportPenaltyFactor" end
+	if(enum==MasstransportRequestedOutputsEnum) return "MasstransportRequestedOutputs" end
+	if(enum==MasstransportStabilizationEnum) return "MasstransportStabilization" end
+	if(enum==MaterialsBetaEnum) return "MaterialsBeta" end
+	if(enum==MaterialsEarthDensityEnum) return "MaterialsEarthDensity" end
+	if(enum==MaterialsEffectiveconductivityAveragingEnum) return "MaterialsEffectiveconductivityAveraging" end
+	if(enum==MaterialsHeatcapacityEnum) return "MaterialsHeatcapacity" end
+	if(enum==MaterialsLatentheatEnum) return "MaterialsLatentheat" end
+	if(enum==MaterialsMeltingpointEnum) return "MaterialsMeltingpoint" end
+	if(enum==MaterialsMixedLayerCapacityEnum) return "MaterialsMixedLayerCapacity" end
+	if(enum==MaterialsMuWaterEnum) return "MaterialsMuWater" end
+	if(enum==MaterialsRheologyLawEnum) return "MaterialsRheologyLaw" end
+	if(enum==MaterialsRhoFreshwaterEnum) return "MaterialsRhoFreshwater" end
+	if(enum==MaterialsRhoIceEnum) return "MaterialsRhoIce" end
+	if(enum==MaterialsRhoSeawaterEnum) return "MaterialsRhoSeawater" end
+	if(enum==MaterialsTemperateiceconductivityEnum) return "MaterialsTemperateiceconductivity" end
+	if(enum==MaterialsThermalExchangeVelocityEnum) return "MaterialsThermalExchangeVelocity" end
+	if(enum==MaterialsThermalconductivityEnum) return "MaterialsThermalconductivity" end
+	if(enum==MeltingOffsetEnum) return "MeltingOffset" end
+	if(enum==MeshAverageVertexConnectivityEnum) return "MeshAverageVertexConnectivity" end
+	if(enum==MeshElementtypeEnum) return "MeshElementtype" end
+	if(enum==MeshNumberoflayersEnum) return "MeshNumberoflayers" end
+	if(enum==MeshNumberofverticesEnum) return "MeshNumberofvertices" end
+	if(enum==MeshNumberofelementsEnum) return "MeshNumberofelements" end
+	if(enum==MigrationMaxEnum) return "MigrationMax" end
+	if(enum==ModelIdEnum) return "ModelId" end
+	if(enum==NbinsEnum) return "Nbins" end
+	if(enum==NodesEnum) return "Nodes" end
+	if(enum==NumModelsEnum) return "NumModels" end
+	if(enum==OceanGridNxEnum) return "OceanGridNx" end
+	if(enum==OceanGridNyEnum) return "OceanGridNy" end
+	if(enum==OceanGridXEnum) return "OceanGridX" end
+	if(enum==OceanGridYEnum) return "OceanGridY" end
+	if(enum==OutputBufferPointerEnum) return "OutputBufferPointer" end
+	if(enum==OutputBufferSizePointerEnum) return "OutputBufferSizePointer" end
+	if(enum==OutputFileNameEnum) return "OutputFileName" end
+	if(enum==OutputFilePointerEnum) return "OutputFilePointer" end
+	if(enum==OutputdefinitionEnum) return "Outputdefinition" end
+	if(enum==QmuErrNameEnum) return "QmuErrName" end
+	if(enum==QmuInNameEnum) return "QmuInName" end
+	if(enum==QmuIsdakotaEnum) return "QmuIsdakota" end
+	if(enum==QmuOutNameEnum) return "QmuOutName" end
+	if(enum==QmuOutputEnum) return "QmuOutput" end
+	if(enum==QmuCurrEvalIdEnum) return "QmuCurrEvalId" end
+	if(enum==QmuNsampleEnum) return "QmuNsample" end
+	if(enum==QmuResponsedescriptorsEnum) return "QmuResponsedescriptors" end
+	if(enum==QmuVariableDescriptorsEnum) return "QmuVariableDescriptors" end
+	if(enum==QmuVariablePartitionsEnum) return "QmuVariablePartitions" end
+	if(enum==QmuVariablePartitionsNpartEnum) return "QmuVariablePartitionsNpart" end
+	if(enum==QmuVariablePartitionsNtEnum) return "QmuVariablePartitionsNt" end
+	if(enum==QmuResponsePartitionsEnum) return "QmuResponsePartitions" end
+	if(enum==QmuResponsePartitionsNpartEnum) return "QmuResponsePartitionsNpart" end
+	if(enum==QmuStatisticsEnum) return "QmuStatistics" end
+	if(enum==QmuNumstatisticsEnum) return "QmuNumstatistics" end
+	if(enum==QmuNdirectoriesEnum) return "QmuNdirectories" end
+	if(enum==QmuNfilesPerDirectoryEnum) return "QmuNfilesPerDirectory" end
+	if(enum==QmuStatisticsMethodEnum) return "QmuStatisticsMethod" end
+	if(enum==QmuMethodsEnum) return "QmuMethods" end
+	if(enum==RestartFileNameEnum) return "RestartFileName" end
+	if(enum==ResultsEnum) return "Results" end
+	if(enum==RootPathEnum) return "RootPath" end
+	if(enum==ModelnameEnum) return "Modelname" end
+	if(enum==SamplingAlphaEnum) return "SamplingAlpha" end
+	if(enum==SamplingPhiEnum) return "SamplingPhi" end
+	if(enum==SamplingNumRequestedOutputsEnum) return "SamplingNumRequestedOutputs" end
+	if(enum==SamplingRequestedOutputsEnum) return "SamplingRequestedOutputs" end
+	if(enum==SamplingRobinEnum) return "SamplingRobin" end
+	if(enum==SamplingSeedEnum) return "SamplingSeed" end
+	if(enum==SamplingTauEnum) return "SamplingTau" end
+	if(enum==SaveResultsEnum) return "SaveResults" end
+	if(enum==SolidearthPartitionIceEnum) return "SolidearthPartitionIce" end
+	if(enum==SolidearthPartitionHydroEnum) return "SolidearthPartitionHydro" end
+	if(enum==SolidearthPartitionOceanEnum) return "SolidearthPartitionOcean" end
+	if(enum==SolidearthNpartIceEnum) return "SolidearthNpartIce" end
+	if(enum==SolidearthNpartOceanEnum) return "SolidearthNpartOcean" end
+	if(enum==SolidearthNpartHydroEnum) return "SolidearthNpartHydro" end
+	if(enum==SolidearthPlanetRadiusEnum) return "SolidearthPlanetRadius" end
+	if(enum==SolidearthPlanetAreaEnum) return "SolidearthPlanetArea" end
+	if(enum==SolidearthSettingsAbstolEnum) return "SolidearthSettingsAbstol" end
+	if(enum==SolidearthSettingsCrossSectionShapeEnum) return "SolidearthSettingsCrossSectionShape" end
+	if(enum==RotationalAngularVelocityEnum) return "RotationalAngularVelocity" end
+	if(enum==SolidearthSettingsElasticEnum) return "SolidearthSettingsElastic" end
+	if(enum==SolidearthSettingsViscousEnum) return "SolidearthSettingsViscous" end
+	if(enum==SealevelchangeGeometryDoneEnum) return "SealevelchangeGeometryDone" end
+	if(enum==SealevelchangeViscousNumStepsEnum) return "SealevelchangeViscousNumSteps" end
+	if(enum==SealevelchangeViscousTimesEnum) return "SealevelchangeViscousTimes" end
+	if(enum==SealevelchangeViscousIndexEnum) return "SealevelchangeViscousIndex" end
+	if(enum==RotationalEquatorialMoiEnum) return "RotationalEquatorialMoi" end
+	if(enum==TidalLoveHEnum) return "TidalLoveH" end
+	if(enum==TidalLoveKEnum) return "TidalLoveK" end
+	if(enum==TidalLoveLEnum) return "TidalLoveL" end
+	if(enum==TidalLoveK2SecularEnum) return "TidalLoveK2Secular" end
+	if(enum==LoadLoveHEnum) return "LoadLoveH" end
+	if(enum==LoadLoveKEnum) return "LoadLoveK" end
+	if(enum==LoadLoveLEnum) return "LoadLoveL" end
+	if(enum==LoveTimeFreqEnum) return "LoveTimeFreq" end
+	if(enum==LoveIsTimeEnum) return "LoveIsTime" end
+	if(enum==SealevelchangeGSelfAttractionEnum) return "SealevelchangeGSelfAttraction" end
+	if(enum==SealevelchangeGViscoElasticEnum) return "SealevelchangeGViscoElastic" end
+	if(enum==SolidearthSettingsSealevelLoadingEnum) return "SolidearthSettingsSealevelLoading" end
+	if(enum==SolidearthSettingsGRDEnum) return "SolidearthSettingsGRD" end
+	if(enum==SolidearthSettingsRunFrequencyEnum) return "SolidearthSettingsRunFrequency" end
+	if(enum==SolidearthSettingsTimeAccEnum) return "SolidearthSettingsTimeAcc" end
+	if(enum==SealevelchangeHViscoElasticEnum) return "SealevelchangeHViscoElastic" end
+	if(enum==SolidearthSettingsHorizEnum) return "SolidearthSettingsHoriz" end
+	if(enum==SolidearthSettingsMaxiterEnum) return "SolidearthSettingsMaxiter" end
+	if(enum==SolidearthSettingsGrdOceanEnum) return "SolidearthSettingsGrdOcean" end
+	if(enum==SolidearthSettingsOceanAreaScalingEnum) return "SolidearthSettingsOceanAreaScaling" end
+	if(enum==StochasticForcingCovarianceEnum) return "StochasticForcingCovariance" end
+	if(enum==StochasticForcingDefaultDimensionEnum) return "StochasticForcingDefaultDimension" end
+	if(enum==StochasticForcingDimensionsEnum) return "StochasticForcingDimensions" end
+	if(enum==StochasticForcingFieldsEnum) return "StochasticForcingFields" end
+	if(enum==StochasticForcingIsEffectivePressureEnum) return "StochasticForcingIsEffectivePressure" end
+	if(enum==StochasticForcingIsStochasticForcingEnum) return "StochasticForcingIsStochasticForcing" end
+	if(enum==StochasticForcingIsWaterPressureEnum) return "StochasticForcingIsWaterPressure" end
+	if(enum==StochasticForcingNumFieldsEnum) return "StochasticForcingNumFields" end
+	if(enum==StochasticForcingRandomflagEnum) return "StochasticForcingRandomflag" end
+	if(enum==RotationalPolarMoiEnum) return "RotationalPolarMoi" end
+	if(enum==SolidearthSettingsReltolEnum) return "SolidearthSettingsReltol" end
+	if(enum==SealevelchangeRequestedOutputsEnum) return "SealevelchangeRequestedOutputs" end
+	if(enum==SolidearthSettingsSelfAttractionEnum) return "SolidearthSettingsSelfAttraction" end
+	if(enum==SolidearthSettingsRotationEnum) return "SolidearthSettingsRotation" end
+	if(enum==SolidearthSettingsMaxSHCoeffEnum) return "SolidearthSettingsMaxSHCoeff" end
+	if(enum==SealevelchangeRunCountEnum) return "SealevelchangeRunCount" end
+	if(enum==SealevelchangeTransitionsEnum) return "SealevelchangeTransitions" end
+	if(enum==SealevelchangeUViscoElasticEnum) return "SealevelchangeUViscoElastic" end
+	if(enum==SettingsIoGatherEnum) return "SettingsIoGather" end
+	if(enum==SettingsNumResultsOnNodesEnum) return "SettingsNumResultsOnNodes" end
+	if(enum==SettingsOutputFrequencyEnum) return "SettingsOutputFrequency" end
+	if(enum==SettingsCheckpointFrequencyEnum) return "SettingsCheckpointFrequency" end
+	if(enum==SettingsResultsOnNodesEnum) return "SettingsResultsOnNodes" end
+	if(enum==SettingsSbCouplingFrequencyEnum) return "SettingsSbCouplingFrequency" end
+	if(enum==SettingsSolverResidueThresholdEnum) return "SettingsSolverResidueThreshold" end
+	if(enum==SettingsWaitonlockEnum) return "SettingsWaitonlock" end
+	if(enum==SmbAIceEnum) return "SmbAIce" end
+	if(enum==SmbAIdxEnum) return "SmbAIdx" end
+	if(enum==SmbASnowEnum) return "SmbASnow" end
+	if(enum==SmbAccualtiEnum) return "SmbAccualti" end
+	if(enum==SmbAccugradEnum) return "SmbAccugrad" end
+	if(enum==SmbAccurefEnum) return "SmbAccuref" end
+	if(enum==SmbAdThreshEnum) return "SmbAdThresh" end
+	if(enum==SmbAutoregressionInitialTimeEnum) return "SmbAutoregressionInitialTime" end
+	if(enum==SmbAutoregressionTimestepEnum) return "SmbAutoregressionTimestep" end
+	if(enum==SmbAutoregressiveOrderEnum) return "SmbAutoregressiveOrder" end
+	if(enum==SmbAveragingEnum) return "SmbAveraging" end
+	if(enum==SmbBeta0Enum) return "SmbBeta0" end
+	if(enum==SmbBeta1Enum) return "SmbBeta1" end
+	if(enum==SmbDesfacEnum) return "SmbDesfac" end
+	if(enum==SmbDpermilEnum) return "SmbDpermil" end
+	if(enum==SmbDsnowIdxEnum) return "SmbDsnowIdx" end
+	if(enum==SmbCldFracEnum) return "SmbCldFrac" end
+	if(enum==SmbDelta18oEnum) return "SmbDelta18o" end
+	if(enum==SmbDelta18oSurfaceEnum) return "SmbDelta18oSurface" end
+	if(enum==SmbDenIdxEnum) return "SmbDenIdx" end
+	if(enum==SmbDtEnum) return "SmbDt" end
+	if(enum==SmbEnum) return "Smb" end
+	if(enum==SmbEIdxEnum) return "SmbEIdx" end
+	if(enum==SmbFEnum) return "SmbF" end
+	if(enum==SmbInitDensityScalingEnum) return "SmbInitDensityScaling" end
+	if(enum==SmbIsaccumulationEnum) return "SmbIsaccumulation" end
+	if(enum==SmbIsalbedoEnum) return "SmbIsalbedo" end
+	if(enum==SmbIsconstrainsurfaceTEnum) return "SmbIsconstrainsurfaceT" end
+	if(enum==SmbIsd18opdEnum) return "SmbIsd18opd" end
+	if(enum==SmbIsdelta18oEnum) return "SmbIsdelta18o" end
+	if(enum==SmbIsdensificationEnum) return "SmbIsdensification" end
+	if(enum==SmbIsdeltaLWupEnum) return "SmbIsdeltaLWup" end
+	if(enum==SmbIsfirnwarmingEnum) return "SmbIsfirnwarming" end
+	if(enum==SmbIsgraingrowthEnum) return "SmbIsgraingrowth" end
+	if(enum==SmbIsmeltEnum) return "SmbIsmelt" end
+	if(enum==SmbIsmungsmEnum) return "SmbIsmungsm" end
+	if(enum==SmbIsprecipscaledEnum) return "SmbIsprecipscaled" end
+	if(enum==SmbIssetpddfacEnum) return "SmbIssetpddfac" end
+	if(enum==SmbIsshortwaveEnum) return "SmbIsshortwave" end
+	if(enum==SmbIstemperaturescaledEnum) return "SmbIstemperaturescaled" end
+	if(enum==SmbIsthermalEnum) return "SmbIsthermal" end
+	if(enum==SmbIsturbulentfluxEnum) return "SmbIsturbulentflux" end
+	if(enum==SmbKEnum) return "SmbK" end
+	if(enum==SmbNumBasinsEnum) return "SmbNumBasins" end
+	if(enum==SmbNumRequestedOutputsEnum) return "SmbNumRequestedOutputs" end
+	if(enum==SmbPfacEnum) return "SmbPfac" end
+	if(enum==SmbPhiEnum) return "SmbPhi" end
+	if(enum==SmbRdlEnum) return "SmbRdl" end
+	if(enum==SmbRequestedOutputsEnum) return "SmbRequestedOutputs" end
+	if(enum==SmbRlapsEnum) return "SmbRlaps" end
+	if(enum==SmbRlapslgmEnum) return "SmbRlapslgm" end
+	if(enum==SmbRunoffaltiEnum) return "SmbRunoffalti" end
+	if(enum==SmbRunoffgradEnum) return "SmbRunoffgrad" end
+	if(enum==SmbRunoffrefEnum) return "SmbRunoffref" end
+	if(enum==SmbSealevEnum) return "SmbSealev" end
+	if(enum==SmbStepsPerStepEnum) return "SmbStepsPerStep" end
+	if(enum==SmbSwIdxEnum) return "SmbSwIdx" end
+	if(enum==SmbT0dryEnum) return "SmbT0dry" end
+	if(enum==SmbT0wetEnum) return "SmbT0wet" end
+	if(enum==SmbTeThreshEnum) return "SmbTeThresh" end
+	if(enum==SmbTdiffEnum) return "SmbTdiff" end
+	if(enum==SmbThermoDeltaTScalingEnum) return "SmbThermoDeltaTScaling" end
+	if(enum==SmbTemperaturesReconstructedYearsEnum) return "SmbTemperaturesReconstructedYears" end
+	if(enum==SmbPrecipitationsReconstructedYearsEnum) return "SmbPrecipitationsReconstructedYears" end
+	if(enum==SmoothThicknessMultiplierEnum) return "SmoothThicknessMultiplier" end
+	if(enum==SolutionTypeEnum) return "SolutionType" end
+	if(enum==SteadystateMaxiterEnum) return "SteadystateMaxiter" end
+	if(enum==SteadystateNumRequestedOutputsEnum) return "SteadystateNumRequestedOutputs" end
+	if(enum==SteadystateReltolEnum) return "SteadystateReltol" end
+	if(enum==SteadystateRequestedOutputsEnum) return "SteadystateRequestedOutputs" end
+	if(enum==StepEnum) return "Step" end
+	if(enum==StepsEnum) return "Steps" end
+	if(enum==StressbalanceAbstolEnum) return "StressbalanceAbstol" end
+	if(enum==StressbalanceFSreconditioningEnum) return "StressbalanceFSreconditioning" end
+	if(enum==StressbalanceIsnewtonEnum) return "StressbalanceIsnewton" end
+	if(enum==StressbalanceMaxiterEnum) return "StressbalanceMaxiter" end
+	if(enum==StressbalanceNumRequestedOutputsEnum) return "StressbalanceNumRequestedOutputs" end
+	if(enum==StressbalancePenaltyFactorEnum) return "StressbalancePenaltyFactor" end
+	if(enum==StressbalanceReltolEnum) return "StressbalanceReltol" end
+	if(enum==StressbalanceRequestedOutputsEnum) return "StressbalanceRequestedOutputs" end
+	if(enum==StressbalanceRestolEnum) return "StressbalanceRestol" end
+	if(enum==StressbalanceRiftPenaltyThresholdEnum) return "StressbalanceRiftPenaltyThreshold" end
+	if(enum==StressbalanceShelfDampeningEnum) return "StressbalanceShelfDampening" end
+	if(enum==ThermalIsdrainicecolumnEnum) return "ThermalIsdrainicecolumn" end
+	if(enum==ThermalIsdynamicbasalspcEnum) return "ThermalIsdynamicbasalspc" end
+	if(enum==ThermalIsenthalpyEnum) return "ThermalIsenthalpy" end
+	if(enum==ThermalMaxiterEnum) return "ThermalMaxiter" end
+	if(enum==ThermalNumRequestedOutputsEnum) return "ThermalNumRequestedOutputs" end
+	if(enum==ThermalPenaltyFactorEnum) return "ThermalPenaltyFactor" end
+	if(enum==ThermalPenaltyLockEnum) return "ThermalPenaltyLock" end
+	if(enum==ThermalPenaltyThresholdEnum) return "ThermalPenaltyThreshold" end
+	if(enum==ThermalReltolEnum) return "ThermalReltol" end
+	if(enum==ThermalRequestedOutputsEnum) return "ThermalRequestedOutputs" end
+	if(enum==ThermalStabilizationEnum) return "ThermalStabilization" end
+	if(enum==ThermalWatercolumnUpperlimitEnum) return "ThermalWatercolumnUpperlimit" end
+	if(enum==TimeEnum) return "Time" end
+	if(enum==TimesteppingCflCoefficientEnum) return "TimesteppingCflCoefficient" end
+	if(enum==TimesteppingCouplingTimeEnum) return "TimesteppingCouplingTime" end
+	if(enum==TimesteppingFinalTimeEnum) return "TimesteppingFinalTime" end
+	if(enum==TimesteppingInterpForcingEnum) return "TimesteppingInterpForcing" end
+	if(enum==TimesteppingCycleForcingEnum) return "TimesteppingCycleForcing" end
+	if(enum==TimesteppingStartTimeEnum) return "TimesteppingStartTime" end
+	if(enum==TimesteppingTimeStepEnum) return "TimesteppingTimeStep" end
+	if(enum==TimesteppingTimeStepMaxEnum) return "TimesteppingTimeStepMax" end
+	if(enum==TimesteppingTimeStepMinEnum) return "TimesteppingTimeStepMin" end
+	if(enum==TimesteppingTypeEnum) return "TimesteppingType" end
+	if(enum==ToMITgcmCommEnum) return "ToMITgcmComm" end
+	if(enum==ToolkitsFileNameEnum) return "ToolkitsFileName" end
+	if(enum==ToolkitsOptionsAnalysesEnum) return "ToolkitsOptionsAnalyses" end
+	if(enum==ToolkitsOptionsStringsEnum) return "ToolkitsOptionsStrings" end
+	if(enum==ToolkitsTypesEnum) return "ToolkitsTypes" end
+	if(enum==TransientAmrFrequencyEnum) return "TransientAmrFrequency" end
+	if(enum==TransientIsdamageevolutionEnum) return "TransientIsdamageevolution" end
+	if(enum==TransientIsesaEnum) return "TransientIsesa" end
+	if(enum==TransientIsgiaEnum) return "TransientIsgia" end
+	if(enum==TransientIsgroundinglineEnum) return "TransientIsgroundingline" end
+	if(enum==TransientIshydrologyEnum) return "TransientIshydrology" end
+	if(enum==TransientIsmasstransportEnum) return "TransientIsmasstransport" end
+	if(enum==TransientIsoceantransportEnum) return "TransientIsoceantransport" end
+	if(enum==TransientIsmovingfrontEnum) return "TransientIsmovingfront" end
+	if(enum==TransientIsoceancouplingEnum) return "TransientIsoceancoupling" end
+	if(enum==TransientIssamplingEnum) return "TransientIssampling" end
+	if(enum==TransientIsslcEnum) return "TransientIsslc" end
+	if(enum==TransientIssmbEnum) return "TransientIssmb" end
+	if(enum==TransientIsstressbalanceEnum) return "TransientIsstressbalance" end
+	if(enum==TransientIsthermalEnum) return "TransientIsthermal" end
+	if(enum==TransientNumRequestedOutputsEnum) return "TransientNumRequestedOutputs" end
+	if(enum==TransientRequestedOutputsEnum) return "TransientRequestedOutputs" end
+	if(enum==VelocityEnum) return "Velocity" end
+	if(enum==XxeEnum) return "Xxe" end
+	if(enum==YyeEnum) return "Yye" end
+	if(enum==ZzeEnum) return "Zze" end
+	if(enum==AreaeEnum) return "Areae" end
+	if(enum==WorldCommEnum) return "WorldComm" end
+	if(enum==ParametersENDEnum) return "ParametersEND" end
+	if(enum==InputsSTARTEnum) return "InputsSTART" end
+	if(enum==AccumulatedDeltaBottomPressureEnum) return "AccumulatedDeltaBottomPressure" end
+	if(enum==AccumulatedDeltaIceThicknessEnum) return "AccumulatedDeltaIceThickness" end
+	if(enum==AccumulatedDeltaTwsEnum) return "AccumulatedDeltaTws" end
+	if(enum==AdjointEnum) return "Adjoint" end
+	if(enum==AdjointpEnum) return "Adjointp" end
+	if(enum==AdjointxEnum) return "Adjointx" end
+	if(enum==AdjointxBaseEnum) return "AdjointxBase" end
+	if(enum==AdjointxShearEnum) return "AdjointxShear" end
+	if(enum==AdjointyEnum) return "Adjointy" end
+	if(enum==AdjointyBaseEnum) return "AdjointyBase" end
+	if(enum==AdjointyShearEnum) return "AdjointyShear" end
+	if(enum==AdjointzEnum) return "Adjointz" end
+	if(enum==AirEnum) return "Air" end
+	if(enum==ApproximationEnum) return "Approximation" end
+	if(enum==BalancethicknessMisfitEnum) return "BalancethicknessMisfit" end
+	if(enum==BalancethicknessOmega0Enum) return "BalancethicknessOmega0" end
+	if(enum==BalancethicknessOmegaEnum) return "BalancethicknessOmega" end
+	if(enum==BalancethicknessSpcthicknessEnum) return "BalancethicknessSpcthickness" end
+	if(enum==BalancethicknessThickeningRateEnum) return "BalancethicknessThickeningRate" end
+	if(enum==BasalCrevasseEnum) return "BasalCrevasse" end
+	if(enum==BasalforcingsFloatingiceMeltingRateEnum) return "BasalforcingsFloatingiceMeltingRate" end
+	if(enum==BasalforcingsGeothermalfluxEnum) return "BasalforcingsGeothermalflux" end
+	if(enum==BasalforcingsGroundediceMeltingRateEnum) return "BasalforcingsGroundediceMeltingRate" end
+	if(enum==BasalforcingsPerturbationMeltingRateEnum) return "BasalforcingsPerturbationMeltingRate" end
+	if(enum==BasalforcingsIsmip6BasinIdEnum) return "BasalforcingsIsmip6BasinId" end
+	if(enum==BasalforcingsIsmip6TfEnum) return "BasalforcingsIsmip6Tf" end
+	if(enum==BasalforcingsIsmip6TfShelfEnum) return "BasalforcingsIsmip6TfShelf" end
+	if(enum==BasalforcingsIsmip6MeltAnomalyEnum) return "BasalforcingsIsmip6MeltAnomaly" end
+	if(enum==BasalforcingsMeltrateFactorEnum) return "BasalforcingsMeltrateFactor" end
+	if(enum==BasalforcingsOceanSalinityEnum) return "BasalforcingsOceanSalinity" end
+	if(enum==BasalforcingsOceanTempEnum) return "BasalforcingsOceanTemp" end
+	if(enum==BasalforcingsPicoBasinIdEnum) return "BasalforcingsPicoBasinId" end
+	if(enum==BasalforcingsPicoBoxIdEnum) return "BasalforcingsPicoBoxId" end
+	if(enum==BasalforcingsPicoOverturningCoeffEnum) return "BasalforcingsPicoOverturningCoeff" end
+	if(enum==BasalforcingsPicoSubShelfOceanOverturningEnum) return "BasalforcingsPicoSubShelfOceanOverturning" end
+	if(enum==BasalforcingsPicoSubShelfOceanSalinityEnum) return "BasalforcingsPicoSubShelfOceanSalinity" end
+	if(enum==BasalforcingsPicoSubShelfOceanTempEnum) return "BasalforcingsPicoSubShelfOceanTemp" end
+	if(enum==BasalStressxEnum) return "BasalStressx" end
+	if(enum==BasalStressyEnum) return "BasalStressy" end
+	if(enum==BasalStressEnum) return "BasalStress" end
+	if(enum==BaseEnum) return "Base" end
+	if(enum==BaseOldEnum) return "BaseOld" end
+	if(enum==BaseSlopeXEnum) return "BaseSlopeX" end
+	if(enum==BaseSlopeYEnum) return "BaseSlopeY" end
+	if(enum==BaselineBasalforcingsFloatingiceMeltingRateEnum) return "BaselineBasalforcingsFloatingiceMeltingRate" end
+	if(enum==BaselineCalvingCalvingrateEnum) return "BaselineCalvingCalvingrate" end
+	if(enum==BaselineFrictionEffectivePressureEnum) return "BaselineFrictionEffectivePressure" end
+	if(enum==BedEnum) return "Bed" end
+	if(enum==BedGRDEnum) return "BedGRD" end
+	if(enum==BedEastEnum) return "BedEast" end
+	if(enum==BedEastGRDEnum) return "BedEastGRD" end
+	if(enum==BedNorthEnum) return "BedNorth" end
+	if(enum==BedNorthGRDEnum) return "BedNorthGRD" end
+	if(enum==BedSlopeXEnum) return "BedSlopeX" end
+	if(enum==BedSlopeYEnum) return "BedSlopeY" end
+	if(enum==BottomPressureEnum) return "BottomPressure" end
+	if(enum==BottomPressureOldEnum) return "BottomPressureOld" end
+	if(enum==CalvingCalvingrateEnum) return "CalvingCalvingrate" end
+	if(enum==CalvingHabFractionEnum) return "CalvingHabFraction" end
+	if(enum==CalvingMeltingrateEnum) return "CalvingMeltingrate" end
+	if(enum==CalvingStressThresholdFloatingiceEnum) return "CalvingStressThresholdFloatingice" end
+	if(enum==CalvingStressThresholdGroundediceEnum) return "CalvingStressThresholdGroundedice" end
+	if(enum==CalvinglevermannCoeffEnum) return "CalvinglevermannCoeff" end
+	if(enum==CalvingratexAverageEnum) return "CalvingratexAverage" end
+	if(enum==CalvingratexEnum) return "Calvingratex" end
+	if(enum==CalvingrateyAverageEnum) return "CalvingrateyAverage" end
+	if(enum==CalvingrateyEnum) return "Calvingratey" end
+	if(enum==CalvingFluxLevelsetEnum) return "CalvingFluxLevelset" end
+	if(enum==CalvingMeltingFluxLevelsetEnum) return "CalvingMeltingFluxLevelset" end
+	if(enum==ConvergedEnum) return "Converged" end
+	if(enum==CrevasseDepthEnum) return "CrevasseDepth" end
+	if(enum==DamageDEnum) return "DamageD" end
+	if(enum==DamageDOldEnum) return "DamageDOld" end
+	if(enum==DamageDbarEnum) return "DamageDbar" end
+	if(enum==DamageDbarOldEnum) return "DamageDbarOld" end
+	if(enum==DamageFEnum) return "DamageF" end
+	if(enum==DegreeOfChannelizationEnum) return "DegreeOfChannelization" end
+	if(enum==DepthBelowSurfaceEnum) return "DepthBelowSurface" end
+	if(enum==DeltaIceThicknessEnum) return "DeltaIceThickness" end
+	if(enum==DeltaTwsEnum) return "DeltaTws" end
+	if(enum==DeltaBottomPressureEnum) return "DeltaBottomPressure" end
+	if(enum==DeltaDslEnum) return "DeltaDsl" end
+	if(enum==DslOldEnum) return "DslOld" end
+	if(enum==DslEnum) return "Dsl" end
+	if(enum==DeltaStrEnum) return "DeltaStr" end
+	if(enum==StrOldEnum) return "StrOld" end
+	if(enum==StrEnum) return "Str" end
+	if(enum==DeviatoricStresseffectiveEnum) return "DeviatoricStresseffective" end
+	if(enum==DeviatoricStressxxEnum) return "DeviatoricStressxx" end
+	if(enum==DeviatoricStressxyEnum) return "DeviatoricStressxy" end
+	if(enum==DeviatoricStressxzEnum) return "DeviatoricStressxz" end
+	if(enum==DeviatoricStressyyEnum) return "DeviatoricStressyy" end
+	if(enum==DeviatoricStressyzEnum) return "DeviatoricStressyz" end
+	if(enum==DeviatoricStresszzEnum) return "DeviatoricStresszz" end
+	if(enum==DeviatoricStress1Enum) return "DeviatoricStress1" end
+	if(enum==DeviatoricStress2Enum) return "DeviatoricStress2" end
+	if(enum==DistanceToCalvingfrontEnum) return "DistanceToCalvingfront" end
+	if(enum==DistanceToGroundinglineEnum) return "DistanceToGroundingline" end
+	if(enum==Domain2DhorizontalEnum) return "Domain2Dhorizontal" end
+	if(enum==Domain2DverticalEnum) return "Domain2Dvertical" end
+	if(enum==Domain3DEnum) return "Domain3D" end
+	if(enum==DragCoefficientAbsGradientEnum) return "DragCoefficientAbsGradient" end
+	if(enum==DrivingStressXEnum) return "DrivingStressX" end
+	if(enum==DrivingStressYEnum) return "DrivingStressY" end
+	if(enum==DummyEnum) return "Dummy" end
+	if(enum==EffectivePressureEnum) return "EffectivePressure" end
+	if(enum==EffectivePressureSubstepEnum) return "EffectivePressureSubstep" end
+	if(enum==EffectivePressureTransientEnum) return "EffectivePressureTransient" end
+	if(enum==EnthalpyEnum) return "Enthalpy" end
+	if(enum==EnthalpyPicardEnum) return "EnthalpyPicard" end
+	if(enum==EplHeadEnum) return "EplHead" end
+	if(enum==EplHeadOldEnum) return "EplHeadOld" end
+	if(enum==EplHeadSlopeXEnum) return "EplHeadSlopeX" end
+	if(enum==EplHeadSlopeYEnum) return "EplHeadSlopeY" end
+	if(enum==EplHeadSubstepEnum) return "EplHeadSubstep" end
+	if(enum==EplHeadTransientEnum) return "EplHeadTransient" end
+	if(enum==EsaEmotionEnum) return "EsaEmotion" end
+	if(enum==EsaNmotionEnum) return "EsaNmotion" end
+	if(enum==EsaRotationrateEnum) return "EsaRotationrate" end
+	if(enum==EsaStrainratexxEnum) return "EsaStrainratexx" end
+	if(enum==EsaStrainratexyEnum) return "EsaStrainratexy" end
+	if(enum==EsaStrainrateyyEnum) return "EsaStrainrateyy" end
+	if(enum==EsaUmotionEnum) return "EsaUmotion" end
+	if(enum==EsaXmotionEnum) return "EsaXmotion" end
+	if(enum==EsaYmotionEnum) return "EsaYmotion" end
+	if(enum==EtaDiffEnum) return "EtaDiff" end
+	if(enum==FlowequationBorderFSEnum) return "FlowequationBorderFS" end
+	if(enum==FrictionAsEnum) return "FrictionAs" end
+	if(enum==FrictionCEnum) return "FrictionC" end
+	if(enum==FrictionCmaxEnum) return "FrictionCmax" end
+	if(enum==FrictionCoefficientEnum) return "FrictionCoefficient" end
+	if(enum==FrictionCoefficientcoulombEnum) return "FrictionCoefficientcoulomb" end
+	if(enum==FrictionEffectivePressureEnum) return "FrictionEffectivePressure" end
+	if(enum==FrictionMEnum) return "FrictionM" end
+	if(enum==FrictionPEnum) return "FrictionP" end
+	if(enum==FrictionPressureAdjustedTemperatureEnum) return "FrictionPressureAdjustedTemperature" end
+	if(enum==FrictionQEnum) return "FrictionQ" end
+	if(enum==FrictionSedimentCompressibilityCoefficientEnum) return "FrictionSedimentCompressibilityCoefficient" end
+	if(enum==FrictionTillFrictionAngleEnum) return "FrictionTillFrictionAngle" end
+	if(enum==FrictionWaterLayerEnum) return "FrictionWaterLayer" end
+	if(enum==FrictionfEnum) return "Frictionf" end
+	if(enum==FrontalForcingsBasinIdEnum) return "FrontalForcingsBasinId" end
+	if(enum==FrontalForcingsSubglacialDischargeEnum) return "FrontalForcingsSubglacialDischarge" end
+	if(enum==FrontalForcingsThermalForcingEnum) return "FrontalForcingsThermalForcing" end
+	if(enum==GeometryHydrostaticRatioEnum) return "GeometryHydrostaticRatio" end
+	if(enum==NGiaEnum) return "NGia" end
+	if(enum==NGiaRateEnum) return "NGiaRate" end
+	if(enum==UGiaEnum) return "UGia" end
+	if(enum==UGiaRateEnum) return "UGiaRate" end
+	if(enum==GradientEnum) return "Gradient" end
+	if(enum==GroundinglineHeightEnum) return "GroundinglineHeight" end
+	if(enum==HydraulicPotentialEnum) return "HydraulicPotential" end
+	if(enum==HydraulicPotentialOldEnum) return "HydraulicPotentialOld" end
+	if(enum==HydrologyBasalFluxEnum) return "HydrologyBasalFlux" end
+	if(enum==HydrologyBumpHeightEnum) return "HydrologyBumpHeight" end
+	if(enum==HydrologyBumpSpacingEnum) return "HydrologyBumpSpacing" end
+	if(enum==HydrologydcBasalMoulinInputEnum) return "HydrologydcBasalMoulinInput" end
+	if(enum==HydrologydcEplThicknessEnum) return "HydrologydcEplThickness" end
+	if(enum==HydrologydcEplThicknessOldEnum) return "HydrologydcEplThicknessOld" end
+	if(enum==HydrologydcEplThicknessSubstepEnum) return "HydrologydcEplThicknessSubstep" end
+	if(enum==HydrologydcEplThicknessTransientEnum) return "HydrologydcEplThicknessTransient" end
+	if(enum==HydrologydcMaskEplactiveEltEnum) return "HydrologydcMaskEplactiveElt" end
+	if(enum==HydrologydcMaskEplactiveNodeEnum) return "HydrologydcMaskEplactiveNode" end
+	if(enum==HydrologydcMaskThawedEltEnum) return "HydrologydcMaskThawedElt" end
+	if(enum==HydrologydcMaskThawedNodeEnum) return "HydrologydcMaskThawedNode" end
+	if(enum==HydrologydcSedimentTransmitivityEnum) return "HydrologydcSedimentTransmitivity" end
+	if(enum==HydrologyDrainageRateEnum) return "HydrologyDrainageRate" end
+	if(enum==HydrologyEnglacialInputEnum) return "HydrologyEnglacialInput" end
+	if(enum==HydrologyGapHeightEnum) return "HydrologyGapHeight" end
+	if(enum==HydrologyGapHeightXEnum) return "HydrologyGapHeightX" end
+	if(enum==HydrologyGapHeightXXEnum) return "HydrologyGapHeightXX" end
+	if(enum==HydrologyGapHeightYEnum) return "HydrologyGapHeightY" end
+	if(enum==HydrologyGapHeightYYEnum) return "HydrologyGapHeightYY" end
+	if(enum==HydrologyHeadEnum) return "HydrologyHead" end
+	if(enum==HydrologyHeadOldEnum) return "HydrologyHeadOld" end
+	if(enum==HydrologyMoulinInputEnum) return "HydrologyMoulinInput" end
+	if(enum==HydrologyNeumannfluxEnum) return "HydrologyNeumannflux" end
+	if(enum==HydrologyReynoldsEnum) return "HydrologyReynolds" end
+	if(enum==HydrologySheetConductivityEnum) return "HydrologySheetConductivity" end
+	if(enum==HydrologySheetThicknessEnum) return "HydrologySheetThickness" end
+	if(enum==HydrologySheetThicknessOldEnum) return "HydrologySheetThicknessOld" end
+	if(enum==HydrologyTwsEnum) return "HydrologyTws" end
+	if(enum==HydrologyTwsSpcEnum) return "HydrologyTwsSpc" end
+	if(enum==HydrologyTwsAnalysisEnum) return "HydrologyTwsAnalysis" end
+	if(enum==HydrologyWatercolumnMaxEnum) return "HydrologyWatercolumnMax" end
+	if(enum==HydrologyWaterVxEnum) return "HydrologyWaterVx" end
+	if(enum==HydrologyWaterVyEnum) return "HydrologyWaterVy" end
+	if(enum==IceEnum) return "Ice" end
+	if(enum==IceMaskNodeActivationEnum) return "IceMaskNodeActivation" end
+	if(enum==InputEnum) return "Input" end
+	if(enum==InversionCostFunctionsCoefficientsEnum) return "InversionCostFunctionsCoefficients" end
+	if(enum==InversionSurfaceObsEnum) return "InversionSurfaceObs" end
+	if(enum==InversionThicknessObsEnum) return "InversionThicknessObs" end
+	if(enum==InversionVelObsEnum) return "InversionVelObs" end
+	if(enum==InversionVxObsEnum) return "InversionVxObs" end
+	if(enum==InversionVyObsEnum) return "InversionVyObs" end
+	if(enum==LevelsetfunctionSlopeXEnum) return "LevelsetfunctionSlopeX" end
+	if(enum==LevelsetfunctionSlopeYEnum) return "LevelsetfunctionSlopeY" end
+	if(enum==LevelsetObservationEnum) return "LevelsetObservation" end
+	if(enum==LoadingforceXEnum) return "LoadingforceX" end
+	if(enum==LoadingforceYEnum) return "LoadingforceY" end
+	if(enum==LoadingforceZEnum) return "LoadingforceZ" end
+	if(enum==MaskOceanLevelsetEnum) return "MaskOceanLevelset" end
+	if(enum==MaskIceLevelsetEnum) return "MaskIceLevelset" end
+	if(enum==MaskIceRefLevelsetEnum) return "MaskIceRefLevelset" end
+	if(enum==MasstransportSpcthicknessEnum) return "MasstransportSpcthickness" end
+	if(enum==MaterialsRheologyBEnum) return "MaterialsRheologyB" end
+	if(enum==MaterialsRheologyBbarEnum) return "MaterialsRheologyBbar" end
+	if(enum==MaterialsRheologyEEnum) return "MaterialsRheologyE" end
+	if(enum==MaterialsRheologyEbarEnum) return "MaterialsRheologyEbar" end
+	if(enum==MaterialsRheologyEcEnum) return "MaterialsRheologyEc" end
+	if(enum==MaterialsRheologyEcbarEnum) return "MaterialsRheologyEcbar" end
+	if(enum==MaterialsRheologyEsEnum) return "MaterialsRheologyEs" end
+	if(enum==MaterialsRheologyEsbarEnum) return "MaterialsRheologyEsbar" end
+	if(enum==MaterialsRheologyNEnum) return "MaterialsRheologyN" end
+	if(enum==MeshScaleFactorEnum) return "MeshScaleFactor" end
+	if(enum==MeshVertexonbaseEnum) return "MeshVertexonbase" end
+	if(enum==MeshVertexonboundaryEnum) return "MeshVertexonboundary" end
+	if(enum==MeshVertexonsurfaceEnum) return "MeshVertexonsurface" end
+	if(enum==MisfitEnum) return "Misfit" end
+	if(enum==MovingFrontalVxEnum) return "MovingFrontalVx" end
+	if(enum==MovingFrontalVyEnum) return "MovingFrontalVy" end
+	if(enum==NeumannfluxEnum) return "Neumannflux" end
+	if(enum==NewDamageEnum) return "NewDamage" end
+	if(enum==NodeEnum) return "Node" end
+	if(enum==OmegaAbsGradientEnum) return "OmegaAbsGradient" end
+	if(enum==OceantransportSpcbottompressureEnum) return "OceantransportSpcbottompressure" end
+	if(enum==OceantransportSpcstrEnum) return "OceantransportSpcstr" end
+	if(enum==OceantransportSpcdslEnum) return "OceantransportSpcdsl" end
+	if(enum==P0Enum) return "P0" end
+	if(enum==P1Enum) return "P1" end
+	if(enum==PartitioningEnum) return "Partitioning" end
+	if(enum==PressureEnum) return "Pressure" end
+	if(enum==RadarEnum) return "Radar" end
+	if(enum==RadarAttenuationMacGregorEnum) return "RadarAttenuationMacGregor" end
+	if(enum==RadarAttenuationWolffEnum) return "RadarAttenuationWolff" end
+	if(enum==RadarIcePeriodEnum) return "RadarIcePeriod" end
+	if(enum==RadarPowerMacGregorEnum) return "RadarPowerMacGregor" end
+	if(enum==RadarPowerWolffEnum) return "RadarPowerWolff" end
+	if(enum==RheologyBAbsGradientEnum) return "RheologyBAbsGradient" end
+	if(enum==RheologyBInitialguessEnum) return "RheologyBInitialguess" end
+	if(enum==RheologyBInitialguessMisfitEnum) return "RheologyBInitialguessMisfit" end
+	if(enum==RheologyBbarAbsGradientEnum) return "RheologyBbarAbsGradient" end
+	if(enum==SampleEnum) return "Sample" end
+	if(enum==SamplingBetaEnum) return "SamplingBeta" end
+	if(enum==SamplingKappaEnum) return "SamplingKappa" end
+	if(enum==SealevelEnum) return "Sealevel" end
+	if(enum==SealevelGRDEnum) return "SealevelGRD" end
+	if(enum==SealevelBarystaticMaskEnum) return "SealevelBarystaticMask" end
+	if(enum==SealevelBarystaticIceMaskEnum) return "SealevelBarystaticIceMask" end
+	if(enum==SealevelBarystaticIceWeightsEnum) return "SealevelBarystaticIceWeights" end
+	if(enum==SealevelBarystaticIceAreaEnum) return "SealevelBarystaticIceArea" end
+	if(enum==SealevelBarystaticIceLatbarEnum) return "SealevelBarystaticIceLatbar" end
+	if(enum==SealevelBarystaticIceLongbarEnum) return "SealevelBarystaticIceLongbar" end
+	if(enum==SealevelBarystaticIceLoadEnum) return "SealevelBarystaticIceLoad" end
+	if(enum==SealevelBarystaticHydroMaskEnum) return "SealevelBarystaticHydroMask" end
+	if(enum==SealevelBarystaticHydroWeightsEnum) return "SealevelBarystaticHydroWeights" end
+	if(enum==SealevelBarystaticHydroAreaEnum) return "SealevelBarystaticHydroArea" end
+	if(enum==SealevelBarystaticHydroLatbarEnum) return "SealevelBarystaticHydroLatbar" end
+	if(enum==SealevelBarystaticHydroLongbarEnum) return "SealevelBarystaticHydroLongbar" end
+	if(enum==SealevelBarystaticHydroLoadEnum) return "SealevelBarystaticHydroLoad" end
+	if(enum==SealevelBarystaticBpMaskEnum) return "SealevelBarystaticBpMask" end
+	if(enum==SealevelBarystaticBpWeightsEnum) return "SealevelBarystaticBpWeights" end
+	if(enum==SealevelBarystaticBpAreaEnum) return "SealevelBarystaticBpArea" end
+	if(enum==SealevelBarystaticBpLoadEnum) return "SealevelBarystaticBpLoad" end
+	if(enum==SealevelBarystaticOceanMaskEnum) return "SealevelBarystaticOceanMask" end
+	if(enum==SealevelBarystaticOceanWeightsEnum) return "SealevelBarystaticOceanWeights" end
+	if(enum==SealevelBarystaticOceanAreaEnum) return "SealevelBarystaticOceanArea" end
+	if(enum==SealevelBarystaticOceanLatbarEnum) return "SealevelBarystaticOceanLatbar" end
+	if(enum==SealevelBarystaticOceanLongbarEnum) return "SealevelBarystaticOceanLongbar" end
+	if(enum==SealevelBarystaticOceanLoadEnum) return "SealevelBarystaticOceanLoad" end
+	if(enum==SealevelNEsaEnum) return "SealevelNEsa" end
+	if(enum==SealevelNEsaRateEnum) return "SealevelNEsaRate" end
+	if(enum==SealevelRSLEnum) return "SealevelRSL" end
+	if(enum==BslcEnum) return "Bslc" end
+	if(enum==BslcIceEnum) return "BslcIce" end
+	if(enum==BslcHydroEnum) return "BslcHydro" end
+	if(enum==BslcOceanEnum) return "BslcOcean" end
+	if(enum==BslcRateEnum) return "BslcRate" end
+	if(enum==GmtslcEnum) return "Gmtslc" end
+	if(enum==SealevelGrotm1Enum) return "SealevelGrotm1" end
+	if(enum==SealevelGrotm2Enum) return "SealevelGrotm2" end
+	if(enum==SealevelGrotm3Enum) return "SealevelGrotm3" end
+	if(enum==SealevelGUrotm1Enum) return "SealevelGUrotm1" end
+	if(enum==SealevelGUrotm2Enum) return "SealevelGUrotm2" end
+	if(enum==SealevelGUrotm3Enum) return "SealevelGUrotm3" end
+	if(enum==SealevelGNrotm1Enum) return "SealevelGNrotm1" end
+	if(enum==SealevelGNrotm2Enum) return "SealevelGNrotm2" end
+	if(enum==SealevelGNrotm3Enum) return "SealevelGNrotm3" end
+	if(enum==SealevelGErotm1Enum) return "SealevelGErotm1" end
+	if(enum==SealevelGErotm2Enum) return "SealevelGErotm2" end
+	if(enum==SealevelGErotm3Enum) return "SealevelGErotm3" end
+	if(enum==SealevelRSLBarystaticEnum) return "SealevelRSLBarystatic" end
+	if(enum==SealevelRSLRateEnum) return "SealevelRSLRate" end
+	if(enum==SealevelUGrdEnum) return "SealevelUGrd" end
+	if(enum==SealevelNGrdEnum) return "SealevelNGrd" end
+	if(enum==SealevelUEastEsaEnum) return "SealevelUEastEsa" end
+	if(enum==SealevelUNorthEsaEnum) return "SealevelUNorthEsa" end
+	if(enum==SealevelchangeIndicesEnum) return "SealevelchangeIndices" end
+	if(enum==SealevelchangeGEnum) return "SealevelchangeG" end
+	if(enum==SealevelchangeGUEnum) return "SealevelchangeGU" end
+	if(enum==SealevelchangeGEEnum) return "SealevelchangeGE" end
+	if(enum==SealevelchangeGNEnum) return "SealevelchangeGN" end
+	if(enum==SealevelchangeGsubelOceanEnum) return "SealevelchangeGsubelOcean" end
+	if(enum==SealevelchangeGUsubelOceanEnum) return "SealevelchangeGUsubelOcean" end
+	if(enum==SealevelchangeGEsubelOceanEnum) return "SealevelchangeGEsubelOcean" end
+	if(enum==SealevelchangeGNsubelOceanEnum) return "SealevelchangeGNsubelOcean" end
+	if(enum==SealevelchangeGsubelIceEnum) return "SealevelchangeGsubelIce" end
+	if(enum==SealevelchangeGUsubelIceEnum) return "SealevelchangeGUsubelIce" end
+	if(enum==SealevelchangeGEsubelIceEnum) return "SealevelchangeGEsubelIce" end
+	if(enum==SealevelchangeGNsubelIceEnum) return "SealevelchangeGNsubelIce" end
+	if(enum==SealevelchangeGsubelHydroEnum) return "SealevelchangeGsubelHydro" end
+	if(enum==SealevelchangeGUsubelHydroEnum) return "SealevelchangeGUsubelHydro" end
+	if(enum==SealevelchangeGEsubelHydroEnum) return "SealevelchangeGEsubelHydro" end
+	if(enum==SealevelchangeGNsubelHydroEnum) return "SealevelchangeGNsubelHydro" end
+	if(enum==SealevelchangeViscousRSLEnum) return "SealevelchangeViscousRSL" end
+	if(enum==SealevelchangeViscousUEnum) return "SealevelchangeViscousU" end
+	if(enum==SealevelchangeViscousNEnum) return "SealevelchangeViscousN" end
+	if(enum==SealevelchangeViscousEEnum) return "SealevelchangeViscousE" end
+	if(enum==SedimentHeadEnum) return "SedimentHead" end
+	if(enum==SedimentHeadOldEnum) return "SedimentHeadOld" end
+	if(enum==SedimentHeadSubstepEnum) return "SedimentHeadSubstep" end
+	if(enum==SedimentHeadTransientEnum) return "SedimentHeadTransient" end
+	if(enum==SedimentHeadResidualEnum) return "SedimentHeadResidual" end
+	if(enum==SedimentHeadStackedEnum) return "SedimentHeadStacked" end
+	if(enum==SigmaNNEnum) return "SigmaNN" end
+	if(enum==SigmaVMEnum) return "SigmaVM" end
+	if(enum==SmbAccumulatedECEnum) return "SmbAccumulatedEC" end
+	if(enum==SmbAccumulatedMassBalanceEnum) return "SmbAccumulatedMassBalance" end
+	if(enum==SmbAccumulatedMeltEnum) return "SmbAccumulatedMelt" end
+	if(enum==SmbAccumulatedPrecipitationEnum) return "SmbAccumulatedPrecipitation" end
+	if(enum==SmbAccumulatedRainEnum) return "SmbAccumulatedRain" end
+	if(enum==SmbAccumulatedRefreezeEnum) return "SmbAccumulatedRefreeze" end
+	if(enum==SmbAccumulatedRunoffEnum) return "SmbAccumulatedRunoff" end
+	if(enum==SmbAEnum) return "SmbA" end
+	if(enum==SmbAdiffEnum) return "SmbAdiff" end
+	if(enum==SmbAValueEnum) return "SmbAValue" end
+	if(enum==SmbAccumulationEnum) return "SmbAccumulation" end
+	if(enum==SmbAdiffiniEnum) return "SmbAdiffini" end
+	if(enum==SmbAiniEnum) return "SmbAini" end
+	if(enum==SmbAutoregressionNoiseEnum) return "SmbAutoregressionNoise" end
+	if(enum==SmbBasinsIdEnum) return "SmbBasinsId" end
+	if(enum==SmbBMaxEnum) return "SmbBMax" end
+	if(enum==SmbBMinEnum) return "SmbBMin" end
+	if(enum==SmbBNegEnum) return "SmbBNeg" end
+	if(enum==SmbBPosEnum) return "SmbBPos" end
+	if(enum==SmbCEnum) return "SmbC" end
+	if(enum==SmbCcsnowValueEnum) return "SmbCcsnowValue" end
+	if(enum==SmbCciceValueEnum) return "SmbCciceValue" end
+	if(enum==SmbCotValueEnum) return "SmbCotValue" end
+	if(enum==SmbDEnum) return "SmbD" end
+	if(enum==SmbDailyairdensityEnum) return "SmbDailyairdensity" end
+	if(enum==SmbDailyairhumidityEnum) return "SmbDailyairhumidity" end
+	if(enum==SmbDailydlradiationEnum) return "SmbDailydlradiation" end
+	if(enum==SmbDailydsradiationEnum) return "SmbDailydsradiation" end
+	if(enum==SmbDailypressureEnum) return "SmbDailypressure" end
+	if(enum==SmbDailyrainfallEnum) return "SmbDailyrainfall" end
+	if(enum==SmbDailysnowfallEnum) return "SmbDailysnowfall" end
+	if(enum==SmbDailytemperatureEnum) return "SmbDailytemperature" end
+	if(enum==SmbDailywindspeedEnum) return "SmbDailywindspeed" end
+	if(enum==SmbDiniEnum) return "SmbDini" end
+	if(enum==SmbDlwrfEnum) return "SmbDlwrf" end
+	if(enum==SmbDulwrfValueEnum) return "SmbDulwrfValue" end
+	if(enum==SmbDswrfEnum) return "SmbDswrf" end
+	if(enum==SmbDswdiffrfEnum) return "SmbDswdiffrf" end
+	if(enum==SmbDzAddEnum) return "SmbDzAdd" end
+	if(enum==SmbDzEnum) return "SmbDz" end
+	if(enum==SmbDzMinEnum) return "SmbDzMin" end
+	if(enum==SmbDzTopEnum) return "SmbDzTop" end
+	if(enum==SmbDziniEnum) return "SmbDzini" end
+	if(enum==SmbEAirEnum) return "SmbEAir" end
+	if(enum==SmbECEnum) return "SmbEC" end
+	if(enum==SmbECDtEnum) return "SmbECDt" end
+	if(enum==SmbECiniEnum) return "SmbECini" end
+	if(enum==SmbElaEnum) return "SmbEla" end
+	if(enum==SmbEvaporationEnum) return "SmbEvaporation" end
+	if(enum==SmbFACEnum) return "SmbFAC" end
+	if(enum==SmbGdnEnum) return "SmbGdn" end
+	if(enum==SmbGdniniEnum) return "SmbGdnini" end
+	if(enum==SmbGspEnum) return "SmbGsp" end
+	if(enum==SmbGspiniEnum) return "SmbGspini" end
+	if(enum==SmbHrefEnum) return "SmbHref" end
+	if(enum==SmbIsInitializedEnum) return "SmbIsInitialized" end
+	if(enum==SmbMAddEnum) return "SmbMAdd" end
+	if(enum==SmbMassBalanceEnum) return "SmbMassBalance" end
+	if(enum==SmbMassBalanceSubstepEnum) return "SmbMassBalanceSubstep" end
+	if(enum==SmbMassBalanceTransientEnum) return "SmbMassBalanceTransient" end
+	if(enum==SmbMeanLHFEnum) return "SmbMeanLHF" end
+	if(enum==SmbMeanSHFEnum) return "SmbMeanSHF" end
+	if(enum==SmbMeanULWEnum) return "SmbMeanULW" end
+	if(enum==SmbMeltEnum) return "SmbMelt" end
+	if(enum==SmbMonthlytemperaturesEnum) return "SmbMonthlytemperatures" end
+	if(enum==SmbMSurfEnum) return "SmbMSurf" end
+	if(enum==SmbNetLWEnum) return "SmbNetLW" end
+	if(enum==SmbNetSWEnum) return "SmbNetSW" end
+	if(enum==SmbPAirEnum) return "SmbPAir" end
+	if(enum==SmbPEnum) return "SmbP" end
+	if(enum==SmbPddfacIceEnum) return "SmbPddfacIce" end
+	if(enum==SmbPddfacSnowEnum) return "SmbPddfacSnow" end
+	if(enum==SmbPrecipitationEnum) return "SmbPrecipitation" end
+	if(enum==SmbPrecipitationsAnomalyEnum) return "SmbPrecipitationsAnomaly" end
+	if(enum==SmbPrecipitationsLgmEnum) return "SmbPrecipitationsLgm" end
+	if(enum==SmbPrecipitationsPresentdayEnum) return "SmbPrecipitationsPresentday" end
+	if(enum==SmbPrecipitationsReconstructedEnum) return "SmbPrecipitationsReconstructed" end
+	if(enum==SmbRainEnum) return "SmbRain" end
+	if(enum==SmbReEnum) return "SmbRe" end
+	if(enum==SmbRefreezeEnum) return "SmbRefreeze" end
+	if(enum==SmbReiniEnum) return "SmbReini" end
+	if(enum==SmbRunoffEnum) return "SmbRunoff" end
+	if(enum==SmbRunoffSubstepEnum) return "SmbRunoffSubstep" end
+	if(enum==SmbRunoffTransientEnum) return "SmbRunoffTransient" end
+	if(enum==SmbS0gcmEnum) return "SmbS0gcm" end
+	if(enum==SmbS0pEnum) return "SmbS0p" end
+	if(enum==SmbS0tEnum) return "SmbS0t" end
+	if(enum==SmbSizeiniEnum) return "SmbSizeini" end
+	if(enum==SmbSmbCorrEnum) return "SmbSmbCorr" end
+	if(enum==SmbSmbrefEnum) return "SmbSmbref" end
+	if(enum==SmbSzaValueEnum) return "SmbSzaValue" end
+	if(enum==SmbTEnum) return "SmbT" end
+	if(enum==SmbTaEnum) return "SmbTa" end
+	if(enum==SmbTeValueEnum) return "SmbTeValue" end
+	if(enum==SmbTemperaturesAnomalyEnum) return "SmbTemperaturesAnomaly" end
+	if(enum==SmbTemperaturesLgmEnum) return "SmbTemperaturesLgm" end
+	if(enum==SmbTemperaturesPresentdayEnum) return "SmbTemperaturesPresentday" end
+	if(enum==SmbTemperaturesReconstructedEnum) return "SmbTemperaturesReconstructed" end
+	if(enum==SmbTiniEnum) return "SmbTini" end
+	if(enum==SmbTmeanEnum) return "SmbTmean" end
+	if(enum==SmbTzEnum) return "SmbTz" end
+	if(enum==SmbValuesAutoregressionEnum) return "SmbValuesAutoregression" end
+	if(enum==SmbVEnum) return "SmbV" end
+	if(enum==SmbVmeanEnum) return "SmbVmean" end
+	if(enum==SmbVzEnum) return "SmbVz" end
+	if(enum==SmbWEnum) return "SmbW" end
+	if(enum==SmbWAddEnum) return "SmbWAdd" end
+	if(enum==SmbWiniEnum) return "SmbWini" end
+	if(enum==SmbZMaxEnum) return "SmbZMax" end
+	if(enum==SmbZMinEnum) return "SmbZMin" end
+	if(enum==SmbZTopEnum) return "SmbZTop" end
+	if(enum==SmbZYEnum) return "SmbZY" end
+	if(enum==SolidearthExternalDisplacementEastRateEnum) return "SolidearthExternalDisplacementEastRate" end
+	if(enum==SolidearthExternalDisplacementNorthRateEnum) return "SolidearthExternalDisplacementNorthRate" end
+	if(enum==SolidearthExternalDisplacementUpRateEnum) return "SolidearthExternalDisplacementUpRate" end
+	if(enum==SolidearthExternalGeoidRateEnum) return "SolidearthExternalGeoidRate" end
+	if(enum==StochasticForcingDefaultIdEnum) return "StochasticForcingDefaultId" end
+	if(enum==StrainRateeffectiveEnum) return "StrainRateeffective" end
+	if(enum==StrainRateparallelEnum) return "StrainRateparallel" end
+	if(enum==StrainRateperpendicularEnum) return "StrainRateperpendicular" end
+	if(enum==StrainRatexxEnum) return "StrainRatexx" end
+	if(enum==StrainRatexyEnum) return "StrainRatexy" end
+	if(enum==StrainRatexzEnum) return "StrainRatexz" end
+	if(enum==StrainRateyyEnum) return "StrainRateyy" end
+	if(enum==StrainRateyzEnum) return "StrainRateyz" end
+	if(enum==StrainRatezzEnum) return "StrainRatezz" end
+	if(enum==StressMaxPrincipalEnum) return "StressMaxPrincipal" end
+	if(enum==StressTensorxxEnum) return "StressTensorxx" end
+	if(enum==StressTensorxyEnum) return "StressTensorxy" end
+	if(enum==StressTensorxzEnum) return "StressTensorxz" end
+	if(enum==StressTensoryyEnum) return "StressTensoryy" end
+	if(enum==StressTensoryzEnum) return "StressTensoryz" end
+	if(enum==StressTensorzzEnum) return "StressTensorzz" end
+	if(enum==SurfaceAbsMisfitEnum) return "SurfaceAbsMisfit" end
+	if(enum==SurfaceAbsVelMisfitEnum) return "SurfaceAbsVelMisfit" end
+	if(enum==AreaEnum) return "Area" end
+	if(enum==SealevelAreaEnum) return "SealevelArea" end
+	if(enum==SurfaceAreaEnum) return "SurfaceArea" end
+	if(enum==SurfaceAverageVelMisfitEnum) return "SurfaceAverageVelMisfit" end
+	if(enum==SurfaceCrevasseEnum) return "SurfaceCrevasse" end
+	if(enum==SurfaceEnum) return "Surface" end
+	if(enum==SurfaceOldEnum) return "SurfaceOld" end
+	if(enum==SurfaceLogVelMisfitEnum) return "SurfaceLogVelMisfit" end
+	if(enum==SurfaceLogVxVyMisfitEnum) return "SurfaceLogVxVyMisfit" end
+	if(enum==SurfaceObservationEnum) return "SurfaceObservation" end
+	if(enum==SurfaceRelVelMisfitEnum) return "SurfaceRelVelMisfit" end
+	if(enum==SurfaceSlopeXEnum) return "SurfaceSlopeX" end
+	if(enum==SurfaceSlopeYEnum) return "SurfaceSlopeY" end
+	if(enum==TemperatureEnum) return "Temperature" end
+	if(enum==TemperaturePDDEnum) return "TemperaturePDD" end
+	if(enum==TemperaturePicardEnum) return "TemperaturePicard" end
+	if(enum==TemperatureSEMICEnum) return "TemperatureSEMIC" end
+	if(enum==ThermalforcingAutoregressionNoiseEnum) return "ThermalforcingAutoregressionNoise" end
+	if(enum==ThermalforcingValuesAutoregressionEnum) return "ThermalforcingValuesAutoregression" end
+	if(enum==ThermalSpctemperatureEnum) return "ThermalSpctemperature" end
+	if(enum==ThicknessAbsGradientEnum) return "ThicknessAbsGradient" end
+	if(enum==ThicknessAbsMisfitEnum) return "ThicknessAbsMisfit" end
+	if(enum==ThicknessAcrossGradientEnum) return "ThicknessAcrossGradient" end
+	if(enum==ThicknessAlongGradientEnum) return "ThicknessAlongGradient" end
+	if(enum==ThicknessEnum) return "Thickness" end
+	if(enum==ThicknessOldEnum) return "ThicknessOld" end
+	if(enum==ThicknessPositiveEnum) return "ThicknessPositive" end
+	if(enum==ThicknessResidualEnum) return "ThicknessResidual" end
+	if(enum==TransientAccumulatedDeltaIceThicknessEnum) return "TransientAccumulatedDeltaIceThickness" end
+	if(enum==VelEnum) return "Vel" end
+	if(enum==VxAverageEnum) return "VxAverage" end
+	if(enum==VxBaseEnum) return "VxBase" end
+	if(enum==VxEnum) return "Vx" end
+	if(enum==VxMeshEnum) return "VxMesh" end
+	if(enum==VxObsEnum) return "VxObs" end
+	if(enum==VxShearEnum) return "VxShear" end
+	if(enum==VxSurfaceEnum) return "VxSurface" end
+	if(enum==VyAverageEnum) return "VyAverage" end
+	if(enum==VyBaseEnum) return "VyBase" end
+	if(enum==VyEnum) return "Vy" end
+	if(enum==VyMeshEnum) return "VyMesh" end
+	if(enum==VyObsEnum) return "VyObs" end
+	if(enum==VyShearEnum) return "VyShear" end
+	if(enum==VySurfaceEnum) return "VySurface" end
+	if(enum==VzEnum) return "Vz" end
+	if(enum==VzFSEnum) return "VzFS" end
+	if(enum==VzHOEnum) return "VzHO" end
+	if(enum==VzMeshEnum) return "VzMesh" end
+	if(enum==VzSSAEnum) return "VzSSA" end
+	if(enum==WaterColumnOldEnum) return "WaterColumnOld" end
+	if(enum==WatercolumnEnum) return "Watercolumn" end
+	if(enum==WaterfractionDrainageEnum) return "WaterfractionDrainage" end
+	if(enum==WaterfractionDrainageIntegratedEnum) return "WaterfractionDrainageIntegrated" end
+	if(enum==WaterfractionEnum) return "Waterfraction" end
+	if(enum==WaterheightEnum) return "Waterheight" end
+	if(enum==FrictionWaterPressureEnum) return "FrictionWaterPressure" end
+	if(enum==FrictionWaterPressureNoiseEnum) return "FrictionWaterPressureNoise" end
+	if(enum==WeightsLevelsetObservationEnum) return "WeightsLevelsetObservation" end
+	if(enum==WeightsSurfaceObservationEnum) return "WeightsSurfaceObservation" end
+	if(enum==OldAccumulatedDeltaBottomPressureEnum) return "OldAccumulatedDeltaBottomPressure" end
+	if(enum==OldAccumulatedDeltaIceThicknessEnum) return "OldAccumulatedDeltaIceThickness" end
+	if(enum==OldAccumulatedDeltaTwsEnum) return "OldAccumulatedDeltaTws" end
+	if(enum==Outputdefinition1Enum) return "Outputdefinition1" end
+	if(enum==Outputdefinition10Enum) return "Outputdefinition10" end
+	if(enum==Outputdefinition11Enum) return "Outputdefinition11" end
+	if(enum==Outputdefinition12Enum) return "Outputdefinition12" end
+	if(enum==Outputdefinition13Enum) return "Outputdefinition13" end
+	if(enum==Outputdefinition14Enum) return "Outputdefinition14" end
+	if(enum==Outputdefinition15Enum) return "Outputdefinition15" end
+	if(enum==Outputdefinition16Enum) return "Outputdefinition16" end
+	if(enum==Outputdefinition17Enum) return "Outputdefinition17" end
+	if(enum==Outputdefinition18Enum) return "Outputdefinition18" end
+	if(enum==Outputdefinition19Enum) return "Outputdefinition19" end
+	if(enum==Outputdefinition20Enum) return "Outputdefinition20" end
+	if(enum==Outputdefinition21Enum) return "Outputdefinition21" end
+	if(enum==Outputdefinition22Enum) return "Outputdefinition22" end
+	if(enum==Outputdefinition23Enum) return "Outputdefinition23" end
+	if(enum==Outputdefinition24Enum) return "Outputdefinition24" end
+	if(enum==Outputdefinition25Enum) return "Outputdefinition25" end
+	if(enum==Outputdefinition26Enum) return "Outputdefinition26" end
+	if(enum==Outputdefinition27Enum) return "Outputdefinition27" end
+	if(enum==Outputdefinition28Enum) return "Outputdefinition28" end
+	if(enum==Outputdefinition29Enum) return "Outputdefinition29" end
+	if(enum==Outputdefinition2Enum) return "Outputdefinition2" end
+	if(enum==Outputdefinition30Enum) return "Outputdefinition30" end
+	if(enum==Outputdefinition31Enum) return "Outputdefinition31" end
+	if(enum==Outputdefinition32Enum) return "Outputdefinition32" end
+	if(enum==Outputdefinition33Enum) return "Outputdefinition33" end
+	if(enum==Outputdefinition34Enum) return "Outputdefinition34" end
+	if(enum==Outputdefinition35Enum) return "Outputdefinition35" end
+	if(enum==Outputdefinition36Enum) return "Outputdefinition36" end
+	if(enum==Outputdefinition37Enum) return "Outputdefinition37" end
+	if(enum==Outputdefinition38Enum) return "Outputdefinition38" end
+	if(enum==Outputdefinition39Enum) return "Outputdefinition39" end
+	if(enum==Outputdefinition3Enum) return "Outputdefinition3" end
+	if(enum==Outputdefinition40Enum) return "Outputdefinition40" end
+	if(enum==Outputdefinition41Enum) return "Outputdefinition41" end
+	if(enum==Outputdefinition42Enum) return "Outputdefinition42" end
+	if(enum==Outputdefinition43Enum) return "Outputdefinition43" end
+	if(enum==Outputdefinition44Enum) return "Outputdefinition44" end
+	if(enum==Outputdefinition45Enum) return "Outputdefinition45" end
+	if(enum==Outputdefinition46Enum) return "Outputdefinition46" end
+	if(enum==Outputdefinition47Enum) return "Outputdefinition47" end
+	if(enum==Outputdefinition48Enum) return "Outputdefinition48" end
+	if(enum==Outputdefinition49Enum) return "Outputdefinition49" end
+	if(enum==Outputdefinition4Enum) return "Outputdefinition4" end
+	if(enum==Outputdefinition50Enum) return "Outputdefinition50" end
+	if(enum==Outputdefinition51Enum) return "Outputdefinition51" end
+	if(enum==Outputdefinition52Enum) return "Outputdefinition52" end
+	if(enum==Outputdefinition53Enum) return "Outputdefinition53" end
+	if(enum==Outputdefinition54Enum) return "Outputdefinition54" end
+	if(enum==Outputdefinition55Enum) return "Outputdefinition55" end
+	if(enum==Outputdefinition56Enum) return "Outputdefinition56" end
+	if(enum==Outputdefinition57Enum) return "Outputdefinition57" end
+	if(enum==Outputdefinition58Enum) return "Outputdefinition58" end
+	if(enum==Outputdefinition59Enum) return "Outputdefinition59" end
+	if(enum==Outputdefinition5Enum) return "Outputdefinition5" end
+	if(enum==Outputdefinition60Enum) return "Outputdefinition60" end
+	if(enum==Outputdefinition61Enum) return "Outputdefinition61" end
+	if(enum==Outputdefinition62Enum) return "Outputdefinition62" end
+	if(enum==Outputdefinition63Enum) return "Outputdefinition63" end
+	if(enum==Outputdefinition64Enum) return "Outputdefinition64" end
+	if(enum==Outputdefinition65Enum) return "Outputdefinition65" end
+	if(enum==Outputdefinition66Enum) return "Outputdefinition66" end
+	if(enum==Outputdefinition67Enum) return "Outputdefinition67" end
+	if(enum==Outputdefinition68Enum) return "Outputdefinition68" end
+	if(enum==Outputdefinition69Enum) return "Outputdefinition69" end
+	if(enum==Outputdefinition6Enum) return "Outputdefinition6" end
+	if(enum==Outputdefinition70Enum) return "Outputdefinition70" end
+	if(enum==Outputdefinition71Enum) return "Outputdefinition71" end
+	if(enum==Outputdefinition72Enum) return "Outputdefinition72" end
+	if(enum==Outputdefinition73Enum) return "Outputdefinition73" end
+	if(enum==Outputdefinition74Enum) return "Outputdefinition74" end
+	if(enum==Outputdefinition75Enum) return "Outputdefinition75" end
+	if(enum==Outputdefinition76Enum) return "Outputdefinition76" end
+	if(enum==Outputdefinition77Enum) return "Outputdefinition77" end
+	if(enum==Outputdefinition78Enum) return "Outputdefinition78" end
+	if(enum==Outputdefinition79Enum) return "Outputdefinition79" end
+	if(enum==Outputdefinition7Enum) return "Outputdefinition7" end
+	if(enum==Outputdefinition80Enum) return "Outputdefinition80" end
+	if(enum==Outputdefinition81Enum) return "Outputdefinition81" end
+	if(enum==Outputdefinition82Enum) return "Outputdefinition82" end
+	if(enum==Outputdefinition83Enum) return "Outputdefinition83" end
+	if(enum==Outputdefinition84Enum) return "Outputdefinition84" end
+	if(enum==Outputdefinition85Enum) return "Outputdefinition85" end
+	if(enum==Outputdefinition86Enum) return "Outputdefinition86" end
+	if(enum==Outputdefinition87Enum) return "Outputdefinition87" end
+	if(enum==Outputdefinition88Enum) return "Outputdefinition88" end
+	if(enum==Outputdefinition89Enum) return "Outputdefinition89" end
+	if(enum==Outputdefinition8Enum) return "Outputdefinition8" end
+	if(enum==Outputdefinition90Enum) return "Outputdefinition90" end
+	if(enum==Outputdefinition91Enum) return "Outputdefinition91" end
+	if(enum==Outputdefinition92Enum) return "Outputdefinition92" end
+	if(enum==Outputdefinition93Enum) return "Outputdefinition93" end
+	if(enum==Outputdefinition94Enum) return "Outputdefinition94" end
+	if(enum==Outputdefinition95Enum) return "Outputdefinition95" end
+	if(enum==Outputdefinition96Enum) return "Outputdefinition96" end
+	if(enum==Outputdefinition97Enum) return "Outputdefinition97" end
+	if(enum==Outputdefinition98Enum) return "Outputdefinition98" end
+	if(enum==Outputdefinition99Enum) return "Outputdefinition99" end
+	if(enum==Outputdefinition9Enum) return "Outputdefinition9" end
+	if(enum==Outputdefinition100Enum) return "Outputdefinition100" end
+	if(enum==InputsENDEnum) return "InputsEND" end
+	if(enum==AbsoluteEnum) return "Absolute" end
+	if(enum==AdaptiveTimesteppingEnum) return "AdaptiveTimestepping" end
+	if(enum==AdjointBalancethickness2AnalysisEnum) return "AdjointBalancethickness2Analysis" end
+	if(enum==AdjointBalancethicknessAnalysisEnum) return "AdjointBalancethicknessAnalysis" end
+	if(enum==AdjointHorizAnalysisEnum) return "AdjointHorizAnalysis" end
+	if(enum==AggressiveMigrationEnum) return "AggressiveMigration" end
+	if(enum==AmrBamgEnum) return "AmrBamg" end
+	if(enum==AmrNeopzEnum) return "AmrNeopz" end
+	if(enum==AndroidFrictionCoefficientEnum) return "AndroidFrictionCoefficient" end
+	if(enum==ArrheniusEnum) return "Arrhenius" end
+	if(enum==AutodiffJacobianEnum) return "AutodiffJacobian" end
+	if(enum==Balancethickness2AnalysisEnum) return "Balancethickness2Analysis" end
+	if(enum==Balancethickness2SolutionEnum) return "Balancethickness2Solution" end
+	if(enum==BalancethicknessAnalysisEnum) return "BalancethicknessAnalysis" end
+	if(enum==BalancethicknessApparentMassbalanceEnum) return "BalancethicknessApparentMassbalance" end
+	if(enum==BalancethicknessSoftAnalysisEnum) return "BalancethicknessSoftAnalysis" end
+	if(enum==BalancethicknessSoftSolutionEnum) return "BalancethicknessSoftSolution" end
+	if(enum==BalancethicknessSolutionEnum) return "BalancethicknessSolution" end
+	if(enum==BalancevelocityAnalysisEnum) return "BalancevelocityAnalysis" end
+	if(enum==BalancevelocitySolutionEnum) return "BalancevelocitySolution" end
+	if(enum==BasalforcingsIsmip6Enum) return "BasalforcingsIsmip6" end
+	if(enum==BasalforcingsPicoEnum) return "BasalforcingsPico" end
+	if(enum==BeckmannGoosseFloatingMeltRateEnum) return "BeckmannGoosseFloatingMeltRate" end
+	if(enum==BedSlopeSolutionEnum) return "BedSlopeSolution" end
+	if(enum==BoolExternalResultEnum) return "BoolExternalResult" end
+	if(enum==BoolInputEnum) return "BoolInput" end
+	if(enum==IntInputEnum) return "IntInput" end
+	if(enum==DoubleInputEnum) return "DoubleInput" end
+	if(enum==BoolParamEnum) return "BoolParam" end
+	if(enum==BoundaryEnum) return "Boundary" end
+	if(enum==BuddJackaEnum) return "BuddJacka" end
+	if(enum==CalvingDev2Enum) return "CalvingDev2" end
+	if(enum==CalvingHabEnum) return "CalvingHab" end
+	if(enum==CalvingLevermannEnum) return "CalvingLevermann" end
+	if(enum==CalvingVonmisesEnum) return "CalvingVonmises" end
+	if(enum==CfdragcoeffabsgradEnum) return "Cfdragcoeffabsgrad" end
+	if(enum==CfsurfacelogvelEnum) return "Cfsurfacelogvel" end
+	if(enum==CfsurfacesquareEnum) return "Cfsurfacesquare" end
+	if(enum==CflevelsetmisfitEnum) return "Cflevelsetmisfit" end
+	if(enum==ChannelEnum) return "Channel" end
+	if(enum==ChannelAreaEnum) return "ChannelArea" end
+	if(enum==ChannelAreaOldEnum) return "ChannelAreaOld" end
+	if(enum==ChannelDischargeEnum) return "ChannelDischarge" end
+	if(enum==ClosedEnum) return "Closed" end
+	if(enum==ColinearEnum) return "Colinear" end
+	if(enum==ConstraintsEnum) return "Constraints" end
+	if(enum==ContactEnum) return "Contact" end
+	if(enum==ContourEnum) return "Contour" end
+	if(enum==ContoursEnum) return "Contours" end
+	if(enum==ControlInputEnum) return "ControlInput" end
+	if(enum==ControlInputGradEnum) return "ControlInputGrad" end
+	if(enum==ControlInputMaxsEnum) return "ControlInputMaxs" end
+	if(enum==ControlInputMinsEnum) return "ControlInputMins" end
+	if(enum==ControlInputValuesEnum) return "ControlInputValues" end
+	if(enum==CrouzeixRaviartEnum) return "CrouzeixRaviart" end
+	if(enum==CuffeyEnum) return "Cuffey" end
+	if(enum==CuffeyTemperateEnum) return "CuffeyTemperate" end
+	if(enum==DamageEvolutionAnalysisEnum) return "DamageEvolutionAnalysis" end
+	if(enum==DamageEvolutionSolutionEnum) return "DamageEvolutionSolution" end
+	if(enum==DataSetEnum) return "DataSet" end
+	if(enum==DataSetParamEnum) return "DataSetParam" end
+	if(enum==DatasetInputEnum) return "DatasetInput" end
+	if(enum==DefaultAnalysisEnum) return "DefaultAnalysis" end
+	if(enum==DefaultCalvingEnum) return "DefaultCalving" end
+	if(enum==DenseEnum) return "Dense" end
+	if(enum==DependentObjectEnum) return "DependentObject" end
+	if(enum==DepthAverageAnalysisEnum) return "DepthAverageAnalysis" end
+	if(enum==DeviatoricStressErrorEstimatorEnum) return "DeviatoricStressErrorEstimator" end
+	if(enum==DivergenceEnum) return "Divergence" end
+	if(enum==Domain3DsurfaceEnum) return "Domain3Dsurface" end
+	if(enum==DoubleArrayInputEnum) return "DoubleArrayInput" end
+	if(enum==ArrayInputEnum) return "ArrayInput" end
+	if(enum==DoubleExternalResultEnum) return "DoubleExternalResult" end
+	if(enum==DoubleMatArrayParamEnum) return "DoubleMatArrayParam" end
+	if(enum==DoubleMatExternalResultEnum) return "DoubleMatExternalResult" end
+	if(enum==DoubleMatParamEnum) return "DoubleMatParam" end
+	if(enum==DoubleParamEnum) return "DoubleParam" end
+	if(enum==DoubleVecParamEnum) return "DoubleVecParam" end
+	if(enum==ElementEnum) return "Element" end
+	if(enum==ElementHookEnum) return "ElementHook" end
+	if(enum==ElementSIdEnum) return "ElementSId" end
+	if(enum==EnthalpyAnalysisEnum) return "EnthalpyAnalysis" end
+	if(enum==EsaAnalysisEnum) return "EsaAnalysis" end
+	if(enum==EsaSolutionEnum) return "EsaSolution" end
+	if(enum==EsaTransitionsEnum) return "EsaTransitions" end
+	if(enum==ExternalResultEnum) return "ExternalResult" end
+	if(enum==ExtrapolationAnalysisEnum) return "ExtrapolationAnalysis" end
+	if(enum==ExtrudeFromBaseAnalysisEnum) return "ExtrudeFromBaseAnalysis" end
+	if(enum==ExtrudeFromTopAnalysisEnum) return "ExtrudeFromTopAnalysis" end
+	if(enum==FSApproximationEnum) return "FSApproximation" end
+	if(enum==FSSolverEnum) return "FSSolver" end
+	if(enum==FSpressureEnum) return "FSpressure" end
+	if(enum==FSvelocityEnum) return "FSvelocity" end
+	if(enum==FemModelEnum) return "FemModel" end
+	if(enum==FileParamEnum) return "FileParam" end
+	if(enum==FixedTimesteppingEnum) return "FixedTimestepping" end
+	if(enum==FloatingAreaEnum) return "FloatingArea" end
+	if(enum==FloatingAreaScaledEnum) return "FloatingAreaScaled" end
+	if(enum==FloatingMeltRateEnum) return "FloatingMeltRate" end
+	if(enum==FreeEnum) return "Free" end
+	if(enum==FreeSurfaceBaseAnalysisEnum) return "FreeSurfaceBaseAnalysis" end
+	if(enum==FreeSurfaceTopAnalysisEnum) return "FreeSurfaceTopAnalysis" end
+	if(enum==FrontalForcingsDefaultEnum) return "FrontalForcingsDefault" end
+	if(enum==FrontalForcingsRignotEnum) return "FrontalForcingsRignot" end
+	if(enum==FrontalForcingsRignotAutoregressionEnum) return "FrontalForcingsRignotAutoregression" end
+	if(enum==FsetEnum) return "Fset" end
+	if(enum==FullMeltOnPartiallyFloatingEnum) return "FullMeltOnPartiallyFloating" end
+	if(enum==GLheightadvectionAnalysisEnum) return "GLheightadvectionAnalysis" end
+	if(enum==GaussPentaEnum) return "GaussPenta" end
+	if(enum==GaussSegEnum) return "GaussSeg" end
+	if(enum==GaussTetraEnum) return "GaussTetra" end
+	if(enum==GaussTriaEnum) return "GaussTria" end
+	if(enum==GenericOptionEnum) return "GenericOption" end
+	if(enum==GenericParamEnum) return "GenericParam" end
+	if(enum==GenericExternalResultEnum) return "GenericExternalResult" end
+	if(enum==Gradient1Enum) return "Gradient1" end
+	if(enum==Gradient2Enum) return "Gradient2" end
+	if(enum==Gradient3Enum) return "Gradient3" end
+	if(enum==Gradient4Enum) return "Gradient4" end
+	if(enum==GroundedAreaEnum) return "GroundedArea" end
+	if(enum==GroundedAreaScaledEnum) return "GroundedAreaScaled" end
+	if(enum==GroundingOnlyEnum) return "GroundingOnly" end
+	if(enum==GroundinglineMassFluxEnum) return "GroundinglineMassFlux" end
+	if(enum==GsetEnum) return "Gset" end
+	if(enum==GslEnum) return "Gsl" end
+	if(enum==HOApproximationEnum) return "HOApproximation" end
+	if(enum==HOFSApproximationEnum) return "HOFSApproximation" end
+	if(enum==HookEnum) return "Hook" end
+	if(enum==HydrologyDCEfficientAnalysisEnum) return "HydrologyDCEfficientAnalysis" end
+	if(enum==HydrologyDCInefficientAnalysisEnum) return "HydrologyDCInefficientAnalysis" end
+	if(enum==HydrologyGlaDSAnalysisEnum) return "HydrologyGlaDSAnalysis" end
+	if(enum==HydrologyGlaDSEnum) return "HydrologyGlaDS" end
+	if(enum==HydrologyPismAnalysisEnum) return "HydrologyPismAnalysis" end
+	if(enum==HydrologyShaktiAnalysisEnum) return "HydrologyShaktiAnalysis" end
+	if(enum==HydrologyShreveAnalysisEnum) return "HydrologyShreveAnalysis" end
+	if(enum==HydrologySolutionEnum) return "HydrologySolution" end
+	if(enum==HydrologydcEnum) return "Hydrologydc" end
+	if(enum==HydrologypismEnum) return "Hydrologypism" end
+	if(enum==HydrologyshaktiEnum) return "Hydrologyshakti" end
+	if(enum==HydrologyshreveEnum) return "Hydrologyshreve" end
+	if(enum==IceMassEnum) return "IceMass" end
+	if(enum==IceMassScaledEnum) return "IceMassScaled" end
+	if(enum==IceVolumeAboveFloatationEnum) return "IceVolumeAboveFloatation" end
+	if(enum==IceVolumeAboveFloatationScaledEnum) return "IceVolumeAboveFloatationScaled" end
+	if(enum==IceVolumeEnum) return "IceVolume" end
+	if(enum==IceVolumeScaledEnum) return "IceVolumeScaled" end
+	if(enum==IcefrontMassFluxEnum) return "IcefrontMassFlux" end
+	if(enum==IcefrontMassFluxLevelsetEnum) return "IcefrontMassFluxLevelset" end
+	if(enum==IncrementalEnum) return "Incremental" end
+	if(enum==IndexedEnum) return "Indexed" end
+	if(enum==IntExternalResultEnum) return "IntExternalResult" end
+	if(enum==ElementInputEnum) return "ElementInput" end
+	if(enum==IntMatExternalResultEnum) return "IntMatExternalResult" end
+	if(enum==IntMatParamEnum) return "IntMatParam" end
+	if(enum==IntParamEnum) return "IntParam" end
+	if(enum==IntVecParamEnum) return "IntVecParam" end
+	if(enum==InputsEnum) return "Inputs" end
+	if(enum==InternalEnum) return "Internal" end
+	if(enum==IntersectEnum) return "Intersect" end
+	if(enum==InversionVzObsEnum) return "InversionVzObs" end
+	if(enum==JEnum) return "J" end
+	if(enum==L1L2ApproximationEnum) return "L1L2Approximation" end
+	if(enum==MLHOApproximationEnum) return "MLHOApproximation" end
+	if(enum==L2ProjectionBaseAnalysisEnum) return "L2ProjectionBaseAnalysis" end
+	if(enum==L2ProjectionEPLAnalysisEnum) return "L2ProjectionEPLAnalysis" end
+	if(enum==LACrouzeixRaviartEnum) return "LACrouzeixRaviart" end
+	if(enum==LATaylorHoodEnum) return "LATaylorHood" end
+	if(enum==LambdaSEnum) return "LambdaS" end
+	if(enum==LevelsetAnalysisEnum) return "LevelsetAnalysis" end
+	if(enum==LevelsetfunctionPicardEnum) return "LevelsetfunctionPicard" end
+	if(enum==LinearFloatingMeltRateEnum) return "LinearFloatingMeltRate" end
+	if(enum==LliboutryDuvalEnum) return "LliboutryDuval" end
+	if(enum==LoadsEnum) return "Loads" end
+	if(enum==LoveAnalysisEnum) return "LoveAnalysis" end
+	if(enum==LoveHiEnum) return "LoveHi" end
+	if(enum==LoveHrEnum) return "LoveHr" end
+	if(enum==LoveKernelsImagEnum) return "LoveKernelsImag" end
+	if(enum==LoveKernelsRealEnum) return "LoveKernelsReal" end
+	if(enum==LoveKiEnum) return "LoveKi" end
+	if(enum==LoveKrEnum) return "LoveKr" end
+	if(enum==LoveLiEnum) return "LoveLi" end
+	if(enum==LoveLrEnum) return "LoveLr" end
+	if(enum==LoveSolutionEnum) return "LoveSolution" end
+	if(enum==MINIEnum) return "MINI" end
+	if(enum==MINIcondensedEnum) return "MINIcondensed" end
+	if(enum==MantlePlumeGeothermalFluxEnum) return "MantlePlumeGeothermalFlux" end
+	if(enum==MassFluxEnum) return "MassFlux" end
+	if(enum==MassconEnum) return "Masscon" end
+	if(enum==MassconaxpbyEnum) return "Massconaxpby" end
+	if(enum==MassfluxatgateEnum) return "Massfluxatgate" end
+	if(enum==MasstransportAnalysisEnum) return "MasstransportAnalysis" end
+	if(enum==MasstransportSolutionEnum) return "MasstransportSolution" end
+	if(enum==MatdamageiceEnum) return "Matdamageice" end
+	if(enum==MatenhancediceEnum) return "Matenhancedice" end
+	if(enum==MaterialsEnum) return "Materials" end
+	if(enum==MatestarEnum) return "Matestar" end
+	if(enum==MaticeEnum) return "Matice" end
+	if(enum==MatlithoEnum) return "Matlitho" end
+	if(enum==MathydroEnum) return "Mathydro" end
+	if(enum==MatrixParamEnum) return "MatrixParam" end
+	if(enum==MaxAbsVxEnum) return "MaxAbsVx" end
+	if(enum==MaxAbsVyEnum) return "MaxAbsVy" end
+	if(enum==MaxAbsVzEnum) return "MaxAbsVz" end
+	if(enum==MaxDivergenceEnum) return "MaxDivergence" end
+	if(enum==MaxVelEnum) return "MaxVel" end
+	if(enum==MaxVxEnum) return "MaxVx" end
+	if(enum==MaxVyEnum) return "MaxVy" end
+	if(enum==MaxVzEnum) return "MaxVz" end
+	if(enum==MelangeEnum) return "Melange" end
+	if(enum==MeltingAnalysisEnum) return "MeltingAnalysis" end
+	if(enum==MeshElementsEnum) return "MeshElements" end
+	if(enum==MeshXEnum) return "MeshX" end
+	if(enum==MeshYEnum) return "MeshY" end
+	if(enum==MinVelEnum) return "MinVel" end
+	if(enum==MinVxEnum) return "MinVx" end
+	if(enum==MinVyEnum) return "MinVy" end
+	if(enum==MinVzEnum) return "MinVz" end
+	if(enum==MismipFloatingMeltRateEnum) return "MismipFloatingMeltRate" end
+	if(enum==MoulinEnum) return "Moulin" end
+	if(enum==MpiDenseEnum) return "MpiDense" end
+	if(enum==MpiEnum) return "Mpi" end
+	if(enum==MpiSparseEnum) return "MpiSparse" end
+	if(enum==MumpsEnum) return "Mumps" end
+	if(enum==NoFrictionOnPartiallyFloatingEnum) return "NoFrictionOnPartiallyFloating" end
+	if(enum==NoMeltOnPartiallyFloatingEnum) return "NoMeltOnPartiallyFloating" end
+	if(enum==NodalEnum) return "Nodal" end
+	if(enum==NodalvalueEnum) return "Nodalvalue" end
+	if(enum==NodeSIdEnum) return "NodeSId" end
+	if(enum==NoneApproximationEnum) return "NoneApproximation" end
+	if(enum==NoneEnum) return "None" end
+	if(enum==NumberedcostfunctionEnum) return "Numberedcostfunction" end
+	if(enum==NyeCO2Enum) return "NyeCO2" end
+	if(enum==NyeH2OEnum) return "NyeH2O" end
+	if(enum==NumericalfluxEnum) return "Numericalflux" end
+	if(enum==OceantransportAnalysisEnum) return "OceantransportAnalysis" end
+	if(enum==OceantransportSolutionEnum) return "OceantransportSolution" end
+	if(enum==OldGradientEnum) return "OldGradient" end
+	if(enum==OneLayerP4zEnum) return "OneLayerP4z" end
+	if(enum==OpenEnum) return "Open" end
+	if(enum==OptionEnum) return "Option" end
+	if(enum==ParamEnum) return "Param" end
+	if(enum==ParametersEnum) return "Parameters" end
+	if(enum==P0ArrayEnum) return "P0Array" end
+	if(enum==P0DGEnum) return "P0DG" end
+	if(enum==P1DGEnum) return "P1DG" end
+	if(enum==P1P1Enum) return "P1P1" end
+	if(enum==P1P1GLSEnum) return "P1P1GLS" end
+	if(enum==P1bubbleEnum) return "P1bubble" end
+	if(enum==P1bubblecondensedEnum) return "P1bubblecondensed" end
+	if(enum==P1xP2Enum) return "P1xP2" end
+	if(enum==P1xP3Enum) return "P1xP3" end
+	if(enum==P1xP4Enum) return "P1xP4" end
+	if(enum==P2Enum) return "P2" end
+	if(enum==P2bubbleEnum) return "P2bubble" end
+	if(enum==P2bubblecondensedEnum) return "P2bubblecondensed" end
+	if(enum==P2xP1Enum) return "P2xP1" end
+	if(enum==P2xP4Enum) return "P2xP4" end
+	if(enum==PatersonEnum) return "Paterson" end
+	if(enum==PengridEnum) return "Pengrid" end
+	if(enum==PenpairEnum) return "Penpair" end
+	if(enum==PentaEnum) return "Penta" end
+	if(enum==PentaInputEnum) return "PentaInput" end
+	if(enum==ProfilerEnum) return "Profiler" end
+	if(enum==ProfilingCurrentFlopsEnum) return "ProfilingCurrentFlops" end
+	if(enum==ProfilingCurrentMemEnum) return "ProfilingCurrentMem" end
+	if(enum==ProfilingSolutionTimeEnum) return "ProfilingSolutionTime" end
+	if(enum==RegionaloutputEnum) return "Regionaloutput" end
+	if(enum==RegularEnum) return "Regular" end
+	if(enum==RecoveryAnalysisEnum) return "RecoveryAnalysis" end
+	if(enum==RiftfrontEnum) return "Riftfront" end
+	if(enum==SamplingAnalysisEnum) return "SamplingAnalysis" end
+	if(enum==SamplingSolutionEnum) return "SamplingSolution" end
+	if(enum==SIAApproximationEnum) return "SIAApproximation" end
+	if(enum==SMBautoregressionEnum) return "SMBautoregression" end
+	if(enum==SMBcomponentsEnum) return "SMBcomponents" end
+	if(enum==SMBd18opddEnum) return "SMBd18opdd" end
+	if(enum==SMBforcingEnum) return "SMBforcing" end
+	if(enum==SMBgcmEnum) return "SMBgcm" end
+	if(enum==SMBgembEnum) return "SMBgemb" end
+	if(enum==SMBgradientsEnum) return "SMBgradients" end
+	if(enum==SMBgradientscomponentsEnum) return "SMBgradientscomponents" end
+	if(enum==SMBgradientselaEnum) return "SMBgradientsela" end
+	if(enum==SMBhenningEnum) return "SMBhenning" end
+	if(enum==SMBmeltcomponentsEnum) return "SMBmeltcomponents" end
+	if(enum==SMBpddEnum) return "SMBpdd" end
+	if(enum==SMBpddSicopolisEnum) return "SMBpddSicopolis" end
+	if(enum==SMBsemicEnum) return "SMBsemic" end
+	if(enum==SSAApproximationEnum) return "SSAApproximation" end
+	if(enum==SSAFSApproximationEnum) return "SSAFSApproximation" end
+	if(enum==SSAHOApproximationEnum) return "SSAHOApproximation" end
+	if(enum==ScaledEnum) return "Scaled" end
+	if(enum==SealevelAbsoluteEnum) return "SealevelAbsolute" end
+	if(enum==SealevelEmotionEnum) return "SealevelEmotion" end
+	if(enum==SealevelInertiaTensorXZEnum) return "SealevelInertiaTensorXZ" end
+	if(enum==SealevelInertiaTensorYZEnum) return "SealevelInertiaTensorYZ" end
+	if(enum==SealevelInertiaTensorZZEnum) return "SealevelInertiaTensorZZ" end
+	if(enum==SealevelchangePolarMotionEnum) return "SealevelchangePolarMotion" end
+	if(enum==SealevelNmotionEnum) return "SealevelNmotion" end
+	if(enum==SealevelUmotionEnum) return "SealevelUmotion" end
+	if(enum==SealevelchangeAnalysisEnum) return "SealevelchangeAnalysis" end
+	if(enum==SegEnum) return "Seg" end
+	if(enum==SegInputEnum) return "SegInput" end
+	if(enum==SegmentEnum) return "Segment" end
+	if(enum==SegmentRiftfrontEnum) return "SegmentRiftfront" end
+	if(enum==SeparateEnum) return "Separate" end
+	if(enum==SeqEnum) return "Seq" end
+	if(enum==SmbAnalysisEnum) return "SmbAnalysis" end
+	if(enum==SmbSolutionEnum) return "SmbSolution" end
+	if(enum==SmoothAnalysisEnum) return "SmoothAnalysis" end
+	if(enum==SoftMigrationEnum) return "SoftMigration" end
+	if(enum==SpatialLinearFloatingMeltRateEnum) return "SpatialLinearFloatingMeltRate" end
+	if(enum==SpcDynamicEnum) return "SpcDynamic" end
+	if(enum==SpcStaticEnum) return "SpcStatic" end
+	if(enum==SpcTransientEnum) return "SpcTransient" end
+	if(enum==SsetEnum) return "Sset" end
+	if(enum==StatisticsSolutionEnum) return "StatisticsSolution" end
+	if(enum==SteadystateSolutionEnum) return "SteadystateSolution" end
+	if(enum==StressIntensityFactorEnum) return "StressIntensityFactor" end
+	if(enum==StressbalanceAnalysisEnum) return "StressbalanceAnalysis" end
+	if(enum==StressbalanceConvergenceNumStepsEnum) return "StressbalanceConvergenceNumSteps" end
+	if(enum==StressbalanceSIAAnalysisEnum) return "StressbalanceSIAAnalysis" end
+	if(enum==StressbalanceSolutionEnum) return "StressbalanceSolution" end
+	if(enum==StressbalanceVerticalAnalysisEnum) return "StressbalanceVerticalAnalysis" end
+	if(enum==StringArrayParamEnum) return "StringArrayParam" end
+	if(enum==StringExternalResultEnum) return "StringExternalResult" end
+	if(enum==StringParamEnum) return "StringParam" end
+	if(enum==SubelementFriction1Enum) return "SubelementFriction1" end
+	if(enum==SubelementFriction2Enum) return "SubelementFriction2" end
+	if(enum==SubelementMelt1Enum) return "SubelementMelt1" end
+	if(enum==SubelementMelt2Enum) return "SubelementMelt2" end
+	if(enum==SubelementMigrationEnum) return "SubelementMigration" end
+	if(enum==SurfaceSlopeSolutionEnum) return "SurfaceSlopeSolution" end
+	if(enum==TaylorHoodEnum) return "TaylorHood" end
+	if(enum==TetraEnum) return "Tetra" end
+	if(enum==TetraInputEnum) return "TetraInput" end
+	if(enum==ThermalAnalysisEnum) return "ThermalAnalysis" end
+	if(enum==ThermalSolutionEnum) return "ThermalSolution" end
+	if(enum==ThicknessErrorEstimatorEnum) return "ThicknessErrorEstimator" end
+	if(enum==TotalCalvingFluxLevelsetEnum) return "TotalCalvingFluxLevelset" end
+	if(enum==TotalCalvingMeltingFluxLevelsetEnum) return "TotalCalvingMeltingFluxLevelset" end
+	if(enum==TotalFloatingBmbEnum) return "TotalFloatingBmb" end
+	if(enum==TotalFloatingBmbScaledEnum) return "TotalFloatingBmbScaled" end
+	if(enum==TotalGroundedBmbEnum) return "TotalGroundedBmb" end
+	if(enum==TotalGroundedBmbScaledEnum) return "TotalGroundedBmbScaled" end
+	if(enum==TotalSmbEnum) return "TotalSmb" end
+	if(enum==TotalSmbScaledEnum) return "TotalSmbScaled" end
+	if(enum==TransientArrayParamEnum) return "TransientArrayParam" end
+	if(enum==TransientInputEnum) return "TransientInput" end
+	if(enum==TransientParamEnum) return "TransientParam" end
+	if(enum==TransientSolutionEnum) return "TransientSolution" end
+	if(enum==TriaEnum) return "Tria" end
+	if(enum==TriaInputEnum) return "TriaInput" end
+	if(enum==UzawaPressureAnalysisEnum) return "UzawaPressureAnalysis" end
+	if(enum==VectorParamEnum) return "VectorParam" end
+	if(enum==VertexEnum) return "Vertex" end
+	if(enum==VertexLIdEnum) return "VertexLId" end
+	if(enum==VertexPIdEnum) return "VertexPId" end
+	if(enum==VertexSIdEnum) return "VertexSId" end
+	if(enum==VerticesEnum) return "Vertices" end
+	if(enum==ViscousHeatingEnum) return "ViscousHeating" end
+	if(enum==WaterEnum) return "Water" end
+	if(enum==XTaylorHoodEnum) return "XTaylorHood" end
+	if(enum==XYEnum) return "XY" end
+	if(enum==XYZEnum) return "XYZ" end
+	if(enum==BalancethicknessD0Enum) return "BalancethicknessD0" end
+	if(enum==BalancethicknessDiffusionCoefficientEnum) return "BalancethicknessDiffusionCoefficient" end
+	if(enum==BilinearInterpEnum) return "BilinearInterp" end
+	if(enum==CalvingdevCoeffEnum) return "CalvingdevCoeff" end
+	if(enum==DeviatoricStressEnum) return "DeviatoricStress" end
+	if(enum==EtaAbsGradientEnum) return "EtaAbsGradient" end
+	if(enum==MeshZEnum) return "MeshZ" end
+	if(enum==NearestInterpEnum) return "NearestInterp" end
+	if(enum==OutputdefinitionListEnum) return "OutputdefinitionList" end
+	if(enum==SealevelObsEnum) return "SealevelObs" end
+	if(enum==SealevelWeightsEnum) return "SealevelWeights" end
+	if(enum==StrainRateEnum) return "StrainRate" end
+	if(enum==StressTensorEnum) return "StressTensor" end
+	if(enum==StressbalanceViscosityOvershootEnum) return "StressbalanceViscosityOvershoot" end
+	if(enum==SubelementMigration4Enum) return "SubelementMigration4" end
+	if(enum==TimesteppingTimeAdaptEnum) return "TimesteppingTimeAdapt" end
+	if(enum==TriangleInterpEnum) return "TriangleInterp" end
+	if(enum==MaximumNumberOfDefinitionsEnum) return "MaximumNumberOfDefinitions" end
+end
Index: issm/trunk/src/jl/core/matice.jl
===================================================================
--- issm/trunk/src/jl/core/matice.jl	(revision 26744)
+++ issm/trunk/src/jl/core/matice.jl	(revision 26744)
@@ -0,0 +1,44 @@
+#Matice class definition
+struct Matice#{{{
+	vx_input::ElementInput
+	vy_input::ElementInput
+	B_input::ElementInput
+	n_input::ElementInput
+end# }}}
+
+function Matice(element::Tria) #{{{
+
+	vx_input  = GetInput(element, VxEnum)
+	vy_input  = GetInput(element, VyEnum)
+	B_input   = GetInput(element, MaterialsRheologyBEnum)
+	n_input   = GetInput(element, MaterialsRheologyNEnum)
+
+	return Matice(vx_input, vy_input, B_input, n_input)
+end#}}}
+
+#vertices functions
+function ViscositySSA(matice::Matice, xyz_list::Matrix{Float64}, gauss::GaussTria, i::Int64) #{{{
+
+	#Get strain rate
+	dvx = GetInputDerivativeValue(matice.vx_input,xyz_list,gauss,i)
+	dvy = GetInputDerivativeValue(matice.vy_input,xyz_list,gauss,i)
+	eps_xx = dvx[1]
+	eps_yy = dvy[2]
+	eps_xy = 0.5*(dvx[2] + dvy[1])
+
+	#In SSA, eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy
+	eps_eff = sqrt(eps_xx*eps_xx + eps_yy*eps_yy + eps_xy*eps_xy + eps_xx*eps_yy)
+
+	#Get B and n
+	n = GetInputValue(matice.n_input, gauss, i)
+	B = GetInputValue(matice.B_input, gauss, i)
+
+	#Compute viscosity
+	if eps_eff==0.
+		mu = 1.e+14/2
+	else
+		mu = B/(2*eps_eff^((n-1)/n))
+	end
+
+	return mu
+end #}}}
Index: issm/trunk/src/jl/core/modules.jl
===================================================================
--- issm/trunk/src/jl/core/modules.jl	(revision 26744)
+++ issm/trunk/src/jl/core/modules.jl	(revision 26744)
@@ -0,0 +1,388 @@
+#Model Processor and Core I/O
+function FetchDataToInput(md::model,inputs::Inputs,elements::Vector{Tria},data::Vector{Float64},enum::IssmEnum) #{{{
+	for i in 1:length(elements)
+		InputCreate(elements[i],inputs,data,enum)
+	end
+end#}}}
+function ModelProcessor(md::model, solutionstring::String) #{{{
+
+	#Initialize structures
+	elements    = Vector{Tria}(undef,0)
+	vertices    = Vector{Vertex}(undef,0)
+	results     = Vector{Result}(undef,0)
+	parameters  = Parameters(Dict{IssmEnum,Parameter}())
+	inputs      = Inputs(md.mesh.numberofelements, md.mesh.numberofvertices, Dict{IssmEnum,Input}())
+
+	#Create  elements, vertices and materials (independent of the analysis)
+	CreateElements(elements, md)
+	CreateVertices(vertices, md)
+	CreateParameters(parameters, md)
+	CreateInputs(inputs,elements, md)
+	if solutionstring=="TransientSolution"
+		UpdateParameters(TransientAnalysis(), parameters, md)
+	end
+
+	#Now create analysis specific data structure
+	if solutionstring=="StressbalanceSolution"
+		analyses = [StressbalanceAnalysis()]
+	elseif solutionstring=="TransientSolution"
+		analyses = [StressbalanceAnalysis(), MasstransportAnalysis()]
+	else
+		error(solutionstring, " not supported by ModelProcessor")
+	end
+
+	#Initialize analysis specific datasets
+	numanalyses = length(analyses)
+	nodes       = Vector{Vector{Node}}(undef,numanalyses)
+	constraints = Vector{Vector{Constraint}}(undef,numanalyses)
+	for i in 1:numanalyses
+		analysis = analyses[i]
+		println("   creating datasets for analysis ", typeof(analysis))
+		nodes[i]       = Vector{Node}(undef,0)
+		constraints[i] = Vector{Constraint}(undef,0)
+
+		UpdateParameters(analysis, parameters, md)
+		UpdateElements(analysis, elements, inputs, md)
+		CreateNodes(analysis, nodes[i], md)
+		CreateConstraints(analysis, constraints[i], md)
+
+		#Configure objects
+		ConfigureObjectx(elements, nodes[i], vertices, parameters, inputs, i)
+	end
+
+	#Build FemModel
+	femmodel = FemModel(analyses, elements, vertices,
+							  Vector{Node}(undef,0), nodes,
+							  parameters, inputs,
+							  Vector{Constraint}(undef,0), constraints,
+							  results)
+
+	println("      detecting active vertices")
+	GetMaskOfIceVerticesLSMx0(femmodel)
+
+	return femmodel
+
+end# }}}
+function CreateElements(elements::Vector{Tria},md::model) #{{{
+
+	#Make sure elements is currently empty
+	@assert length(elements)==0
+
+
+
+	count = 0
+	for i in 1:md.mesh.numberofelements
+
+		#Assume Linear Elements for now
+		vertexids = md.mesh.elements[i,:]
+		nodeids   = md.mesh.elements[i,:]
+
+		#Call constructor and add to dataset elements
+		push!(elements,Tria(i,count, vertexids))
+	end
+
+end# }}}
+function CreateVertices(vertices::Vector{Vertex},md::model) #{{{
+
+	#Make sure vertices is currently empty
+	@assert length(vertices)==0
+
+	#Get data from md
+	x = md.mesh.x
+	y = md.mesh.y
+
+	count = 0
+	for i in 1:md.mesh.numberofvertices
+		push!(vertices,Vertex(i,x[i],y[i],0.))
+	end
+
+end# }}}
+function CreateParameters(parameters::Parameters,md::model) #{{{
+
+	#Get data from md
+	AddParam(parameters,md.materials.rho_ice,MaterialsRhoIceEnum)
+	AddParam(parameters,md.materials.rho_water,MaterialsRhoSeawaterEnum)
+	AddParam(parameters,md.materials.rho_freshwater,MaterialsRhoFreshwaterEnum)
+	AddParam(parameters,md.constants.g,ConstantsGEnum)
+	
+	#Set step and time, this will be overwritten if we run a transient
+	AddParam(parameters,1,StepEnum)
+	AddParam(parameters,0.0,TimeEnum)
+
+end# }}}
+function CreateInputs(inputs::Inputs,elements::Vector{Tria},md::model) #{{{
+
+	#Only assume we have Matice for now
+	FetchDataToInput(md,inputs,elements,md.materials.rheology_B,MaterialsRheologyBEnum)
+	FetchDataToInput(md,inputs,elements,md.materials.rheology_n,MaterialsRheologyNEnum)
+end# }}}
+function OutputResultsx(femmodel::FemModel, md::model, solution::String)# {{{
+
+
+	if solution=="TransientSolution"
+
+		#Compute maximum number of steps
+		maxstep = 0
+		for i in length(femmodel.results)
+			if(femmodel.results[i].step>maxstep) maxstep = femmodel.results[i].step end
+		end
+
+		#Initialize vector now that we know the size
+		output = Vector{Dict}(undef, maxstep)
+		for i in 1:maxstep; output[i] = Dict() end
+
+		#Insert results in vector
+		for i in 1:length(femmodel.results)
+			result = femmodel.results[i]
+			step   = femmodel.results[i].step
+			(output[step])[EnumToString(result.enum)] = result.value
+		end
+	else
+		output = Dict()
+		for i in length(femmodel.results)
+			result = femmodel.results[i]
+			output[EnumToString(result.enum)] = result.value
+		end
+	end
+
+	md.results[solution] = output
+
+end# }}}
+
+#Other modules
+function ConfigureObjectx(elements::Vector{Tria}, nodes::Vector{Node}, vertices::Vector{Vertex}, parameters::Parameters, inputs::Inputs, analysis::Int64) #{{{
+
+	for i in 1:length(elements)
+		Configure(elements[i], nodes, vertices, parameters, inputs, analysis)
+	end
+
+end# }}}
+function SpcNodesx(nodes::Vector{Node},constraints::Vector{Constraint},parameters::Parameters) #{{{
+
+	for i in 1:length(constraints)
+		ConstrainNode(constraints[i],nodes,parameters)
+	end
+
+end# }}}
+function NodesDofx(nodes::Vector{Node}, parameters::Parameters) #{{{
+
+	#Do we have any nodes?
+	if length(nodes)==0
+		return
+	end
+
+	#Do we really need to update dof indexing
+	if(~RequiresDofReindexing(nodes)) return end
+
+	print("   Renumbering degrees of freedom\n")
+	DistributeDofs(nodes,GsetEnum)
+	DistributeDofs(nodes,FsetEnum)
+	DistributeDofs(nodes,SsetEnum)
+
+end# }}}
+function GetSolutionFromInputsx(analysis::Analysis,femmodel::FemModel) #{{{
+
+	#Get size of vector
+	gsize = NumberOfDofs(femmodel.nodes,GsetEnum)
+
+	#Initialize solution vector
+	ug = IssmVector(gsize)
+
+	#Go through elements and plug in solution
+	for i=1:length(femmodel.elements)
+		GetSolutionFromInputs(analysis,ug,femmodel.elements[i])
+	end
+
+	return ug
+
+end#}}}
+function InputUpdateFromSolutionx(analysis::Analysis,ug::IssmVector,femmodel::FemModel) #{{{
+
+	#Go through elements and plug in solution
+	for i=1:length(femmodel.elements)
+		InputUpdateFromSolution(analysis,ug.vector,femmodel.elements[i])
+	end
+
+	return ug
+
+end#}}}
+function InputUpdateFromVectorx(femmodel::FemModel, vector::Vector{Float64}, enum::IssmEnum, layout::IssmEnum)
+
+	#Go through elements and plug in solution
+	for i=1:length(femmodel.elements)
+		InputUpdateFromVector(femmodel.elements[i], vector, enum, layout)
+	end
+
+end#}}}
+function InputDuplicatex(femmodel::FemModel, oldenum::IssmEnum, newenum::IssmEnum) #{{{
+	DuplicateInput(femmodel.inputs, oldenum, newenum)
+end#}}}
+function Reducevectorgtofx(ug::IssmVector,nodes::Vector{Node}) #{{{
+
+	#Get size of output vector
+	fsize = NumberOfDofs(nodes,FsetEnum)
+
+	#Initialize output vector
+	uf = IssmVector(fsize)
+
+	#Go through elements and plug in solution
+	for i=1:length(nodes)
+		VecReduce(nodes[i],ug.vector,uf)
+	end
+
+	return uf
+
+end#}}}
+function Mergesolutionfromftogx(ug::IssmVector, uf::IssmVector, ys::IssmVector, nodes::Vector{Node}) #{{{
+
+	#Go through elements and plug in solution
+	for i=1:length(nodes)
+		VecMerge(nodes[i],ug,uf.vector,ys.vector)
+	end
+
+	return ug
+
+end#}}}
+function Reduceloadx!(pf::IssmVector, Kfs::IssmMatrix, ys::IssmVector) #{{{
+
+	#Is there anything to do?
+	m, n = GetSize(Kfs)
+
+	if(m*n>0)
+
+		#Allocate Kfs*ys
+		Kfsy_s=IssmVector(m)
+
+		#Perform multiplication
+		MatMult!(Kfs,ys,Kfsy_s)
+
+		#Subtract Kfs*ys from pf
+		AXPY!(pf,-1.0,Kfsy_s)
+
+	end
+end#}}}
+function SystemMatricesx(femmodel::FemModel,analysis::Analysis)# {{{
+
+	#Allocate matrices
+	fsize = NumberOfDofs(femmodel.nodes,FsetEnum)
+	ssize = NumberOfDofs(femmodel.nodes,SsetEnum)
+	Kff = IssmMatrix(fsize,fsize)
+	Kfs = IssmMatrix(fsize,ssize)
+	pf  = IssmVector(fsize)
+
+	#Construct Stiffness matrix and load vector from elements
+	for i in 1:length(femmodel.elements)
+		Ke = CreateKMatrix(analysis,femmodel.elements[i])
+		pe = CreatePVector(analysis,femmodel.elements[i])
+
+		if(!isnothing(Ke)) AddToGlobal!(Ke,Kff,Kfs) end
+		if(!isnothing(pe)) AddToGlobal!(pe,pf) end
+	end
+
+	Assemble!(Kff)
+	Assemble!(Kfs)
+	Assemble!(pf)
+	
+	return Kff, Kfs, pf
+end# }}}
+function CreateNodalConstraintsx(nodes::Vector{Node})# {{{
+
+	#Allocate vector
+	ssize=NumberOfDofs(nodes,SsetEnum)
+	ys=IssmVector(ssize)
+
+	#constraints vector with the constraint values
+	for i in 1:length(nodes)
+		CreateNodalConstraints(nodes[i],ys)
+	end
+
+	return ys
+end# }}}
+function RequestedOutputsx(femmodel::FemModel,outputlist::Vector{IssmEnum})# {{{
+
+	#Get Step and Time from parameters
+	step = FindParam(femmodel.parameters,StepEnum)
+	time = FindParam(femmodel.parameters,TimeEnum)
+	
+	#Now fetch results
+	for i in 1:length(outputlist)
+
+		#See if outputlist[i] is an input
+		if outputlist[i]>InputsSTARTEnum && outputlist[i]<InputsENDEnum
+
+			#Create Result
+			input  = GetInput(femmodel.inputs,outputlist[i])
+			result = Result(outputlist[i], step, time, copy(input.values))
+
+			#Add to femmodel.results dataset
+			push!(femmodel.results, result)
+
+		else
+			println("Output ",outputlist[i]," not supported yet")
+		end
+	end
+end# }}}
+function MigrateGroundinglinex(femmodel::FemModel)# {{{
+
+	for i=1:length(femmodel.elements)
+		MigrateGroundingLine(femmodel.elements[i])
+	end
+
+end# }}}
+function UpdateConstraintsx(femmodel::FemModel, analysis::Analysis)# {{{
+
+	#First, see if the analysis needs to change constraints
+	UpdateConstraints(analysis, femmodel)
+
+	#Second, constraints might be time dependent
+	SpcNodesx(femmodel.nodes, femmodel.constraints, femmodel.parameters)
+
+	#Now, update degrees of freedoms
+	NodesDofx(femmodel.nodes, femmodel.parameters)
+
+end# }}}
+function SetActiveNodesLSMx(femmodel::FemModel) #{{{
+
+	#Check mask of each element to see if element is active
+	numnodes = 3
+	mask = Vector{Float64}(undef, numnodes)
+	for i in 1:length(femmodel.elements)
+		GetInputListOnNodes!(femmodel.elements[i], mask, IceMaskNodeActivationEnum)
+		for j in 1:numnodes
+			node = femmodel.elements[i].nodes[j]
+			if(mask[j]==1.) Activate!(node)
+			else             Deactivate!(node)
+			end
+		end
+
+	end
+end#}}}
+function GetMaskOfIceVerticesLSMx0(femmodel::FemModel) #{{{
+
+	#Initialize vector with number of vertices
+	numvertices=length(femmodel.vertices)
+   if(numvertices==0) return end
+
+	#Initialize vector
+	nbv = 3
+	onesvec      = ones(nbv)
+	vec_mask_ice = IssmVector(numvertices)
+	vertexids    = Vector{Int64}(undef, nbv)
+
+	#Assign values to vector
+	for i in 1:length(femmodel.elements)
+		if (IsIceInElement(femmodel.elements[i]))
+			for j in 1:nbv
+				vertexids[j] = femmodel.elements[i].vertices[j].sid
+			end
+			SetValues!(vec_mask_ice, nbv, vertexids, onesvec)
+		end
+	end
+	Assemble!(vec_mask_ice)
+
+	#Serialize vector
+	vec_mask_ice_serial = ToSerial(vec_mask_ice)
+
+	#Update IceMaskNodeActivationEnum in elements
+	InputUpdateFromVectorx(femmodel, vec_mask_ice_serial, IceMaskNodeActivationEnum, VertexSIdEnum)
+end#}}}
Index: issm/trunk/src/jl/core/nodes.jl
===================================================================
--- issm/trunk/src/jl/core/nodes.jl	(revision 26744)
+++ issm/trunk/src/jl/core/nodes.jl	(revision 26744)
@@ -0,0 +1,267 @@
+#Node class definition
+mutable struct Node #{{{
+	id::Int64
+	sid::Int64
+	indexingupdate::Bool
+	active::Bool
+	gsize::Int64
+	gdoflist::Vector{Int64}
+	fdoflist::Vector{Int64}
+	sdoflist::Vector{Int64}
+	svalues::Vector{Float64}
+end# }}}
+
+#Node functions
+function Base.show(io::IO, this::Node)# {{{
+
+	println(io,"Node:")
+	println(io,"   id:  ",this.id)
+	println(io,"   sid: ",this.sid)
+	println(io,"   indexingupdate: ",this.indexingupdate)
+	println(io,"   gsize: ",this.gsize)
+	println(io,"   gdoflist: ",this.gdoflist)
+	println(io,"   fdoflist: ",this.fdoflist)
+	println(io,"   sdoflist: ",this.sdoflist)
+	println(io,"   svalues: ",this.svalues)
+end# }}}
+function Activate!(node::Node) #{{{
+
+	if(!node.active)
+		node.indexingupdate = true
+		node.active = true
+		for i in 1:node.gsize
+			node.fdoflist[i]  = +1
+			node.sdoflist[i]  = -1
+			node.svalues[i]   = 0.0
+		end
+	end
+
+end# }}}
+function Deactivate!(node::Node) #{{{
+
+	if(node.active)
+		node.indexingupdate = true
+		node.active = false
+		for i in 1:node.gsize
+			node.fdoflist[i]  = -1
+			node.sdoflist[i]  = +1
+			node.svalues[i]   = 0.0
+		end
+	end
+
+end# }}}
+function ApplyConstraint(node::Node,dof::Int8,value::Float64) #{{{
+
+	node.indexingupdate = true
+	node.fdoflist[dof]  = -1
+	node.sdoflist[dof]  = +1
+	node.svalues[dof]   = value
+
+end# }}}
+function CreateNodalConstraints(node::Node,ys::IssmVector) #{{{
+
+	if(SSize(node)>0)
+		SetValues!(ys,node.gsize,node.sdoflist,node.svalues)
+	end
+
+end# }}}
+function DistributeDofs(node::Node,setenum::IssmEnum,dofcount::Int64) #{{{
+
+	if setenum==GsetEnum
+		for i in 1:node.gsize
+			node.gdoflist[i] = dofcount
+			dofcount += 1
+		end
+	elseif setenum==FsetEnum
+		for i in 1:node.gsize
+			if  node.fdoflist[i]!=-1
+				@assert node.sdoflist[i]==-1
+				node.fdoflist[i] = dofcount
+				dofcount += 1
+			end
+		end
+	elseif setenum==SsetEnum
+		for i in 1:node.gsize
+			if  node.sdoflist[i]!=-1
+				@assert node.fdoflist[i]==-1
+				node.sdoflist[i] = dofcount
+				dofcount += 1
+			end
+		end
+	else
+		error("not supported")
+	end
+
+	return dofcount
+end# }}}
+function GetNumberOfDofs(node::Node,setenum::IssmEnum) #{{{
+
+	if setenum==GsetEnum
+		dofcount = node.gsize
+	elseif setenum==FsetEnum
+		dofcount = 0
+		for i=1:node.gsize
+			if  node.fdoflist[i]!=-1
+				dofcount += 1
+			end
+		end
+	elseif setenum==SsetEnum
+		dofcount = 0
+		for i=1:node.gsize
+			if  node.sdoflist[i]!=-1
+				dofcount += 1
+			end
+		end
+	else
+		error("not supported")
+	end
+
+	return dofcount
+
+end# }}}
+function GetDofList(node::Node,doflist::Vector{Int64},count::Int64,setenum::IssmEnum) #{{{
+
+	if setenum==GsetEnum
+		for i in 1:node.gsize
+			count += 1
+			doflist[count] = node.gdoflist[i]
+		end
+	elseif setenum==FsetEnum
+		for i=1:node.gsize
+			#if  node.fdoflist[i]!=-1
+				count += 1
+				doflist[count] = node.fdoflist[i]
+			#end
+		end
+	elseif setenum==SsetEnum
+		for i=1:node.gsize
+			#if  node.sdoflist[i]!=-1
+				count += 1
+				doflist[count] = node.sdoflist[i]
+			#end
+		end
+	else
+		error("not supported")
+	end
+
+	return count
+
+end# }}}
+function GetGlobalDofList(nodes::Vector{Node},ndofs::Int64,setenum::IssmEnum) #{{{
+
+	#Allocate list
+	doflist = Vector{Int64}(undef,ndofs)
+
+	#Assign values 
+	count = 0
+	for i in 1:length(nodes)
+		count = GetDofList(nodes[i],doflist,count,setenum)
+	end
+	@assert count==ndofs
+
+	return doflist
+
+end# }}}
+function VecReduce(node::Node,ug::Vector{Float64},uf::IssmVector) #{{{
+
+	for i=1:node.gsize
+		if node.fdoflist[i]!=-1
+			uf.vector[node.fdoflist[i]] = ug[node.gdoflist[i]]
+		end
+	end
+
+end# }}}
+function VecMerge(node::Node,ug::IssmVector,uf::Vector{Float64},ys::Vector{Float64}) #{{{
+
+	fsize = FSize(node)
+	ssize = SSize(node)
+
+	if fsize>0
+		indices = Vector{Int64}(undef,fsize)
+		values  = Vector{Float64}(undef,fsize)
+
+		count = 1
+		for i=1:node.gsize
+			if node.fdoflist[i]!=-1
+				indices[count] = node.gdoflist[i]
+				values[count]  = uf[node.fdoflist[i]]
+				count += 1
+			end
+		end
+		SetValues!(ug,fsize,indices,values)
+	end
+
+	if ssize>0
+		indices = Vector{Int64}(undef,ssize)
+		values  = Vector{Float64}(undef,ssize)
+
+		count = 1
+		for i=1:node.gsize
+			if node.sdoflist[i]!=-1
+				indices[count] = node.gdoflist[i]
+				values[count]  = ys[node.sdoflist[i]]
+				count += 1
+			end
+		end
+		SetValues!(ug,ssize,indices,values)
+	end
+
+end# }}}
+function SSize(node::Node) #{{{
+
+	ssize = 0
+
+	for i=1:node.gsize
+		if node.sdoflist[i]!=-1
+			ssize+=1
+		end
+	end
+
+	return ssize
+
+end# }}}
+function FSize(node::Node) #{{{
+
+	fsize = 0
+
+	for i=1:node.gsize
+		if node.fdoflist[i]!=-1
+			fsize+=1
+		end
+	end
+
+	return fsize
+
+end# }}}
+
+#Nodes functions
+function RequiresDofReindexing(nodes::Vector{Node}) #{{{
+
+	for i in 1:length(nodes)
+		if nodes[i].indexingupdate
+			return true
+		end
+	end
+
+	return false
+
+end# }}}
+function DistributeDofs(nodes::Vector{Node},setenum::IssmEnum) #{{{
+
+	dofcount = 1
+
+	for i in 1:length(nodes)
+		dofcount = DistributeDofs(nodes[i],setenum,dofcount)
+	end
+
+
+end# }}}
+function NumberOfDofs(nodes::Vector{Node},setenum::IssmEnum) #{{{
+
+	numdofs = 0
+	for i in 1:length(nodes)
+		numdofs += GetNumberOfDofs(nodes[i],setenum)
+	end
+	return numdofs
+
+end# }}}
Index: issm/trunk/src/jl/core/parameters.jl
===================================================================
--- issm/trunk/src/jl/core/parameters.jl	(revision 26744)
+++ issm/trunk/src/jl/core/parameters.jl	(revision 26744)
@@ -0,0 +1,53 @@
+#Parameter class definition
+abstract type Parameter end
+struct DoubleParam <: Parameter #{{{
+	enum::IssmEnum
+	value::Float64
+end# }}}
+struct IntParam <: Parameter #{{{
+	enum::IssmEnum
+	value::Int64
+end# }}}
+struct BoolParam <: Parameter #{{{
+	enum::IssmEnum
+	value::Bool
+end# }}}
+
+#Parameters dataset class definition
+mutable struct Parameters #{{{
+	lookup::Dict{IssmEnum,Parameter}
+end# }}}
+
+#Parameter functions
+function GetParameterValue(param::DoubleParam) #{{{
+	return param.value
+end#}}}
+function GetParameterValue(param::IntParam) #{{{
+	return param.value
+end#}}}
+function GetParameterValue(param::BoolParam) #{{{
+	return param.value
+end#}}}
+
+#Parameters functions
+function AddParam(parameters::Parameters,value::Float64,enum::IssmEnum) #{{{
+
+	parameters.lookup[enum] = DoubleParam(enum,value)
+
+end#}}}
+function AddParam(parameters::Parameters,value::Int64, enum::IssmEnum) #{{{
+
+	parameters.lookup[enum] = IntParam(enum,value)
+
+end#}}}
+function AddParam(parameters::Parameters,value::Bool, enum::IssmEnum) #{{{
+
+	parameters.lookup[enum] = BoolParam(enum,value)
+
+end#}}}
+function FindParam(parameters::Parameters,enum::IssmEnum) #{{{
+
+	param = parameters.lookup[enum]
+	return GetParameterValue(param)
+
+end#}}}
Index: issm/trunk/src/jl/core/results.jl
===================================================================
--- issm/trunk/src/jl/core/results.jl	(revision 26744)
+++ issm/trunk/src/jl/core/results.jl	(revision 26744)
@@ -0,0 +1,6 @@
+mutable struct Result #{{{
+	enum::IssmEnum
+	step::Int64
+	time::Float64
+	value
+end#}}}
Index: issm/trunk/src/jl/core/solutionsequences.jl
===================================================================
--- issm/trunk/src/jl/core/solutionsequences.jl	(revision 26744)
+++ issm/trunk/src/jl/core/solutionsequences.jl	(revision 26744)
@@ -0,0 +1,132 @@
+function solutionsequence_linear(femmodel::FemModel,analysis::Analysis) # {{{
+
+	#First, update constraints in case the levelset has changed
+	UpdateConstraintsx(femmodel, analysis)
+
+	#Get new matrices
+	Kff, Kfs, pf = SystemMatricesx(femmodel,analysis)
+
+	#Enforce constraints
+	ys = CreateNodalConstraintsx(femmodel.nodes)
+	Reduceloadx!(pf, Kfs, ys)
+
+	#Solve!
+	uf = Solverx(Kff, pf)
+
+	#Merge uf with ys and update inputs
+	gsize = NumberOfDofs(femmodel.nodes,GsetEnum)
+	ug = IssmVector(gsize)
+	Mergesolutionfromftogx(ug, uf, ys, femmodel.nodes)
+
+	InputUpdateFromSolutionx(analysis, ug, femmodel)
+
+end# }}}
+function solutionsequence_nonlinear(femmodel::FemModel,analysis::Analysis,maxiter::Int64,restol::Float64,reltol::Float64,abstol::Float64) # {{{
+
+	#First, update constraints in case the levelset has changed
+	UpdateConstraintsx(femmodel, analysis)
+
+	#Initialize number of iterations
+	count = 0
+	converged = false
+
+	#Get existing solution
+	ug = GetSolutionFromInputsx(analysis,femmodel)
+	uf = Reducevectorgtofx(ug,femmodel.nodes)
+
+	#Update once again the solution to make sure that vx and vxold are similar (for next step in transient or steadystate)
+	InputUpdateFromSolutionx(analysis,ug,femmodel)
+
+	#Loop until we reach convergence
+	while(~converged)
+
+		#Get new matrices
+		Kff, Kfs, pf = SystemMatricesx(femmodel,analysis)
+
+		#Enforce constraints
+		ys = CreateNodalConstraintsx(femmodel.nodes)
+		Reduceloadx!(pf, Kfs, ys)
+
+		#Solve!
+		old_uf = uf
+		uf = Solverx(Kff, pf, old_uf)
+
+		#Merge uf with ys
+		Mergesolutionfromftogx(ug, uf, ys, femmodel.nodes)
+
+		#Check for convergence
+		converged = convergence(Kff,pf,uf,old_uf,restol,reltol,abstol)
+		InputUpdateFromSolutionx(analysis,ug,femmodel)
+
+		#Increase count
+		count += 1
+		if(count>=maxiter)
+			println("   maximum number of nonlinear iterations (",maxiter,") exceeded")
+			converged = true
+		end
+	end
+
+	print("\n   total number of iterations: ",  count,  "\n")
+
+end# }}}
+function convergence(Kff::IssmMatrix, pf::IssmVector, uf::IssmVector, old_uf::IssmVector, restol::Float64, reltol::Float64, abstol::Float64)#{{{
+
+	print("   checking convergence\n");
+
+	#If solution vector is empty, return true
+	if(IsEmpty(uf))
+		return true
+	end
+
+	#Convergence criterion #1: force equilibrium (Mandatory)
+	#compute K[n]U[n-1] - F
+	KUold  = Duplicate(uf);    MatMult!(Kff,old_uf,KUold)
+	KUoldF = Duplicate(KUold); VecCopy!(KUold, KUoldF); AXPY!(KUoldF, -1.0, pf)
+	nKUoldF = Norm(KUoldF,2)
+	nF      = Norm(pf,2)
+	res = nKUoldF/nF
+	if ~isfinite(res)
+		println("norm nf = ", nF, " and norm kuold = ",nKUoldF)
+		error("mechanical equilibrium convergence criterion is not finite!")
+	end
+	if(res<restol)
+		print("   mechanical equilibrium convergence criterion ", res*100, " < ", restol*100, " %\n")
+		converged=true
+	else
+		print("   mechanical equilibrium convergence criterion ", res*100, " > ", restol*100, " %\n")
+		converged=false;
+	end
+
+	#Convergence criterion #2: norm(du)/norm(u)
+	if ~isnan(reltol)
+		duf = Duplicate(old_uf); VecCopy!(old_uf,duf); AXPY!(duf, -1.0, uf)
+		ndu = Norm(duf, 2); nu = Norm(old_uf, 2)
+		if ~isfinite(ndu) | ~isfinite(nu) 
+			error("convergence criterion is not finite!")
+		end
+		if((ndu/nu)<reltol)
+			print("   Convergence criterion: norm(du)/norm(u)      ", ndu/nu*100, " < ", reltol*100, " %\n")
+		else
+			print("   Convergence criterion: norm(du)/norm(u)      ", ndu/nu*100, " > ", reltol*100, " %\n")
+			converged=false;
+		end
+	end
+
+	#Convergence criterion #3: max(du)
+	if ~isnan(abstol)
+		duf = Duplicate(old_uf); VecCopy!(old_uf,duf); AXPY!(duf, -1.0, uf)
+		nduinf= Norm(duf, 3)
+		if ~isfinite(nduinf) 
+			error("convergence criterion is not finite!")
+		end
+		if(nduinf<abstol)
+			print("   Convergence criterion: max(du)               ", nduinf, " < ", abstol, "\n")
+		else
+			print("   Convergence criterion: max(du)               ", nduinf, " > ", abstol, "\n")
+			converged=false;
+		end
+	end
+
+	return converged
+
+end#}}}
Index: issm/trunk/src/jl/core/solve.jl
===================================================================
--- issm/trunk/src/jl/core/solve.jl	(revision 26744)
+++ issm/trunk/src/jl/core/solve.jl	(revision 26744)
@@ -0,0 +1,45 @@
+include("../usr/classes.jl")
+include("./issmenums.jl")
+include("./toolkits.jl")
+include("./gauss.jl")
+include("./parameters.jl")
+include("./inputs.jl")
+include("./vertices.jl")
+include("./nodes.jl")
+include("./elements.jl")
+include("./constraints.jl")
+include("./results.jl")
+include("./matice.jl")
+include("./friction.jl")
+include("./analyses/analysis.jl")
+include("./femmodel.jl")
+
+#All analyses
+include("./analyses/stressbalanceanalysis.jl")
+include("./analyses/masstransportanalysis.jl")
+include("./analyses/transientanalysis.jl")
+
+include("./solutionsequences.jl")
+include("./modules.jl")
+include("./elementmatrix.jl")
+include("./utils.jl")
+
+function IssmCore(md::model, solutionstring::String) #{{{
+
+	#Construct FemModel
+	femmodel=ModelProcessor(md, solutionstring)
+
+	#Solve FIXME: to be improved later...
+	if(solutionstring=="StressbalanceSolution")
+		analysis = StressbalanceAnalysis()
+	elseif (solutionstring=="TransientSolution")
+		analysis = TransientAnalysis()
+	else
+		error("not supported")
+	end
+	Core(analysis, femmodel)
+
+	#move results to md
+	OutputResultsx(femmodel, md, solutionstring)
+
+end# }}}
Index: issm/trunk/src/jl/core/toolkits.jl
===================================================================
--- issm/trunk/src/jl/core/toolkits.jl	(revision 26744)
+++ issm/trunk/src/jl/core/toolkits.jl	(revision 26744)
@@ -0,0 +1,150 @@
+
+#Toolkit #1: serial sparse arrays
+using SparseArrays
+
+#Matrix
+mutable struct IssmMatrix #{{{
+	M::Int64
+	N::Int64
+	rows::Vector{Int64}
+	cols::Vector{Int64}
+	vals::Vector{Float64}
+	matrix::SparseMatrixCSC{Float64,Int64}
+end #}}}
+function IssmMatrix(M::Int64,N::Int64)#{{{
+	return IssmMatrix(M, N, Vector{Int64}(undef,0), Vector{Int64}(undef,0), Vector{Float64}(undef,0), spzeros(0,0))
+end#}}}
+function AddValues!(matrix::IssmMatrix,m::Int64,midx::Vector{Int64},n::Int64,nidx::Vector{Int64},values::Matrix{Float64})#{{{
+
+	#This is inefficient now, but it will work
+	for i in 1:m
+		if(midx[i]==-1) continue end
+		for j in 1:n
+			if(nidx[j]==-1) continue end
+			push!(matrix.rows, midx[i])
+			push!(matrix.cols, nidx[j])
+			push!(matrix.vals, values[i,j])
+		end
+	end
+
+end#}}}
+function GetSize(matrix::IssmMatrix)#{{{
+
+	return size(matrix.matrix)
+
+end#}}}
+function Assemble!(matrix::IssmMatrix)#{{{
+
+	matrix.matrix = sparse(matrix.rows, matrix.cols, matrix.vals, matrix.M, matrix.N)
+
+end#}}}
+
+#Vector
+mutable struct IssmVector #{{{
+	vector::Vector{Float64}
+end #}}}
+function IssmVector(M::Int64)#{{{
+	return IssmVector(zeros(M))
+end#}}}
+function GetSize(vector::IssmVector)#{{{
+
+	return length(vector.vector)
+
+end#}}}
+function AddValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{
+
+	#This is inefficient now, but it will work
+	for i in 1:m
+		if(midx[i]==-1) continue end
+		vector.vector[midx[i]] += values[i]
+	end
+
+end#}}}
+function SetValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{
+
+	#This is inefficient now, but it will work
+	for i in 1:m
+		if(midx[i]==-1) continue end
+		vector.vector[midx[i]] = values[i]
+	end
+
+end#}}}
+function IsEmpty(vector::IssmVector)#{{{
+
+	return GetSize(vector)==0
+
+end#}}}
+function Duplicate(vector::IssmVector)#{{{
+
+	#Copy data structure
+	M=GetSize(vector)
+	return IssmVector(M)
+
+end#}}}
+function VecCopy!(x::IssmVector,y::IssmVector)#{{{
+
+	y.vector = x.vector
+
+end#}}}
+function Assemble!(vector::IssmVector)#{{{
+
+	#Nothing to do for this toolkit
+
+end#}}}
+function ToSerial(vector::IssmVector)#{{{
+
+	return vector.vector
+
+end#}}}
+function Norm(x::IssmVector,type::Int64)#{{{
+
+	norm = 0
+
+	if type==2
+		for i in 1:length(x.vector)
+			norm += x.vector[i]^2
+		end
+		norm = sqrt(norm)
+	elseif type==3
+		#Infinite norm
+		for i in 1:length(x.vector)
+			if(abs(x.vector[i])>norm) norm = abs(x.vector[i]) end
+		end
+	else
+		error("type ",type," not supported yet")
+	end
+
+	return norm
+
+end#}}}
+
+#Operations
+function MatMult!(A::IssmMatrix,x::IssmVector,y::IssmVector) #{{{
+
+	y.vector = A.matrix*x.vector
+
+end#}}}
+function AXPY!(y::IssmVector,alpha::Float64,x::IssmVector) #{{{
+
+	y.vector = alpha*x.vector + y.vector
+
+end#}}}
+function Solverx(A::IssmMatrix, b::IssmVector, xold::IssmVector) #{{{
+
+	#Initialize output
+	#x = IssmVector(GetSize(xold))
+	
+	return Solverx(A, b)
+
+end#}}}
+function Solverx(A::IssmMatrix, b::IssmVector) #{{{
+
+	#Initialize output
+	x = IssmVector(0)
+
+	#Solve linear system
+	x.vector = A.matrix\b.vector
+
+	return x
+
+end#}}}
Index: issm/trunk/src/jl/core/utils.jl
===================================================================
--- issm/trunk/src/jl/core/utils.jl	(revision 26744)
+++ issm/trunk/src/jl/core/utils.jl	(revision 26744)
@@ -0,0 +1,26 @@
+function Matrix2x2Determinant(A::Matrix{Float64}) #{{{
+
+	return  A[1,1]*A[2,2]-A[2,1]*A[1,2]
+
+end#}}}
+function Matrix2x2Invert(A::Matrix{Float64}) #{{{
+
+	#Initialize output
+	Ainv = Matrix{Float64}(undef,2,2)
+
+	#Compute determinant
+	det = Matrix2x2Determinant(A)
+	if(abs(det)<eps(Float64)) error("Determinant smaller than machine epsilon") end
+
+	#Multiplication is faster than divsion, so we multiply by the reciprocal
+	det_reciprocal = 1/det
+
+	#compute invert matrix
+	Ainv[1,1]=   A[2,2]*det_reciprocal # =  d/det
+   Ainv[1,2]= - A[1,2]*det_reciprocal # = -b/det
+   Ainv[2,1]= - A[2,1]*det_reciprocal # = -c/det
+   Ainv[2,2]=   A[1,1]*det_reciprocal # =  a/det
+
+	return  Ainv
+
+end#}}}
Index: issm/trunk/src/jl/core/vertices.jl
===================================================================
--- issm/trunk/src/jl/core/vertices.jl	(revision 26744)
+++ issm/trunk/src/jl/core/vertices.jl	(revision 26744)
@@ -0,0 +1,26 @@
+#Vertex class definition
+mutable struct Vertex#{{{
+	sid::Int64
+	x::Float64
+	y::Float64
+	z::Float64
+end# }}}
+
+#vertices functions
+function GetVerticesCoordinates(vertices::Vector{Vertex}) #{{{
+
+	#Intermediaries
+	nbv = length(vertices)
+
+	#Allocate
+	xyz_list = Matrix{Float64}(undef,nbv,3)
+
+	#Assign value to xyz_list
+	for i in 1:nbv
+		xyz_list[i,1]=vertices[i].x
+		xyz_list[i,2]=vertices[i].y
+		xyz_list[i,3]=vertices[i].z
+	end
+
+	return xyz_list
+end #}}}
Index: issm/trunk/src/jl/issm.jl
===================================================================
--- issm/trunk/src/jl/issm.jl	(revision 26744)
+++ issm/trunk/src/jl/issm.jl	(revision 26744)
@@ -0,0 +1,20 @@
+# Julia version of the Ice-sheet and Sea-level System Model
+#
+# Author: Mathieu Morlighem
+# email:  mathieu.morlighem@dartmouth.edu
+
+module ISSM
+
+include("usr/classes.jl")
+export model
+include("usr/exp.jl")
+export expread, ContourToNodes
+include("usr/utils.jl")
+export archread, solve, issmdir
+include("usr/triangle.jl")
+export triangle
+include("usr/parameterization.jl")
+export setmask, InterpFromMeshToMesh2d
+include("core/solve.jl")
+
+end
Index: issm/trunk/src/jl/tests/test.jl
===================================================================
--- issm/trunk/src/jl/tests/test.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test.jl	(revision 26744)
@@ -0,0 +1,14 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+using MAT
+
+#Load model from MATLAB file
+#file = matopen("./Pig.mat")
+file = matopen("/Users/mmorligh/Desktop/issmuci/trunk-jpl/test/NightlyRun/temp.mat")
+mat  = read(file, "md")
+close(file)
+md = model(mat)
+
+#Solve stress balance
+md = solve(md, "Stressbalance")
Index: issm/trunk/src/jl/tests/test101.jl
===================================================================
--- issm/trunk/src/jl/tests/test101.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test101.jl	(revision 26744)
@@ -0,0 +1,45 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+
+md = model()
+md = triangle(md,issmdir()*"/test/Exp/Square.exp",50000.)
+md = setmask(md,"all","")
+
+#Geometry
+hmin=300.
+hmax=1000.
+ymin=minimum(md.mesh.y)
+ymax=maximum(md.mesh.y)
+xmin=minimum(md.mesh.x)
+xmax=maximum(md.mesh.x)
+md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin)
+md.geometry.base      = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+md.geometry.surface   = md.geometry.base+md.geometry.thickness
+md.geometry.bed       = md.geometry.base .-10
+
+#Initial velocity
+x     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x")
+y     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y")
+vx    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx")
+vy    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy")
+index = Int.(archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index"))
+md.initialization.vx=0 .*InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y,0.0)
+md.initialization.vy=0 .*InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y,0.0)
+
+md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices)
+md.materials.rheology_n=3*ones(md.mesh.numberofelements)
+md.friction.coefficient=20*ones(md.mesh.numberofvertices)
+
+md.stressbalance.restol=0.05
+md.stressbalance.reltol=0.05
+md.stressbalance.abstol=NaN
+
+#Boundary conditions
+md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices)
+md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices)
+pos = findall(md.mesh.vertexonboundary)
+md.stressbalance.spcvx[pos] .= 0.0
+md.stressbalance.spcvy[pos] .= 0.0
+
+md=solve(md,"Stressbalance")
Index: issm/trunk/src/jl/tests/test201.jl
===================================================================
--- issm/trunk/src/jl/tests/test201.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test201.jl	(revision 26744)
@@ -0,0 +1,51 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+
+md = model()
+md = triangle(md,issmdir()*"/test/Exp/Square.exp", 50000.)
+md = setmask(md, "all", "")
+
+#Geometry
+hmin=300.
+hmax=1000.
+ymin=minimum(md.mesh.y)
+ymax=maximum(md.mesh.y)
+xmin=minimum(md.mesh.x)
+xmax=maximum(md.mesh.x)
+md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin)
+md.geometry.base      = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+md.geometry.surface   = md.geometry.base+md.geometry.thickness
+md.geometry.bed       = md.geometry.base .-10
+
+#Initial velocity
+x     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x")
+y     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y")
+vx    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx")
+vy    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy")
+index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index")
+md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y)
+md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
+
+md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices)
+md.materials.rheology_n=3*ones(md.mesh.numberofelements)
+md.friction.coefficient=20*ones(md.mesh.numberofvertices)
+
+md.stressbalance.restol=0.1
+md.stressbalance.reltol=0.02
+md.stressbalance.abstol=NaN
+
+#Boundary conditions
+nodefront=ContourToNodes(md.mesh.x,md.mesh.y,issmdir()*"/test/Exp/SquareFront.exp",2.0) .& md.mesh.vertexonboundary
+md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices)
+md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices)
+pos = findall(md.mesh.vertexonboundary .& .~nodefront)
+md.mask.ice_levelset[findall(nodefront)] .= 0
+
+segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0
+segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2)
+pos=md.mesh.segments[segments,1:2]
+md.stressbalance.spcvx[pos] .= 0.0
+md.stressbalance.spcvy[pos] .= 0.0
+
+md=solve(md,"Stressbalance")
Index: issm/trunk/src/jl/tests/test208.jl
===================================================================
--- issm/trunk/src/jl/tests/test208.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test208.jl	(revision 26744)
@@ -0,0 +1,59 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+
+md = model()
+md = triangle(md,issmdir()*"/test/Exp/Square.exp", 150000.)
+md = setmask(md, "all", "")
+
+#Geometry
+hmin=300.
+hmax=1000.
+ymin=minimum(md.mesh.y)
+ymax=maximum(md.mesh.y)
+xmin=minimum(md.mesh.x)
+xmax=maximum(md.mesh.x)
+md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin)
+md.geometry.base      = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+md.geometry.surface   = md.geometry.base+md.geometry.thickness
+md.geometry.bed       = md.geometry.base .-10
+
+#Initial velocity
+x     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x")
+y     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y")
+vx    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx")
+vy    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy")
+index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index")
+md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y)
+md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
+
+md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices)
+md.materials.rheology_n=3*ones(md.mesh.numberofelements)
+md.friction.coefficient=20*ones(md.mesh.numberofvertices)
+
+md.stressbalance.restol=0.1
+md.stressbalance.reltol=0.02
+md.stressbalance.abstol=NaN
+md.timestepping.start_time = 0.0
+md.timestepping.final_time = 3.0
+md.timestepping.time_step  = 1.0
+
+#Boundary conditions
+nodefront=ContourToNodes(md.mesh.x,md.mesh.y,issmdir()*"/test/Exp/SquareFront.exp",2.0) .& md.mesh.vertexonboundary
+md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices)
+md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices)
+pos = findall(md.mesh.vertexonboundary .& .~nodefront)
+md.mask.ice_levelset[findall(nodefront)] .= 0
+
+segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0
+segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2)
+pos=md.mesh.segments[segments,1:2]
+md.stressbalance.spcvx[pos] .= 0.0
+md.stressbalance.spcvy[pos] .= 0.0
+
+md.smb.mass_balance = zeros(md.mesh.numberofvertices)
+md.basalforcings.groundedice_melting_rate = zeros(md.mesh.numberofvertices)
+md.basalforcings.floatingice_melting_rate = ones(md.mesh.numberofvertices)
+md.masstransport.spcthickness = NaN*ones(md.mesh.numberofvertices)
+
+md=solve(md,"Transient")
Index: issm/trunk/src/jl/tests/test301.jl
===================================================================
--- issm/trunk/src/jl/tests/test301.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test301.jl	(revision 26744)
@@ -0,0 +1,45 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+
+md = model()
+md = triangle(md,issmdir()*"/test/Exp/Square.exp",150000.)
+md = setmask(md,"","")
+
+#Geometry
+hmin=300.
+hmax=1000.
+ymin=minimum(md.mesh.y)
+ymax=maximum(md.mesh.y)
+xmin=minimum(md.mesh.x)
+xmax=maximum(md.mesh.x)
+md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin)
+md.geometry.base      = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness .+20
+md.geometry.surface   = md.geometry.base+md.geometry.thickness
+md.geometry.bed       = md.geometry.base
+
+#Initial velocity
+#x     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x")
+#y     = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y")
+#vx    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx")
+#vy    = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy")
+#index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index")
+md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y)
+md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
+
+md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices)
+md.materials.rheology_n=3*ones(md.mesh.numberofelements)
+md.friction.coefficient=20*ones(md.mesh.numberofvertices)
+
+md.stressbalance.restol=0.05
+md.stressbalance.reltol=0.05
+md.stressbalance.abstol=NaN
+
+#Boundary conditions
+md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices)
+md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices)
+pos = findall(md.mesh.vertexonboundary)
+md.stressbalance.spcvx[pos] .= 0.0
+md.stressbalance.spcvy[pos] .= 0.0
+
+md=solve(md,"Stressbalance")
Index: issm/trunk/src/jl/tests/test501.jl
===================================================================
--- issm/trunk/src/jl/tests/test501.jl	(revision 26744)
+++ issm/trunk/src/jl/tests/test501.jl	(revision 26744)
@@ -0,0 +1,50 @@
+#!/Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
+include("../issm.jl")
+using .ISSM
+
+md = model()
+md = triangle(md,issmdir()*"/test/Exp/Pig.exp",10000.)
+md = setmask( md,issmdir()*"/test/Exp/PigShelves.exp",issmdir()*"/test/Exp/PigIslands.exp")
+
+#Initial velocity and geometry
+x         = archread(issmdir()*"/test/Data/Pig.arch","x")
+y         = archread(issmdir()*"/test/Data/Pig.arch","y")
+vx_obs    = archread(issmdir()*"/test/Data/Pig.arch","vx_obs")
+vy_obs    = archread(issmdir()*"/test/Data/Pig.arch","vy_obs")
+index     = Int.(archread(issmdir()*"/test/Data/Pig.arch","index"))
+surface   = archread(issmdir()*"/test/Data/Pig.arch","surface")
+thickness = archread(issmdir()*"/test/Data/Pig.arch","thickness")
+bed       = archread(issmdir()*"/test/Data/Pig.arch","bed")
+md.initialization.vx=InterpFromMeshToMesh2d(index, x, y, vx_obs, md.mesh.x, md.mesh.y, 0.0)
+md.initialization.vy=InterpFromMeshToMesh2d(index, x, y, vy_obs, md.mesh.x, md.mesh.y, 0.0)
+md.geometry.surface = InterpFromMeshToMesh2d(index, x, y, surface, md.mesh.x, md.mesh.y, 0.0)
+md.geometry.thickness = InterpFromMeshToMesh2d(index, x, y, thickness, md.mesh.x, md.mesh.y, 0.0)
+md.geometry.base=md.geometry.surface .- md.geometry.thickness
+md.geometry.bed =md.geometry.base
+pos = findall(md.mask.ocean_levelset.<0)
+md.geometry.bed[pos] = InterpFromMeshToMesh2d(index, x, y, bed, md.mesh.x[pos], md.mesh.y[pos])
+
+md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices)
+md.materials.rheology_n=3*ones(md.mesh.numberofelements)
+md.friction.coefficient=50*ones(md.mesh.numberofvertices)
+
+md.stressbalance.restol=0.05
+md.stressbalance.reltol=1.0
+md.stressbalance.abstol=NaN
+
+#Boundary conditions
+pos = findall(vec(sum(Int64.(md.mask.ocean_levelset[md.mesh.elements].<0), dims=2)) .> 0.0)
+vertexonfloatingice=zeros(md.mesh.numberofvertices)
+vertexonfloatingice[md.mesh.elements[pos,:]] .= 1
+nodefront=(md.mesh.vertexonboundary .& (vertexonfloatingice.>0))
+md.mask.ice_levelset[findall(nodefront)] .= 0
+
+md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices)
+md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices)
+segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0
+segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2)
+pos=md.mesh.segments[segments,1:2]
+md.stressbalance.spcvx[pos] .= 0.0
+md.stressbalance.spcvy[pos] .= 0.0
+
+md=solve(md,"Stressbalance")
Index: issm/trunk/src/jl/usr/classes.jl
===================================================================
--- issm/trunk/src/jl/usr/classes.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/classes.jl	(revision 26744)
@@ -0,0 +1,305 @@
+using Printf
+
+#Model fields
+#Mesh {{{
+abstract type AbstractMesh end
+mutable struct Mesh2dTriangle <: AbstractMesh
+	numberofvertices::Int64
+	numberofelements::Int64
+	x::Vector{Float64}
+	y::Vector{Float64}
+	elements::Matrix{Int64}
+	segments::Matrix{Int64}
+	vertexonboundary::Vector{Bool}
+end
+function Mesh2dTriangle() #{{{
+	return Mesh2dTriangle( 0, 0, Vector{Float64}(undef,0), Vector{Float64}(undef, 0), Matrix{Int64}(undef, 0, 0), Matrix{Int64}(undef, 0, 0), Vector{Bool}(undef,0))
+end# }}}
+function Base.show(io::IO, this::Mesh2dTriangle)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+mutable struct Mesh3dPrism{T} <: AbstractMesh
+	numberofvertices::Int64
+	numberofelements::Int64
+	numberoflayers::Int64
+	x::Vector{Float64}
+	y::Vector{Float64}
+	z::Vector{Float64}
+	elements::Matrix{Int64}
+	segments::Matrix{Int64}
+	vertexonboundary::Vector{Bool}
+end
+function Mesh3dPrism() #{{{
+	return Mesh3dPrism( 0, 0, 0, Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Matrix{Int64}(undef, 0, 0), Matrix{Int64}(undef, 0, 0), Vector{Bool}(undef,0))
+end# }}}
+#}}}
+#Geometry{{{
+mutable struct Geometry
+	surface::Vector{Float64}
+	base::Vector{Float64}
+	thickness::Vector{Float64}
+	bed::Vector{Float64}
+end
+function Geometry() #{{{
+	return Geometry( Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::Geometry)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+#}}}
+#Mask {{{
+mutable struct Mask
+	ocean_levelset::Vector{Float64}
+	ice_levelset::Vector{Float64}
+end
+function Mask() #{{{
+	return Mask( Vector{Float64}(undef,0), Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::Mask)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+#}}}
+#Initialization{{{
+mutable struct Initialization
+	vx::Vector{Float64}
+	vy::Vector{Float64}
+end
+function Initialization() #{{{
+	return Initialization( Vector{Float64}(undef,0), Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::Initialization)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+#}}}
+#Stressbalance {{{
+mutable struct Stressbalance
+	spcvx::Vector{Float64}
+	spcvy::Vector{Float64}
+	restol::Float64
+	reltol::Float64
+	abstol::Float64
+	maxiter::Int64
+end
+function Stressbalance() #{{{
+	return Stressbalance( Vector{Float64}(undef,0), Vector{Float64}(undef,0), 1.e-4, 0.01, 10., 100)
+end# }}}
+function Base.show(io::IO, this::Stressbalance)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+#}}}
+#Constants{{{
+mutable struct Constants
+	g::Float64
+	yts::Float64
+end
+function Constants() #{{{
+	return Constants( 9.81,  365*24*3600.)
+end# }}}
+function Base.show(io::IO, this::Constants)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Materials {{{
+mutable struct Materials
+	rho_ice::Float64
+	rho_water::Float64
+	rho_freshwater::Float64
+	mu_water::Float64
+	heatcapacity::Float64
+	latentheat::Float64
+	thermalconductivity::Float64
+	temperateiceconductivity::Float64
+	effectiveconductivity_averaging::Int64
+	meltingpoint::Float64
+	beta::Float64
+	mixed_layer_capacity::Float64
+	thermal_exchange_velocity::Float64
+	rheology_B::Vector{Float64}
+	rheology_n::Vector{Float64}
+	rheology_law::String
+end
+function Materials() #{{{
+	return Materials(917., 1023., 1000., 0.001787, 2093., 3.34*10^5, 2.4, .24, 1, 273.15, 9.8*10^-8, 3974., 1.00*10^-4, Vector{Float64}(undef,0), Vector{Float64}(undef,0), "Cuffey")
+end# }}}
+function Base.show(io::IO, this::Materials)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Friction {{{
+abstract type AbstractFriction end
+mutable struct BuddFriction <: AbstractFriction
+	coefficient::Vector{Float64}
+end
+function BuddFriction() #{{{
+	return BuddFriction(Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::BuddFriction)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+mutable struct WeertmanFriction <: AbstractFriction
+	C::Vector{Float64}
+	m::Vector{Float64}
+end
+# }}}
+#Basalforcings {{{
+mutable struct Basalforcings
+	groundedice_melting_rate::Vector{Float64}
+	floatingice_melting_rate::Vector{Float64}
+end
+function Basalforcings() #{{{
+	return Basalforcings( Vector{Float64}(undef,0), Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::Basalforcings)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Surfaceforcings {{{
+mutable struct SMBforcings
+	mass_balance::Vector{Float64}
+end
+function SMBforcings() #{{{
+	return SMBforcings( Vector{Float64}(undef,0))
+end# }}}
+function Base.show(io::IO, this::SMBforcings)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Timestepping{{{
+abstract type AbstractTimestepping end
+mutable struct Timestepping <: AbstractTimestepping
+	start_time::Float64
+	final_time::Float64
+	time_step::Float64
+end
+function Timestepping() #{{{
+	return Timestepping( 0., 0., 0.)
+end# }}}
+function Base.show(io::IO, this::Timestepping)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Masstransport {{{
+mutable struct Masstransport
+	spcthickness::Vector{Float64}
+	min_thickness::Float64
+	stabilization::Int64
+end
+function Masstransport() #{{{
+	return Masstransport( Vector{Float64}(undef,0), 10.0, 1)
+end# }}}
+function Base.show(io::IO, this::Masstransport)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+#Transient {{{
+mutable struct Transient
+	issmb::Bool
+	ismasstransport::Bool
+	isstressbalance::Bool
+	isgroundingline::Bool
+	ismovingfront::Bool
+end
+function Transient() #{{{
+	return Transient( true, true, true, true, true)
+end# }}}
+function Base.show(io::IO, this::Transient)# {{{
+	IssmStructDisp(io, this)
+end# }}}
+# }}}
+
+#Model structure
+mutable struct model
+	mesh::AbstractMesh
+	geometry::Geometry
+	mask::Mask
+	materials::Materials
+	initialization::Initialization
+	stressbalance::Stressbalance
+	constants::Constants
+	results::Dict
+	friction::AbstractFriction
+	basalforcings::Basalforcings
+	smb::SMBforcings
+	timestepping::Timestepping
+	masstransport::Masstransport
+	transient::Transient
+end
+function model() #{{{
+	return model( Mesh2dTriangle(), Geometry(), Mask(), Materials(),
+					 Initialization(),Stressbalance(), Constants(), Dict(),
+					 BuddFriction(), Basalforcings(), SMBforcings(), Timestepping(),
+					 Masstransport(), Transient())
+end#}}}
+function model(matmd::Dict) #{{{
+
+	#initialize output
+	md = model()
+
+	#Loop over all possible fields
+	for name1 in keys(matmd)
+		if !(Symbol(name1) in fieldnames(model))
+			println("could not recover md.",name1)
+			continue
+		end
+		mdfield  = getfield(md,Symbol(name1))
+		matfield = matmd[name1]
+		for name2 in keys(matfield)
+			if !(Symbol(name2) in fieldnames(typeof(mdfield)))
+				println("could not recover md.",name1,".",name2)
+				continue
+			end
+			value_matlab = matfield[name2]
+			value_julia  = getfield(mdfield, Symbol(name2))
+
+			if typeof(value_matlab)==typeof(value_julia)
+				setfield!(mdfield, Symbol(name2), value_matlab)
+
+			elseif typeof(value_matlab)==Float64 && typeof(value_julia)==Int64
+				setfield!(mdfield, Symbol(name2), Int64(value_matlab))
+
+			elseif typeof(value_matlab)==Float64 && typeof(value_julia)==Bool
+				setfield!(mdfield, Symbol(name2), Bool(value_matlab))
+
+			elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Vector{Float64}
+				if(size(value_matlab,2)!=1) error("only one column expected") end
+				setfield!(mdfield, Symbol(name2), value_matlab[:,1])
+
+			elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Matrix{Int64}
+				matrix = Matrix{Int64}(undef,size(value_matlab))
+				for i in 1:length(value_matlab) matrix[i] = Int64(value_matlab[i]) end
+				setfield!(mdfield, Symbol(name2), matrix)
+
+			elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Vector{Bool}
+				if(size(value_matlab,2)!=1) error("only one column expected") end
+				vector = Vector{Bool}(undef,size(value_matlab,1))
+				for i in 1:length(vector) vector[i] = Bool(value_matlab[i]) end
+				setfield!(mdfield, Symbol(name2), vector)
+
+			else
+				error("Don't know how to convert ",typeof(value_matlab)," to ",typeof(value_julia))
+			end
+		end
+	end
+
+	return md
+end#}}}
+function Base.show(io::IO, md::model)# {{{
+
+	compact = get(io, :compact, false)
+
+	println(io,"Model:")
+	@printf "%19s: %-26s -- %s\n" "mesh" typeof(md.mesh) "mesh properties"
+	@printf "%19s: %-26s -- %s\n" "geometry" typeof(md.geometry) "surface elevation, bedrock topography, ice thickness,..."
+	@printf "%19s: %-26s -- %s\n" "mask" typeof(md.mask) "defines grounded and floating regions"
+	@printf "%19s: %-26s -- %s\n" "materials" typeof(md.materials) "material properties"
+	@printf "%19s: %-26s -- %s\n" "initialization" typeof(md.initialization) "initial state"
+	@printf "%19s: %-26s -- %s\n" "constants" typeof(md.constants) "physical constants"
+	@printf "%19s: %-26s -- %s\n" "friction" typeof(md.friction) "basal friction"
+	@printf "%19s: %-26s -- %s\n" "basalforcings" typeof(md.basalforcings) "basal forcings"
+	@printf "%19s: %-26s -- %s\n" "smb" typeof(md.smb) "surface mass balance"
+	@printf "%19s: %-26s -- %s\n" "timestepping" typeof(md.timestepping) "time stepping for transient simulations"
+	@printf "%19s: %-26s -- %s\n" "stressbalance" typeof(md.stressbalance) "parameters stress balance simulations"
+	@printf "%19s: %-26s -- %s\n" "masstransport" typeof(md.masstransport) "parameters mass transport simulations"
+	@printf "%19s: %-26s -- %s\n" "transient" typeof(md.transient) "parameters for transient simulations"
+
+end# }}}
Index: issm/trunk/src/jl/usr/exp.jl
===================================================================
--- issm/trunk/src/jl/usr/exp.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/exp.jl	(revision 26744)
@@ -0,0 +1,234 @@
+#for exptool, look into this http://juliaplots.org/MakieReferenceImages/gallery//mouse_picking/index.html
+
+#exp object definition, constructor, and disp
+mutable struct ExpStruct #{{{
+	name::String
+	nods::Int32
+	density::Float64
+	x::Vector{Float64}
+   y::Vector{Float64}
+	closed::Bool
+end  #}}}
+function ExpStruct() #{{{
+	return ExpStruct("",0, 0., Vector{Float64}(undef,0), Vector{Float64}(undef,0), false)
+end# }}}
+function Base.show(io::IO, exp::ExpStruct)# {{{
+
+	compact = get(io, :compact, false)
+
+	println(io,"ExpStruct:")
+	for name in fieldnames(typeof(exp))
+		a=getfield(exp,name)
+		print(io,"   $(name) = ")
+		if !isempty(a)
+			if compact && eltype(a)<:Number && length(a)>3
+				println(io, typeof(a), " of size ", size(a))
+			else
+				println(io,a)
+			end
+		else
+			println(io,"empty")
+		end
+	end
+end# }}}
+
+#methods
+#expread {{{
+"""
+	EXPREAD - read a file exp and build a Structure
+
+	This function reads an *.exp* and builds a structure containing the fields x
+	and y corresponding to the coordinates, one for the filename of the exp
+	file, for the density, for the nodes, and a field 'closed' to indicate if the
+	domain is closed.
+
+	Usage:
+		exp=expread(filename)
+
+# Examples:
+```julia-repl
+julia> exp=expread('domainoutline.exp')
+```
+
+# Arguments:
+- filename: the ARGUS file to read
+"""
+function expread(filename::String)
+
+	#initialize output
+	contours = Vector{ExpStruct}(undef, 0)
+
+	#open file
+	f = open(filename, "r") do f
+
+		#initialize some variables
+		nprof = 0
+		line = 1
+
+		while !eof(f)
+
+			#read first line
+			A = readline(f); line += 1
+
+			#if isempty, go to the next line and try again
+			if isempty(A)
+				continue
+			else
+				#initialize new profile
+				nprof += 1 
+				exp = ExpStruct();
+			end
+
+			#extract profile name
+			if A[1:8]!="## Name:"
+				println("line $(line): $(A)")
+				error("Unexpected exp file formatting") 
+			end
+			if length(A)>8
+				exp.name = A[9:end]
+			end
+
+			#read Icon
+			A = readline(f); line += 1
+			if A[1:8]!="## Icon:" error("Unexpected exp file formatting") end
+
+			#read Info
+			A = readline(f); line += 1
+			if A[1:14]!="# Points Count"
+				println("line $(line): $(A)")
+				error("Unexpected exp file formatting") 
+			end
+
+			#Reads number of nods and density
+			A = readline(f); line += 1
+			A = parse.(Float64, split(A))
+			if length(A) != 2 error("Unexpected exp file formatting") end
+			exp.nods = A[1]; exp.density = A[2]
+
+			#Allocate arrays
+			if exp.nods<=0 error("Unexpected exp file formatting") end
+			exp.x = Vector{Float64}(undef,exp.nods)
+			exp.y = Vector{Float64}(undef,exp.nods)
+
+			#Read coordinates
+			A = readline(f); line += 1
+			if A[1:13]!="# X pos Y pos" error("Unexpected exp file formatting") end
+			for i in 1:exp.nods
+				A = readline(f); line += 1
+				A = parse.(Float64, split(A))
+				if length(A) != 2 error("Unexpected exp file formatting") end
+				if any(isnan.(A)) error("NaNs found in coordinate") end
+				exp.x[i] = A[1]; exp.y[i] = A[2]
+			end
+
+			#check if closed
+			if exp.nods>1 && exp.x[1]==exp.x[end] && exp.y[1]==exp.y[end]
+				exp.closed = true
+			else
+				exp.closed = false
+			end
+
+			#add profile to list
+			push!(contours, exp)
+		end
+	end
+
+	return contours
+end# }}}
+#ContourToNodes{{{
+"""
+	ContourToNodes - Flag points that are in contour
+
+   More doc to come later....
+
+	Usage:
+		exp=expread(filename)
+
+# Examples:
+```julia-repl
+julia> exp=expread('domainoutline.exp')
+```
+
+# Arguments:
+- filename: the ARGUS file to read
+"""
+function ContourToNodes(x::Vector{Float64},y::Vector{Float64},filename::String,edgevalue::Float64)
+
+	#Read input file
+	contours = expread(filename)
+
+	#Initialize output
+	nbpts = length(x)
+	flags = zeros(Bool,nbpts)
+
+	#Loop over contours
+	for c in 1:length(contours)
+
+		#Get current contours
+		contour = contours[c]
+		xp      = contour.x
+		yp      = contour.y
+
+		#Check that we are within box
+		xmin = minimum(xp); xmax = maximum(xp)
+		ymin = minimum(yp); ymax = maximum(yp)
+
+		#Loop over all points provided
+		for ii in 1:nbpts
+
+			#If this node is already within one of the contours, do not change it
+			if(flags[ii]) continue end
+
+			#Are we within bounds?
+			if(x[ii]<xmin || x[ii]>xmax || y[ii]<ymin || y[ii]>ymax) continue end
+
+			#we are potentially inside... perform pnpoly test
+			flags[ii] = pnpoly(xp, yp, x[ii], y[ii], edgevalue)
+		end
+	end
+	
+	return flags
+end# }}}
+
+function pnpoly(xp::Vector{Float64},yp::Vector{Float64},x::Float64,y::Float64,edgevalue::Float64) #{{{
+
+	npol = length(xp)
+
+	#Do we need to test for colinearity?
+	if(edgevalue!=2)
+		i = 1
+		j = npol
+		while(i<=npol)
+
+			n1 = (yp[i]-yp[j])^2 + (xp[i]-xp[j])^2
+			n2 = (y-yp[j])^2 + (x-xp[j])^2
+
+			normp=sqrt(n1*n2)
+			scalar=(yp[i]-yp[j])*(y-yp[j])+(xp[i]-xp[j])*(x-xp[j])
+
+			if (scalar == normp)
+				if (n2<=n1)
+					return edgevalue
+				end
+			end
+
+			j =  i
+			i += 1
+		end
+	end
+
+	#second test : point is neither on a vertex, nor on a side, where is it ?
+	i = 1
+	j = npol
+	c = false
+	while(i<=npol)
+		if (((yp[i]<=y && y<yp[j]) || (yp[j]<=y && y<yp[i])) &&
+            (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))
+         c = !c
+		end
+
+		j =  i
+		i += 1
+	end
+	return c
+end# }}}
Index: issm/trunk/src/jl/usr/parameterization.jl
===================================================================
--- issm/trunk/src/jl/usr/parameterization.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/parameterization.jl	(revision 26744)
@@ -0,0 +1,54 @@
+# setmask {{{
+"""
+SETMASK - establish boundaries between grounded and floating ice.
+
+   By default, ice is considered grounded. The contour floatingicename defines nodes 
+   for which ice is floating. The contour groundedicename defines nodes inside an floatingice, 
+   that are grounded (ie: ice rises, islands, etc ...)
+   All input files are in the Argus format (extension .exp).
+
+   Usage:
+      md=setmask(md,floatingicename,groundedicename)
+
+   Examples:
+      md=setmask(md,'all','');
+      md=setmask(md,'Iceshelves.exp','Islands.exp');
+"""
+function setmask(md::model,floatingicename::String,groundedicename::String)
+
+	elementonfloatingice = FlagElements( md, floatingicename)
+	elementongroundedice = FlagElements( md, groundedicename)
+
+	elementonfloatingice = convert( Array{Float64}, (elementonfloatingice.>0) .&  (elementongroundedice.==0.))
+	elementongroundedice = convert( Array{Float64}, elementonfloatingice.==0.)
+
+	vertexonfloatingice=zeros(md.mesh.numberofvertices)
+	vertexongroundedice=zeros(md.mesh.numberofvertices)
+
+	vertexongroundedice[md.mesh.elements[findall(elementongroundedice.>0),:]] .= 1.
+	vertexonfloatingice[findall(vertexongroundedice.==0.)] .= 1.
+
+	#define levelsets
+	md.mask.ocean_levelset = vertexongroundedice
+	md.mask.ocean_levelset[findall(vertexongroundedice .==0.)] .= -1.
+	md.mask.ice_levelset = -1*ones(md.mesh.numberofvertices)
+
+	return md
+end
+#}}}
+# FlagElements {{{
+function FlagElements(md::model,region::String)
+
+	if isempty(region)
+		flags = zeros(md.mesh.numberofelements)
+	elseif region == "all"
+		flags = ones(md.mesh.numberofelements)
+	else
+		xcenter = md.mesh.x[md.mesh.elements]*[1;1;1]/3
+		ycenter = md.mesh.y[md.mesh.elements]*[1;1;1]/3
+		flags = ContourToNodes(xcenter, ycenter, region, 2.)
+	end
+
+	return flags
+end
+#}}}
Index: issm/trunk/src/jl/usr/plotmodel.jl
===================================================================
--- issm/trunk/src/jl/usr/plotmodel.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/plotmodel.jl	(revision 26744)
@@ -0,0 +1,68 @@
+import ColorSchemes.jet
+using  GLMakie
+using .ISSM
+
+function plotmodel( md::model, data::Vector, showvertices::Bool=false, showfacets::Bool=true)
+
+	vertexcolor  = :black
+	facetcolor   = :blue
+
+	if data isa AbstractVector
+
+		if length(data)==md.mesh.numberofelements
+			# vector of polygons
+			x = md.mesh.x
+			y = md.mesh.y
+			index = md.mesh.elements
+			ps = [Makie.GeometryBasics.Polygon([Point2(x[index[i,1]], y[index[i,1]]), Point2(x[index[i,2]], y[index[i,2]]), Point2(x[index[i,3]], y[index[i,3]])])
+					for i in 1:md.mesh.numberofelements]
+
+			fig, ax, h = Makie.poly(ps, color = data, colormap = jet)
+
+			#Add colorbar
+			Colorbar(fig[1, 2], limits = (minimum(data), maximum(data)), colormap = jet)
+		elseif length(data)==md.mesh.numberofvertices
+			fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = data, colormap = jet)
+
+			#Add colorbar
+			#Colorbar(fig[1, 2], h, width=25)
+		else
+			error("data of size "*string(length(data))*" not supported yet!")
+		end
+	else
+		# default to single color
+		@assert length(data)==1
+		fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = data, colormap = jet)
+	end
+
+	if showfacets
+		Makie.wireframe!(ax, h[1][], color=facetcolor)
+	end
+
+	if showvertices
+		Makie.scatter!( [md.mesh.x md.mesh.y], markersize = 4, color = vertexcolor)
+	end
+
+	return fig
+end
+
+function plotmodel(md::model,data::BitVector) #{{{
+
+	println("Converting BitVector to Vector")
+	data2 = Vector{Float64}(undef,size(data))
+	for i in 1:length(data)
+		data2[i] = Float64(data[i])
+	end
+
+	plotmodel(md,data2)
+
+end#}}}
+function plotmodel(md::model,data::String) #{{{
+
+	if(data=="mesh")
+		poly([md.mesh.x md.mesh.y], md.mesh.elements, strokewidth=1, shading=false)
+	else
+		error(data, " plot not supported yet")
+	end
+
+end#}}}
Index: issm/trunk/src/jl/usr/triangle.jl
===================================================================
--- issm/trunk/src/jl/usr/triangle.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/triangle.jl	(revision 26744)
@@ -0,0 +1,178 @@
+
+#Class Triangle's triangulateio
+mutable struct CTriangulateIO #{{{
+
+    pointlist :: Ptr{Cdouble}
+    pointattributelist :: Ptr{Cdouble}
+    pointmarkerlist :: Ptr{Cint}
+    numberofpoints :: Cint
+    numberofpointattributes :: Cint
+
+    trianglelist :: Ptr{Cint}
+    triangleattributelist :: Ptr{Cdouble}
+    trianglearealist :: Ptr{Cdouble}
+    neighborlist :: Ptr{Cint}
+    numberoftriangles :: Cint
+    numberofcorners :: Cint
+    numberoftriangleattributes :: Cint
+
+    segmentlist :: Ptr{Cint}
+    segmentmarkerlist :: Ptr{Cint}
+    numberofsegments :: Cint
+
+    holelist :: Ptr{Cdouble}
+    numberofholes :: Cint
+
+    regionlist :: Ptr{Cdouble}
+    numberofregions :: Cint
+
+    edgelist :: Ptr{Cint}
+    edgemarkerlist :: Ptr{Cint}
+    normlist :: Ptr{Cdouble}
+    numberofedges :: Cint
+ end  #}}}
+function CTriangulateIO() #{{{
+	return CTriangulateIO(C_NULL, C_NULL, C_NULL, 0, 0,
+								 C_NULL, C_NULL, C_NULL, C_NULL, 0, 0, 0,
+								 C_NULL, C_NULL, 0,
+								 C_NULL, 0,
+								 C_NULL, 0,
+								 C_NULL, C_NULL, C_NULL, 0)
+end# }}}
+function Base.show(io::IO, tio::CTriangulateIO)# {{{
+	println(io,"CTriangulateIO(")
+	for name in fieldnames(typeof(tio))
+		a=getfield(tio,name)
+		print(io,"$(name) = ")
+		println(io,a)
+	end
+	println(io,")")
+end# }}}
+
+using Printf #needed for sprintf
+
+"""
+TRIANGLE - create model mesh using the triangle package
+
+	This function creates a model mesh using Triangle and a domain outline, to
+	within a certain resolution
+#Arguments
+ - md is a model tuple
+ - domainname is the name of an Argus domain outline file
+ - resolution:  is a characteristic length for the mesh (same unit as the domain outline unit)
+
+# Usage:
+ - md=triangle(md,domainname,resolution)
+# Examples:
+ - md=triangle(md,'DomainOutline.exp',1000);
+ - md=triangle(md,'DomainOutline.exp','Rifts.exp',1500);
+"""
+function triangle(md::model,domainname::String,resolution::Float64) #{{{
+
+	#read input file
+	contours = expread(domainname)
+	area     = resolution^2
+
+	#Initialize i/o structures
+	ctio_in  = CTriangulateIO();
+	ctio_out = CTriangulateIO();
+	vor_out  = CTriangulateIO();
+
+	#Construct input structure
+	numberofpoints   = 0
+	numberofsegments = 0
+	for i in 1:length(contours)
+		numberofpoints   += contours[i].nods-1
+		numberofsegments += contours[i].nods-1
+	end
+	numberofpointattributes = 1
+
+	pointlist=Array{Cdouble,2}(undef,2,numberofpoints)
+	count = 0
+	for i in 1:length(contours)
+		nods = contours[i].nods
+		pointlist[1,count+1:count+nods-1] = contours[i].x[1:end-1]
+		pointlist[2,count+1:count+nods-1] = contours[i].y[1:end-1]
+		count += (nods-1)
+	end
+	pointattributelist=Array{Cdouble,1}(undef,numberofpoints)
+	pointmarkerlist=Array{Cint,1}(undef,numberofpoints)
+	for i in 1:numberofpoints
+		pointmarkerlist[i]=0
+		pointattributelist[i]=0.
+	end
+
+	counter=0;
+   backcounter=0;
+	segmentlist=Array{Cint,2}(undef,2,numberofsegments)
+	segmentmarkerlist=Array{Cint,1}(undef,numberofsegments)
+	segmentmarkerlist[:].=0
+	for i in 1:length(contours)
+		nods = contours[i].nods
+		segmentlist[1,counter+1:counter+nods-2] = collect(counter+0:counter+nods-3)
+		segmentlist[2,counter+1:counter+nods-2] = collect(counter+1:counter+nods-2)
+		counter+=nods-2
+		#close profile
+		segmentlist[1,counter+1]=counter
+		segmentlist[2,counter+1]=backcounter
+		counter+=1
+		backcounter=counter
+	end
+
+	numberofregions = 0
+	numberofholes = length(contours)-1
+	holelist = Array{Cdouble,2}(undef,2,numberofholes)
+	if numberofholes>0
+		 for i in 2:length(contours)
+			 xA=contours[i].x[1]; xB=contours[i].x[end-1]
+			 yA=contours[i].y[1]; yB=contours[i].y[end-1]
+			 xC=(xA+xB)/2;        yC=(yA+yB)/2;
+			 xD=xC+tan(10. /180. *pi)*(yC-yA);
+			 yD=yC+tan(10. /180. *pi)*(xA-xC);
+			 xE=xC-tan(10. /180. *pi)*(yC-yA);
+			 yE=yC-tan(10. /180. *pi)*(xA-xC);
+			 holelist[1,i-1] = xD
+			 holelist[2,i-1] = yD
+		 end
+	end
+
+	#based on this, prepare input structure
+	ctio_in.numberofpoints = numberofpoints
+	ctio_in.pointlist=pointer(pointlist)
+	ctio_in.numberofpointattributes=numberofpointattributes
+	ctio_in.pointattributelist=pointer(pointattributelist)
+	ctio_in.pointmarkerlist=pointer(pointmarkerlist)
+	ctio_in.numberofsegments=numberofsegments
+	ctio_in.segmentlist=pointer(segmentlist)
+	ctio_in.segmentmarkerlist = pointer(segmentmarkerlist)
+	ctio_in.numberofholes=numberofholes
+	ctio_in.holelist=pointer(holelist)
+	ctio_in.numberofregions=0
+
+	#Call triangle using ISSM's default options
+	triangle_switches = "pQzDq30ia"*@sprintf("%lf",area) #replace V by Q to quiet down the logging
+	#rc=ccall( (:triangulate,"libtriangle"),
+	rc=ccall( (:triangulate,issmdir()*"/externalpackages/triangle/src/libtriangle.dylib"),
+				Cint, ( Cstring, Ref{CTriangulateIO}, Ref{CTriangulateIO}, Ref{CTriangulateIO}),
+				triangle_switches, Ref(ctio_in), Ref(ctio_out), Ref(vor_out))
+
+	#post process output
+	points    = convert(Array{Cdouble,2}, Base.unsafe_wrap(Array, ctio_out.pointlist,    (2,Int(ctio_out.numberofpoints)), own=true))'
+	triangles = convert(Array{Cint,2},    Base.unsafe_wrap(Array, ctio_out.trianglelist, (3,Int(ctio_out.numberoftriangles)), own=true))' .+1
+	segments  = convert(Array{Cint,2},    Base.unsafe_wrap(Array, ctio_out.segmentlist,  (2,Int(ctio_out.numberofsegments)), own=true))' .+1
+
+	#assign output
+	md.mesh = Mesh2dTriangle()
+	md.mesh.numberofvertices = ctio_out.numberofpoints
+	md.mesh.numberofelements = ctio_out.numberoftriangles
+	md.mesh.x                = points[:,1]
+	md.mesh.y                = points[:,2]
+	md.mesh.elements         = triangles
+	md.mesh.segments         = segments
+
+	#post processing
+	md.mesh.vertexonboundary = zeros(Bool,md.mesh.numberofvertices)
+	md.mesh.vertexonboundary[md.mesh.segments] .= true
+
+   return md
+end#}}}
Index: issm/trunk/src/jl/usr/utils.jl
===================================================================
--- issm/trunk/src/jl/usr/utils.jl	(revision 26744)
+++ issm/trunk/src/jl/usr/utils.jl	(revision 26744)
@@ -0,0 +1,242 @@
+#utils
+function issmdir() #{{{
+	issmdir = ENV["ISSM_DIR"]
+
+	if isempty(issmdir)
+		error("Could not determine the location of ISSM")
+	else
+		return issmdir
+	end
+end#}}}
+function archread(filename::String,variablename::String) #{{{
+
+	#initialize variables
+	found = false
+
+	#open file
+	output = open(filename, "r") do f
+
+		while !eof(f)
+			reclen  = bswap(read(f, Int32))
+			rectype = bswap(read(f, Int32))
+			if rectype!=1
+				error("Expected variable of type string")
+			else
+				fieldname_length = bswap(read(f, Int32))
+				field_name = String(read(f, fieldname_length))
+			end
+			rec_length = bswap(read(f, Int32))
+			field_type = bswap(read(f, Int32))
+			if field_type==2
+				data = bswap(read(f, Float64))
+			elseif field_type==3
+				rows = bswap(read(f, Int32))
+				cols = bswap(read(f, Int32))
+				data = reinterpret(Float64, read(f, sizeof(Float64)*rows*cols))
+				data .= ntoh.(data)
+				data = reshape(data, (rows,cols))
+				data = collect(data)
+				if cols == 1
+					data = vec(data)
+				end
+			else
+				error("Error: Encountered invalid field type when reading data.")
+			end
+
+			if field_name == variablename
+				found = true
+				return data
+			end
+		end
+	end
+
+	return output
+end# }}}
+function InterpFromMeshToMesh2d(index_data::Array,x_data::Vector,y_data::Vector,data::Vector,xout::Vector,yout::Vector,default::Float64=NaN) #{{{
+
+	#Allocate output
+	nods_out = length(xout)
+	data_out = default*ones(nods_out)
+
+	#Interpolation type
+	data_length = size(data,1)
+	nods_data   = length(x_data)
+	nels_data   = size(index_data,1)
+	if(data_length==nods_data)
+		interpolation_type=1;
+	elseif (data_length==nels_data)
+		interpolation_type=2
+	else
+		error("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!")
+	end
+	xmin = minimum(xout); xmax = maximum(xout)
+	ymin = minimum(yout); ymax = maximum(yout)
+
+	for i in 1:nels_data
+
+		#skip element if no overlap
+		if (minimum(x_data[index_data[i,:]]) > xmax) continue end
+		if (minimum(y_data[index_data[i,:]]) > ymax) continue end
+		if (maximum(x_data[index_data[i,:]]) < xmin) continue end
+		if (maximum(y_data[index_data[i,:]]) < ymin) continue end
+
+		#get area of the current element (Jacobian = 2 * area)*/
+		#area =x2 * y3 - y2*x3 + x1 * y2 - y1 * x2 + x3 * y1 - y3 * x1;
+		area = (x_data[index_data[i,2]]*y_data[index_data[i,3]]-y_data[index_data[i,2]]*x_data[index_data[i,3]] 
+				  +  x_data[index_data[i,1]]*y_data[index_data[i,2]]-y_data[index_data[i,1]]*x_data[index_data[i,2]] 
+				  +  x_data[index_data[i,3]]*y_data[index_data[i,1]]-y_data[index_data[i,3]]*x_data[index_data[i,1]])
+
+		for j in 1:nods_out
+			#Get first area coordinate = det(x-x3  x2-x3 ; y-y3   y2-y3)/area
+			area_1=((xout[j]-x_data[index_data[i,3]])*(y_data[index_data[i,2]]-y_data[index_data[i,3]])
+					 -  (yout[j]-y_data[index_data[i,3]])*(x_data[index_data[i,2]]-x_data[index_data[i,3]]))/area
+			#Get second area coordinate =det(x1-x3  x-x3 ; y1-y3   y-y3)/area
+			area_2=((x_data[index_data[i,1]]-x_data[index_data[i,3]])*(yout[j]-y_data[index_data[i,3]])
+					  - (y_data[index_data[i,1]]-y_data[index_data[i,3]])*(xout[j]-x_data[index_data[i,3]]))/area
+			#Get third area coordinate = 1-area1-area2
+			area_3=1-area_1-area_2
+
+			if (area_1>=0 && area_2>=0 && area_3>=0)
+				if (interpolation_type==1)
+					#nodal interpolation
+					data_out[j]=area_1*data[index_data[i,1]]+area_2*data[index_data[i,2]]+area_3*data[index_data[i,3]];
+				else
+					#element interpolation
+					data_out[j]=data[i];
+				end
+			end
+		end
+	end
+	return data_out
+
+	#OLD STUFF!!! not working...
+	
+	#prepare input arrays
+	nods = Cint(length(x))
+	nels = Cint(size(index,1))
+	nods_interp = Cint(length(xout))
+	Cindex=Array{Cint,1}(undef,length(index))
+	for i in 1:size(index,1)
+		for j in 1:3
+			Cindex[(i-1)*3+j] = Int32(index[i,j])
+		end
+	end
+	Cx    = Array{Cdouble,1}(undef,nods)
+	Cy    = Array{Cdouble,1}(undef,nods)
+	Cdata = Array{Cdouble,1}(undef,nods)
+	for i in 1:nods
+		Cx[i]    = x[i]
+		Cy[i]    = y[i]
+		Cdata[i] = data[i]
+	end
+	Cxout = Array{Cdouble,1}(undef,nods_interp)
+	Cyout = Array{Cdouble,1}(undef,nods_interp)
+	for i in 1:nods_interp
+		Cxout[i] = xout[i]
+		Cyout[i] = yout[i]
+	end
+
+	Cdataout = Vector{Float64}(undef,nods_interp)
+
+	#This is not working....
+	rc=ccall( (:InterpFromMeshToMesh2dx,"libISSMCore"),
+				Cint, (Ptr{Ptr{Cdouble}},Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Cint),
+				Ref(Ref(Cdataout)), Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels,
+				Ref(Cdata), nods, 1, Ref(Cxout), Ref(Cyout), nods_interp)
+
+	#Process output
+	dataout = Vector{Float64}(undef,nods_interp)
+	for i in 1:nods_interp
+		dataout[i] = Cdataout[i]
+	end
+
+	return dataout
+end #}}}
+function InterpFromMeshToMesh2d2(index_data::Array,x_data::Vector,y_data::Vector,data::Vector,xout::Vector,yout::Vector) #{{{
+
+	#prepare input arrays
+	nods = Cint(length(x_data))
+	nels = Cint(size(index_data,1))
+	nods_interp = Cint(length(xout))
+	Cindex=Array{Cint,1}(undef,length(index_data))
+	for i in 1:size(index_data,1)
+		for j in 1:3
+			Cindex[(i-1)*3+j] = Int32(index_data[i,j])
+		end
+	end
+	Cx    = Array{Cdouble,1}(undef,nods)
+	Cy    = Array{Cdouble,1}(undef,nods)
+	Cdata = Array{Cdouble,1}(undef,nods)
+	for i in 1:nods
+		Cx[i]    = x_data[i]
+		Cy[i]    = y_data[i]
+		Cdata[i] = data[i]
+	end
+	Cxout    = Array{Cdouble,1}(undef,nods_interp)
+	Cyout    = Array{Cdouble,1}(undef,nods_interp)
+	Cdataout = Array{Cdouble,1}(undef,nods_interp)
+	for i in 1:nods_interp
+		Cxout[i] = xout[i]
+		Cyout[i] = yout[i]
+	end
+
+	#This is not working....
+	#rc=ccall( (:InterpFromMeshToMesh2dx,"../bamg/libBamg.so"),
+	#			Cint, (Ptr{Cdouble},Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Cint),
+	#			Ref(Cdataout), Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels,
+	#			Ref(Cdata), nods, 1, Ref(Cxout), Ref(Cyout), nods_interp)
+	#rc=ccall( (:InterpFromMeshToMesh2dx,"../bamg/libBamg.so"),
+	#			Cint, (Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint),
+	#			Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels)
+	#
+	#
+	dataout = Vector{Float64}(undef,nods_interp)
+	rc=ccall( (:InterpFromMeshToMesh2dx3,"/Users/mmorligh/Desktop/issmuci/trunk-jpl/src/jl/bamg/libBamg.dylib"),
+				Cint, (Ptr{Cdouble}, Cint),
+				dataout, nods_interp)
+
+	#Process output
+	for i in 1:nods_interp
+		dataout[i] = Cdataout[i]
+	end
+
+	return dataout
+end #}}}
+function solve(md::model,solution::String) #{{{
+
+	if solution=="sb" || solution=="Stressbalance"
+		solutionstring = "StressbalanceSolution"
+	elseif solution=="tr" || solution=="Transient"
+			solutionstring = "TransientSolution"
+	else
+		error("solutionstring "*solution*" not supported!");
+	end
+
+	IssmCore(md, solutionstring)
+
+	return md
+end #}}}
+function IssmStructDisp(io::IO, modelfield::Any) # {{{
+	println(io,typeof(modelfield),":")
+	for name in fieldnames(typeof(modelfield))
+		a=getfield(modelfield,name)
+		#print(io,"   $(name) = ")
+		@printf "%19s: " name
+		if isa(a,String)
+			println(io, a)
+		elseif length(a)>1
+			if !isempty(a)
+				println(io, typeof(a), " of size ", size(a))
+			else
+				println(io,"empty")
+			end
+		else
+			println(io, a)
+		end
+	end
+end #}}}
+function meshgrid(x::Vector, y::Vector)
+    X = [i for i in x, j in 1:length(y)]
+    Y = [j for i in 1:length(x), j in y]
+    return X, Y
+end
Index: issm/trunk/src/m/archive/arch.py
===================================================================
--- issm/trunk/src/m/archive/arch.py	(revision 25994)
+++ issm/trunk/src/m/archive/arch.py	(revision 26744)
@@ -6,8 +6,8 @@
 
 def archwrite(filename, *args):  # {{{
-    """
-    ARCHWRITE - Write data to a field, given the file name, field name, and data.
-        Usage:
-            archwrite('archive101.arch', 'variable_name', data)
+    """ARCHWRITE - Write data to a field, given the file name, field name, and data.
+
+    Usage:
+        archwrite('archive101.arch', 'variable_name', data)
     """
 
@@ -45,9 +45,9 @@
 
 def archread(filename, fieldname):  # {{{
-    """
-    ARCHREAD - Given an arch file name, and a field name, find and return the data
-                    associated with that field name.
-        Usage:
-            archread('archive101.arch', 'field_var_1')
+    """ARCHREAD - Given an arch file name, and a field name, find and return 
+    the data associated with that field name.
+
+    Usage:
+        archread('archive101.arch', 'field_var_1')
     """
     try:
@@ -76,9 +76,8 @@
 
 def archdisp(filename):  # {{{
-    """
-    ARCHDISP - Given an arch filename, display the contents of that file
-
-        Usage:
-            archdisp('archive101.arch')
+    """ARCHDISP - Given an arch filename, display the contents of that file
+
+    Usage:
+        archdisp('archive101.arch')
     """
     try:
@@ -97,5 +96,5 @@
         print(('\t\tSize:\t\t{0}'.format(result['size'])))
         print(('\t\tDatatype:\t{0}'.format(result['data_type'])))
-    # go to next result
+        # go to next result
         result = read_field(fid)
     # close file
@@ -106,6 +105,5 @@
 # Helper functions
 def write_field_name(fid, data):  # {{{
-    """
-    Routine to write field name (variable name) to an archive file.
+    """Routine to write field name (variable name) to an archive file.
     """
     # write the length of the record
@@ -125,6 +123,5 @@
 
 def write_scalar(fid, data):  # {{{
-    """
-    Procedure to write a double to an arch file pointed to by fid
+    """Procedure to write a double to an arch file pointed to by fid
     """
     # write length of record
@@ -141,6 +138,5 @@
 
 def write_vector(fid, data):  # {{{
-    """
-    Procedure to write a np.array to an arch file
+    """Procedure to write a np.array to an arch file
     """
     # Make sure our vector is the correct shape.
@@ -161,5 +157,5 @@
     reclen = 4 + 4 + 4 + 8 * sz[0] * sz[1]
     # make sure we can fit data into file
-    if reclen > 2**31:
+    if reclen > pow(2, 31):
         raise ValueError("archwrite error : can not write vector to binary file because it is too large")
     fid.write(struct.pack('>i', reclen))
@@ -176,16 +172,17 @@
 
 def read_field(fid):  # {{{
-    """
-    Procedure to read a field and return a results list with the following attributes:
-    result['field_name']     -> the name of the variable that was just read
-    result['size']             -> size (dimensions) of the variable just read
-    result['data_type']     -> the type of data that was just read
-    result['data']             -> the actual data
+    """Procedure to read a field and return a results list with the following 
+    attributes:
+
+        result['field_name']    -> the name of the variable that was just read
+        result['size']          -> size (dimensions) of the variable just read
+        result['data_type']     -> the type of data that was just read
+        result['data']          -> the actual data
     """
 
     try:
         # first, read the string
-        #first read the size and continue reading
-        struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]  #name length
+        # first read the size and continue reading
+        struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]  # name length
         check_name = struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]
         if check_name != 1:
@@ -194,6 +191,6 @@
         fieldname = struct.unpack('>{}s'.format(namelen), fid.read(namelen))[0]
         # then, read the data
-        #first read the size and continue reading
-        struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]  #data length
+        # first read the size and continue reading
+        struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]  # data length
         data_type = struct.unpack('>i', fid.read(struct.calcsize('>i')))[0]
 
@@ -235,22 +232,19 @@
 
 
-def format_archive_code(format):  # {{{
-    """
-    Given a variable, determine it's type and return
-    an integer value:
-
-    1 : string
-    2 : double (scalar)
-    3 : vector or matrix (of type double)
-
-    """
-    if isinstance(format, str):
+def format_archive_code(var):  # {{{
+    """Given a variable, determine it's type and return an integer value:
+
+        1 : string
+        2 : double (scalar)
+        3 : vector or matrix (of type double)
+    """
+    if isinstance(var, str):
         code = 1
-    elif format.shape[0] == 1 and format.shape[1] == 1:
+    elif var.shape[0] == 1 and var.shape[1] == 1:
         code = 2
-    elif isinstance(format, (list, tuple, np.ndarray)):
+    elif isinstance(var, (list, tuple, np.ndarray)):
         code = 3
     else:
-        raise TypeError("archwrite error: data type '%s' is not valid." % type(format))
+        raise TypeError('archwrite error: data type {} is not valid.'.format(type(var)))
     return code
     # }}}
Index: issm/trunk/src/m/array/arrayoperations.js
===================================================================
--- issm/trunk/src/m/array/arrayoperations.js	(revision 25994)
+++ issm/trunk/src/m/array/arrayoperations.js	(revision 26744)
@@ -54,5 +54,5 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array) {
+        if (arg instanceof Array || arg instanceof Float64Array) {
             size = arg.length;
             array = arg;
@@ -64,7 +64,7 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array && arg.length != size) {
+        if ((arg instanceof Array || arg instanceof Float64Array) && arg.length != size) {
             throw Error("ArrayAdd error message: arrays provided as arguments are not of the same length!");
-        } else if (!(arg instanceof Array) && typeof arg != 'number') {
+        } else if (!(arg instanceof Array || arg instanceof Float64Array) && typeof arg != 'number') {
             throw Error("ArrayAdd error message: arguments provided are not of the type Array or Number!");
         }
@@ -75,9 +75,9 @@
 		if (a != initial) {
 			arg = arguments[a];
-			if (arg instanceof Array) {
+			if (arg instanceof Array || arg instanceof Float64Array) {
 				for(var i = 0; i < result.length; i++){
 					result[i] += arg[i];
 				}
-			} else if (typeof arg != 'number') {
+			} else if (typeof arg === 'number') {
 				for(var i = 0; i < result.length; i++){
 					result[i] += arg;
@@ -94,5 +94,5 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array) {
+        if (arg instanceof Array || arg instanceof Float64Array) {
             size = arg.length;
             array = arg;
@@ -104,7 +104,7 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array && arg.length != size) {
+        if ((arg instanceof Array || arg instanceof Float64Array) && arg.length != size) {
             throw Error("ArrayAdd error message: arrays provided as arguments are not of the same length!");
-        } else if (!(arg instanceof Array) && typeof arg != 'number') {
+        } else if (!(arg instanceof Array || arg instanceof Float64Array) && typeof arg != 'number') {
             throw Error("ArrayAdd error message: arguments provided are not of the type Array or Number!");
         }
@@ -115,11 +115,57 @@
 		if (a !== initial) {
 			arg = arguments[a];
-			if (arg instanceof Array) {
+			if (arg instanceof Array || arg instanceof Float64Array) {
 				for(var i = 0; i < result.length; i++){
 					result[i] -= arg[i];
 				}
-			} else if (typeof arg != 'number') {
+			} else if (typeof arg === 'number') {
 				for(var i = 0; i < result.length; i++){
 					result[i] -= arg;
+				}
+			}
+        }
+	}
+	return result;
+} //}}}
+function ArraySubtract2D(){ //{{{
+    //Takes in any number of scalars or arrays, and calculates the subtraction. Scalars are treated as similar length arrays of the scalar.
+    //Determine reference array and size
+    var size, array, arg, initial;
+	for (var a = 0; a < arguments.length; a++) {
+        arg = arguments[a];
+        if (arg instanceof Array || arg instanceof Float64Array) {
+            size = arg.length;
+            array = arg;
+			initial = a;
+            break;
+        }
+    }
+	//check internal consistency of arrays provided!: 
+	for (var a = 0; a < arguments.length; a++) {
+        arg = arguments[a];
+        if ((arg instanceof Array || arg instanceof Float64Array) && arg.length != size) {
+            throw Error("ArrayAdd error message: arrays provided as arguments are not of the same length!");
+        } else if (!(arg instanceof Array || arg instanceof Float64Array) && typeof arg != 'number') {
+            throw Error("ArrayAdd error message: arguments provided are not of the type Array or Number!");
+        }
+	}
+	//calculate the result, using the first argument to initialize:
+	var result = [];
+	for (var a = 0; a < arguments.length; a++) {
+		if (a !== initial) {
+			arg = arguments[a];
+			if (arg instanceof Array || arg instanceof Float64Array) {
+				for(var i = 0; i < array.length; i++){
+					result[i] = [];
+					for(var j = 0; j < array[i].length; j++){
+					    result[i][j] = array[i][j] - arg[i][j];
+					}
+				}
+			} else if (typeof arg === 'number') {
+				for(var i = 0; i < array.length; i++){
+					result[i] = [];
+					for(var j = 0; j < array[i].length; j++){
+					    result[i][j] = array[i][j] - arg;
+					}
 				}
 			}
@@ -134,5 +180,5 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array) {
+        if (arg instanceof Array || arg instanceof Float64Array) {
             size = arg.length;
             array = arg;
@@ -144,7 +190,7 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array && arg.length != size) {
+        if ((arg instanceof Array || arg instanceof Float64Array) && arg.length != size) {
             throw Error("ArrayAdd error message: arrays provided as arguments are not of the same length!");
-        } else if (!(arg instanceof Array) && typeof arg != 'number') {
+        } else if (!(arg instanceof Array || arg instanceof Float64Array) && typeof arg != 'number') {
             throw Error("ArrayAdd error message: arguments provided are not of the type Array or Number!");
         }
@@ -155,9 +201,9 @@
 		if (a !== initial) {
 			arg = arguments[a];
-			if (arg instanceof Array) {
+			if (arg instanceof Array || arg instanceof Float64Array) {
 				for(var i = 0; i < result.length; i++){
 					result[i] *= arg[i];
 				}
-			} else if (typeof arg != 'number') {
+			} else if (typeof arg === 'number') {
 				for(var i = 0; i < result.length; i++){
 					result[i] *= arg;
@@ -174,5 +220,5 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array) {
+        if (arg instanceof Array || arg instanceof Float64Array) {
             size = arg.length;
             array = arg;
@@ -184,7 +230,7 @@
 	for (var a = 0; a < arguments.length; a++) {
         arg = arguments[a];
-        if (arg instanceof Array && arg.length != size) {
+        if ((arg instanceof Array || arg instanceof Float64Array) && arg.length != size) {
             throw Error("ArrayAdd error message: arrays provided as arguments are not of the same length!");
-        } else if (!(arg instanceof Array) && typeof arg != 'number') {
+        } else if (!(arg instanceof Array || arg instanceof Float64Array) && typeof arg != 'number') {
             throw Error("ArrayAdd error message: arguments provided are not of the type Array or Number!");
         }
@@ -195,9 +241,9 @@
 		if (a !== initial) {
 			arg = arguments[a];
-			if (arg instanceof Array) {
+			if (arg instanceof Array || arg instanceof Float64Array) {
 				for(var i = 0; i < result.length; i++){
 					result[i] /= arg[i];
 				}
-			} else if (typeof arg != 'number') {
+			} else if (typeof arg === 'number') {
 				for(var i = 0; i < result.length; i++){
 					result[i] /= arg;
@@ -282,27 +328,4 @@
 
 } //}}}
-function ArrayOr(){ //{{{
-    if (arguments.length<2)throw Error("ArrayOr error message: sum has to be for at least two arrays!");
-
-	//check internal consistency of arrays provided!: 
-	var firstarray=arguments[0];
-	var firstsize=firstarray.length;
-	
-	for(var a=1;a<arguments.length;a++){
-		var array=arguments[a];
-		if(array.length!=firstsize)throw Error("ArrayOr error message: arrays provided as arguments are not of the same length!");
-	}
-
-	//do the or:
-	var or=NewArrayFill(firstsize,0);
-	for(var a=0;a<arguments.length;a++){
-		var array=arguments[a];
-		for(var i=0;i<array.length;i++){
-			or[i] = or[i] | array[i];
-		}
-	}
-	return or;
-
-} //}}}
 function ArrayConcat(a, b) { //{{{
 	// Make sure that both typed arrays are of the same type
@@ -322,22 +345,22 @@
 } //}}}
 function ArrayCol(matrix, cols) { //{{{
-    var column = [];
-    if (cols instanceof Array) {
+    var columns = [];
+    if (cols instanceof Array || cols instanceof Float64Array) {
         for (var i = 0; i < matrix.length; i++){
-            var row = [];
-            for (var j = cols[0]; j <= cols[1]; j++){
-                row.push(matrix[i][j]);
+            var col = [];
+            for (var j = 0; j < cols.length; j++){
+                col.push(matrix[i][cols[j]]);
             }
-            column.push(row); 
+            columns.push(col); 
         }
 
     } else if (typeof cols == 'number') {
         for (var i = 0; i < matrix.length; i++){
-            column.push(matrix[i][cols]);
+            columns.push(matrix[i][cols]);
         }
     } else {
         throw new Error("ArrayCol error: cols must be a single integer or an array with 2 integers!");
     }
-   return column;
+   return columns;
 } //}}}
 function ListToMatrix(list, elementsPerSubArray) { //{{{
@@ -445,16 +468,147 @@
     return 0;
 } //}}}
-function ArrayUnique(arr) { //{{{
-
-	return arr.reverse().filter(function (e, i, arr) {
-		    return arr.indexOf(e, i+1) === -1;
-	}).reverse();
-} //}}}
-function ArraySort(array) { //{{{
-
-	return array.sort(function(a, b) {
-		return a - b;
-	});
-
+function ArrayUnique(arr,rows) { //{{{
+	if (arguments.length == 2){
+		if (rows == 'rows') {
+			//See Matlab unique function and https://stackoverflow.com/a/20339709/1905613
+			let equals = (a, b) => JSON.stringify(a) === JSON.stringify(b);
+			let uniques = [];
+			let indexA = [];
+			let indexC = [];
+			let itemsFound = {};;
+			for(let i = 0, l = arr.length; i < l; i++) {
+				let stringified = JSON.stringify(arr[i]);
+				if (typeof(itemsFound[stringified]) != 'undefined') {
+					indexC.push(itemsFound[stringified]);
+					continue;
+				}
+				uniques.push(arr[i]);
+				indexA.push(i);
+				itemsFound[stringified] = uniques.length-1;
+				indexC.push(itemsFound[stringified]);
+			}
+			//assert arr == uniques[indexC,:];
+			for (let i = 0; i < indexC.length; i++) {
+				if (!equals(arr[i], uniques[indexC[i]])) {
+					throw new Error('bad implementation');	
+				}
+			}
+			//assert uniques == arr[indexA, :];
+			for (let i = 0; i < indexA.length; i++) {
+				if (!equals(uniques[i], arr[indexA[i]])) {
+					throw new Error('bad implementation');	
+				}
+			}
+			let [uniquesSorted, indexInToOut, indexOutToIn] = ArraySortWithIndices(uniques);
+			//indexMapping is the index of the edge in the old array
+			indexCSorted = []; //indexC.length == arr.length
+			//assert uniquesSorted[i,:] = uniques[indexInToOut[i],:]
+			for (let i = 0; i < indexInToOut.length; i++) {
+				if (!equals(uniquesSorted[i], uniques[indexInToOut[i]])) {
+					console.log(i, uniquesSorted[indexInToOut[i]], uniques[i]);
+					throw new Error('bad implementation');	
+				}
+			}
+			//assert uniques[i,:] = uniquesSorted[indexOutToIn[i],:]
+			for (let i = 0; i < indexOutToIn.length; i++) {
+				if (!equals(uniques[i], uniquesSorted[indexOutToIn[i]])) {
+					console.log(i, uniques[indexOutToIn[i]], uniquesSorted[i]);
+					throw new Error('bad implementation');	
+				}
+			}
+			//GOAL: assert arr[i,:] == uniquesSorted[indexCSorted[i], :]
+			//GIVEN: assert arr[i,:] == uniques[indexC[i],:];
+			//GIVEN: assert uniquesSorted[i,:] = uniques[indexInToOut[i],:]
+			//GIVEN: assert uniques[i,:] = uniquesSorted[indexOutToIn[i],:]
+			//assert uniques[indexC[i],:] == uniquesSorted[indexOutToIn[indexC[i]],:]
+			//assert uniquesSorted[indexCSorted[i],:]; == uniquesSorted[indexOutToIn[indexC[i]],:];
+			for (let i = 0; i < arr.length; i++) {
+				indexCSorted[i] = indexOutToIn[indexC[i]];
+			}
+			for (let i = 0; i < indexC.length; i++) {
+				if (!equals(arr[i], uniquesSorted[indexCSorted[i]])) {
+					console.log(i, arr[i], uniquesSorted[indexCSorted[i]]);
+					throw new Error('bad implementation');	
+				}
+			}
+
+			indexASorted = []; //indexA.length == uniques.length
+			//GOAL: uniquesSorted[i, :] == arr[indexASorted[i], :]
+			//GIVEN: assert arr[i,:] == uniques[indexC[i],:];
+			//GIVEN: assert arr[indexA[i],:] == uniques[i,:];
+			//GIVEN: assert uniques[indexInToOut[i],:] == uniquesSorted[i,:]
+			//GIVEN: assert uniques[i,:] = uniquesSorted[indexOutToIn[i],:]
+			//assert uniquesSorted[i,:] == uniques[indexInToOut[i],:]
+			//assert uniques[indexInToOut[i],:] == arr[indexA[indexInToOut[i]],:];
+			//assert indexA[indexInToOut] == indexASorted
+			//indexASorted == indexA[indexMapping[i]]
+			for (let i = 0; i < indexA.length; i++) {
+				indexASorted[i] = indexA[indexInToOut[i]];
+			}
+			//assert uniques == arr[indexA, :];
+			for (let i = 0; i < indexASorted.length; i++) {
+				if (!equals(uniquesSorted[i], arr[indexASorted[i]])) {
+					throw new Error('bad implementation');	
+				}
+			}
+			console.log('Good uniques');
+			return [uniquesSorted, indexASorted, indexCSorted];
+		} else {
+			throw new Error('ArrayUnique non "rows" not supported');	
+		}
+	} else {
+		return arr.reverse().filter(function (e, i, arr) {
+				return arr.indexOf(e, i+1) === -1;
+		}).reverse();
+	}
+} //}}}
+function ArraySortWithIndices(toSort, sortingFunction) { //{{{
+	//returns the sorted and index such that toSort[index[i]] == sorted[i]
+	let toSortCopy = [];
+	for (var i = 0; i < toSort.length; i++) {
+	    toSortCopy[i] = [toSort[i], i];
+	}
+	if (typeof(sortingFunction) == 'undefined') {
+		let numeric2DFunction = function(a, b) {
+			if (a[0][0] == b[0][0]) {
+                return a[0][1] - b[0][1];
+			} else {
+			    return a[0][0] - b[0][0];
+			}
+		};
+		sortingFunction = numeric2DFunction;
+	}
+	toSortCopy.sort(sortingFunction);
+	let indicesInToOut = [];
+	let indicesOutToIn = [];
+	let sorted = [];
+	for (var j = 0; j < toSortCopy.length; j++) {
+	    indicesInToOut[j] = toSortCopy[j][1];
+	    indicesOutToIn[toSortCopy[j][1]] = j;
+	    sorted[j] = toSortCopy[j][0];
+	}
+	return [sorted, indicesInToOut, indicesOutToIn];
+} //}}}
+function ArraySort(array,dim) { //{{{
+	let numericFunction = function(a, b) {
+	    return a - b;
+	};
+	let numeric2DFunction = function(a, b) {
+	    return a[0] - b[0];
+	};
+	if (arguments.length == 2){
+		if (dim == 1) {
+			array.sort(numeric2DFunction);
+		} else if (dim == 2) {
+			for (let i = 0; i < array.length; i++) {
+				array[i].sort(numericFunction);
+			}
+		} else {
+			throw new Error('ArraySort dim > 2 not yet supported')
+		}
+		return array;
+	} else {
+		return array.sort(numericFunction);
+	}
 } //}}}
 function ArrayRange(lower, upper) { //{{{
@@ -515,7 +669,100 @@
 } //}}}
 function ArrayAnd(array1,array2) { //{{{
-
-	var array=array1;
-	for (var i=0;i<array1.length;i++)array[i]=array1[i] & array2[i];
+	var array = new Array(array1.length);
+	for (var i=0;i<array1.length;i++) {
+		array[i]=array1[i] & array2[i];
+	}
+	return array;
+} //}}}
+function ArrayOr(array1,array2) { //{{{
+	var array = new Array(array1.length);
+	for (var i=0;i<array1.length;i++) {
+		array[i]=array1[i] | array2[i];
+	}
+	return array;
+} //}}}
+function ArrayEqual(array1,array2) { //{{{
+	var array = new Array(array1.length);
+
+	if (typeof(array1[0]) == 'number') {
+		if (typeof(array2) == 'number') {
+			for(var i=0;i<array1.length;i++){
+				array[i] = array1[i] == array2;
+			}
+		} else {
+			for(var i=0;i<array1.length;i++){
+				array[i] = array1[i] == array2[i];
+			}
+		}
+	} else { //provide support for 2d arrays
+		if (typeof(array2) == 'number') {
+			for(var i=0;i<array1.length;i++){
+				array[i] = new Array(array1[i].length);
+				for(var j=0;j<array1[i].length;j++){
+					array[i][j] = array1[i][j] == array2;
+				}
+			}
+		} else {
+			for(var i=0;i<array1.length;i++){
+				array[i] = new Array(array1[i].length);
+				for(var j=0;j<array1[i].length;j++){
+					array[i][j] = array1[i][j] == array2[i][j];
+				}
+			}
+		}
+	}
+	return array;
+} //}}}
+function ArrayLessThan(array1,array2) { //{{{
+	var array = new Array(array1.length);
+
+	if (typeof(array2) == 'number') {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] < array2;
+		}
+	} else {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] < array2[i];
+		}
+	}
+	return array;
+} //}}}
+function ArrayGreaterThan(array1,array2) { //{{{
+	var array = new Array(array1.length);
+	if (typeof(array2) == 'number') {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] > array2;
+		}
+	} else {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] > array2[i];
+		}
+	}
+	return array;
+} //}}}
+function ArrayLessEqualThan(array1,array2) { //{{{
+	var array = new Array(array1.length);
+	if (typeof(array2) == 'number') {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] <= array2;
+		}
+	} else {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] <= array2[i];
+		}
+	}
+	return array;
+} //}}}
+function ArrayGreaterEqualThan(array1,array2) { //{{{
+	var array = new Array(array1.length);
+	if (typeof(array2) == 'number') {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] >= array2;
+		}
+	} else {
+		for(var i=0;i<array1.length;i++){
+			array[i] = array1[i] >= array2[i];
+		}
+	}
 	return array;
 } //}}}
@@ -551,5 +798,5 @@
 	return arr;
 } //}}}
-function NewArrayFillIncrement(size,start,increment) { //{{{
+function NewArrayFillIncrement(start,size,increment) { //{{{
 	var array=new Array(size); 
 
@@ -559,4 +806,10 @@
 
 	return array;
+} //}}}
+function ones(size) { //{{{
+	return NewArrayFill(size,1);
+} //}}}
+function zeros(size) { //{{{
+	return NewArrayFill(size,0);
 } //}}}
 function ArrayFind(array,value) { //{{{
@@ -611,4 +864,30 @@
 	}
 	return indices;
+} //}}}
+function ArrayIndex(array1,array2,value) { //{{{
+	//Change behavior between get (if no value is provided) to set (if value to set is provided)
+	if (arguments.length == 2){
+		let data = []
+		if (typeof(array2[0]) == 'number') {
+			for (let i=0;i<array2.length;i++){
+				data.push(array1[array2[i]]);
+			}
+		} else {
+			//2d index array
+			for (let i=0;i<array2.length;i++){
+				let data2 = [];
+				for (let j=0;j<array2[i].length;j++){
+				    data2.push(array1[array2[i][j]]);
+				}
+				data.push(data2);
+			}
+		}
+		return data;
+	} else {
+		for (var i=0;i<array2.length;i++){
+			array1[array2[i]]=value;
+		}
+		return array1;
+	}
 } //}}}
 function Create2DArray(rows,cols) { //{{{
@@ -644,5 +923,5 @@
 
 	// Handle Array
-	if (obj instanceof Array) {
+	if (obj instanceof Array || arg instanceof Float64Array) {
 		copy = [];
 		for (var i = 0, len = obj.length; i < len; i++) {
Index: issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m	(revision 25994)
+++ issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m	(revision 26744)
@@ -31,5 +31,8 @@
 %Initialize surface and basal forcings
 md.smb = initialize(md.smb,md);
-md.basalforcings   = initialize(md.basalforcings,md);
+md.basalforcings = initialize(md.basalforcings,md);
+
+%Initialize ocean forcings and sealevel
+md.dsl = initialize(md.dsl,md);
 
 %Deal with other boundary conditions
Index: issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py	(revision 25994)
+++ issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py	(revision 26744)
@@ -3,55 +3,57 @@
 
 def SetIceSheetBC(md):
-    """
-    SETICESHEETBC - Create the boundary conditions for stressbalance and thermal models for an IceSheet with no Ice Front
+    """SETICESHEETBC - Create the boundary conditions for stressbalance and thermal models for an IceSheet with no Ice Front
 
-       Usage:
-          md = SetIceSheetBC(md)
+    Usage:
+        md = SetIceSheetBC(md)
 
-       See also: SETICESHELFBC, SETMARINEICESHEETBC
+    See also: SETICESHELFBC, SETMARINEICESHEETBC
     """
 
-    #node on Dirichlet
+    # node on Dirichlet
     pos = np.nonzero(md.mesh.vertexonboundary)
-    md.stressbalance.spcvx = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.stressbalance.spcvy = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.stressbalance.spcvz = float('nan') * np.ones((md.mesh.numberofvertices))
+    md.stressbalance.spcvx = np.nan * np.ones((md.mesh.numberofvertices))
+    md.stressbalance.spcvy = np.nan * np.ones((md.mesh.numberofvertices))
+    md.stressbalance.spcvz = np.nan * np.ones((md.mesh.numberofvertices))
     md.stressbalance.spcvx[pos] = 0
     md.stressbalance.spcvy[pos] = 0
     md.stressbalance.spcvz[pos] = 0
-    md.stressbalance.referential = float('nan') * np.ones((md.mesh.numberofvertices, 6))
+    md.stressbalance.referential = np.nan * np.ones((md.mesh.numberofvertices, 6))
     md.stressbalance.loadingforce = 0 * np.ones((md.mesh.numberofvertices, 3))
 
-    #Dirichlet Values
+    # Dirichlet Values
     if isinstance(md.inversion.vx_obs, np.ndarray) and np.size(md.inversion.vx_obs, axis=0) == md.mesh.numberofvertices and isinstance(md.inversion.vy_obs, np.ndarray) and np.size(md.inversion.vy_obs, axis=0) == md.mesh.numberofvertices:
-        print("      boundary conditions for stressbalance model: spc set as observed velocities")
+        print('      boundary conditions for stressbalance model: spc set as observed velocities')
         md.stressbalance.spcvx[pos] = md.inversion.vx_obs[pos]
         md.stressbalance.spcvy[pos] = md.inversion.vy_obs[pos]
     else:
-        print("      boundary conditions for stressbalance model: spc set as zero")
+        print('      boundary conditions for stressbalance model: spc set as zero')
 
-    #No ice front -> do nothing
+    # No ice front -> do nothing
 
-    #Create zeros basalforcings and smb
+    # Initialize surface and basal forcings
     md.smb.initialize(md)
     md.basalforcings.initialize(md)
 
-    #Deal with other boundary conditions
+    # Initialize ocean forcings and sealevel
+    md.dsl.initialize(md)
+
+    # Deal with other boundary conditions
     if np.all(np.isnan(md.balancethickness.thickening_rate)):
         md.balancethickness.thickening_rate = np.zeros((md.mesh.numberofvertices))
-        print("      no balancethickness.thickening_rate specified: values set as zero")
-    md.masstransport.spcthickness = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.balancethickness.spcthickness = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.damage.spcdamage = float('nan') * np.ones((md.mesh.numberofvertices))
+        print('      no balancethickness.thickening_rate specified: values set as zero')
+    md.masstransport.spcthickness = np.nan * np.ones((md.mesh.numberofvertices))
+    md.balancethickness.spcthickness = np.nan * np.ones((md.mesh.numberofvertices))
+    md.damage.spcdamage = np.nan * np.ones((md.mesh.numberofvertices))
 
     if isinstance(md.initialization.temperature, np.ndarray) and np.size(md.initialization.temperature, axis=0) == md.mesh.numberofvertices:
-        md.thermal.spctemperature = float('nan') * np.ones((md.mesh.numberofvertices))
+        md.thermal.spctemperature = np.nan * np.ones((md.mesh.numberofvertices))
         if hasattr(md.mesh, 'vertexonsurface'):
             pos = np.nonzero(md.mesh.vertexonsurface)[0]
-            md.thermal.spctemperature[pos] = md.initialization.temperature[pos]  #impose observed temperature on surface
+            md.thermal.spctemperature[pos] = md.initialization.temperature[pos]  # impose observed temperature on surface
         if not isinstance(md.basalforcings.geothermalflux, np.ndarray) or not np.size(md.basalforcings.geothermalflux) == md.mesh.numberofvertices:
-            md.basalforcings.geothermalflux = 50. * 10**-3 * np.ones((md.mesh.numberofvertices))  #50 mW / m^2
+            md.basalforcings.geothermalflux = 50.0 * pow(10, -3) * np.ones((md.mesh.numberofvertices))  # 50 mW/m^2
     else:
-        print("      no thermal boundary conditions created: no observed temperature found")
+        print('      no thermal boundary conditions created: no observed temperature found')
 
     return md
Index: issm/trunk/src/m/boundaryconditions/SetMLHOBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMLHOBC.m	(revision 26744)
+++ issm/trunk/src/m/boundaryconditions/SetMLHOBC.m	(revision 26744)
@@ -0,0 +1,16 @@
+function md=SetMLHOBC(md)
+%SETMLHOBC - Create the boundary conditions for stressbalance for MLHO: VxBase, VyBase, VxShear, VyShear
+%
+%   Usage:
+%      md=SetMLHOBC(md)
+%
+
+
+%node on Dirichlet
+if md.flowequation.isMLHO
+	md.stressbalance.spcvx_base=md.stressbalance.spcvx;
+	md.stressbalance.spcvy_base=md.stressbalance.spcvy;
+
+	md.stressbalance.spcvx_shear=NaN*ones(size(md.stressbalance.spcvx_base));
+	md.stressbalance.spcvy_shear=NaN*ones(size(md.stressbalance.spcvy_base));
+end
Index: issm/trunk/src/m/boundaryconditions/SetMLHOBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMLHOBC.py	(revision 26744)
+++ issm/trunk/src/m/boundaryconditions/SetMLHOBC.py	(revision 26744)
@@ -0,0 +1,22 @@
+import numpy as np
+
+
+def SetMLHOBC(md):
+    """
+    SETMLHOBC - Create the boundary conditions for stressbalance for MLHO: VxBase, VyBase, VxShear, VyShear
+
+       Usage:
+          md = SetIceShelfBC(md, varargin)
+
+       Example:
+          md = SetIceShelfBC(md)
+
+    """
+
+    #node on Dirichlet (boundary and ~icefront)
+    md.stressbalance.spcvx_base = md.stressbalance.spcvx
+    md.stressbalance.spcvy_base = md.stressbalance.spcvy
+    md.stressbalance.spcvx_shear = np.nan * md.stressbalance.spcvx
+    md.stressbalance.spcvy_shear = np.nan * md.stressbalance.spcvy
+
+    return md
Index: issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 25994)
+++ issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 26744)
@@ -40,5 +40,5 @@
 pos=find(md.mesh.vertexonboundary & ~vertexonicefront);
 if isempty(pos),
-	disp('SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet applied')
+	disp('Warning: SetMarineIceSheetBC.m: ice front all around the glacier, no dirichlet applied')
 end
 md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
Index: issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 25994)
+++ issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 26744)
@@ -5,51 +5,51 @@
 
 def SetMarineIceSheetBC(md, icefrontfile=''):
-    """
-    SETICEMARINESHEETBC - Create the boundary conditions for stressbalance and thermal models for a  Marine Ice Sheet with Ice Front
+    """SETICEMARINESHEETBC - Create the boundary conditions for stressbalance 
+    and thermal models for a  Marine Ice Sheet with Ice Front
 
-       Neumann BC are used on the ice front (an ARGUS contour around the ice front
-       can be given in input, or it will be deduced as onfloatingice & onboundary)
-       Dirichlet BC are used elsewhere for stressbalance
+    Neumann BC are used on the ice front (an ARGUS contour around the ice front
+    can be given in input, or it will be deduced as onfloatingice & onboundary)
+    Dirichlet BC are used elsewhere for stressbalance
 
-       Usage:
-          md = SetMarineIceSheetBC(md, icefrontfile)
-          md = SetMarineIceSheetBC(md)
+    Usage:
+        md = SetMarineIceSheetBC(md, icefrontfile)
+        md = SetMarineIceSheetBC(md)
 
-       Example:
-          md = SetMarineIceSheetBC(md, 'Front.exp')
-          md = SetMarineIceSheetBC(md)
+    Example:
+        md = SetMarineIceSheetBC(md, 'Front.exp')
+        md = SetMarineIceSheetBC(md)
 
-       See also: SETICESHELFBC, SETMARINEICESHEETBC
+    See also: SETICESHELFBC, SETMARINEICESHEETBC
     """
     #node on Dirichlet (boundary and ~icefront)
     if icefrontfile:
-        #User provided Front.exp, use it
+        # User provided Front.exp, use it
         if not os.path.exists(icefrontfile):
-            raise IOError("SetMarineIceSheetBC error message: ice front file '%s' not found." % icefrontfile)
+            raise IOError('SetMarineIceSheetBC error message: ice front file \'{}\' not found.'.format(icefrontfile))
         incontour = ContourToMesh(md.mesh.elements, md.mesh.x, md.mesh.y, icefrontfile, 'node', 2)
         vertexonicefront = np.logical_and(md.mesh.vertexonboundary, incontour.reshape(-1))
     else:
-        #Guess where the ice front is
+        # Guess where the ice front is
         vertexonfloatingice = np.zeros((md.mesh.numberofvertices))
-        pos = np.nonzero(np.sum(md.mask.ocean_levelset[md.mesh.elements - 1] < 0., axis=1) > 0.)[0]
+        pos = np.nonzero(np.sum(md.mask.ocean_levelset[md.mesh.elements - 1] < 0.0, axis=1) > 0.0)[0]
         vertexonfloatingice[md.mesh.elements[pos].astype(int) - 1] = 1.
-        vertexonicefront = np.logical_and(np.reshape(md.mesh.vertexonboundary, (-1, )), vertexonfloatingice > 0.)
+        vertexonicefront = np.logical_and(np.reshape(md.mesh.vertexonboundary, (-1, )), vertexonfloatingice > 0.0)
 
     #pos = find(md.mesh.vertexonboundary & ~vertexonicefront)
     pos = np.nonzero(np.logical_and(md.mesh.vertexonboundary, np.logical_not(vertexonicefront)))[0]
     if not np.size(pos):
-        print("SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually.")
+        print('Warning: SetMarineIceSheetBC.py: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually.')
 
-    md.stressbalance.spcvx = float('nan') * np.ones(md.mesh.numberofvertices)
-    md.stressbalance.spcvy = float('nan') * np.ones(md.mesh.numberofvertices)
-    md.stressbalance.spcvz = float('nan') * np.ones(md.mesh.numberofvertices)
-    md.stressbalance.referential = float('nan') * np.ones((md.mesh.numberofvertices, 6))
+    md.stressbalance.spcvx = np.nan * np.ones(md.mesh.numberofvertices)
+    md.stressbalance.spcvy = np.nan * np.ones(md.mesh.numberofvertices)
+    md.stressbalance.spcvz = np.nan * np.ones(md.mesh.numberofvertices)
+    md.stressbalance.referential = np.nan * np.ones((md.mesh.numberofvertices, 6))
     md.stressbalance.loadingforce = 0 * np.ones((md.mesh.numberofvertices, 3))
 
-    #Position of ice front
+    # Position of ice front
     pos = np.nonzero(vertexonicefront)[0]
     md.mask.ice_levelset[pos] = 0
 
-    #First find segments that are not completely on the front
+    # First find segments that are not completely on the front
     if md.mesh.elementtype() == 'Penta':
         numbernodesfront = 4
@@ -57,5 +57,5 @@
         numbernodesfront = 2
     else:
-        raise Exception("Mesh type not supported")
+        raise Exception('Mesh type not supported')
     if any(md.mask.ice_levelset <= 0):
         values = md.mask.ice_levelset[md.mesh.segments[:, 0:-1] - 1]
@@ -63,5 +63,5 @@
         np.sum(segmentsfront, axis=1) != numbernodesfront
         segments = np.nonzero(np.sum(segmentsfront, axis=1) != numbernodesfront)[0]
-    #Find all nodes for these segments and spc them
+        # Find all nodes for these segments and spc them
         pos = md.mesh.segments[segments, 0:-1] - 1
     else:
@@ -71,11 +71,11 @@
     md.stressbalance.spcvz[pos] = 0
 
-    #Dirichlet Values
+    # Dirichlet Values
     if isinstance(md.inversion.vx_obs, np.ndarray) and np.size(md.inversion.vx_obs, axis=0) == md.mesh.numberofvertices and isinstance(md.inversion.vy_obs, np.ndarray) and np.size(md.inversion.vy_obs, axis=0) == md.mesh.numberofvertices:
-        print("      boundary conditions for stressbalance model: spc set as observed velocities")
+        print('      boundary conditions for stressbalance model: spc set as observed velocities')
         md.stressbalance.spcvx[pos] = md.inversion.vx_obs[pos]
         md.stressbalance.spcvy[pos] = md.inversion.vy_obs[pos]
     else:
-        print("      boundary conditions for stressbalance model: spc set as zero")
+        print('      boundary conditions for stressbalance model: spc set as zero')
 
     md.hydrology.spcwatercolumn = np.zeros((md.mesh.numberofvertices, 2))
@@ -90,20 +90,20 @@
     if np.all(np.isnan(md.balancethickness.thickening_rate)):
         md.balancethickness.thickening_rate = np.zeros((md.mesh.numberofvertices))
-        print("      no balancethickness.thickening_rate specified: values set as zero")
+        print('      no balancethickness.thickening_rate specified: values set as zero')
 
-    md.masstransport.spcthickness = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.balancethickness.spcthickness = float('nan') * np.ones((md.mesh.numberofvertices))
-    md.damage.spcdamage = float('nan') * np.ones((md.mesh.numberofvertices))
+    md.masstransport.spcthickness = np.nan * np.ones((md.mesh.numberofvertices))
+    md.balancethickness.spcthickness = np.nan * np.ones((md.mesh.numberofvertices))
+    md.damage.spcdamage = np.nan * np.ones((md.mesh.numberofvertices))
 
     if isinstance(md.initialization.temperature, np.ndarray) and np.size(md.initialization.temperature, axis=0) == md.mesh.numberofvertices:
-        md.thermal.spctemperature = float('nan') * np.ones((md.mesh.numberofvertices))
+        md.thermal.spctemperature = np.nan * np.ones((md.mesh.numberofvertices))
         if hasattr(md.mesh, 'vertexonsurface'):
             pos = np.nonzero(md.mesh.vertexonsurface)[0]
-            md.thermal.spctemperature[pos] = md.initialization.temperature[pos]  #impose observed temperature on surface
+            md.thermal.spctemperature[pos] = md.initialization.temperature[pos]  # impose observed temperature on surface
         if not isinstance(md.basalforcings.geothermalflux, np.ndarray) or not np.size(md.basalforcings.geothermalflux, axis=0) == md.mesh.numberofvertices:
             md.basalforcings.geothermalflux = np.zeros((md.mesh.numberofvertices))
-            md.basalforcings.geothermalflux[np.nonzero(md.mask.ocean_levelset > 0.)] = 50. * 10.**- 3  #50mW / m2
+            md.basalforcings.geothermalflux[np.nonzero(md.mask.ocean_levelset > 0.0)] = 50.0 * pow(10.0, -3)  # 50mW/m2
     else:
-        print("      no thermal boundary conditions created: no observed temperature found")
+        print('      no thermal boundary conditions created: no observed temperature found')
 
     return md
Index: issm/trunk/src/m/boundaryconditions/getlovenumbers.js
===================================================================
--- issm/trunk/src/m/boundaryconditions/getlovenumbers.js	(revision 26744)
+++ issm/trunk/src/m/boundaryconditions/getlovenumbers.js	(revision 26744)
@@ -0,0 +1,10104 @@
+function getlovenumbers() {//{{{
+	/**
+	 * GETLOVENUMBERS: provide love numbers retrieved from,
+	 *
+	 *     http://www.srosat.com/iag-jsg/loveNb.php
+	 *
+	 * in a chosen reference frame
+	 *
+	 * Usage:
+	 *     series = getlovenumbers('type', 'loadingverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', 1000);
+	 * - type = one of 'loadingverticaldisplacement', 
+	'loadinggravitationalpotential', 'loadinghorizontaldisplacement', 
+	'tidalverticaldisplacement', 'tidalgravitationalpotential', 
+	'tidalhorizontaldisplacement'
+	 * - referenceframe = one of 'CM' (default) and 'CF'
+	 * - maxdeg = default 1000
+	 *
+	 * Example:
+	 *     h = getlovenumbers('type', 'loadingverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 *     k = getlovenumbers('type', 'loadinggravitationalpotential', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 *     l = getlovenumbers('type', 'loadinghorizontaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 *     th = getlovenumbers('type', 'tidalverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 *     tk = getlovenumbers('type', 'tidalgravitationalpotential', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 *     tl = getlovenumbers('type', 'tidalhorizontaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg);
+	 */
+
+	// Recover options
+	let options = new pairoptions(arguments);
+	let type = options.getfieldvalue('type');
+	let frame = options.getfieldvalue('referenceframe', 'CM');
+	let maxdeg = options.getfieldvalue('maxdeg', 1000);
+
+	if (maxdeg > 10000) {
+		error('PREM love numbers computed only for deg < 10,000. Request lower maxdeg');
+	}
+
+	const TYPES = [
+		'loadingverticaldisplacement',
+		'loadinggravitationalpotential',
+		'loadinghorizontaldisplacement',
+		'tidalverticaldisplacement',
+		'tidalgravitationalpotential',
+		'tidalhorizontaldisplacement'
+	];
+
+	if (!(TYPES.includes(type))) {
+		error('type should be one of \'loadingverticaldisplacement\', \'loadinggravitationalpotential\', \'loadinghorizontaldisplacement\',\'tidalverticaldisplacement\', \'tidalgravitationalpotential\', \'tidalhorizontaldisplacement\'');
+	}
+
+	let love_numbers = [
+		[0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000],
+		[-1.28740059, -1.00000000, -0.89858519, 0.00000000, 0.00000000, 0.00000000],
+		[-1.00025365, -0.30922675, 0.02060926, 0.62933648, 0.30136172, 0.08745784],
+		[-1.06243501, -0.19927948, 0.06801636, 0.29799672, 0.09304210, 0.01525258],
+		[-1.06779588, -0.13649834, 0.05667027, 0.18024117, 0.04181593, 0.01055799],
+		[-1.10365923, -0.10736896, 0.04401221, 0.13257950, 0.02455390, 0.00874595],
+		[-1.16440348, -0.09295485, 0.03638747, 0.10999739, 0.01694141, 0.00701045],
+		[-1.23634156, -0.08469861, 0.03202759, 0.09727833, 0.01279626, 0.00556581],
+		[-1.31140380, -0.07921412, 0.02937593, 0.08896691, 0.01019313, 0.00445157],
+		[-1.38582399, -0.07513541, 0.02762338, 0.08291950, 0.00840274, 0.00360620],
+		[-1.45807465, -0.07187005, 0.02638627, 0.07819716, 0.00709641, 0.00295944],
+		[-1.52763314, -0.06913154, 0.02547640, 0.07433538, 0.00610349, 0.00245649],
+		[-1.59437866, -0.06676258, 0.02479080, 0.07107472, 0.00532548, 0.00205857],
+		[-1.65833071, -0.06466619, 0.02426511, 0.06825469, 0.00470107, 0.00173889],
+		[-1.71954820, -0.06277732, 0.02385464, 0.06576832, 0.00418998, 0.00147872],
+		[-1.77809640, -0.06105001, 0.02352654, 0.06354080, 0.00376467, 0.00126474],
+		[-1.83403970, -0.05945081, 0.02325609, 0.06151811, 0.00340573, 0.00108719],
+		[-1.88744242, -0.05795502, 0.02302469, 0.05966045, 0.00309910, 0.00093879],
+		[-1.93837115, -0.05654418, 0.02281843, 0.05793806, 0.00283441, 0.00081397],
+		[-1.98689666, -0.05520447, 0.02262706, 0.05632844, 0.00260382, 0.00070843],
+		[-2.03309477, -0.05392545, 0.02244322, 0.05481440, 0.00240132, 0.00061877],
+		[-2.07704643, -0.05269926, 0.02226173, 0.05338269, 0.00222224, 0.00054227],
+		[-2.11883714, -0.05151988, 0.02207909, 0.05202300, 0.00206289, 0.00047675],
+		[-2.15855611, -0.05038274, 0.02189307, 0.05072723, 0.00192031, 0.00042043],
+		[-2.19629514, -0.04928430, 0.02170238, 0.04948894, 0.00179212, 0.00037187],
+		[-2.23214747, -0.04822179, 0.02150643, 0.04830294, 0.00167634, 0.00032986],
+		[-2.26620674, -0.04719301, 0.02130509, 0.04716500, 0.00157138, 0.00029341],
+		[-2.29856595, -0.04619619, 0.02109858, 0.04607163, 0.00147587, 0.00026171],
+		[-2.32931659, -0.04522983, 0.02088735, 0.04501989, 0.00138869, 0.00023405],
+		[-2.35854794, -0.04429270, 0.02067197, 0.04400725, 0.00130886, 0.00020985],
+		[-2.38634650, -0.04338368, 0.02045310, 0.04303154, 0.00123559, 0.00018864],
+		[-2.41279547, -0.04250179, 0.02023142, 0.04209082, 0.00116814, 0.00017000],
+		[-2.43797451, -0.04164613, 0.02000761, 0.04118337, 0.00110593, 0.00015358],
+		[-2.46195951, -0.04081583, 0.01978231, 0.04030761, 0.00104841, 0.00013908],
+		[-2.48482241, -0.04001011, 0.01955614, 0.03946212, 0.00099513, 0.00012625],
+		[-2.50663126, -0.03922817, 0.01932966, 0.03864555, 0.00094568, 0.00011488],
+		[-2.52745016, -0.03846928, 0.01910337, 0.03785666, 0.00089971, 0.00010477],
+		[-2.54733938, -0.03773269, 0.01887774, 0.03709428, 0.00085689, 0.00009577],
+		[-2.56635547, -0.03701769, 0.01865317, 0.03635731, 0.00081696, 0.00008775],
+		[-2.58455138, -0.03632358, 0.01843000, 0.03564469, 0.00077965, 0.00008057],
+		[-2.60197665, -0.03564968, 0.01820854, 0.03495543, 0.00074474, 0.00007415],
+		[-2.61867756, -0.03499532, 0.01798905, 0.03428858, 0.00071205, 0.00006839],
+		[-2.63469733, -0.03435985, 0.01777176, 0.03364323, 0.00068137, 0.00006322],
+		[-2.65007629, -0.03374263, 0.01755683, 0.03301851, 0.00065257, 0.00005857],
+		[-2.66485208, -0.03314303, 0.01734443, 0.03241359, 0.00062548, 0.00005438],
+		[-2.67905981, -0.03256047, 0.01713468, 0.03182769, 0.00059998, 0.00005059],
+		[-2.69273222, -0.03199435, 0.01692767, 0.03126003, 0.00057595, 0.00004717],
+		[-2.70589990, -0.03144411, 0.01672347, 0.03070991, 0.00055327, 0.00004407],
+		[-2.71859139, -0.03090919, 0.01652215, 0.03017662, 0.00053186, 0.00004127],
+		[-2.73083334, -0.03038907, 0.01632374, 0.02965950, 0.00051162, 0.00003872],
+		[-2.74265068, -0.02988323, 0.01612826, 0.02915791, 0.00049246, 0.00003641],
+		[-2.75406669, -0.02939118, 0.01593573, 0.02867125, 0.00047432, 0.00003431],
+		[-2.76510320, -0.02891245, 0.01574615, 0.02819894, 0.00045712, 0.00003239],
+		[-2.77578063, -0.02844656, 0.01555950, 0.02774043, 0.00044081, 0.00003065],
+		[-2.78611812, -0.02799309, 0.01537578, 0.02729517, 0.00042531, 0.00002905],
+		[-2.79613364, -0.02755161, 0.01519496, 0.02686267, 0.00041059, 0.00002760],
+		[-2.80584405, -0.02712170, 0.01501701, 0.02644244, 0.00039659, 0.00002627],
+		[-2.81526521, -0.02670298, 0.01484191, 0.02603402, 0.00038326, 0.00002505],
+		[-2.82441204, -0.02629506, 0.01466961, 0.02563696, 0.00037057, 0.00002393],
+		[-2.83329857, -0.02589759, 0.01450009, 0.02525085, 0.00035847, 0.00002291],
+		[-2.84193804, -0.02551021, 0.01433329, 0.02487527, 0.00034693, 0.00002197],
+		[-2.85034293, -0.02513260, 0.01416919, 0.02450984, 0.00033591, 0.00002111],
+		[-2.85852503, -0.02476443, 0.01400773, 0.02415420, 0.00032539, 0.00002031],
+		[-2.86649548, -0.02440538, 0.01384888, 0.02380798, 0.00031534, 0.00001958],
+		[-2.87426481, -0.02405518, 0.01369258, 0.02347086, 0.00030573, 0.00001891],
+		[-2.88184299, -0.02371352, 0.01353880, 0.02314250, 0.00029653, 0.00001829],
+		[-2.88923945, -0.02338014, 0.01338749, 0.02282261, 0.00028772, 0.00001772],
+		[-2.89646316, -0.02305478, 0.01323861, 0.02251087, 0.00027928, 0.00001720],
+		[-2.90352261, -0.02273718, 0.01309211, 0.02220702, 0.00027120, 0.00001671],
+		[-2.91042585, -0.02242710, 0.01294795, 0.02191078, 0.00026344, 0.00001626],
+		[-2.91718054, -0.02212431, 0.01280609, 0.02162189, 0.00025600, 0.00001585],
+		[-2.92379397, -0.02182859, 0.01266648, 0.02134010, 0.00024886, 0.00001546],
+		[-2.93027306, -0.02153971, 0.01252908, 0.02106517, 0.00024200, 0.00001511],
+		[-2.93662439, -0.02125748, 0.01239386, 0.02079689, 0.00023540, 0.00001478],
+		[-2.94285425, -0.02098169, 0.01226077, 0.02053502, 0.00022907, 0.00001447],
+		[-2.94896860, -0.02071215, 0.01212977, 0.02027936, 0.00022297, 0.00001419],
+		[-2.95497314, -0.02044868, 0.01200082, 0.02002971, 0.00021710, 0.00001392],
+		[-2.96087331, -0.02019110, 0.01187388, 0.01978587, 0.00021146, 0.00001368],
+		[-2.96667427, -0.01993924, 0.01174893, 0.01954767, 0.00020602, 0.00001345],
+		[-2.97238097, -0.01969293, 0.01162591, 0.01931492, 0.00020078, 0.00001324],
+		[-2.97799813, -0.01945201, 0.01150481, 0.01908746, 0.00019573, 0.00001305],
+		[-2.98353025, -0.01921634, 0.01138557, 0.01886511, 0.00019086, 0.00001286],
+		[-2.98898162, -0.01898576, 0.01126817, 0.01864773, 0.00018616, 0.00001269],
+		[-2.99435636, -0.01876014, 0.01115257, 0.01843516, 0.00018162, 0.00001253],
+		[-2.99965838, -0.01853932, 0.01103875, 0.01822725, 0.00017725, 0.00001238],
+		[-3.00489143, -0.01832319, 0.01092666, 0.01802387, 0.00017302, 0.00001224],
+		[-3.01005909, -0.01811161, 0.01081628, 0.01782489, 0.00016893, 0.00001211],
+		[-3.01516479, -0.01790446, 0.01070757, 0.01763017, 0.00016499, 0.00001199],
+		[-3.02021180, -0.01770162, 0.01060052, 0.01743958, 0.00016117, 0.00001187],
+		[-3.02520323, -0.01750298, 0.01049508, 0.01725302, 0.00015748, 0.00001177],
+		[-3.03014209, -0.01730842, 0.01039123, 0.01707036, 0.00015391, 0.00001166],
+		[-3.03503122, -0.01711783, 0.01028894, 0.01689149, 0.00015045, 0.00001157],
+		[-3.03987336, -0.01693111, 0.01018819, 0.01671631, 0.00014711, 0.00001148],
+		[-3.04467112, -0.01674816, 0.01008894, 0.01654470, 0.00014387, 0.00001139],
+		[-3.04942699, -0.01656889, 0.00999117, 0.01637658, 0.00014073, 0.00001131],
+		[-3.05414335, -0.01639319, 0.00989485, 0.01621185, 0.00013769, 0.00001124],
+		[-3.05882250, -0.01622097, 0.00979997, 0.01605041, 0.00013474, 0.00001116],
+		[-3.06346660, -0.01605215, 0.00970649, 0.01589217, 0.00013189, 0.00001109],
+		[-3.06807773, -0.01588664, 0.00961439, 0.01573705, 0.00012912, 0.00001103],
+		[-3.07265789, -0.01572436, 0.00952364, 0.01558496, 0.00012643, 0.00001097],
+		[-3.07720897, -0.01556522, 0.00943423, 0.01543582, 0.00012382, 0.00001091],
+		[-3.08173279, -0.01540916, 0.00934613, 0.01528956, 0.00012129, 0.00001085],
+		[-3.08623109, -0.01525608, 0.00925931, 0.01514610, 0.00011883, 0.00001080],
+		[-3.09070551, -0.01510592, 0.00917376, 0.01500536, 0.00011645, 0.00001074],
+		[-3.09515765, -0.01495861, 0.00908946, 0.01486728, 0.00011413, 0.00001069],
+		[-3.09958899, -0.01481408, 0.00900637, 0.01473179, 0.00011188, 0.00001064],
+		[-3.10400100, -0.01467225, 0.00892449, 0.01459882, 0.00010969, 0.00001060],
+		[-3.10839504, -0.01453308, 0.00884379, 0.01446831, 0.00010756, 0.00001055],
+		[-3.11277241, -0.01439648, 0.00876425, 0.01434019, 0.00010549, 0.00001051],
+		[-3.11713438, -0.01426240, 0.00868586, 0.01421441, 0.00010348, 0.00001047],
+		[-3.12148213, -0.01413079, 0.00860858, 0.01409091, 0.00010152, 0.00001042],
+		[-3.12581680, -0.01400157, 0.00853241, 0.01396963, 0.00009962, 0.00001038],
+		[-3.13013947, -0.01387471, 0.00845733, 0.01385052, 0.00009776, 0.00001034],
+		[-3.13445117, -0.01375013, 0.00838331, 0.01373352, 0.00009596, 0.00001031],
+		[-3.13875289, -0.01362779, 0.00831034, 0.01361859, 0.00009420, 0.00001027],
+		[-3.14304556, -0.01350764, 0.00823841, 0.01350567, 0.00009249, 0.00001023],
+		[-3.14733008, -0.01338963, 0.00816748, 0.01339472, 0.00009083, 0.00001020],
+		[-3.15160728, -0.01327370, 0.00809756, 0.01328569, 0.00008920, 0.00001016],
+		[-3.15587797, -0.01315981, 0.00802862, 0.01317853, 0.00008762, 0.00001012],
+		[-3.16014293, -0.01304792, 0.00796064, 0.01307320, 0.00008608, 0.00001009],
+		[-3.16440288, -0.01293797, 0.00789361, 0.01296967, 0.00008458, 0.00001006],
+		[-3.16865852, -0.01282993, 0.00782751, 0.01286788, 0.00008311, 0.00001002],
+		[-3.17291049, -0.01272375, 0.00776233, 0.01276779, 0.00008169, 0.00000999],
+		[-3.17715942, -0.01261940, 0.00769805, 0.01266938, 0.00008029, 0.00000996],
+		[-3.18140591, -0.01251682, 0.00763466, 0.01257259, 0.00007893, 0.00000992],
+		[-3.18565052, -0.01241598, 0.00757215, 0.01247740, 0.00007761, 0.00000989],
+		[-3.18989378, -0.01231685, 0.00751049, 0.01238376, 0.00007631, 0.00000986],
+		[-3.19413619, -0.01221938, 0.00744968, 0.01229165, 0.00007505, 0.00000983],
+		[-3.19837823, -0.01212354, 0.00738970, 0.01220103, 0.00007381, 0.00000979],
+		[-3.20262035, -0.01202930, 0.00733053, 0.01211186, 0.00007261, 0.00000976],
+		[-3.20686298, -0.01193661, 0.00727217, 0.01202412, 0.00007143, 0.00000973],
+		[-3.21110653, -0.01184546, 0.00721461, 0.01193777, 0.00007028, 0.00000970],
+		[-3.21535137, -0.01175579, 0.00715782, 0.01185279, 0.00006916, 0.00000967],
+		[-3.21959786, -0.01166759, 0.00710179, 0.01176914, 0.00006806, 0.00000964],
+		[-3.22384634, -0.01158082, 0.00704652, 0.01168680, 0.00006699, 0.00000961],
+		[-3.22809714, -0.01149545, 0.00699199, 0.01160573, 0.00006594, 0.00000957],
+		[-3.23235055, -0.01141146, 0.00693819, 0.01152591, 0.00006492, 0.00000954],
+		[-3.23660685, -0.01132880, 0.00688511, 0.01144732, 0.00006392, 0.00000951],
+		[-3.24086631, -0.01124746, 0.00683273, 0.01136993, 0.00006294, 0.00000948],
+		[-3.24512918, -0.01116741, 0.00678105, 0.01129371, 0.00006198, 0.00000945],
+		[-3.24939569, -0.01108862, 0.00673005, 0.01121864, 0.00006105, 0.00000942],
+		[-3.25366606, -0.01101107, 0.00667973, 0.01114470, 0.00006013, 0.00000939],
+		[-3.25794050, -0.01093473, 0.00663007, 0.01107186, 0.00005923, 0.00000936],
+		[-3.26221918, -0.01085957, 0.00658106, 0.01100010, 0.00005835, 0.00000932],
+		[-3.26650230, -0.01078557, 0.00653269, 0.01092939, 0.00005750, 0.00000929],
+		[-3.27079000, -0.01071272, 0.00648495, 0.01085973, 0.00005665, 0.00000926],
+		[-3.27508246, -0.01064097, 0.00643784, 0.01079108, 0.00005583, 0.00000923],
+		[-3.27937980, -0.01057032, 0.00639134, 0.01072343, 0.00005503, 0.00000920],
+		[-3.28368216, -0.01050074, 0.00634544, 0.01065676, 0.00005424, 0.00000917],
+		[-3.28798965, -0.01043222, 0.00630013, 0.01059104, 0.00005346, 0.00000914],
+		[-3.29230239, -0.01036472, 0.00625541, 0.01052626, 0.00005271, 0.00000910],
+		[-3.29662047, -0.01029823, 0.00621126, 0.01046241, 0.00005196, 0.00000907],
+		[-3.30094399, -0.01023273, 0.00616768, 0.01039945, 0.00005124, 0.00000904],
+		[-3.30527303, -0.01016819, 0.00612465, 0.01033738, 0.00005053, 0.00000901],
+		[-3.30960766, -0.01010461, 0.00608218, 0.01027618, 0.00004983, 0.00000898],
+		[-3.31394795, -0.01004197, 0.00604024, 0.01021583, 0.00004914, 0.00000895],
+		[-3.31829395, -0.00998024, 0.00599883, 0.01015631, 0.00004847, 0.00000891],
+		[-3.32264573, -0.00991940, 0.00595795, 0.01009762, 0.00004781, 0.00000888],
+		[-3.32700331, -0.00985945, 0.00591759, 0.01003973, 0.00004717, 0.00000885],
+		[-3.33136675, -0.00980035, 0.00587773, 0.00998262, 0.00004654, 0.00000882],
+		[-3.33573607, -0.00974211, 0.00583838, 0.00992630, 0.00004592, 0.00000879],
+		[-3.34011130, -0.00968470, 0.00579951, 0.00987073, 0.00004531, 0.00000875],
+		[-3.34449246, -0.00962810, 0.00576113, 0.00981591, 0.00004471, 0.00000872],
+		[-3.34887956, -0.00957230, 0.00572323, 0.00976182, 0.00004413, 0.00000869],
+		[-3.35327261, -0.00951729, 0.00568581, 0.00970845, 0.00004355, 0.00000866],
+		[-3.35767163, -0.00946304, 0.00564884, 0.00965578, 0.00004299, 0.00000863],
+		[-3.36207660, -0.00940956, 0.00561233, 0.00960381, 0.00004244, 0.00000859],
+		[-3.36648753, -0.00935681, 0.00557627, 0.00955252, 0.00004189, 0.00000856],
+		[-3.37090440, -0.00930480, 0.00554066, 0.00950190, 0.00004136, 0.00000853],
+		[-3.37532721, -0.00925350, 0.00550548, 0.00945194, 0.00004084, 0.00000850],
+		[-3.37975593, -0.00920290, 0.00547073, 0.00940262, 0.00004032, 0.00000847],
+		[-3.38419056, -0.00915300, 0.00543641, 0.00935393, 0.00003982, 0.00000843],
+		[-3.38863105, -0.00910377, 0.00540251, 0.00930586, 0.00003932, 0.00000840],
+		[-3.39307740, -0.00905520, 0.00536901, 0.00925841, 0.00003884, 0.00000837],
+		[-3.39752956, -0.00900729, 0.00533593, 0.00921156, 0.00003836, 0.00000834],
+		[-3.40198751, -0.00896002, 0.00530324, 0.00916530, 0.00003789, 0.00000830],
+		[-3.40645121, -0.00891338, 0.00527095, 0.00911962, 0.00003743, 0.00000827],
+		[-3.41092063, -0.00886736, 0.00523904, 0.00907451, 0.00003697, 0.00000824],
+		[-3.41539571, -0.00882195, 0.00520752, 0.00902996, 0.00003653, 0.00000821],
+		[-3.41987643, -0.00877713, 0.00517637, 0.00898596, 0.00003609, 0.00000817],
+		[-3.42436272, -0.00873290, 0.00514560, 0.00894250, 0.00003566, 0.00000814],
+		[-3.42885456, -0.00868925, 0.00511520, 0.00889958, 0.00003524, 0.00000811],
+		[-3.43335188, -0.00864617, 0.00508515, 0.00885718, 0.00003482, 0.00000808],
+		[-3.43785464, -0.00860364, 0.00505546, 0.00881530, 0.00003441, 0.00000804],
+		[-3.44236278, -0.00856166, 0.00502613, 0.00877392, 0.00003401, 0.00000801],
+		[-3.44687625, -0.00852021, 0.00499714, 0.00873304, 0.00003361, 0.00000798],
+		[-3.45139500, -0.00847930, 0.00496849, 0.00869264, 0.00003323, 0.00000795],
+		[-3.45591895, -0.00843890, 0.00494017, 0.00865273, 0.00003284, 0.00000791],
+		[-3.46044807, -0.00839902, 0.00491219, 0.00861330, 0.00003247, 0.00000788],
+		[-3.46498227, -0.00835964, 0.00488454, 0.00857433, 0.00003210, 0.00000785],
+		[-3.46952151, -0.00832075, 0.00485721, 0.00853582, 0.00003173, 0.00000782],
+		[-3.47406572, -0.00828234, 0.00483019, 0.00849776, 0.00003138, 0.00000778],
+		[-3.47861484, -0.00824442, 0.00480349, 0.00846014, 0.00003102, 0.00000775],
+		[-3.48316880, -0.00820696, 0.00477710, 0.00842296, 0.00003068, 0.00000772],
+		[-3.48772753, -0.00816996, 0.00475102, 0.00838622, 0.00003034, 0.00000769],
+		[-3.49229097, -0.00813342, 0.00472523, 0.00834989, 0.00003000, 0.00000766],
+		[-3.49685904, -0.00809733, 0.00469975, 0.00831398, 0.00002967, 0.00000762],
+		[-3.50143169, -0.00806167, 0.00467455, 0.00827848, 0.00002935, 0.00000759],
+		[-3.50600884, -0.00802644, 0.00464964, 0.00824338, 0.00002903, 0.00000756],
+		[-3.51059042, -0.00799164, 0.00462502, 0.00820868, 0.00002871, 0.00000753],
+		[-3.51517637, -0.00795726, 0.00460068, 0.00817437, 0.00002840, 0.00000750],
+		[-3.51976660, -0.00792329, 0.00457662, 0.00814045, 0.00002810, 0.00000746],
+		[-3.52436105, -0.00788972, 0.00455283, 0.00810691, 0.00002779, 0.00000743],
+		[-3.52895964, -0.00785655, 0.00452930, 0.00807373, 0.00002750, 0.00000740],
+		[-3.53356231, -0.00782377, 0.00450605, 0.00804093, 0.00002721, 0.00000737],
+		[-3.53816898, -0.00779138, 0.00448306, 0.00800849, 0.00002692, 0.00000734],
+		[-3.54277957, -0.00775937, 0.00446032, 0.00797640, 0.00002664, 0.00000730],
+		[-3.54739402, -0.00772773, 0.00443784, 0.00794466, 0.00002636, 0.00000727],
+		[-3.55201224, -0.00769645, 0.00441562, 0.00791327, 0.00002608, 0.00000724],
+		[-3.55663417, -0.00766554, 0.00439364, 0.00788222, 0.00002581, 0.00000721],
+		[-3.56125973, -0.00763498, 0.00437190, 0.00785151, 0.00002555, 0.00000718],
+		[-3.56588885, -0.00760478, 0.00435041, 0.00782113, 0.00002528, 0.00000715],
+		[-3.57052145, -0.00757491, 0.00432916, 0.00779107, 0.00002502, 0.00000712],
+		[-3.57515745, -0.00754539, 0.00430814, 0.00776133, 0.00002477, 0.00000708],
+		[-3.57979678, -0.00751620, 0.00428736, 0.00773191, 0.00002452, 0.00000705],
+		[-3.58443937, -0.00748734, 0.00426681, 0.00770279, 0.00002427, 0.00000702],
+		[-3.58908514, -0.00745880, 0.00424648, 0.00767399, 0.00002403, 0.00000699],
+		[-3.59373401, -0.00743059, 0.00422637, 0.00764549, 0.00002379, 0.00000696],
+		[-3.59838592, -0.00740268, 0.00420649, 0.00761728, 0.00002355, 0.00000693],
+		[-3.60304078, -0.00737509, 0.00418682, 0.00758937, 0.00002331, 0.00000690],
+		[-3.60769852, -0.00734780, 0.00416737, 0.00756175, 0.00002308, 0.00000687],
+		[-3.61235907, -0.00732081, 0.00414813, 0.00753441, 0.00002286, 0.00000684],
+		[-3.61702235, -0.00729411, 0.00412910, 0.00750735, 0.00002263, 0.00000681],
+		[-3.62168828, -0.00726771, 0.00411028, 0.00748058, 0.00002241, 0.00000678],
+		[-3.62635680, -0.00724159, 0.00409166, 0.00745407, 0.00002219, 0.00000674],
+		[-3.63102782, -0.00721575, 0.00407325, 0.00742783, 0.00002198, 0.00000671],
+		[-3.63570128, -0.00719020, 0.00405503, 0.00740186, 0.00002176, 0.00000668],
+		[-3.64037709, -0.00716491, 0.00403700, 0.00737615, 0.00002156, 0.00000665],
+		[-3.64505519, -0.00713990, 0.00401918, 0.00735070, 0.00002135, 0.00000662],
+		[-3.64973550, -0.00711515, 0.00400154, 0.00732550, 0.00002115, 0.00000659],
+		[-3.65441795, -0.00709066, 0.00398409, 0.00730055, 0.00002094, 0.00000656],
+		[-3.65910247, -0.00706643, 0.00396683, 0.00727585, 0.00002075, 0.00000653],
+		[-3.66378898, -0.00704246, 0.00394975, 0.00725140, 0.00002055, 0.00000650],
+		[-3.66847740, -0.00701873, 0.00393286, 0.00722718, 0.00002036, 0.00000647],
+		[-3.67316767, -0.00699526, 0.00391614, 0.00720320, 0.00002017, 0.00000644],
+		[-3.67785972, -0.00697202, 0.00389960, 0.00717946, 0.00001998, 0.00000641],
+		[-3.68255347, -0.00694903, 0.00388324, 0.00715594, 0.00001979, 0.00000638],
+		[-3.68724885, -0.00692627, 0.00386705, 0.00713266, 0.00001961, 0.00000636],
+		[-3.69194579, -0.00690374, 0.00385103, 0.00710959, 0.00001943, 0.00000633],
+		[-3.69664421, -0.00688145, 0.00383518, 0.00708675, 0.00001925, 0.00000630],
+		[-3.70134406, -0.00685938, 0.00381949, 0.00706413, 0.00001907, 0.00000627],
+		[-3.70604525, -0.00683753, 0.00380397, 0.00704173, 0.00001890, 0.00000624],
+		[-3.71074772, -0.00681590, 0.00378861, 0.00701953, 0.00001873, 0.00000621],
+		[-3.71545140, -0.00679449, 0.00377342, 0.00699755, 0.00001856, 0.00000618],
+		[-3.72015622, -0.00677330, 0.00375838, 0.00697577, 0.00001839, 0.00000615],
+		[-3.72486211, -0.00675231, 0.00374349, 0.00695420, 0.00001823, 0.00000612],
+		[-3.72956899, -0.00673153, 0.00372877, 0.00693283, 0.00001806, 0.00000609],
+		[-3.73427682, -0.00671096, 0.00371419, 0.00691165, 0.00001790, 0.00000607],
+		[-3.73898550, -0.00669059, 0.00369976, 0.00689068, 0.00001774, 0.00000604],
+		[-3.74369498, -0.00667042, 0.00368549, 0.00686989, 0.00001759, 0.00000601],
+		[-3.74840519, -0.00665044, 0.00367136, 0.00684930, 0.00001743, 0.00000598],
+		[-3.75311607, -0.00663066, 0.00365738, 0.00682890, 0.00001728, 0.00000595],
+		[-3.75782754, -0.00661107, 0.00364354, 0.00680868, 0.00001713, 0.00000592],
+		[-3.76253955, -0.00659167, 0.00362984, 0.00678865, 0.00001698, 0.00000590],
+		[-3.76725202, -0.00657245, 0.00361628, 0.00676880, 0.00001683, 0.00000587],
+		[-3.77196489, -0.00655341, 0.00360286, 0.00674913, 0.00001668, 0.00000584],
+		[-3.77667809, -0.00653456, 0.00358958, 0.00672963, 0.00001654, 0.00000581],
+		[-3.78139156, -0.00651589, 0.00357643, 0.00671031, 0.00001640, 0.00000579],
+		[-3.78610525, -0.00649739, 0.00356342, 0.00669116, 0.00001625, 0.00000576],
+		[-3.79081907, -0.00647906, 0.00355053, 0.00667218, 0.00001612, 0.00000573],
+		[-3.79553298, -0.00646091, 0.00353778, 0.00665337, 0.00001598, 0.00000570],
+		[-3.80024690, -0.00644292, 0.00352516, 0.00663472, 0.00001584, 0.00000568],
+		[-3.80496078, -0.00642510, 0.00351266, 0.00661624, 0.00001571, 0.00000565],
+		[-3.80967455, -0.00640745, 0.00350029, 0.00659792, 0.00001557, 0.00000562],
+		[-3.81438815, -0.00638996, 0.00348804, 0.00657976, 0.00001544, 0.00000560],
+		[-3.81910152, -0.00637262, 0.00347592, 0.00656176, 0.00001531, 0.00000557],
+		[-3.82381460, -0.00635545, 0.00346392, 0.00654391, 0.00001519, 0.00000554],
+		[-3.82852732, -0.00633843, 0.00345204, 0.00652622, 0.00001506, 0.00000552],
+		[-3.83323964, -0.00632157, 0.00344027, 0.00650867, 0.00001493, 0.00000549],
+		[-3.83795149, -0.00630485, 0.00342863, 0.00649128, 0.00001481, 0.00000546],
+		[-3.84266280, -0.00628829, 0.00341709, 0.00647404, 0.00001469, 0.00000544],
+		[-3.84737353, -0.00627187, 0.00340568, 0.00645694, 0.00001457, 0.00000541],
+		[-3.85208361, -0.00625560, 0.00339437, 0.00643998, 0.00001445, 0.00000538],
+		[-3.85679299, -0.00623948, 0.00338318, 0.00642317, 0.00001433, 0.00000536],
+		[-3.86150160, -0.00622349, 0.00337210, 0.00640650, 0.00001421, 0.00000533],
+		[-3.86620939, -0.00620765, 0.00336112, 0.00638997, 0.00001410, 0.00000531],
+		[-3.87091631, -0.00619194, 0.00335026, 0.00637358, 0.00001398, 0.00000528],
+		[-3.87562229, -0.00617637, 0.00333950, 0.00635732, 0.00001387, 0.00000526],
+		[-3.88032729, -0.00616094, 0.00332885, 0.00634120, 0.00001376, 0.00000523],
+		[-3.88503124, -0.00614564, 0.00331830, 0.00632520, 0.00001364, 0.00000521],
+		[-3.88973410, -0.00613047, 0.00330785, 0.00630934, 0.00001354, 0.00000518],
+		[-3.89443580, -0.00611543, 0.00329750, 0.00629361, 0.00001343, 0.00000515],
+		[-3.89913629, -0.00610051, 0.00328726, 0.00627801, 0.00001332, 0.00000513],
+		[-3.90383552, -0.00608573, 0.00327711, 0.00626253, 0.00001321, 0.00000510],
+		[-3.90853343, -0.00607107, 0.00326707, 0.00624718, 0.00001311, 0.00000508],
+		[-3.91322998, -0.00605653, 0.00325712, 0.00623195, 0.00001301, 0.00000506],
+		[-3.91792511, -0.00604212, 0.00324726, 0.00621684, 0.00001290, 0.00000503],
+		[-3.92261876, -0.00602782, 0.00323750, 0.00620185, 0.00001280, 0.00000501],
+		[-3.92731089, -0.00601364, 0.00322784, 0.00618698, 0.00001270, 0.00000498],
+		[-3.93200144, -0.00599958, 0.00321826, 0.00617223, 0.00001260, 0.00000496],
+		[-3.93669036, -0.00598564, 0.00320878, 0.00615760, 0.00001250, 0.00000493],
+		[-3.94137761, -0.00597181, 0.00319939, 0.00614308, 0.00001241, 0.00000491],
+		[-3.94606313, -0.00595809, 0.00319009, 0.00612867, 0.00001231, 0.00000488],
+		[-3.95074687, -0.00594449, 0.00318088, 0.00611438, 0.00001221, 0.00000486],
+		[-3.95542878, -0.00593099, 0.00317175, 0.00610019, 0.00001212, 0.00000484],
+		[-3.96010882, -0.00591761, 0.00316271, 0.00608612, 0.00001203, 0.00000481],
+		[-3.96478693, -0.00590433, 0.00315376, 0.00607215, 0.00001193, 0.00000479],
+		[-3.96946306, -0.00589116, 0.00314489, 0.00605829, 0.00001184, 0.00000477],
+		[-3.97413718, -0.00587809, 0.00313611, 0.00604454, 0.00001175, 0.00000474],
+		[-3.97880922, -0.00586512, 0.00312740, 0.00603089, 0.00001166, 0.00000472],
+		[-3.98347915, -0.00585226, 0.00311878, 0.00601735, 0.00001157, 0.00000470],
+		[-3.98814692, -0.00583950, 0.00311024, 0.00600390, 0.00001149, 0.00000467],
+		[-3.99281247, -0.00582684, 0.00310178, 0.00599056, 0.00001140, 0.00000465],
+		[-3.99747577, -0.00581428, 0.00309340, 0.00597732, 0.00001131, 0.00000463],
+		[-4.00213677, -0.00580181, 0.00308510, 0.00596417, 0.00001123, 0.00000460],
+		[-4.00679542, -0.00578944, 0.00307688, 0.00595113, 0.00001114, 0.00000458],
+		[-4.01145168, -0.00577717, 0.00306873, 0.00593818, 0.00001106, 0.00000456],
+		[-4.01610551, -0.00576499, 0.00306065, 0.00592532, 0.00001098, 0.00000454],
+		[-4.02075685, -0.00575290, 0.00305266, 0.00591256, 0.00001090, 0.00000451],
+		[-4.02540567, -0.00574091, 0.00304473, 0.00589990, 0.00001082, 0.00000449],
+		[-4.03005191, -0.00572900, 0.00303688, 0.00588732, 0.00001073, 0.00000447],
+		[-4.03469555, -0.00571719, 0.00302910, 0.00587484, 0.00001066, 0.00000445],
+		[-4.03933654, -0.00570546, 0.00302139, 0.00586244, 0.00001058, 0.00000443],
+		[-4.04397482, -0.00569382, 0.00301375, 0.00585014, 0.00001050, 0.00000440],
+		[-4.04861037, -0.00568227, 0.00300619, 0.00583792, 0.00001042, 0.00000438],
+		[-4.05324314, -0.00567080, 0.00299869, 0.00582579, 0.00001035, 0.00000436],
+		[-4.05787308, -0.00565942, 0.00299126, 0.00581375, 0.00001027, 0.00000434],
+		[-4.06250017, -0.00564812, 0.00298390, 0.00580179, 0.00001019, 0.00000432],
+		[-4.06712435, -0.00563690, 0.00297660, 0.00578992, 0.00001012, 0.00000430],
+		[-4.07174558, -0.00562577, 0.00296937, 0.00577813, 0.00001005, 0.00000427],
+		[-4.07636383, -0.00561471, 0.00296221, 0.00576642, 0.00000997, 0.00000425],
+		[-4.08097906, -0.00560374, 0.00295511, 0.00575480, 0.00000990, 0.00000423],
+		[-4.08559122, -0.00559284, 0.00294807, 0.00574325, 0.00000983, 0.00000421],
+		[-4.09020028, -0.00558202, 0.00294110, 0.00573179, 0.00000976, 0.00000419],
+		[-4.09480620, -0.00557128, 0.00293419, 0.00572040, 0.00000969, 0.00000417],
+		[-4.09940894, -0.00556061, 0.00292734, 0.00570909, 0.00000962, 0.00000415],
+		[-4.10400846, -0.00555002, 0.00292056, 0.00569786, 0.00000955, 0.00000413],
+		[-4.10860473, -0.00553950, 0.00291383, 0.00568670, 0.00000948, 0.00000411],
+		[-4.11319770, -0.00552906, 0.00290717, 0.00567562, 0.00000942, 0.00000409],
+		[-4.11778734, -0.00551869, 0.00290056, 0.00566462, 0.00000935, 0.00000407],
+		[-4.12237362, -0.00550839, 0.00289401, 0.00565369, 0.00000928, 0.00000405],
+		[-4.12695649, -0.00549816, 0.00288752, 0.00564283, 0.00000922, 0.00000403],
+		[-4.13153592, -0.00548801, 0.00288109, 0.00563204, 0.00000915, 0.00000401],
+		[-4.13611188, -0.00547792, 0.00287471, 0.00562133, 0.00000909, 0.00000399],
+		[-4.14068433, -0.00546790, 0.00286839, 0.00561069, 0.00000902, 0.00000397],
+		[-4.14525323, -0.00545795, 0.00286213, 0.00560011, 0.00000896, 0.00000395],
+		[-4.14981854, -0.00544806, 0.00285592, 0.00558961, 0.00000890, 0.00000393],
+		[-4.15438025, -0.00543824, 0.00284976, 0.00557918, 0.00000883, 0.00000391],
+		[-4.15893830, -0.00542849, 0.00284366, 0.00556881, 0.00000877, 0.00000389],
+		[-4.16349267, -0.00541880, 0.00283761, 0.00555851, 0.00000871, 0.00000387],
+		[-4.16804332, -0.00540918, 0.00283162, 0.00554827, 0.00000865, 0.00000385],
+		[-4.17259021, -0.00539962, 0.00282567, 0.00553811, 0.00000859, 0.00000383],
+		[-4.17713333, -0.00539012, 0.00281978, 0.00552800, 0.00000853, 0.00000381],
+		[-4.18167262, -0.00538069, 0.00281394, 0.00551796, 0.00000847, 0.00000379],
+		[-4.18620807, -0.00537131, 0.00280815, 0.00550799, 0.00000841, 0.00000377],
+		[-4.19073963, -0.00536200, 0.00280241, 0.00549808, 0.00000836, 0.00000375],
+		[-4.19526728, -0.00535274, 0.00279671, 0.00548823, 0.00000830, 0.00000373],
+		[-4.19979098, -0.00534355, 0.00279107, 0.00547844, 0.00000824, 0.00000372],
+		[-4.20431070, -0.00533441, 0.00278548, 0.00546871, 0.00000818, 0.00000370],
+		[-4.20882641, -0.00532534, 0.00277993, 0.00545905, 0.00000813, 0.00000368],
+		[-4.21333809, -0.00531632, 0.00277443, 0.00544944, 0.00000807, 0.00000366],
+		[-4.21784569, -0.00530735, 0.00276897, 0.00543989, 0.00000802, 0.00000364],
+		[-4.22234919, -0.00529845, 0.00276357, 0.00543040, 0.00000796, 0.00000362],
+		[-4.22684856, -0.00528959, 0.00275820, 0.00542097, 0.00000791, 0.00000361],
+		[-4.23134377, -0.00528080, 0.00275289, 0.00541160, 0.00000786, 0.00000359],
+		[-4.23583479, -0.00527206, 0.00274762, 0.00540228, 0.00000780, 0.00000357],
+		[-4.24032159, -0.00526337, 0.00274239, 0.00539302, 0.00000775, 0.00000355],
+		[-4.24480413, -0.00525473, 0.00273720, 0.00538382, 0.00000770, 0.00000353],
+		[-4.24928241, -0.00524615, 0.00273206, 0.00537467, 0.00000765, 0.00000352],
+		[-4.25375637, -0.00523762, 0.00272697, 0.00536557, 0.00000759, 0.00000350],
+		[-4.25822600, -0.00522914, 0.00272191, 0.00535653, 0.00000754, 0.00000348],
+		[-4.26269127, -0.00522071, 0.00271690, 0.00534754, 0.00000749, 0.00000346],
+		[-4.26715214, -0.00521233, 0.00271193, 0.00533861, 0.00000744, 0.00000345],
+		[-4.27160860, -0.00520401, 0.00270700, 0.00532973, 0.00000739, 0.00000343],
+		[-4.27606061, -0.00519573, 0.00270211, 0.00532090, 0.00000734, 0.00000341],
+		[-4.28050816, -0.00518750, 0.00269726, 0.00531212, 0.00000729, 0.00000339],
+		[-4.28495120, -0.00517932, 0.00269245, 0.00530339, 0.00000725, 0.00000338],
+		[-4.28938971, -0.00517119, 0.00268767, 0.00529471, 0.00000720, 0.00000336],
+		[-4.29382368, -0.00516310, 0.00268294, 0.00528608, 0.00000715, 0.00000334],
+		[-4.29825306, -0.00515506, 0.00267825, 0.00527750, 0.00000710, 0.00000333],
+		[-4.30267785, -0.00514707, 0.00267359, 0.00526897, 0.00000706, 0.00000331],
+		[-4.30709800, -0.00513912, 0.00266898, 0.00526049, 0.00000701, 0.00000329],
+		[-4.31151350, -0.00513122, 0.00266440, 0.00525206, 0.00000696, 0.00000328],
+		[-4.31592431, -0.00512337, 0.00265985, 0.00524367, 0.00000692, 0.00000326],
+		[-4.32033043, -0.00511555, 0.00265535, 0.00523533, 0.00000687, 0.00000324],
+		[-4.32473181, -0.00510779, 0.00265088, 0.00522704, 0.00000683, 0.00000323],
+		[-4.32912844, -0.00510006, 0.00264644, 0.00521879, 0.00000678, 0.00000321],
+		[-4.33352030, -0.00509238, 0.00264204, 0.00521059, 0.00000674, 0.00000319],
+		[-4.33790735, -0.00508474, 0.00263768, 0.00520243, 0.00000669, 0.00000318],
+		[-4.34228957, -0.00507715, 0.00263335, 0.00519432, 0.00000665, 0.00000316],
+		[-4.34666695, -0.00506959, 0.00262906, 0.00518625, 0.00000661, 0.00000315],
+		[-4.35103946, -0.00506208, 0.00262479, 0.00517822, 0.00000656, 0.00000313],
+		[-4.35540706, -0.00505461, 0.00262057, 0.00517024, 0.00000652, 0.00000311],
+		[-4.35976976, -0.00504718, 0.00261637, 0.00516230, 0.00000648, 0.00000310],
+		[-4.36412751, -0.00503978, 0.00261221, 0.00515441, 0.00000644, 0.00000308],
+		[-4.36848029, -0.00503243, 0.00260808, 0.00514656, 0.00000639, 0.00000307],
+		[-4.37282810, -0.00502512, 0.00260399, 0.00513874, 0.00000635, 0.00000305],
+		[-4.37717089, -0.00501785, 0.00259992, 0.00513097, 0.00000631, 0.00000304],
+		[-4.38150866, -0.00501061, 0.00259589, 0.00512324, 0.00000627, 0.00000302],
+		[-4.38584137, -0.00500341, 0.00259189, 0.00511555, 0.00000623, 0.00000301],
+		[-4.39016901, -0.00499626, 0.00258792, 0.00510791, 0.00000619, 0.00000299],
+		[-4.39449156, -0.00498913, 0.00258397, 0.00510030, 0.00000615, 0.00000298],
+		[-4.39880900, -0.00498205, 0.00258006, 0.00509273, 0.00000611, 0.00000296],
+		[-4.40312130, -0.00497500, 0.00257618, 0.00508520, 0.00000607, 0.00000295],
+		[-4.40742845, -0.00496799, 0.00257233, 0.00507770, 0.00000603, 0.00000293],
+		[-4.41173042, -0.00496101, 0.00256851, 0.00507025, 0.00000599, 0.00000292],
+		[-4.41602719, -0.00495407, 0.00256472, 0.00506283, 0.00000596, 0.00000290],
+		[-4.42031875, -0.00494717, 0.00256096, 0.00505545, 0.00000592, 0.00000289],
+		[-4.42460508, -0.00494030, 0.00255722, 0.00504811, 0.00000588, 0.00000287],
+		[-4.42888615, -0.00493346, 0.00255351, 0.00504081, 0.00000584, 0.00000286],
+		[-4.43316194, -0.00492666, 0.00254984, 0.00503354, 0.00000581, 0.00000284],
+		[-4.43743244, -0.00491989, 0.00254618, 0.00502631, 0.00000577, 0.00000283],
+		[-4.44169763, -0.00491316, 0.00254256, 0.00501911, 0.00000573, 0.00000281],
+		[-4.44595749, -0.00490646, 0.00253896, 0.00501195, 0.00000570, 0.00000280],
+		[-4.45021200, -0.00489979, 0.00253539, 0.00500482, 0.00000566, 0.00000279],
+		[-4.45446115, -0.00489316, 0.00253185, 0.00499773, 0.00000562, 0.00000277],
+		[-4.45870490, -0.00488655, 0.00252833, 0.00499068, 0.00000559, 0.00000276],
+		[-4.46294326, -0.00487998, 0.00252484, 0.00498365, 0.00000555, 0.00000274],
+		[-4.46717619, -0.00487344, 0.00252137, 0.00497667, 0.00000552, 0.00000273],
+		[-4.47140368, -0.00486693, 0.00251793, 0.00496971, 0.00000548, 0.00000272],
+		[-4.47562571, -0.00486046, 0.00251451, 0.00496279, 0.00000545, 0.00000270],
+		[-4.47984227, -0.00485401, 0.00251112, 0.00495590, 0.00000541, 0.00000269],
+		[-4.48405334, -0.00484759, 0.00250775, 0.00494904, 0.00000538, 0.00000268],
+		[-4.48825891, -0.00484121, 0.00250441, 0.00494222, 0.00000535, 0.00000266],
+		[-4.49245894, -0.00483485, 0.00250109, 0.00493543, 0.00000531, 0.00000265],
+		[-4.49665344, -0.00482852, 0.00249780, 0.00492867, 0.00000528, 0.00000264],
+		[-4.50084238, -0.00482223, 0.00249453, 0.00492194, 0.00000525, 0.00000262],
+		[-4.50502575, -0.00481596, 0.00249128, 0.00491524, 0.00000521, 0.00000261],
+		[-4.50920352, -0.00480972, 0.00248805, 0.00490857, 0.00000518, 0.00000260],
+		[-4.51337569, -0.00480350, 0.00248485, 0.00490194, 0.00000515, 0.00000258],
+		[-4.51754224, -0.00479732, 0.00248167, 0.00489533, 0.00000512, 0.00000257],
+		[-4.52170315, -0.00479117, 0.00247851, 0.00488876, 0.00000508, 0.00000256],
+		[-4.52585842, -0.00478504, 0.00247538, 0.00488221, 0.00000505, 0.00000254],
+		[-4.53000801, -0.00477894, 0.00247227, 0.00487569, 0.00000502, 0.00000253],
+		[-4.53415192, -0.00477286, 0.00246917, 0.00486921, 0.00000499, 0.00000252],
+		[-4.53829014, -0.00476682, 0.00246610, 0.00486275, 0.00000496, 0.00000251],
+		[-4.54242264, -0.00476080, 0.00246306, 0.00485632, 0.00000493, 0.00000249],
+		[-4.54654942, -0.00475480, 0.00246003, 0.00484992, 0.00000490, 0.00000248],
+		[-4.55067046, -0.00474884, 0.00245702, 0.00484354, 0.00000487, 0.00000247],
+		[-4.55478574, -0.00474290, 0.00245404, 0.00483720, 0.00000484, 0.00000245],
+		[-4.55889526, -0.00473698, 0.00245107, 0.00483088, 0.00000481, 0.00000244],
+		[-4.56299899, -0.00473109, 0.00244812, 0.00482459, 0.00000478, 0.00000243],
+		[-4.56709693, -0.00472522, 0.00244520, 0.00481833, 0.00000475, 0.00000242],
+		[-4.57118906, -0.00471938, 0.00244229, 0.00481209, 0.00000472, 0.00000241],
+		[-4.57527536, -0.00471357, 0.00243940, 0.00480588, 0.00000469, 0.00000239],
+		[-4.57935583, -0.00470778, 0.00243654, 0.00479970, 0.00000466, 0.00000238],
+		[-4.58343045, -0.00470201, 0.00243369, 0.00479354, 0.00000463, 0.00000237],
+		[-4.58749921, -0.00469627, 0.00243086, 0.00478741, 0.00000460, 0.00000236],
+		[-4.59156210, -0.00469055, 0.00242805, 0.00478131, 0.00000457, 0.00000235],
+		[-4.59561910, -0.00468485, 0.00242526, 0.00477523, 0.00000454, 0.00000233],
+		[-4.59967020, -0.00467918, 0.00242248, 0.00476918, 0.00000452, 0.00000232],
+		[-4.60371538, -0.00467353, 0.00241973, 0.00476315, 0.00000449, 0.00000231],
+		[-4.60775465, -0.00466791, 0.00241699, 0.00475714, 0.00000446, 0.00000230],
+		[-4.61178797, -0.00466230, 0.00241427, 0.00475116, 0.00000443, 0.00000229],
+		[-4.61581536, -0.00465672, 0.00241157, 0.00474521, 0.00000441, 0.00000228],
+		[-4.61983678, -0.00465116, 0.00240889, 0.00473928, 0.00000438, 0.00000226],
+		[-4.62385223, -0.00464563, 0.00240622, 0.00473337, 0.00000435, 0.00000225],
+		[-4.62786170, -0.00464011, 0.00240357, 0.00472749, 0.00000432, 0.00000224],
+		[-4.63186517, -0.00463462, 0.00240093, 0.00472163, 0.00000430, 0.00000223],
+		[-4.63586264, -0.00462915, 0.00239832, 0.00471580, 0.00000427, 0.00000222],
+		[-4.63985410, -0.00462370, 0.00239572, 0.00470998, 0.00000425, 0.00000221],
+		[-4.64383953, -0.00461827, 0.00239313, 0.00470419, 0.00000422, 0.00000220],
+		[-4.64781892, -0.00461286, 0.00239057, 0.00469843, 0.00000419, 0.00000219],
+		[-4.65179227, -0.00460748, 0.00238802, 0.00469268, 0.00000417, 0.00000217],
+		[-4.65575956, -0.00460211, 0.00238548, 0.00468696, 0.00000414, 0.00000216],
+		[-4.65972078, -0.00459677, 0.00238296, 0.00468126, 0.00000412, 0.00000215],
+		[-4.66367592, -0.00459144, 0.00238046, 0.00467559, 0.00000409, 0.00000214],
+		[-4.66762497, -0.00458614, 0.00237797, 0.00466993, 0.00000407, 0.00000213],
+		[-4.67156793, -0.00458085, 0.00237549, 0.00466430, 0.00000404, 0.00000212],
+		[-4.67550478, -0.00457558, 0.00237303, 0.00465869, 0.00000402, 0.00000211],
+		[-4.67943552, -0.00457034, 0.00237059, 0.00465310, 0.00000399, 0.00000210],
+		[-4.68336012, -0.00456511, 0.00236816, 0.00464753, 0.00000397, 0.00000209],
+		[-4.68727860, -0.00455990, 0.00236575, 0.00464198, 0.00000394, 0.00000208],
+		[-4.69119092, -0.00455472, 0.00236335, 0.00463645, 0.00000392, 0.00000207],
+		[-4.69509710, -0.00454955, 0.00236096, 0.00463095, 0.00000389, 0.00000206],
+		[-4.69899711, -0.00454440, 0.00235859, 0.00462546, 0.00000387, 0.00000205],
+		[-4.70289095, -0.00453926, 0.00235623, 0.00461999, 0.00000385, 0.00000204],
+		[-4.70677861, -0.00453415, 0.00235389, 0.00461455, 0.00000382, 0.00000203],
+		[-4.71066008, -0.00452905, 0.00235156, 0.00460912, 0.00000380, 0.00000202],
+		[-4.71453535, -0.00452398, 0.00234924, 0.00460372, 0.00000378, 0.00000200],
+		[-4.71840442, -0.00451892, 0.00234694, 0.00459833, 0.00000375, 0.00000199],
+		[-4.72226728, -0.00451387, 0.00234465, 0.00459296, 0.00000373, 0.00000198],
+		[-4.72612392, -0.00450885, 0.00234237, 0.00458761, 0.00000371, 0.00000197],
+		[-4.72997433, -0.00450384, 0.00234011, 0.00458229, 0.00000369, 0.00000196],
+		[-4.73381850, -0.00449885, 0.00233786, 0.00457698, 0.00000366, 0.00000195],
+		[-4.73765643, -0.00449388, 0.00233562, 0.00457168, 0.00000364, 0.00000195],
+		[-4.74148810, -0.00448893, 0.00233340, 0.00456641, 0.00000362, 0.00000194],
+		[-4.74531352, -0.00448399, 0.00233119, 0.00456116, 0.00000360, 0.00000193],
+		[-4.74913267, -0.00447907, 0.00232899, 0.00455592, 0.00000357, 0.00000192],
+		[-4.75294555, -0.00447416, 0.00232680, 0.00455071, 0.00000355, 0.00000191],
+		[-4.75675214, -0.00446927, 0.00232462, 0.00454551, 0.00000353, 0.00000190],
+		[-4.76055246, -0.00446440, 0.00232246, 0.00454033, 0.00000351, 0.00000189],
+		[-4.76434647, -0.00445955, 0.00232031, 0.00453516, 0.00000349, 0.00000188],
+		[-4.76813419, -0.00445471, 0.00231816, 0.00453002, 0.00000347, 0.00000187],
+		[-4.77191560, -0.00444988, 0.00231604, 0.00452489, 0.00000344, 0.00000186],
+		[-4.77569070, -0.00444507, 0.00231392, 0.00451978, 0.00000342, 0.00000185],
+		[-4.77945947, -0.00444028, 0.00231181, 0.00451469, 0.00000340, 0.00000184],
+		[-4.78322192, -0.00443550, 0.00230972, 0.00450961, 0.00000338, 0.00000183],
+		[-4.78697804, -0.00443074, 0.00230763, 0.00450455, 0.00000336, 0.00000182],
+		[-4.79072783, -0.00442600, 0.00230556, 0.00449951, 0.00000334, 0.00000181],
+		[-4.79447127, -0.00442127, 0.00230350, 0.00449448, 0.00000332, 0.00000180],
+		[-4.79820836, -0.00441655, 0.00230145, 0.00448947, 0.00000330, 0.00000179],
+		[-4.80193909, -0.00441185, 0.00229941, 0.00448448, 0.00000328, 0.00000178],
+		[-4.80566347, -0.00440716, 0.00229738, 0.00447951, 0.00000326, 0.00000178],
+		[-4.80938148, -0.00440249, 0.00229536, 0.00447454, 0.00000324, 0.00000177],
+		[-4.81309312, -0.00439783, 0.00229335, 0.00446960, 0.00000322, 0.00000176],
+		[-4.81679838, -0.00439319, 0.00229135, 0.00446467, 0.00000320, 0.00000175],
+		[-4.82049726, -0.00438856, 0.00228937, 0.00445976, 0.00000318, 0.00000174],
+		[-4.82418976, -0.00438395, 0.00228739, 0.00445486, 0.00000316, 0.00000173],
+		[-4.82787587, -0.00437935, 0.00228542, 0.00444998, 0.00000314, 0.00000172],
+		[-4.83155558, -0.00437476, 0.00228346, 0.00444512, 0.00000312, 0.00000171],
+		[-4.83522889, -0.00437019, 0.00228151, 0.00444027, 0.00000310, 0.00000171],
+		[-4.83889580, -0.00436563, 0.00227957, 0.00443543, 0.00000308, 0.00000170],
+		[-4.84255630, -0.00436109, 0.00227764, 0.00443061, 0.00000306, 0.00000169],
+		[-4.84621038, -0.00435656, 0.00227572, 0.00442580, 0.00000305, 0.00000168],
+		[-4.84985805, -0.00435204, 0.00227381, 0.00442101, 0.00000303, 0.00000167],
+		[-4.85349930, -0.00434753, 0.00227191, 0.00441624, 0.00000301, 0.00000166],
+		[-4.85713412, -0.00434304, 0.00227002, 0.00441148, 0.00000299, 0.00000165],
+		[-4.86076252, -0.00433856, 0.00226813, 0.00440673, 0.00000297, 0.00000165],
+		[-4.86438448, -0.00433410, 0.00226626, 0.00440200, 0.00000295, 0.00000164],
+		[-4.86800001, -0.00432965, 0.00226439, 0.00439728, 0.00000294, 0.00000163],
+		[-4.87160909, -0.00432521, 0.00226253, 0.00439258, 0.00000292, 0.00000162],
+		[-4.87521174, -0.00432078, 0.00226069, 0.00438789, 0.00000290, 0.00000161],
+		[-4.87880793, -0.00431637, 0.00225885, 0.00438321, 0.00000288, 0.00000161],
+		[-4.88239768, -0.00431196, 0.00225701, 0.00437855, 0.00000286, 0.00000160],
+		[-4.88598098, -0.00430758, 0.00225519, 0.00437390, 0.00000285, 0.00000159],
+		[-4.88955781, -0.00430320, 0.00225338, 0.00436927, 0.00000283, 0.00000158],
+		[-4.89312819, -0.00429883, 0.00225157, 0.00436465, 0.00000281, 0.00000157],
+		[-4.89669211, -0.00429448, 0.00224977, 0.00436004, 0.00000279, 0.00000157],
+		[-4.90024957, -0.00429014, 0.00224798, 0.00435545, 0.00000278, 0.00000156],
+		[-4.90380055, -0.00428581, 0.00224620, 0.00435087, 0.00000276, 0.00000155],
+		[-4.90734507, -0.00428150, 0.00224442, 0.00434630, 0.00000274, 0.00000154],
+		[-4.91088312, -0.00427719, 0.00224266, 0.00434174, 0.00000272, 0.00000153],
+		[-4.91441469, -0.00427290, 0.00224090, 0.00433720, 0.00000271, 0.00000153],
+		[-4.91793978, -0.00426862, 0.00223915, 0.00433267, 0.00000269, 0.00000152],
+		[-4.92145840, -0.00426435, 0.00223740, 0.00432816, 0.00000267, 0.00000151],
+		[-4.92497053, -0.00426009, 0.00223566, 0.00432366, 0.00000266, 0.00000150],
+		[-4.92847618, -0.00425584, 0.00223394, 0.00431916, 0.00000264, 0.00000150],
+		[-4.93197535, -0.00425160, 0.00223221, 0.00431469, 0.00000262, 0.00000149],
+		[-4.93546803, -0.00424738, 0.00223050, 0.00431022, 0.00000261, 0.00000148],
+		[-4.93895423, -0.00424317, 0.00222879, 0.00430577, 0.00000259, 0.00000147],
+		[-4.94243393, -0.00423896, 0.00222709, 0.00430133, 0.00000258, 0.00000147],
+		[-4.94590714, -0.00423477, 0.00222540, 0.00429690, 0.00000256, 0.00000146],
+		[-4.94937386, -0.00423059, 0.00222371, 0.00429248, 0.00000254, 0.00000145],
+		[-4.95283409, -0.00422642, 0.00222203, 0.00428808, 0.00000253, 0.00000144],
+		[-4.95628782, -0.00422226, 0.00222036, 0.00428368, 0.00000251, 0.00000144],
+		[-4.95973505, -0.00421811, 0.00221869, 0.00427930, 0.00000250, 0.00000143],
+		[-4.96317579, -0.00421397, 0.00221703, 0.00427493, 0.00000248, 0.00000142],
+		[-4.96661002, -0.00420984, 0.00221538, 0.00427058, 0.00000246, 0.00000142],
+		[-4.97003776, -0.00420573, 0.00221373, 0.00426623, 0.00000245, 0.00000141],
+		[-4.97345900, -0.00420162, 0.00221209, 0.00426189, 0.00000243, 0.00000140],
+		[-4.97687374, -0.00419752, 0.00221046, 0.00425757, 0.00000242, 0.00000139],
+		[-4.98028197, -0.00419344, 0.00220883, 0.00425326, 0.00000240, 0.00000139],
+		[-4.98368371, -0.00418936, 0.00220721, 0.00424896, 0.00000239, 0.00000138],
+		[-4.98707894, -0.00418529, 0.00220559, 0.00424467, 0.00000237, 0.00000137],
+		[-4.99046767, -0.00418123, 0.00220398, 0.00424039, 0.00000236, 0.00000137],
+		[-4.99384989, -0.00417719, 0.00220238, 0.00423612, 0.00000234, 0.00000136],
+		[-4.99722561, -0.00417315, 0.00220078, 0.00423187, 0.00000233, 0.00000135],
+		[-5.00059483, -0.00416912, 0.00219919, 0.00422762, 0.00000231, 0.00000135],
+		[-5.00395754, -0.00416511, 0.00219761, 0.00422339, 0.00000230, 0.00000134],
+		[-5.00731375, -0.00416110, 0.00219603, 0.00421916, 0.00000228, 0.00000133],
+		[-5.01066346, -0.00415710, 0.00219445, 0.00421495, 0.00000227, 0.00000133],
+		[-5.01400667, -0.00415311, 0.00219288, 0.00421075, 0.00000226, 0.00000132],
+		[-5.01734337, -0.00414913, 0.00219132, 0.00420655, 0.00000224, 0.00000131],
+		[-5.02067356, -0.00414516, 0.00218976, 0.00420237, 0.00000223, 0.00000131],
+		[-5.02399726, -0.00414120, 0.00218821, 0.00419820, 0.00000221, 0.00000130],
+		[-5.02731445, -0.00413724, 0.00218666, 0.00419404, 0.00000220, 0.00000129],
+		[-5.03062515, -0.00413330, 0.00218512, 0.00418989, 0.00000218, 0.00000129],
+		[-5.03392934, -0.00412937, 0.00218359, 0.00418574, 0.00000217, 0.00000128],
+		[-5.03722703, -0.00412544, 0.00218206, 0.00418161, 0.00000216, 0.00000127],
+		[-5.04051822, -0.00412153, 0.00218053, 0.00417749, 0.00000214, 0.00000127],
+		[-5.04380292, -0.00411762, 0.00217901, 0.00417338, 0.00000213, 0.00000126],
+		[-5.04708112, -0.00411372, 0.00217750, 0.00416928, 0.00000212, 0.00000125],
+		[-5.05035282, -0.00410983, 0.00217599, 0.00416519, 0.00000210, 0.00000125],
+		[-5.05361802, -0.00410595, 0.00217448, 0.00416111, 0.00000209, 0.00000124],
+		[-5.05687674, -0.00410208, 0.00217298, 0.00415703, 0.00000207, 0.00000124],
+		[-5.06012896, -0.00409821, 0.00217148, 0.00415297, 0.00000206, 0.00000123],
+		[-5.06337469, -0.00409436, 0.00216999, 0.00414892, 0.00000205, 0.00000122],
+		[-5.06661393, -0.00409051, 0.00216851, 0.00414488, 0.00000203, 0.00000122],
+		[-5.06984668, -0.00408668, 0.00216703, 0.00414084, 0.00000202, 0.00000121],
+		[-5.07307294, -0.00408285, 0.00216555, 0.00413682, 0.00000201, 0.00000121],
+		[-5.07629272, -0.00407902, 0.00216408, 0.00413280, 0.00000199, 0.00000120],
+		[-5.07950602, -0.00407521, 0.00216261, 0.00412880, 0.00000198, 0.00000119],
+		[-5.08271283, -0.00407141, 0.00216115, 0.00412480, 0.00000197, 0.00000119],
+		[-5.08591317, -0.00406761, 0.00215969, 0.00412081, 0.00000196, 0.00000118],
+		[-5.08910703, -0.00406382, 0.00215823, 0.00411683, 0.00000194, 0.00000118],
+		[-5.09229441, -0.00406004, 0.00215678, 0.00411286, 0.00000193, 0.00000117],
+		[-5.09547532, -0.00405627, 0.00215534, 0.00410890, 0.00000192, 0.00000116],
+		[-5.09864975, -0.00405250, 0.00215390, 0.00410495, 0.00000191, 0.00000116],
+		[-5.10181772, -0.00404874, 0.00215246, 0.00410101, 0.00000189, 0.00000115],
+		[-5.10497922, -0.00404500, 0.00215102, 0.00409707, 0.00000188, 0.00000115],
+		[-5.10813425, -0.00404125, 0.00214960, 0.00409315, 0.00000187, 0.00000114],
+		[-5.11128282, -0.00403752, 0.00214817, 0.00408923, 0.00000186, 0.00000114],
+		[-5.11442494, -0.00403379, 0.00214675, 0.00408532, 0.00000184, 0.00000113],
+		[-5.11756059, -0.00403008, 0.00214533, 0.00408142, 0.00000183, 0.00000112],
+		[-5.12068979, -0.00402637, 0.00214392, 0.00407753, 0.00000182, 0.00000112],
+		[-5.12381254, -0.00402266, 0.00214251, 0.00407365, 0.00000181, 0.00000111],
+		[-5.12692884, -0.00401897, 0.00214110, 0.00406978, 0.00000179, 0.00000111],
+		[-5.13003869, -0.00401528, 0.00213970, 0.00406591, 0.00000178, 0.00000110],
+		[-5.13314210, -0.00401160, 0.00213831, 0.00406205, 0.00000177, 0.00000110],
+		[-5.13623906, -0.00400792, 0.00213691, 0.00405820, 0.00000176, 0.00000109],
+		[-5.13932959, -0.00400426, 0.00213552, 0.00405436, 0.00000175, 0.00000109],
+		[-5.14241368, -0.00400060, 0.00213413, 0.00405053, 0.00000173, 0.00000108],
+		[-5.14549135, -0.00399695, 0.00213275, 0.00404670, 0.00000172, 0.00000107],
+		[-5.14856258, -0.00399330, 0.00213137, 0.00404289, 0.00000171, 0.00000107],
+		[-5.15162739, -0.00398967, 0.00213000, 0.00403908, 0.00000170, 0.00000106],
+		[-5.15468577, -0.00398604, 0.00212862, 0.00403528, 0.00000169, 0.00000106],
+		[-5.15773774, -0.00398241, 0.00212725, 0.00403148, 0.00000168, 0.00000105],
+		[-5.16078329, -0.00397880, 0.00212589, 0.00402770, 0.00000167, 0.00000105],
+		[-5.16382243, -0.00397519, 0.00212453, 0.00402392, 0.00000165, 0.00000104],
+		[-5.16685516, -0.00397159, 0.00212317, 0.00402015, 0.00000164, 0.00000104],
+		[-5.16988149, -0.00396799, 0.00212181, 0.00401639, 0.00000163, 0.00000103],
+		[-5.17290141, -0.00396440, 0.00212046, 0.00401264, 0.00000162, 0.00000103],
+		[-5.17591494, -0.00396082, 0.00211911, 0.00400889, 0.00000161, 0.00000102],
+		[-5.17892208, -0.00395724, 0.00211776, 0.00400515, 0.00000160, 0.00000102],
+		[-5.18192282, -0.00395368, 0.00211642, 0.00400142, 0.00000159, 0.00000101],
+		[-5.18491718, -0.00395011, 0.00211508, 0.00399770, 0.00000158, 0.00000101],
+		[-5.18790516, -0.00394656, 0.00211374, 0.00399398, 0.00000156, 0.00000100],
+		[-5.19088675, -0.00394301, 0.00211241, 0.00399027, 0.00000155, 0.00000100],
+		[-5.19386198, -0.00393947, 0.00211108, 0.00398657, 0.00000154, 0.00000099],
+		[-5.19683083, -0.00393593, 0.00210975, 0.00398288, 0.00000153, 0.00000099],
+		[-5.19979332, -0.00393241, 0.00210843, 0.00397919, 0.00000152, 0.00000098],
+		[-5.20274945, -0.00392888, 0.00210710, 0.00397551, 0.00000151, 0.00000098],
+		[-5.20569922, -0.00392537, 0.00210578, 0.00397184, 0.00000150, 0.00000097],
+		[-5.20864264, -0.00392186, 0.00210447, 0.00396817, 0.00000149, 0.00000097],
+		[-5.21157971, -0.00391835, 0.00210315, 0.00396451, 0.00000148, 0.00000096],
+		[-5.21451043, -0.00391486, 0.00210184, 0.00396086, 0.00000147, 0.00000096],
+		[-5.21743482, -0.00391137, 0.00210054, 0.00395722, 0.00000146, 0.00000095],
+		[-5.22035287, -0.00390788, 0.00209923, 0.00395358, 0.00000145, 0.00000095],
+		[-5.22326459, -0.00390440, 0.00209793, 0.00394995, 0.00000144, 0.00000094],
+		[-5.22616999, -0.00390093, 0.00209663, 0.00394633, 0.00000143, 0.00000094],
+		[-5.22906906, -0.00389747, 0.00209533, 0.00394271, 0.00000142, 0.00000093],
+		[-5.23196182, -0.00389401, 0.00209404, 0.00393910, 0.00000141, 0.00000093],
+		[-5.23484826, -0.00389055, 0.00209274, 0.00393550, 0.00000140, 0.00000093],
+		[-5.23772840, -0.00388711, 0.00209145, 0.00393191, 0.00000139, 0.00000092],
+		[-5.24060224, -0.00388366, 0.00209017, 0.00392832, 0.00000138, 0.00000092],
+		[-5.24346978, -0.00388023, 0.00208888, 0.00392473, 0.00000137, 0.00000091],
+		[-5.24633103, -0.00387680, 0.00208760, 0.00392116, 0.00000136, 0.00000091],
+		[-5.24918599, -0.00387338, 0.00208632, 0.00391759, 0.00000135, 0.00000090],
+		[-5.25203467, -0.00386996, 0.00208504, 0.00391403, 0.00000134, 0.00000090],
+		[-5.25487707, -0.00386655, 0.00208377, 0.00391047, 0.00000133, 0.00000089],
+		[-5.25771320, -0.00386314, 0.00208250, 0.00390692, 0.00000132, 0.00000089],
+		[-5.26054307, -0.00385974, 0.00208123, 0.00390338, 0.00000131, 0.00000088],
+		[-5.26336668, -0.00385634, 0.00207996, 0.00389984, 0.00000130, 0.00000088],
+		[-5.26618402, -0.00385295, 0.00207869, 0.00389631, 0.00000129, 0.00000088],
+		[-5.26899512, -0.00384957, 0.00207743, 0.00389279, 0.00000128, 0.00000087],
+		[-5.27179998, -0.00384619, 0.00207617, 0.00388927, 0.00000127, 0.00000087],
+		[-5.27459860, -0.00384282, 0.00207491, 0.00388576, 0.00000126, 0.00000086],
+		[-5.27739098, -0.00383945, 0.00207365, 0.00388226, 0.00000125, 0.00000086],
+		[-5.28017713, -0.00383609, 0.00207240, 0.00387876, 0.00000124, 0.00000085],
+		[-5.28295706, -0.00383274, 0.00207115, 0.00387527, 0.00000123, 0.00000085],
+		[-5.28573078, -0.00382939, 0.00206989, 0.00387178, 0.00000122, 0.00000085],
+		[-5.28849828, -0.00382604, 0.00206865, 0.00386830, 0.00000121, 0.00000084],
+		[-5.29125958, -0.00382271, 0.00206740, 0.00386483, 0.00000120, 0.00000084],
+		[-5.29401468, -0.00381937, 0.00206616, 0.00386136, 0.00000119, 0.00000083],
+		[-5.29676358, -0.00381604, 0.00206491, 0.00385790, 0.00000118, 0.00000083],
+		[-5.29950630, -0.00381272, 0.00206367, 0.00385445, 0.00000118, 0.00000083],
+		[-5.30224283, -0.00380940, 0.00206243, 0.00385100, 0.00000117, 0.00000082],
+		[-5.30497319, -0.00380609, 0.00206120, 0.00384755, 0.00000116, 0.00000082],
+		[-5.30769738, -0.00380279, 0.00205996, 0.00384412, 0.00000115, 0.00000081],
+		[-5.31041540, -0.00379948, 0.00205873, 0.00384068, 0.00000114, 0.00000081],
+		[-5.31312727, -0.00379619, 0.00205750, 0.00383726, 0.00000113, 0.00000081],
+		[-5.31583299, -0.00379290, 0.00205627, 0.00383384, 0.00000112, 0.00000080],
+		[-5.31853255, -0.00378961, 0.00205504, 0.00383043, 0.00000111, 0.00000080],
+		[-5.32122598, -0.00378633, 0.00205382, 0.00382702, 0.00000110, 0.00000079],
+		[-5.32391328, -0.00378306, 0.00205259, 0.00382362, 0.00000110, 0.00000079],
+		[-5.32659445, -0.00377979, 0.00205137, 0.00382022, 0.00000109, 0.00000079],
+		[-5.32926950, -0.00377652, 0.00205015, 0.00381683, 0.00000108, 0.00000078],
+		[-5.33193843, -0.00377326, 0.00204893, 0.00381344, 0.00000107, 0.00000078],
+		[-5.33460126, -0.00377000, 0.00204772, 0.00381006, 0.00000106, 0.00000077],
+		[-5.33725798, -0.00376675, 0.00204650, 0.00380669, 0.00000105, 0.00000077],
+		[-5.33990861, -0.00376351, 0.00204529, 0.00380332, 0.00000104, 0.00000077],
+		[-5.34255316, -0.00376027, 0.00204408, 0.00379996, 0.00000103, 0.00000076],
+		[-5.34519162, -0.00375703, 0.00204287, 0.00379660, 0.00000103, 0.00000076],
+		[-5.34782400, -0.00375380, 0.00204166, 0.00379325, 0.00000102, 0.00000075],
+		[-5.35045032, -0.00375058, 0.00204045, 0.00378991, 0.00000101, 0.00000075],
+		[-5.35307057, -0.00374736, 0.00203925, 0.00378657, 0.00000100, 0.00000075],
+		[-5.35568477, -0.00374414, 0.00203804, 0.00378323, 0.00000099, 0.00000074],
+		[-5.35829292, -0.00374093, 0.00203684, 0.00377990, 0.00000098, 0.00000074],
+		[-5.36089503, -0.00373773, 0.00203564, 0.00377658, 0.00000098, 0.00000074],
+		[-5.36349110, -0.00373453, 0.00203444, 0.00377326, 0.00000097, 0.00000073],
+		[-5.36608114, -0.00373133, 0.00203324, 0.00376994, 0.00000096, 0.00000073],
+		[-5.36866517, -0.00372814, 0.00203205, 0.00376664, 0.00000095, 0.00000073],
+		[-5.37124318, -0.00372495, 0.00203085, 0.00376333, 0.00000094, 0.00000072],
+		[-5.37381518, -0.00372177, 0.00202966, 0.00376004, 0.00000094, 0.00000072],
+		[-5.37638118, -0.00371859, 0.00202847, 0.00375674, 0.00000093, 0.00000071],
+		[-5.37894119, -0.00371542, 0.00202728, 0.00375346, 0.00000092, 0.00000071],
+		[-5.38149521, -0.00371225, 0.00202609, 0.00375018, 0.00000091, 0.00000071],
+		[-5.38404325, -0.00370909, 0.00202490, 0.00374690, 0.00000090, 0.00000070],
+		[-5.38658532, -0.00370593, 0.00202371, 0.00374363, 0.00000090, 0.00000070],
+		[-5.38912142, -0.00370278, 0.00202253, 0.00374036, 0.00000089, 0.00000070],
+		[-5.39165157, -0.00369963, 0.00202134, 0.00373710, 0.00000088, 0.00000069],
+		[-5.39417576, -0.00369648, 0.00202016, 0.00373385, 0.00000087, 0.00000069],
+		[-5.39669401, -0.00369334, 0.00201898, 0.00373059, 0.00000087, 0.00000069],
+		[-5.39920633, -0.00369021, 0.00201780, 0.00372735, 0.00000086, 0.00000068],
+		[-5.40171272, -0.00368707, 0.00201662, 0.00372411, 0.00000085, 0.00000068],
+		[-5.40421318, -0.00368395, 0.00201544, 0.00372087, 0.00000084, 0.00000068],
+		[-5.40670773, -0.00368082, 0.00201427, 0.00371764, 0.00000083, 0.00000067],
+		[-5.40919637, -0.00367771, 0.00201309, 0.00371442, 0.00000083, 0.00000067],
+		[-5.41167912, -0.00367459, 0.00201192, 0.00371119, 0.00000082, 0.00000067],
+		[-5.41415597, -0.00367148, 0.00201075, 0.00370798, 0.00000081, 0.00000066],
+		[-5.41662693, -0.00366838, 0.00200957, 0.00370477, 0.00000080, 0.00000066],
+		[-5.41909202, -0.00366528, 0.00200840, 0.00370156, 0.00000080, 0.00000066],
+		[-5.42155124, -0.00366218, 0.00200724, 0.00369836, 0.00000079, 0.00000065],
+		[-5.42400460, -0.00365909, 0.00200607, 0.00369516, 0.00000078, 0.00000065],
+		[-5.42645210, -0.00365600, 0.00200490, 0.00369197, 0.00000077, 0.00000065],
+		[-5.42889376, -0.00365292, 0.00200374, 0.00368879, 0.00000077, 0.00000064],
+		[-5.43132958, -0.00364984, 0.00200257, 0.00368560, 0.00000076, 0.00000064],
+		[-5.43375956, -0.00364677, 0.00200141, 0.00368243, 0.00000075, 0.00000064],
+		[-5.43618372, -0.00364370, 0.00200024, 0.00367926, 0.00000075, 0.00000063],
+		[-5.43860207, -0.00364063, 0.00199908, 0.00367609, 0.00000074, 0.00000063],
+		[-5.44101460, -0.00363757, 0.00199792, 0.00367293, 0.00000073, 0.00000063],
+		[-5.44342134, -0.00363451, 0.00199676, 0.00366977, 0.00000072, 0.00000063],
+		[-5.44582228, -0.00363146, 0.00199561, 0.00366661, 0.00000072, 0.00000062],
+		[-5.44821744, -0.00362841, 0.00199445, 0.00366346, 0.00000071, 0.00000062],
+		[-5.45060682, -0.00362536, 0.00199329, 0.00366032, 0.00000070, 0.00000062],
+		[-5.45299043, -0.00362232, 0.00199214, 0.00365718, 0.00000070, 0.00000061],
+		[-5.45536828, -0.00361929, 0.00199098, 0.00365405, 0.00000069, 0.00000061],
+		[-5.45774037, -0.00361625, 0.00198983, 0.00365092, 0.00000068, 0.00000061],
+		[-5.46010672, -0.00361323, 0.00198868, 0.00364779, 0.00000067, 0.00000060],
+		[-5.46246734, -0.00361020, 0.00198753, 0.00364467, 0.00000067, 0.00000060],
+		[-5.46482222, -0.00360718, 0.00198638, 0.00364155, 0.00000066, 0.00000060],
+		[-5.46717138, -0.00360417, 0.00198523, 0.00363844, 0.00000065, 0.00000060],
+		[-5.46951483, -0.00360115, 0.00198408, 0.00363533, 0.00000065, 0.00000059],
+		[-5.47185257, -0.00359814, 0.00198293, 0.00363223, 0.00000064, 0.00000059],
+		[-5.47418461, -0.00359514, 0.00198178, 0.00362913, 0.00000063, 0.00000059],
+		[-5.47651097, -0.00359214, 0.00198064, 0.00362604, 0.00000063, 0.00000058],
+		[-5.47883164, -0.00358914, 0.00197949, 0.00362295, 0.00000062, 0.00000058],
+		[-5.48114664, -0.00358615, 0.00197835, 0.00361986, 0.00000061, 0.00000058],
+		[-5.48345598, -0.00358316, 0.00197721, 0.00361678, 0.00000061, 0.00000058],
+		[-5.48575966, -0.00358018, 0.00197606, 0.00361370, 0.00000060, 0.00000057],
+		[-5.48805769, -0.00357720, 0.00197492, 0.00361063, 0.00000059, 0.00000057],
+		[-5.49035007, -0.00357422, 0.00197378, 0.00360756, 0.00000059, 0.00000057],
+		[-5.49263683, -0.00357125, 0.00197264, 0.00360450, 0.00000058, 0.00000056],
+		[-5.49491797, -0.00356828, 0.00197150, 0.00360144, 0.00000057, 0.00000056],
+		[-5.49719348, -0.00356532, 0.00197036, 0.00359839, 0.00000057, 0.00000056],
+		[-5.49946339, -0.00356236, 0.00196923, 0.00359534, 0.00000056, 0.00000056],
+		[-5.50172771, -0.00355940, 0.00196809, 0.00359229, 0.00000056, 0.00000055],
+		[-5.50398643, -0.00355645, 0.00196695, 0.00358925, 0.00000055, 0.00000055],
+		[-5.50623957, -0.00355350, 0.00196582, 0.00358621, 0.00000054, 0.00000055],
+		[-5.50848713, -0.00355055, 0.00196468, 0.00358318, 0.00000054, 0.00000054],
+		[-5.51072913, -0.00354761, 0.00196355, 0.00358015, 0.00000053, 0.00000054],
+		[-5.51296557, -0.00354467, 0.00196242, 0.00357712, 0.00000052, 0.00000054],
+		[-5.51519647, -0.00354174, 0.00196129, 0.00357410, 0.00000052, 0.00000054],
+		[-5.51742182, -0.00353881, 0.00196016, 0.00357108, 0.00000051, 0.00000053],
+		[-5.51964164, -0.00353588, 0.00195902, 0.00356807, 0.00000050, 0.00000053],
+		[-5.52185594, -0.00353296, 0.00195789, 0.00356506, 0.00000050, 0.00000053],
+		[-5.52406473, -0.00353004, 0.00195677, 0.00356206, 0.00000049, 0.00000053],
+		[-5.52626800, -0.00352712, 0.00195564, 0.00355906, 0.00000049, 0.00000052],
+		[-5.52846578, -0.00352421, 0.00195451, 0.00355606, 0.00000048, 0.00000052],
+		[-5.53065808, -0.00352130, 0.00195338, 0.00355307, 0.00000047, 0.00000052],
+		[-5.53284489, -0.00351840, 0.00195226, 0.00355008, 0.00000047, 0.00000052],
+		[-5.53502623, -0.00351550, 0.00195113, 0.00354710, 0.00000046, 0.00000051],
+		[-5.53720210, -0.00351260, 0.00195001, 0.00354412, 0.00000046, 0.00000051],
+		[-5.53937252, -0.00350971, 0.00194888, 0.00354114, 0.00000045, 0.00000051],
+		[-5.54153750, -0.00350682, 0.00194776, 0.00353817, 0.00000044, 0.00000051],
+		[-5.54369704, -0.00350393, 0.00194663, 0.00353520, 0.00000044, 0.00000050],
+		[-5.54585115, -0.00350105, 0.00194551, 0.00353224, 0.00000043, 0.00000050],
+		[-5.54799984, -0.00349817, 0.00194439, 0.00352928, 0.00000043, 0.00000050],
+		[-5.55014311, -0.00349529, 0.00194327, 0.00352632, 0.00000042, 0.00000050],
+		[-5.55228099, -0.00349242, 0.00194215, 0.00352337, 0.00000041, 0.00000049],
+		[-5.55441347, -0.00348955, 0.00194103, 0.00352042, 0.00000041, 0.00000049],
+		[-5.55654057, -0.00348669, 0.00193991, 0.00351748, 0.00000040, 0.00000049],
+		[-5.55866229, -0.00348383, 0.00193879, 0.00351454, 0.00000040, 0.00000049],
+		[-5.56077864, -0.00348097, 0.00193767, 0.00351160, 0.00000039, 0.00000048],
+		[-5.56288964, -0.00347811, 0.00193655, 0.00350867, 0.00000039, 0.00000048],
+		[-5.56499528, -0.00347526, 0.00193544, 0.00350574, 0.00000038, 0.00000048],
+		[-5.56709558, -0.00347242, 0.00193432, 0.00350282, 0.00000037, 0.00000048],
+		[-5.56919055, -0.00346957, 0.00193321, 0.00349990, 0.00000037, 0.00000047],
+		[-5.57128020, -0.00346673, 0.00193209, 0.00349698, 0.00000036, 0.00000047],
+		[-5.57336453, -0.00346390, 0.00193098, 0.00349407, 0.00000036, 0.00000047],
+		[-5.57544356, -0.00346106, 0.00192986, 0.00349116, 0.00000035, 0.00000047],
+		[-5.57751729, -0.00345823, 0.00192875, 0.00348825, 0.00000035, 0.00000047],
+		[-5.57958573, -0.00345541, 0.00192764, 0.00348535, 0.00000034, 0.00000046],
+		[-5.58164889, -0.00345259, 0.00192652, 0.00348245, 0.00000033, 0.00000046],
+		[-5.58370679, -0.00344977, 0.00192541, 0.00347956, 0.00000033, 0.00000046],
+		[-5.58575942, -0.00344695, 0.00192430, 0.00347667, 0.00000032, 0.00000046],
+		[-5.58780679, -0.00344414, 0.00192319, 0.00347378, 0.00000032, 0.00000045],
+		[-5.58984893, -0.00344133, 0.00192208, 0.00347090, 0.00000031, 0.00000045],
+		[-5.59188583, -0.00343852, 0.00192097, 0.00346802, 0.00000031, 0.00000045],
+		[-5.59391750, -0.00343572, 0.00191986, 0.00346515, 0.00000030, 0.00000045],
+		[-5.59594396, -0.00343292, 0.00191875, 0.00346228, 0.00000030, 0.00000045],
+		[-5.59796521, -0.00343013, 0.00191764, 0.00345941, 0.00000029, 0.00000044],
+		[-5.59998126, -0.00342733, 0.00191653, 0.00345654, 0.00000029, 0.00000044],
+		[-5.60199212, -0.00342455, 0.00191543, 0.00345368, 0.00000028, 0.00000044],
+		[-5.60399781, -0.00342176, 0.00191432, 0.00345083, 0.00000028, 0.00000044],
+		[-5.60599831, -0.00341898, 0.00191321, 0.00344797, 0.00000027, 0.00000043],
+		[-5.60799366, -0.00341620, 0.00191211, 0.00344513, 0.00000026, 0.00000043],
+		[-5.60998385, -0.00341342, 0.00191100, 0.00344228, 0.00000026, 0.00000043],
+		[-5.61196890, -0.00341065, 0.00190990, 0.00343944, 0.00000025, 0.00000043],
+		[-5.61394881, -0.00340788, 0.00190879, 0.00343660, 0.00000025, 0.00000043],
+		[-5.61592360, -0.00340512, 0.00190769, 0.00343376, 0.00000024, 0.00000042],
+		[-5.61789327, -0.00340235, 0.00190659, 0.00343093, 0.00000024, 0.00000042],
+		[-5.61985783, -0.00339960, 0.00190548, 0.00342811, 0.00000023, 0.00000042],
+		[-5.62181729, -0.00339684, 0.00190438, 0.00342528, 0.00000023, 0.00000042],
+		[-5.62377166, -0.00339409, 0.00190328, 0.00342246, 0.00000022, 0.00000042],
+		[-5.62572095, -0.00339134, 0.00190218, 0.00341964, 0.00000022, 0.00000041],
+		[-5.62766517, -0.00338859, 0.00190108, 0.00341683, 0.00000021, 0.00000041],
+		[-5.62960432, -0.00338585, 0.00189998, 0.00341402, 0.00000021, 0.00000041],
+		[-5.63153842, -0.00338311, 0.00189888, 0.00341122, 0.00000020, 0.00000041],
+		[-5.63346748, -0.00338037, 0.00189778, 0.00340841, 0.00000020, 0.00000041],
+		[-5.63539150, -0.00337764, 0.00189668, 0.00340561, 0.00000019, 0.00000040],
+		[-5.63731050, -0.00337491, 0.00189558, 0.00340282, 0.00000019, 0.00000040],
+		[-5.63922447, -0.00337218, 0.00189448, 0.00340003, 0.00000018, 0.00000040],
+		[-5.64113344, -0.00336946, 0.00189338, 0.00339724, 0.00000018, 0.00000040],
+		[-5.64303741, -0.00336674, 0.00189229, 0.00339445, 0.00000017, 0.00000040],
+		[-5.64493639, -0.00336402, 0.00189119, 0.00339167, 0.00000017, 0.00000039],
+		[-5.64683039, -0.00336131, 0.00189009, 0.00338889, 0.00000016, 0.00000039],
+		[-5.64871942, -0.00335860, 0.00188899, 0.00338612, 0.00000016, 0.00000039],
+		[-5.65060348, -0.00335589, 0.00188790, 0.00338335, 0.00000015, 0.00000039],
+		[-5.65248259, -0.00335319, 0.00188680, 0.00338058, 0.00000015, 0.00000039],
+		[-5.65435676, -0.00335049, 0.00188571, 0.00337781, 0.00000014, 0.00000038],
+		[-5.65622600, -0.00334779, 0.00188461, 0.00337505, 0.00000014, 0.00000038],
+		[-5.65809030, -0.00334509, 0.00188352, 0.00337229, 0.00000013, 0.00000038],
+		[-5.65994970, -0.00334240, 0.00188243, 0.00336954, 0.00000013, 0.00000038],
+		[-5.66180418, -0.00333971, 0.00188133, 0.00336679, 0.00000013, 0.00000038],
+		[-5.66365377, -0.00333703, 0.00188024, 0.00336404, 0.00000012, 0.00000038],
+		[-5.66549846, -0.00333434, 0.00187915, 0.00336130, 0.00000012, 0.00000037],
+		[-5.66733828, -0.00333166, 0.00187805, 0.00335856, 0.00000011, 0.00000037],
+		[-5.66917323, -0.00332899, 0.00187696, 0.00335582, 0.00000011, 0.00000037],
+		[-5.67100331, -0.00332631, 0.00187587, 0.00335309, 0.00000010, 0.00000037],
+		[-5.67282855, -0.00332364, 0.00187478, 0.00335035, 0.00000010, 0.00000037],
+		[-5.67464894, -0.00332098, 0.00187369, 0.00334763, 0.00000009, 0.00000036],
+		[-5.67646450, -0.00331831, 0.00187260, 0.00334490, 0.00000009, 0.00000036],
+		[-5.67827523, -0.00331565, 0.00187151, 0.00334218, 0.00000008, 0.00000036],
+		[-5.68008115, -0.00331299, 0.00187042, 0.00333947, 0.00000008, 0.00000036],
+		[-5.68188226, -0.00331034, 0.00186933, 0.00333675, 0.00000007, 0.00000036],
+		[-5.68367858, -0.00330769, 0.00186824, 0.00333404, 0.00000007, 0.00000036],
+		[-5.68547011, -0.00330504, 0.00186715, 0.00333133, 0.00000007, 0.00000035],
+		[-5.68725686, -0.00330239, 0.00186606, 0.00332863, 0.00000006, 0.00000035],
+		[-5.68903884, -0.00329975, 0.00186498, 0.00332593, 0.00000006, 0.00000035],
+		[-5.69081606, -0.00329711, 0.00186389, 0.00332323, 0.00000005, 0.00000035],
+		[-5.69258853, -0.00329447, 0.00186280, 0.00332054, 0.00000005, 0.00000035],
+		[-5.69435627, -0.00329184, 0.00186172, 0.00331785, 0.00000004, 0.00000035],
+		[-5.69611926, -0.00328921, 0.00186063, 0.00331516, 0.00000004, 0.00000034],
+		[-5.69787754, -0.00328658, 0.00185954, 0.00331247, 0.00000003, 0.00000034],
+		[-5.69963110, -0.00328396, 0.00185846, 0.00330979, 0.00000003, 0.00000034],
+		[-5.70137996, -0.00328133, 0.00185737, 0.00330711, 0.00000003, 0.00000034],
+		[-5.70312413, -0.00327872, 0.00185629, 0.00330444, 0.00000002, 0.00000034],
+		[-5.70486360, -0.00327610, 0.00185520, 0.00330177, 0.00000002, 0.00000034],
+		[-5.70659840, -0.00327349, 0.00185412, 0.00329910, 0.00000001, 0.00000033],
+		[-5.70832854, -0.00327088, 0.00185304, 0.00329643, 0.00000001, 0.00000033],
+		[-5.71005402, -0.00326827, 0.00185195, 0.00329377, 0.00000000, 0.00000033],
+		[-5.71177484, -0.00326567, 0.00185087, 0.00329111, 0.00000000, 0.00000033],
+		[-5.71349103, -0.00326306, 0.00184979, 0.00328846, -0.00000000, 0.00000033],
+		[-5.71520259, -0.00326047, 0.00184870, 0.00328580, -0.00000001, 0.00000033],
+		[-5.71690953, -0.00325787, 0.00184762, 0.00328316, -0.00000001, 0.00000032],
+		[-5.71861185, -0.00325528, 0.00184654, 0.00328051, -0.00000002, 0.00000032],
+		[-5.72030958, -0.00325269, 0.00184546, 0.00327787, -0.00000002, 0.00000032],
+		[-5.72200271, -0.00325010, 0.00184438, 0.00327523, -0.00000002, 0.00000032],
+		[-5.72369126, -0.00324752, 0.00184330, 0.00327259, -0.00000003, 0.00000032],
+		[-5.72537523, -0.00324494, 0.00184222, 0.00326996, -0.00000003, 0.00000032],
+		[-5.72705463, -0.00324236, 0.00184114, 0.00326733, -0.00000004, 0.00000032],
+		[-5.72872948, -0.00323979, 0.00184006, 0.00326470, -0.00000004, 0.00000031],
+		[-5.73039979, -0.00323721, 0.00183898, 0.00326207, -0.00000005, 0.00000031],
+		[-5.73206555, -0.00323464, 0.00183790, 0.00325945, -0.00000005, 0.00000031],
+		[-5.73372679, -0.00323208, 0.00183682, 0.00325683, -0.00000005, 0.00000031],
+		[-5.73538351, -0.00322952, 0.00183574, 0.00325422, -0.00000006, 0.00000031],
+		[-5.73703572, -0.00322695, 0.00183466, 0.00325161, -0.00000006, 0.00000031],
+		[-5.73868343, -0.00322440, 0.00183359, 0.00324900, -0.00000007, 0.00000030],
+		[-5.74032664, -0.00322184, 0.00183251, 0.00324639, -0.00000007, 0.00000030],
+		[-5.74196538, -0.00321929, 0.00183143, 0.00324379, -0.00000007, 0.00000030],
+		[-5.74359964, -0.00321674, 0.00183036, 0.00324119, -0.00000008, 0.00000030],
+		[-5.74522943, -0.00321419, 0.00182928, 0.00323859, -0.00000008, 0.00000030],
+		[-5.74685478, -0.00321165, 0.00182820, 0.00323600, -0.00000009, 0.00000030],
+		[-5.74847567, -0.00320911, 0.00182713, 0.00323341, -0.00000009, 0.00000030],
+		[-5.75009213, -0.00320657, 0.00182605, 0.00323082, -0.00000009, 0.00000029],
+		[-5.75170417, -0.00320404, 0.00182498, 0.00322824, -0.00000010, 0.00000029],
+		[-5.75331179, -0.00320151, 0.00182390, 0.00322566, -0.00000010, 0.00000029],
+		[-5.75491499, -0.00319898, 0.00182283, 0.00322308, -0.00000010, 0.00000029],
+		[-5.75651380, -0.00319645, 0.00182176, 0.00322050, -0.00000011, 0.00000029],
+		[-5.75810822, -0.00319393, 0.00182068, 0.00321793, -0.00000011, 0.00000029],
+		[-5.75969826, -0.00319141, 0.00181961, 0.00321536, -0.00000012, 0.00000029],
+		[-5.76128392, -0.00318889, 0.00181854, 0.00321280, -0.00000012, 0.00000028],
+		[-5.76286523, -0.00318637, 0.00181746, 0.00321023, -0.00000012, 0.00000028],
+		[-5.76444218, -0.00318386, 0.00181639, 0.00320767, -0.00000013, 0.00000028],
+		[-5.76601479, -0.00318135, 0.00181532, 0.00320512, -0.00000013, 0.00000028],
+		[-5.76758306, -0.00317884, 0.00181425, 0.00320256, -0.00000013, 0.00000028],
+		[-5.76914700, -0.00317634, 0.00181318, 0.00320001, -0.00000014, 0.00000028],
+		[-5.77070663, -0.00317384, 0.00181210, 0.00319746, -0.00000014, 0.00000028],
+		[-5.77226195, -0.00317134, 0.00181103, 0.00319492, -0.00000015, 0.00000028],
+		[-5.77381298, -0.00316884, 0.00180996, 0.00319237, -0.00000015, 0.00000027],
+		[-5.77535971, -0.00316635, 0.00180889, 0.00318984, -0.00000015, 0.00000027],
+		[-5.77690216, -0.00316386, 0.00180782, 0.00318730, -0.00000016, 0.00000027],
+		[-5.77844035, -0.00316137, 0.00180675, 0.00318477, -0.00000016, 0.00000027],
+		[-5.77997427, -0.00315889, 0.00180569, 0.00318223, -0.00000016, 0.00000027],
+		[-5.78150394, -0.00315640, 0.00180462, 0.00317971, -0.00000017, 0.00000027],
+		[-5.78302936, -0.00315393, 0.00180355, 0.00317718, -0.00000017, 0.00000027],
+		[-5.78455056, -0.00315145, 0.00180248, 0.00317466, -0.00000017, 0.00000026],
+		[-5.78606752, -0.00314897, 0.00180141, 0.00317214, -0.00000018, 0.00000026],
+		[-5.78758027, -0.00314650, 0.00180035, 0.00316963, -0.00000018, 0.00000026],
+		[-5.78908882, -0.00314403, 0.00179928, 0.00316711, -0.00000019, 0.00000026],
+		[-5.79059316, -0.00314157, 0.00179821, 0.00316460, -0.00000019, 0.00000026],
+		[-5.79209332, -0.00313911, 0.00179715, 0.00316209, -0.00000019, 0.00000026],
+		[-5.79358930, -0.00313665, 0.00179608, 0.00315959, -0.00000020, 0.00000026],
+		[-5.79508110, -0.00313419, 0.00179501, 0.00315709, -0.00000020, 0.00000026],
+		[-5.79656875, -0.00313173, 0.00179395, 0.00315459, -0.00000020, 0.00000025],
+		[-5.79805224, -0.00312928, 0.00179288, 0.00315209, -0.00000021, 0.00000025],
+		[-5.79953159, -0.00312683, 0.00179182, 0.00314960, -0.00000021, 0.00000025],
+		[-5.80100681, -0.00312438, 0.00179075, 0.00314711, -0.00000021, 0.00000025],
+		[-5.80247790, -0.00312194, 0.00178969, 0.00314462, -0.00000022, 0.00000025],
+		[-5.80394487, -0.00311950, 0.00178863, 0.00314214, -0.00000022, 0.00000025],
+		[-5.80540774, -0.00311706, 0.00178756, 0.00313966, -0.00000022, 0.00000025],
+		[-5.80686651, -0.00311462, 0.00178650, 0.00313718, -0.00000023, 0.00000025],
+		[-5.80832119, -0.00311219, 0.00178544, 0.00313470, -0.00000023, 0.00000024],
+		[-5.80977179, -0.00310976, 0.00178438, 0.00313223, -0.00000023, 0.00000024],
+		[-5.81121832, -0.00310733, 0.00178331, 0.00312976, -0.00000024, 0.00000024],
+		[-5.81266079, -0.00310490, 0.00178225, 0.00312729, -0.00000024, 0.00000024],
+		[-5.81409921, -0.00310248, 0.00178119, 0.00312483, -0.00000024, 0.00000024],
+		[-5.81553358, -0.00310006, 0.00178013, 0.00312237, -0.00000025, 0.00000024],
+		[-5.81696392, -0.00309764, 0.00177907, 0.00311991, -0.00000025, 0.00000024],
+		[-5.81839023, -0.00309523, 0.00177801, 0.00311745, -0.00000025, 0.00000024],
+		[-5.81981252, -0.00309282, 0.00177695, 0.00311500, -0.00000026, 0.00000024],
+		[-5.82123081, -0.00309041, 0.00177589, 0.00311255, -0.00000026, 0.00000023],
+		[-5.82264509, -0.00308800, 0.00177483, 0.00311010, -0.00000026, 0.00000023],
+		[-5.82405539, -0.00308560, 0.00177377, 0.00310766, -0.00000027, 0.00000023],
+		[-5.82546171, -0.00308319, 0.00177271, 0.00310521, -0.00000027, 0.00000023],
+		[-5.82686405, -0.00308079, 0.00177165, 0.00310277, -0.00000027, 0.00000023],
+		[-5.82826243, -0.00307840, 0.00177059, 0.00310034, -0.00000028, 0.00000023],
+		[-5.82965686, -0.00307600, 0.00176954, 0.00309790, -0.00000028, 0.00000023],
+		[-5.83104734, -0.00307361, 0.00176848, 0.00309547, -0.00000028, 0.00000023],
+		[-5.83243389, -0.00307122, 0.00176742, 0.00309305, -0.00000029, 0.00000023],
+		[-5.83381650, -0.00306884, 0.00176637, 0.00309062, -0.00000029, 0.00000022],
+		[-5.83519520, -0.00306645, 0.00176531, 0.00308820, -0.00000029, 0.00000022],
+		[-5.83656999, -0.00306407, 0.00176425, 0.00308578, -0.00000030, 0.00000022],
+		[-5.83794088, -0.00306169, 0.00176320, 0.00308336, -0.00000030, 0.00000022],
+		[-5.83930788, -0.00305932, 0.00176214, 0.00308095, -0.00000030, 0.00000022],
+		[-5.84067099, -0.00305695, 0.00176109, 0.00307853, -0.00000031, 0.00000022],
+		[-5.84203023, -0.00305458, 0.00176003, 0.00307612, -0.00000031, 0.00000022],
+		[-5.84338560, -0.00305221, 0.00175898, 0.00307372, -0.00000031, 0.00000022],
+		[-5.84473712, -0.00304984, 0.00175793, 0.00307132, -0.00000031, 0.00000022],
+		[-5.84608479, -0.00304748, 0.00175687, 0.00306891, -0.00000032, 0.00000022],
+		[-5.84742862, -0.00304512, 0.00175582, 0.00306652, -0.00000032, 0.00000021],
+		[-5.84876862, -0.00304276, 0.00175477, 0.00306412, -0.00000032, 0.00000021],
+		[-5.85010480, -0.00304041, 0.00175371, 0.00306173, -0.00000033, 0.00000021],
+		[-5.85143717, -0.00303805, 0.00175266, 0.00305934, -0.00000033, 0.00000021],
+		[-5.85276573, -0.00303570, 0.00175161, 0.00305695, -0.00000033, 0.00000021],
+		[-5.85409050, -0.00303336, 0.00175056, 0.00305457, -0.00000034, 0.00000021],
+		[-5.85541148, -0.00303101, 0.00174951, 0.00305218, -0.00000034, 0.00000021],
+		[-5.85672868, -0.00302867, 0.00174846, 0.00304981, -0.00000034, 0.00000021],
+		[-5.85804212, -0.00302633, 0.00174741, 0.00304743, -0.00000034, 0.00000021],
+		[-5.85935180, -0.00302399, 0.00174636, 0.00304506, -0.00000035, 0.00000020],
+		[-5.86065772, -0.00302166, 0.00174531, 0.00304268, -0.00000035, 0.00000020],
+		[-5.86195991, -0.00301932, 0.00174426, 0.00304032, -0.00000035, 0.00000020],
+		[-5.86325835, -0.00301699, 0.00174321, 0.00303795, -0.00000036, 0.00000020],
+		[-5.86455308, -0.00301467, 0.00174216, 0.00303559, -0.00000036, 0.00000020],
+		[-5.86584409, -0.00301234, 0.00174111, 0.00303323, -0.00000036, 0.00000020],
+		[-5.86713139, -0.00301002, 0.00174006, 0.00303087, -0.00000037, 0.00000020],
+		[-5.86841499, -0.00300770, 0.00173902, 0.00302851, -0.00000037, 0.00000020],
+		[-5.86969490, -0.00300538, 0.00173797, 0.00302616, -0.00000037, 0.00000020],
+		[-5.87097113, -0.00300307, 0.00173692, 0.00302381, -0.00000037, 0.00000020],
+		[-5.87224368, -0.00300076, 0.00173588, 0.00302146, -0.00000038, 0.00000020],
+		[-5.87351257, -0.00299845, 0.00173483, 0.00301912, -0.00000038, 0.00000019],
+		[-5.87477781, -0.00299614, 0.00173378, 0.00301678, -0.00000038, 0.00000019],
+		[-5.87603940, -0.00299383, 0.00173274, 0.00301444, -0.00000039, 0.00000019],
+		[-5.87729735, -0.00299153, 0.00173169, 0.00301210, -0.00000039, 0.00000019],
+		[-5.87855167, -0.00298923, 0.00173065, 0.00300977, -0.00000039, 0.00000019],
+		[-5.87980237, -0.00298694, 0.00172961, 0.00300744, -0.00000039, 0.00000019],
+		[-5.88104946, -0.00298464, 0.00172856, 0.00300511, -0.00000040, 0.00000019],
+		[-5.88229294, -0.00298235, 0.00172752, 0.00300278, -0.00000040, 0.00000019],
+		[-5.88353283, -0.00298006, 0.00172648, 0.00300046, -0.00000040, 0.00000019],
+		[-5.88476913, -0.00297777, 0.00172543, 0.00299814, -0.00000040, 0.00000019],
+		[-5.88600185, -0.00297549, 0.00172439, 0.00299582, -0.00000041, 0.00000019],
+		[-5.88723100, -0.00297320, 0.00172335, 0.00299350, -0.00000041, 0.00000018],
+		[-5.88845659, -0.00297093, 0.00172231, 0.00299119, -0.00000041, 0.00000018],
+		[-5.88967862, -0.00296865, 0.00172127, 0.00298888, -0.00000042, 0.00000018],
+		[-5.89089712, -0.00296637, 0.00172022, 0.00298657, -0.00000042, 0.00000018],
+		[-5.89211207, -0.00296410, 0.00171918, 0.00298427, -0.00000042, 0.00000018],
+		[-5.89332350, -0.00296183, 0.00171814, 0.00298196, -0.00000042, 0.00000018],
+		[-5.89453141, -0.00295956, 0.00171710, 0.00297966, -0.00000043, 0.00000018],
+		[-5.89573581, -0.00295730, 0.00171607, 0.00297737, -0.00000043, 0.00000018],
+		[-5.89693670, -0.00295504, 0.00171503, 0.00297507, -0.00000043, 0.00000018],
+		[-5.89813411, -0.00295278, 0.00171399, 0.00297278, -0.00000043, 0.00000018],
+		[-5.89932802, -0.00295052, 0.00171295, 0.00297049, -0.00000044, 0.00000018],
+		[-5.90051846, -0.00294826, 0.00171191, 0.00296820, -0.00000044, 0.00000017],
+		[-5.90170544, -0.00294601, 0.00171088, 0.00296592, -0.00000044, 0.00000017],
+		[-5.90288895, -0.00294376, 0.00170984, 0.00296363, -0.00000045, 0.00000017],
+		[-5.90406901, -0.00294151, 0.00170880, 0.00296136, -0.00000045, 0.00000017],
+		[-5.90524562, -0.00293927, 0.00170777, 0.00295908, -0.00000045, 0.00000017],
+		[-5.90641881, -0.00293702, 0.00170673, 0.00295680, -0.00000045, 0.00000017],
+		[-5.90758856, -0.00293478, 0.00170569, 0.00295453, -0.00000046, 0.00000017],
+		[-5.90875490, -0.00293254, 0.00170466, 0.00295226, -0.00000046, 0.00000017],
+		[-5.90991782, -0.00293031, 0.00170363, 0.00295000, -0.00000046, 0.00000017],
+		[-5.91107735, -0.00292807, 0.00170259, 0.00294773, -0.00000046, 0.00000017],
+		[-5.91223348, -0.00292584, 0.00170156, 0.00294547, -0.00000047, 0.00000017],
+		[-5.91338622, -0.00292362, 0.00170052, 0.00294321, -0.00000047, 0.00000017],
+		[-5.91453559, -0.00292139, 0.00169949, 0.00294095, -0.00000047, 0.00000016],
+		[-5.91568159, -0.00291917, 0.00169846, 0.00293870, -0.00000047, 0.00000016],
+		[-5.91682423, -0.00291694, 0.00169743, 0.00293645, -0.00000048, 0.00000016],
+		[-5.91796352, -0.00291472, 0.00169639, 0.00293420, -0.00000048, 0.00000016],
+		[-5.91909946, -0.00291251, 0.00169536, 0.00293195, -0.00000048, 0.00000016],
+		[-5.92023207, -0.00291029, 0.00169433, 0.00292971, -0.00000048, 0.00000016],
+		[-5.92136135, -0.00290808, 0.00169330, 0.00292746, -0.00000049, 0.00000016],
+		[-5.92248731, -0.00290587, 0.00169227, 0.00292523, -0.00000049, 0.00000016],
+		[-5.92360996, -0.00290367, 0.00169124, 0.00292299, -0.00000049, 0.00000016],
+		[-5.92472930, -0.00290146, 0.00169021, 0.00292075, -0.00000049, 0.00000016],
+		[-5.92584536, -0.00289926, 0.00168918, 0.00291852, -0.00000050, 0.00000016],
+		[-5.92695812, -0.00289706, 0.00168816, 0.00291629, -0.00000050, 0.00000016],
+		[-5.92806761, -0.00289486, 0.00168713, 0.00291407, -0.00000050, 0.00000016],
+		[-5.92917382, -0.00289267, 0.00168610, 0.00291184, -0.00000050, 0.00000015],
+		[-5.93027677, -0.00289047, 0.00168507, 0.00290962, -0.00000051, 0.00000015],
+		[-5.93137647, -0.00288828, 0.00168405, 0.00290740, -0.00000051, 0.00000015],
+		[-5.93247293, -0.00288610, 0.00168302, 0.00290518, -0.00000051, 0.00000015],
+		[-5.93356614, -0.00288391, 0.00168199, 0.00290297, -0.00000051, 0.00000015],
+		[-5.93465613, -0.00288173, 0.00168097, 0.00290076, -0.00000051, 0.00000015],
+		[-5.93574289, -0.00287955, 0.00167994, 0.00289855, -0.00000052, 0.00000015],
+		[-5.93682644, -0.00287737, 0.00167892, 0.00289634, -0.00000052, 0.00000015],
+		[-5.93790678, -0.00287519, 0.00167789, 0.00289414, -0.00000052, 0.00000015],
+		[-5.93898392, -0.00287302, 0.00167687, 0.00289193, -0.00000052, 0.00000015],
+		[-5.94005788, -0.00287085, 0.00167585, 0.00288973, -0.00000053, 0.00000015],
+		[-5.94112865, -0.00286868, 0.00167482, 0.00288754, -0.00000053, 0.00000015],
+		[-5.94219625, -0.00286651, 0.00167380, 0.00288534, -0.00000053, 0.00000015],
+		[-5.94326068, -0.00286435, 0.00167278, 0.00288315, -0.00000053, 0.00000015],
+		[-5.94432196, -0.00286218, 0.00167176, 0.00288096, -0.00000054, 0.00000014],
+		[-5.94538008, -0.00286002, 0.00167074, 0.00287877, -0.00000054, 0.00000014],
+		[-5.94643506, -0.00285787, 0.00166971, 0.00287659, -0.00000054, 0.00000014],
+		[-5.94748691, -0.00285571, 0.00166869, 0.00287441, -0.00000054, 0.00000014],
+		[-5.94853563, -0.00285356, 0.00166767, 0.00287222, -0.00000055, 0.00000014],
+		[-5.94958124, -0.00285141, 0.00166666, 0.00287005, -0.00000055, 0.00000014],
+		[-5.95062373, -0.00284926, 0.00166564, 0.00286787, -0.00000055, 0.00000014],
+		[-5.95166312, -0.00284711, 0.00166462, 0.00286570, -0.00000055, 0.00000014],
+		[-5.95269941, -0.00284497, 0.00166360, 0.00286353, -0.00000055, 0.00000014],
+		[-5.95373262, -0.00284283, 0.00166258, 0.00286136, -0.00000056, 0.00000014],
+		[-5.95476275, -0.00284069, 0.00166156, 0.00285919, -0.00000056, 0.00000014],
+		[-5.95578980, -0.00283855, 0.00166055, 0.00285703, -0.00000056, 0.00000014],
+		[-5.95681380, -0.00283642, 0.00165953, 0.00285487, -0.00000056, 0.00000014],
+		[-5.95783474, -0.00283429, 0.00165852, 0.00285271, -0.00000057, 0.00000014],
+		[-5.95885262, -0.00283216, 0.00165750, 0.00285056, -0.00000057, 0.00000014],
+		[-5.95986747, -0.00283003, 0.00165648, 0.00284840, -0.00000057, 0.00000013],
+		[-5.96087929, -0.00282791, 0.00165547, 0.00284625, -0.00000057, 0.00000013],
+		[-5.96188808, -0.00282578, 0.00165446, 0.00284410, -0.00000057, 0.00000013],
+		[-5.96289385, -0.00282366, 0.00165344, 0.00284196, -0.00000058, 0.00000013],
+		[-5.96389662, -0.00282154, 0.00165243, 0.00283981, -0.00000058, 0.00000013],
+		[-5.96489638, -0.00281943, 0.00165142, 0.00283767, -0.00000058, 0.00000013],
+		[-5.96589315, -0.00281732, 0.00165040, 0.00283553, -0.00000058, 0.00000013],
+		[-5.96688693, -0.00281520, 0.00164939, 0.00283339, -0.00000058, 0.00000013],
+		[-5.96787774, -0.00281310, 0.00164838, 0.00283126, -0.00000059, 0.00000013],
+		[-5.96886557, -0.00281099, 0.00164737, 0.00282913, -0.00000059, 0.00000013],
+		[-5.96985044, -0.00280888, 0.00164636, 0.00282700, -0.00000059, 0.00000013],
+		[-5.97083235, -0.00280678, 0.00164535, 0.00282487, -0.00000059, 0.00000013],
+		[-5.97181132, -0.00280468, 0.00164434, 0.00282274, -0.00000060, 0.00000013],
+		[-5.97278734, -0.00280258, 0.00164333, 0.00282062, -0.00000060, 0.00000013],
+		[-5.97376044, -0.00280049, 0.00164232, 0.00281850, -0.00000060, 0.00000013],
+		[-5.97473060, -0.00279840, 0.00164131, 0.00281638, -0.00000060, 0.00000013],
+		[-5.97569785, -0.00279631, 0.00164031, 0.00281427, -0.00000060, 0.00000012],
+		[-5.97666219, -0.00279422, 0.00163930, 0.00281215, -0.00000061, 0.00000012],
+		[-5.97762362, -0.00279213, 0.00163829, 0.00281004, -0.00000061, 0.00000012],
+		[-5.97858216, -0.00279005, 0.00163729, 0.00280793, -0.00000061, 0.00000012],
+		[-5.97953782, -0.00278796, 0.00163628, 0.00280583, -0.00000061, 0.00000012],
+		[-5.98049059, -0.00278589, 0.00163527, 0.00280372, -0.00000061, 0.00000012],
+		[-5.98144049, -0.00278381, 0.00163427, 0.00280162, -0.00000062, 0.00000012],
+		[-5.98238752, -0.00278173, 0.00163326, 0.00279952, -0.00000062, 0.00000012],
+		[-5.98333170, -0.00277966, 0.00163226, 0.00279742, -0.00000062, 0.00000012],
+		[-5.98427302, -0.00277759, 0.00163126, 0.00279533, -0.00000062, 0.00000012],
+		[-5.98521150, -0.00277552, 0.00163025, 0.00279324, -0.00000062, 0.00000012],
+		[-5.98614715, -0.00277346, 0.00162925, 0.00279115, -0.00000063, 0.00000012],
+		[-5.98707997, -0.00277139, 0.00162825, 0.00278906, -0.00000063, 0.00000012],
+		[-5.98800996, -0.00276933, 0.00162725, 0.00278697, -0.00000063, 0.00000012],
+		[-5.98893715, -0.00276727, 0.00162625, 0.00278489, -0.00000063, 0.00000012],
+		[-5.98986153, -0.00276521, 0.00162525, 0.00278281, -0.00000063, 0.00000012],
+		[-5.99078310, -0.00276316, 0.00162425, 0.00278073, -0.00000064, 0.00000012],
+		[-5.99170189, -0.00276111, 0.00162325, 0.00277865, -0.00000064, 0.00000012],
+		[-5.99261789, -0.00275906, 0.00162225, 0.00277658, -0.00000064, 0.00000011],
+		[-5.99353112, -0.00275701, 0.00162125, 0.00277451, -0.00000064, 0.00000011],
+		[-5.99444158, -0.00275496, 0.00162025, 0.00277244, -0.00000064, 0.00000011],
+		[-5.99534927, -0.00275292, 0.00161925, 0.00277037, -0.00000065, 0.00000011],
+		[-5.99625421, -0.00275088, 0.00161826, 0.00276831, -0.00000065, 0.00000011],
+		[-5.99715640, -0.00274884, 0.00161726, 0.00276624, -0.00000065, 0.00000011],
+		[-5.99805585, -0.00274680, 0.00161626, 0.00276418, -0.00000065, 0.00000011],
+		[-5.99895257, -0.00274476, 0.00161527, 0.00276213, -0.00000065, 0.00000011],
+		[-5.99984656, -0.00274273, 0.00161427, 0.00276007, -0.00000066, 0.00000011],
+		[-6.00073784, -0.00274070, 0.00161328, 0.00275802, -0.00000066, 0.00000011],
+		[-6.00162640, -0.00273867, 0.00161228, 0.00275597, -0.00000066, 0.00000011],
+		[-6.00251225, -0.00273665, 0.00161129, 0.00275392, -0.00000066, 0.00000011],
+		[-6.00339541, -0.00273462, 0.00161030, 0.00275187, -0.00000066, 0.00000011],
+		[-6.00427588, -0.00273260, 0.00160931, 0.00274983, -0.00000066, 0.00000011],
+		[-6.00515367, -0.00273058, 0.00160831, 0.00274778, -0.00000067, 0.00000011],
+		[-6.00602878, -0.00272856, 0.00160732, 0.00274574, -0.00000067, 0.00000011],
+		[-6.00690122, -0.00272655, 0.00160633, 0.00274371, -0.00000067, 0.00000011],
+		[-6.00777100, -0.00272454, 0.00160534, 0.00274167, -0.00000067, 0.00000011],
+		[-6.00863812, -0.00272252, 0.00160435, 0.00273964, -0.00000067, 0.00000011],
+		[-6.00950260, -0.00272052, 0.00160336, 0.00273761, -0.00000068, 0.00000010],
+		[-6.01036444, -0.00271851, 0.00160237, 0.00273558, -0.00000068, 0.00000010],
+		[-6.01122364, -0.00271651, 0.00160138, 0.00273355, -0.00000068, 0.00000010],
+		[-6.01208022, -0.00271450, 0.00160039, 0.00273153, -0.00000068, 0.00000010],
+		[-6.01293417, -0.00271250, 0.00159941, 0.00272951, -0.00000068, 0.00000010],
+		[-6.01378552, -0.00271051, 0.00159842, 0.00272749, -0.00000068, 0.00000010],
+		[-6.01463426, -0.00270851, 0.00159743, 0.00272547, -0.00000069, 0.00000010],
+		[-6.01548040, -0.00270652, 0.00159645, 0.00272346, -0.00000069, 0.00000010],
+		[-6.01632394, -0.00270453, 0.00159546, 0.00272144, -0.00000069, 0.00000010],
+		[-6.01716491, -0.00270254, 0.00159448, 0.00271943, -0.00000069, 0.00000010],
+		[-6.01800329, -0.00270055, 0.00159349, 0.00271742, -0.00000069, 0.00000010],
+		[-6.01883911, -0.00269856, 0.00159251, 0.00271542, -0.00000070, 0.00000010],
+		[-6.01967236, -0.00269658, 0.00159153, 0.00271341, -0.00000070, 0.00000010],
+		[-6.02050306, -0.00269460, 0.00159054, 0.00271141, -0.00000070, 0.00000010],
+		[-6.02133120, -0.00269262, 0.00158956, 0.00270941, -0.00000070, 0.00000010],
+		[-6.02215680, -0.00269065, 0.00158858, 0.00270741, -0.00000070, 0.00000010],
+		[-6.02297987, -0.00268867, 0.00158760, 0.00270542, -0.00000070, 0.00000010],
+		[-6.02380040, -0.00268670, 0.00158662, 0.00270343, -0.00000071, 0.00000010],
+		[-6.02461841, -0.00268473, 0.00158564, 0.00270144, -0.00000071, 0.00000010],
+		[-6.02543391, -0.00268276, 0.00158466, 0.00269945, -0.00000071, 0.00000010],
+		[-6.02624690, -0.00268080, 0.00158368, 0.00269746, -0.00000071, 0.00000010],
+		[-6.02705738, -0.00267883, 0.00158270, 0.00269548, -0.00000071, 0.00000009],
+		[-6.02786537, -0.00267687, 0.00158172, 0.00269350, -0.00000071, 0.00000009],
+		[-6.02867087, -0.00267491, 0.00158074, 0.00269152, -0.00000072, 0.00000009],
+		[-6.02947389, -0.00267296, 0.00157977, 0.00268954, -0.00000072, 0.00000009],
+		[-6.03027443, -0.00267100, 0.00157879, 0.00268756, -0.00000072, 0.00000009],
+		[-6.03107251, -0.00266905, 0.00157781, 0.00268559, -0.00000072, 0.00000009],
+		[-6.03186812, -0.00266710, 0.00157684, 0.00268362, -0.00000072, 0.00000009],
+		[-6.03266127, -0.00266515, 0.00157586, 0.00268165, -0.00000072, 0.00000009],
+		[-6.03345198, -0.00266320, 0.00157489, 0.00267968, -0.00000073, 0.00000009],
+		[-6.03424025, -0.00266126, 0.00157391, 0.00267772, -0.00000073, 0.00000009],
+		[-6.03502608, -0.00265932, 0.00157294, 0.00267576, -0.00000073, 0.00000009],
+		[-6.03580948, -0.00265738, 0.00157197, 0.00267380, -0.00000073, 0.00000009],
+		[-6.03659046, -0.00265544, 0.00157100, 0.00267184, -0.00000073, 0.00000009],
+		[-6.03736903, -0.00265350, 0.00157002, 0.00266988, -0.00000073, 0.00000009],
+		[-6.03814518, -0.00265157, 0.00156905, 0.00266793, -0.00000074, 0.00000009],
+		[-6.03891894, -0.00264964, 0.00156808, 0.00266598, -0.00000074, 0.00000009],
+		[-6.03969029, -0.00264771, 0.00156711, 0.00266403, -0.00000074, 0.00000009],
+		[-6.04045926, -0.00264578, 0.00156614, 0.00266208, -0.00000074, 0.00000009],
+		[-6.04122585, -0.00264386, 0.00156517, 0.00266014, -0.00000074, 0.00000009],
+		[-6.04199006, -0.00264193, 0.00156421, 0.00265819, -0.00000074, 0.00000009],
+		[-6.04275190, -0.00264001, 0.00156324, 0.00265625, -0.00000075, 0.00000009],
+		[-6.04351138, -0.00263809, 0.00156227, 0.00265431, -0.00000075, 0.00000009],
+		[-6.04426850, -0.00263618, 0.00156130, 0.00265238, -0.00000075, 0.00000009],
+		[-6.04502327, -0.00263426, 0.00156034, 0.00265044, -0.00000075, 0.00000008],
+		[-6.04577570, -0.00263235, 0.00155937, 0.00264851, -0.00000075, 0.00000008],
+		[-6.04652579, -0.00263044, 0.00155841, 0.00264658, -0.00000075, 0.00000008],
+		[-6.04727354, -0.00262853, 0.00155744, 0.00264465, -0.00000075, 0.00000008],
+		[-6.04801898, -0.00262662, 0.00155648, 0.00264273, -0.00000076, 0.00000008],
+		[-6.04876210, -0.00262472, 0.00155552, 0.00264080, -0.00000076, 0.00000008],
+		[-6.04950290, -0.00262282, 0.00155455, 0.00263888, -0.00000076, 0.00000008],
+		[-6.05024140, -0.00262092, 0.00155359, 0.00263696, -0.00000076, 0.00000008],
+		[-6.05097760, -0.00261902, 0.00155263, 0.00263505, -0.00000076, 0.00000008],
+		[-6.05171151, -0.00261712, 0.00155167, 0.00263313, -0.00000076, 0.00000008],
+		[-6.05244313, -0.00261523, 0.00155071, 0.00263122, -0.00000077, 0.00000008],
+		[-6.05317248, -0.00261334, 0.00154975, 0.00262931, -0.00000077, 0.00000008],
+		[-6.05389955, -0.00261145, 0.00154879, 0.00262740, -0.00000077, 0.00000008],
+		[-6.05462435, -0.00260956, 0.00154783, 0.00262549, -0.00000077, 0.00000008],
+		[-6.05534689, -0.00260767, 0.00154687, 0.00262359, -0.00000077, 0.00000008],
+		[-6.05606718, -0.00260579, 0.00154591, 0.00262169, -0.00000077, 0.00000008],
+		[-6.05678521, -0.00260391, 0.00154495, 0.00261979, -0.00000077, 0.00000008],
+		[-6.05750101, -0.00260203, 0.00154400, 0.00261789, -0.00000078, 0.00000008],
+		[-6.05821457, -0.00260015, 0.00154304, 0.00261599, -0.00000078, 0.00000008],
+		[-6.05892590, -0.00259827, 0.00154209, 0.00261410, -0.00000078, 0.00000008],
+		[-6.05963501, -0.00259640, 0.00154113, 0.00261221, -0.00000078, 0.00000008],
+		[-6.06034190, -0.00259453, 0.00154018, 0.00261032, -0.00000078, 0.00000008],
+		[-6.06104657, -0.00259266, 0.00153922, 0.00260843, -0.00000078, 0.00000008],
+		[-6.06174905, -0.00259079, 0.00153827, 0.00260654, -0.00000078, 0.00000008],
+		[-6.06244932, -0.00258893, 0.00153732, 0.00260466, -0.00000079, 0.00000008],
+		[-6.06314740, -0.00258706, 0.00153637, 0.00260278, -0.00000079, 0.00000008],
+		[-6.06384330, -0.00258520, 0.00153541, 0.00260090, -0.00000079, 0.00000008],
+		[-6.06453701, -0.00258334, 0.00153446, 0.00259902, -0.00000079, 0.00000007],
+		[-6.06522855, -0.00258148, 0.00153351, 0.00259715, -0.00000079, 0.00000007],
+		[-6.06591793, -0.00257963, 0.00153256, 0.00259527, -0.00000079, 0.00000007],
+		[-6.06660514, -0.00257778, 0.00153161, 0.00259340, -0.00000079, 0.00000007],
+		[-6.06729019, -0.00257592, 0.00153067, 0.00259153, -0.00000080, 0.00000007],
+		[-6.06797309, -0.00257408, 0.00152972, 0.00258967, -0.00000080, 0.00000007],
+		[-6.06865385, -0.00257223, 0.00152877, 0.00258780, -0.00000080, 0.00000007],
+		[-6.06933248, -0.00257038, 0.00152782, 0.00258594, -0.00000080, 0.00000007],
+		[-6.07000896, -0.00256854, 0.00152688, 0.00258408, -0.00000080, 0.00000007],
+		[-6.07068333, -0.00256670, 0.00152593, 0.00258222, -0.00000080, 0.00000007],
+		[-6.07135557, -0.00256486, 0.00152499, 0.00258036, -0.00000080, 0.00000007],
+		[-6.07202570, -0.00256302, 0.00152404, 0.00257851, -0.00000081, 0.00000007],
+		[-6.07269372, -0.00256119, 0.00152310, 0.00257666, -0.00000081, 0.00000007],
+		[-6.07335964, -0.00255935, 0.00152215, 0.00257480, -0.00000081, 0.00000007],
+		[-6.07402346, -0.00255752, 0.00152121, 0.00257296, -0.00000081, 0.00000007],
+		[-6.07468520, -0.00255569, 0.00152027, 0.00257111, -0.00000081, 0.00000007],
+		[-6.07534484, -0.00255387, 0.00151933, 0.00256927, -0.00000081, 0.00000007],
+		[-6.07600241, -0.00255204, 0.00151839, 0.00256742, -0.00000081, 0.00000007],
+		[-6.07665791, -0.00255022, 0.00151745, 0.00256558, -0.00000082, 0.00000007],
+		[-6.07731134, -0.00254840, 0.00151651, 0.00256374, -0.00000082, 0.00000007],
+		[-6.07796271, -0.00254658, 0.00151557, 0.00256191, -0.00000082, 0.00000007],
+		[-6.07861202, -0.00254476, 0.00151463, 0.00256007, -0.00000082, 0.00000007],
+		[-6.07925928, -0.00254294, 0.00151369, 0.00255824, -0.00000082, 0.00000007],
+		[-6.07990450, -0.00254113, 0.00151275, 0.00255641, -0.00000082, 0.00000007],
+		[-6.08054769, -0.00253932, 0.00151182, 0.00255458, -0.00000082, 0.00000007],
+		[-6.08118884, -0.00253751, 0.00151088, 0.00255276, -0.00000082, 0.00000007],
+		[-6.08182796, -0.00253570, 0.00150994, 0.00255093, -0.00000083, 0.00000007],
+		[-6.08246507, -0.00253390, 0.00150901, 0.00254911, -0.00000083, 0.00000007],
+		[-6.08310016, -0.00253210, 0.00150807, 0.00254729, -0.00000083, 0.00000007],
+		[-6.08373324, -0.00253029, 0.00150714, 0.00254547, -0.00000083, 0.00000007],
+		[-6.08436431, -0.00252849, 0.00150621, 0.00254366, -0.00000083, 0.00000006],
+		[-6.08499339, -0.00252670, 0.00150527, 0.00254184, -0.00000083, 0.00000006],
+		[-6.08562048, -0.00252490, 0.00150434, 0.00254003, -0.00000083, 0.00000006],
+		[-6.08624558, -0.00252311, 0.00150341, 0.00253822, -0.00000084, 0.00000006],
+		[-6.08686870, -0.00252132, 0.00150248, 0.00253641, -0.00000084, 0.00000006],
+		[-6.08748985, -0.00251953, 0.00150155, 0.00253461, -0.00000084, 0.00000006],
+		[-6.08810902, -0.00251774, 0.00150062, 0.00253280, -0.00000084, 0.00000006],
+		[-6.08872624, -0.00251595, 0.00149969, 0.00253100, -0.00000084, 0.00000006],
+		[-6.08934149, -0.00251417, 0.00149876, 0.00252920, -0.00000084, 0.00000006],
+		[-6.08995479, -0.00251239, 0.00149784, 0.00252740, -0.00000084, 0.00000006],
+		[-6.09056615, -0.00251061, 0.00149691, 0.00252561, -0.00000084, 0.00000006],
+		[-6.09117556, -0.00250883, 0.00149598, 0.00252381, -0.00000085, 0.00000006],
+		[-6.09178304, -0.00250705, 0.00149506, 0.00252202, -0.00000085, 0.00000006],
+		[-6.09238859, -0.00250528, 0.00149413, 0.00252023, -0.00000085, 0.00000006],
+		[-6.09299221, -0.00250351, 0.00149320, 0.00251844, -0.00000085, 0.00000006],
+		[-6.09359392, -0.00250174, 0.00149228, 0.00251666, -0.00000085, 0.00000006],
+		[-6.09419371, -0.00249997, 0.00149136, 0.00251487, -0.00000085, 0.00000006],
+		[-6.09479159, -0.00249820, 0.00149043, 0.00251309, -0.00000085, 0.00000006],
+		[-6.09538757, -0.00249644, 0.00148951, 0.00251131, -0.00000085, 0.00000006],
+		[-6.09598165, -0.00249468, 0.00148859, 0.00250953, -0.00000086, 0.00000006],
+		[-6.09657385, -0.00249292, 0.00148767, 0.00250776, -0.00000086, 0.00000006],
+		[-6.09716415, -0.00249116, 0.00148675, 0.00250598, -0.00000086, 0.00000006],
+		[-6.09775257, -0.00248940, 0.00148583, 0.00250421, -0.00000086, 0.00000006],
+		[-6.09833912, -0.00248765, 0.00148491, 0.00250244, -0.00000086, 0.00000006],
+		[-6.09892380, -0.00248589, 0.00148399, 0.00250067, -0.00000086, 0.00000006],
+		[-6.09950662, -0.00248414, 0.00148307, 0.00249891, -0.00000086, 0.00000006],
+		[-6.10008757, -0.00248239, 0.00148215, 0.00249714, -0.00000086, 0.00000006],
+		[-6.10066667, -0.00248065, 0.00148124, 0.00249538, -0.00000086, 0.00000006],
+		[-6.10124393, -0.00247890, 0.00148032, 0.00249362, -0.00000087, 0.00000006],
+		[-6.10181934, -0.00247716, 0.00147941, 0.00249186, -0.00000087, 0.00000006],
+		[-6.10239291, -0.00247542, 0.00147849, 0.00249010, -0.00000087, 0.00000006],
+		[-6.10296465, -0.00247368, 0.00147758, 0.00248835, -0.00000087, 0.00000006],
+		[-6.10353456, -0.00247194, 0.00147666, 0.00248660, -0.00000087, 0.00000006],
+		[-6.10410265, -0.00247020, 0.00147575, 0.00248484, -0.00000087, 0.00000006],
+		[-6.10466892, -0.00246847, 0.00147484, 0.00248310, -0.00000087, 0.00000006],
+		[-6.10523338, -0.00246674, 0.00147393, 0.00248135, -0.00000087, 0.00000005],
+		[-6.10579604, -0.00246501, 0.00147301, 0.00247960, -0.00000088, 0.00000005],
+		[-6.10635689, -0.00246328, 0.00147210, 0.00247786, -0.00000088, 0.00000005],
+		[-6.10691595, -0.00246155, 0.00147119, 0.00247612, -0.00000088, 0.00000005],
+		[-6.10747322, -0.00245983, 0.00147028, 0.00247438, -0.00000088, 0.00000005],
+		[-6.10802871, -0.00245811, 0.00146937, 0.00247264, -0.00000088, 0.00000005],
+		[-6.10858241, -0.00245639, 0.00146847, 0.00247091, -0.00000088, 0.00000005],
+		[-6.10913434, -0.00245467, 0.00146756, 0.00246917, -0.00000088, 0.00000005],
+		[-6.10968450, -0.00245295, 0.00146665, 0.00246744, -0.00000088, 0.00000005],
+		[-6.11023289, -0.00245123, 0.00146575, 0.00246571, -0.00000088, 0.00000005],
+		[-6.11077953, -0.00244952, 0.00146484, 0.00246398, -0.00000089, 0.00000005],
+		[-6.11132441, -0.00244781, 0.00146393, 0.00246226, -0.00000089, 0.00000005],
+		[-6.11186754, -0.00244610, 0.00146303, 0.00246053, -0.00000089, 0.00000005],
+		[-6.11240893, -0.00244439, 0.00146213, 0.00245881, -0.00000089, 0.00000005],
+		[-6.11294858, -0.00244269, 0.00146122, 0.00245709, -0.00000089, 0.00000005],
+		[-6.11348649, -0.00244098, 0.00146032, 0.00245537, -0.00000089, 0.00000005],
+		[-6.11402268, -0.00243928, 0.00145942, 0.00245366, -0.00000089, 0.00000005],
+		[-6.11455714, -0.00243758, 0.00145852, 0.00245194, -0.00000089, 0.00000005],
+		[-6.11508989, -0.00243588, 0.00145762, 0.00245023, -0.00000089, 0.00000005],
+		[-6.11562092, -0.00243419, 0.00145672, 0.00244852, -0.00000090, 0.00000005],
+		[-6.11615024, -0.00243249, 0.00145582, 0.00244681, -0.00000090, 0.00000005],
+		[-6.11667786, -0.00243080, 0.00145492, 0.00244510, -0.00000090, 0.00000005],
+		[-6.11720378, -0.00242911, 0.00145402, 0.00244340, -0.00000090, 0.00000005],
+		[-6.11772800, -0.00242742, 0.00145312, 0.00244170, -0.00000090, 0.00000005],
+		[-6.11825054, -0.00242574, 0.00145223, 0.00244000, -0.00000090, 0.00000005],
+		[-6.11877140, -0.00242405, 0.00145133, 0.00243830, -0.00000090, 0.00000005],
+		[-6.11929057, -0.00242237, 0.00145043, 0.00243660, -0.00000090, 0.00000005],
+		[-6.11980807, -0.00242069, 0.00144954, 0.00243490, -0.00000090, 0.00000005],
+		[-6.12032390, -0.00241901, 0.00144864, 0.00243321, -0.00000090, 0.00000005],
+		[-6.12083807, -0.00241733, 0.00144775, 0.00243152, -0.00000091, 0.00000005],
+		[-6.12135058, -0.00241565, 0.00144686, 0.00242983, -0.00000091, 0.00000005],
+		[-6.12186144, -0.00241398, 0.00144597, 0.00242814, -0.00000091, 0.00000005],
+		[-6.12237064, -0.00241231, 0.00144507, 0.00242645, -0.00000091, 0.00000005],
+		[-6.12287820, -0.00241064, 0.00144418, 0.00242477, -0.00000091, 0.00000005],
+		[-6.12338412, -0.00240897, 0.00144329, 0.00242309, -0.00000091, 0.00000005],
+		[-6.12388841, -0.00240730, 0.00144240, 0.00242141, -0.00000091, 0.00000005],
+		[-6.12439107, -0.00240563, 0.00144151, 0.00241973, -0.00000091, 0.00000005],
+		[-6.12489210, -0.00240397, 0.00144062, 0.00241805, -0.00000091, 0.00000005],
+		[-6.12539151, -0.00240231, 0.00143974, 0.00241637, -0.00000092, 0.00000005],
+		[-6.12588931, -0.00240065, 0.00143885, 0.00241470, -0.00000092, 0.00000005],
+		[-6.12638549, -0.00239899, 0.00143796, 0.00241303, -0.00000092, 0.00000005],
+		[-6.12688007, -0.00239734, 0.00143708, 0.00241136, -0.00000092, 0.00000005],
+		[-6.12737305, -0.00239568, 0.00143619, 0.00240969, -0.00000092, 0.00000005],
+		[-6.12786443, -0.00239403, 0.00143531, 0.00240803, -0.00000092, 0.00000004],
+		[-6.12835422, -0.00239238, 0.00143442, 0.00240636, -0.00000092, 0.00000004],
+		[-6.12884242, -0.00239073, 0.00143354, 0.00240470, -0.00000092, 0.00000004],
+		[-6.12932904, -0.00238908, 0.00143266, 0.00240304, -0.00000092, 0.00000004],
+		[-6.12981408, -0.00238744, 0.00143177, 0.00240138, -0.00000092, 0.00000004],
+		[-6.13029755, -0.00238580, 0.00143089, 0.00239972, -0.00000093, 0.00000004],
+		[-6.13077945, -0.00238416, 0.00143001, 0.00239807, -0.00000093, 0.00000004],
+		[-6.13125979, -0.00238252, 0.00142913, 0.00239642, -0.00000093, 0.00000004],
+		[-6.13173857, -0.00238088, 0.00142825, 0.00239477, -0.00000093, 0.00000004],
+		[-6.13221579, -0.00237924, 0.00142737, 0.00239312, -0.00000093, 0.00000004],
+		[-6.13269147, -0.00237761, 0.00142649, 0.00239147, -0.00000093, 0.00000004],
+		[-6.13316560, -0.00237598, 0.00142562, 0.00238982, -0.00000093, 0.00000004],
+		[-6.13363819, -0.00237434, 0.00142474, 0.00238818, -0.00000093, 0.00000004],
+		[-6.13410924, -0.00237272, 0.00142386, 0.00238654, -0.00000093, 0.00000004],
+		[-6.13457876, -0.00237109, 0.00142299, 0.00238490, -0.00000093, 0.00000004],
+		[-6.13504676, -0.00236946, 0.00142211, 0.00238326, -0.00000093, 0.00000004],
+		[-6.13551323, -0.00236784, 0.00142124, 0.00238162, -0.00000094, 0.00000004],
+		[-6.13597818, -0.00236622, 0.00142036, 0.00237999, -0.00000094, 0.00000004],
+		[-6.13644163, -0.00236460, 0.00141949, 0.00237835, -0.00000094, 0.00000004],
+		[-6.13690356, -0.00236298, 0.00141862, 0.00237672, -0.00000094, 0.00000004],
+		[-6.13736399, -0.00236136, 0.00141774, 0.00237509, -0.00000094, 0.00000004],
+		[-6.13782292, -0.00235975, 0.00141687, 0.00237347, -0.00000094, 0.00000004],
+		[-6.13828035, -0.00235814, 0.00141600, 0.00237184, -0.00000094, 0.00000004],
+		[-6.13873630, -0.00235652, 0.00141513, 0.00237022, -0.00000094, 0.00000004],
+		[-6.13919076, -0.00235492, 0.00141426, 0.00236859, -0.00000094, 0.00000004],
+		[-6.13964373, -0.00235331, 0.00141339, 0.00236697, -0.00000094, 0.00000004],
+		[-6.14009523, -0.00235170, 0.00141253, 0.00236535, -0.00000094, 0.00000004],
+		[-6.14054526, -0.00235010, 0.00141166, 0.00236374, -0.00000095, 0.00000004],
+		[-6.14099381, -0.00234850, 0.00141079, 0.00236212, -0.00000095, 0.00000004],
+		[-6.14144091, -0.00234689, 0.00140993, 0.00236051, -0.00000095, 0.00000004],
+		[-6.14188654, -0.00234530, 0.00140906, 0.00235890, -0.00000095, 0.00000004],
+		[-6.14233072, -0.00234370, 0.00140820, 0.00235729, -0.00000095, 0.00000004],
+		[-6.14277345, -0.00234210, 0.00140733, 0.00235568, -0.00000095, 0.00000004],
+		[-6.14321473, -0.00234051, 0.00140647, 0.00235407, -0.00000095, 0.00000004],
+		[-6.14365457, -0.00233892, 0.00140561, 0.00235247, -0.00000095, 0.00000004],
+		[-6.14409297, -0.00233733, 0.00140474, 0.00235087, -0.00000095, 0.00000004],
+		[-6.14452994, -0.00233574, 0.00140388, 0.00234926, -0.00000095, 0.00000004],
+		[-6.14496548, -0.00233415, 0.00140302, 0.00234767, -0.00000095, 0.00000004],
+		[-6.14539959, -0.00233257, 0.00140216, 0.00234607, -0.00000096, 0.00000004],
+		[-6.14583228, -0.00233098, 0.00140130, 0.00234447, -0.00000096, 0.00000004],
+		[-6.14626356, -0.00232940, 0.00140044, 0.00234288, -0.00000096, 0.00000004],
+		[-6.14669342, -0.00232782, 0.00139958, 0.00234129, -0.00000096, 0.00000004],
+		[-6.14712188, -0.00232625, 0.00139873, 0.00233970, -0.00000096, 0.00000004],
+		[-6.14754894, -0.00232467, 0.00139787, 0.00233811, -0.00000096, 0.00000004],
+		[-6.14797459, -0.00232309, 0.00139701, 0.00233652, -0.00000096, 0.00000004],
+		[-6.14839885, -0.00232152, 0.00139616, 0.00233493, -0.00000096, 0.00000004],
+		[-6.14882172, -0.00231995, 0.00139530, 0.00233335, -0.00000096, 0.00000004],
+		[-6.14924320, -0.00231838, 0.00139445, 0.00233177, -0.00000096, 0.00000004],
+		[-6.14966330, -0.00231681, 0.00139359, 0.00233019, -0.00000096, 0.00000004],
+		[-6.15008202, -0.00231525, 0.00139274, 0.00232861, -0.00000097, 0.00000004],
+		[-6.15049937, -0.00231368, 0.00139189, 0.00232704, -0.00000097, 0.00000004],
+		[-6.15091535, -0.00231212, 0.00139104, 0.00232546, -0.00000097, 0.00000004],
+		[-6.15132996, -0.00231056, 0.00139018, 0.00232389, -0.00000097, 0.00000004],
+		[-6.15174321, -0.00230900, 0.00138933, 0.00232232, -0.00000097, 0.00000003],
+		[-6.15215510, -0.00230744, 0.00138848, 0.00232075, -0.00000097, 0.00000003],
+		[-6.15256564, -0.00230589, 0.00138763, 0.00231918, -0.00000097, 0.00000003],
+		[-6.15297483, -0.00230433, 0.00138679, 0.00231761, -0.00000097, 0.00000003],
+		[-6.15338268, -0.00230278, 0.00138594, 0.00231605, -0.00000097, 0.00000003],
+		[-6.15378918, -0.00230123, 0.00138509, 0.00231449, -0.00000097, 0.00000003],
+		[-6.15419435, -0.00229968, 0.00138424, 0.00231293, -0.00000097, 0.00000003],
+		[-6.15459818, -0.00229814, 0.00138340, 0.00231137, -0.00000097, 0.00000003],
+		[-6.15500069, -0.00229659, 0.00138255, 0.00230981, -0.00000097, 0.00000003],
+		[-6.15540187, -0.00229505, 0.00138171, 0.00230825, -0.00000098, 0.00000003],
+		[-6.15580173, -0.00229350, 0.00138087, 0.00230670, -0.00000098, 0.00000003],
+		[-6.15620027, -0.00229196, 0.00138002, 0.00230515, -0.00000098, 0.00000003],
+		[-6.15659750, -0.00229042, 0.00137918, 0.00230360, -0.00000098, 0.00000003],
+		[-6.15699342, -0.00228889, 0.00137834, 0.00230205, -0.00000098, 0.00000003],
+		[-6.15738804, -0.00228735, 0.00137750, 0.00230050, -0.00000098, 0.00000003],
+		[-6.15778136, -0.00228582, 0.00137666, 0.00229896, -0.00000098, 0.00000003],
+		[-6.15817338, -0.00228429, 0.00137582, 0.00229741, -0.00000098, 0.00000003],
+		[-6.15856410, -0.00228276, 0.00137498, 0.00229587, -0.00000098, 0.00000003],
+		[-6.15895354, -0.00228123, 0.00137414, 0.00229433, -0.00000098, 0.00000003],
+		[-6.15934170, -0.00227970, 0.00137330, 0.00229279, -0.00000098, 0.00000003],
+		[-6.15972857, -0.00227818, 0.00137246, 0.00229125, -0.00000098, 0.00000003],
+		[-6.16011416, -0.00227665, 0.00137162, 0.00228972, -0.00000099, 0.00000003],
+		[-6.16049848, -0.00227513, 0.00137079, 0.00228818, -0.00000099, 0.00000003],
+		[-6.16088154, -0.00227361, 0.00136995, 0.00228665, -0.00000099, 0.00000003],
+		[-6.16126332, -0.00227209, 0.00136912, 0.00228512, -0.00000099, 0.00000003],
+		[-6.16164385, -0.00227057, 0.00136828, 0.00228359, -0.00000099, 0.00000003],
+		[-6.16202312, -0.00226906, 0.00136745, 0.00228207, -0.00000099, 0.00000003],
+		[-6.16240113, -0.00226754, 0.00136662, 0.00228054, -0.00000099, 0.00000003],
+		[-6.16277790, -0.00226603, 0.00136579, 0.00227902, -0.00000099, 0.00000003],
+		[-6.16315341, -0.00226452, 0.00136495, 0.00227750, -0.00000099, 0.00000003],
+		[-6.16352769, -0.00226301, 0.00136412, 0.00227598, -0.00000099, 0.00000003],
+		[-6.16390073, -0.00226151, 0.00136329, 0.00227446, -0.00000099, 0.00000003],
+		[-6.16427253, -0.00226000, 0.00136246, 0.00227294, -0.00000099, 0.00000003],
+		[-6.16464310, -0.00225850, 0.00136164, 0.00227143, -0.00000099, 0.00000003],
+		[-6.16501245, -0.00225700, 0.00136081, 0.00226991, -0.00000100, 0.00000003],
+		[-6.16538057, -0.00225549, 0.00135998, 0.00226840, -0.00000100, 0.00000003],
+		[-6.16574747, -0.00225400, 0.00135915, 0.00226689, -0.00000100, 0.00000003],
+		[-6.16611316, -0.00225250, 0.00135833, 0.00226538, -0.00000100, 0.00000003],
+		[-6.16647763, -0.00225100, 0.00135750, 0.00226388, -0.00000100, 0.00000003],
+		[-6.16684090, -0.00224951, 0.00135668, 0.00226237, -0.00000100, 0.00000003],
+		[-6.16720296, -0.00224802, 0.00135585, 0.00226087, -0.00000100, 0.00000003],
+		[-6.16756382, -0.00224653, 0.00135503, 0.00225936, -0.00000100, 0.00000003],
+		[-6.16792348, -0.00224504, 0.00135421, 0.00225786, -0.00000100, 0.00000003],
+		[-6.16828195, -0.00224355, 0.00135338, 0.00225637, -0.00000100, 0.00000003],
+		[-6.16863923, -0.00224206, 0.00135256, 0.00225487, -0.00000100, 0.00000003],
+		[-6.16899533, -0.00224058, 0.00135174, 0.00225337, -0.00000100, 0.00000003],
+		[-6.16935024, -0.00223910, 0.00135092, 0.00225188, -0.00000100, 0.00000003],
+		[-6.16970397, -0.00223762, 0.00135010, 0.00225039, -0.00000100, 0.00000003],
+		[-6.17005653, -0.00223614, 0.00134928, 0.00224890, -0.00000101, 0.00000003],
+		[-6.17040791, -0.00223466, 0.00134846, 0.00224741, -0.00000101, 0.00000003],
+		[-6.17075813, -0.00223318, 0.00134765, 0.00224592, -0.00000101, 0.00000003],
+		[-6.17110719, -0.00223171, 0.00134683, 0.00224444, -0.00000101, 0.00000003],
+		[-6.17145508, -0.00223024, 0.00134601, 0.00224295, -0.00000101, 0.00000003],
+		[-6.17180182, -0.00222876, 0.00134520, 0.00224147, -0.00000101, 0.00000003],
+		[-6.17214740, -0.00222729, 0.00134438, 0.00223999, -0.00000101, 0.00000003],
+		[-6.17249183, -0.00222583, 0.00134357, 0.00223851, -0.00000101, 0.00000003],
+		[-6.17283512, -0.00222436, 0.00134275, 0.00223703, -0.00000101, 0.00000003],
+		[-6.17317726, -0.00222289, 0.00134194, 0.00223556, -0.00000101, 0.00000003],
+		[-6.17351827, -0.00222143, 0.00134113, 0.00223408, -0.00000101, 0.00000003],
+		[-6.17385813, -0.00221997, 0.00134032, 0.00223261, -0.00000101, 0.00000003],
+		[-6.17419687, -0.00221851, 0.00133950, 0.00223114, -0.00000101, 0.00000003],
+		[-6.17453448, -0.00221705, 0.00133869, 0.00222967, -0.00000101, 0.00000003],
+		[-6.17487096, -0.00221559, 0.00133788, 0.00222820, -0.00000101, 0.00000003],
+		[-6.17520632, -0.00221414, 0.00133708, 0.00222674, -0.00000102, 0.00000003],
+		[-6.17554056, -0.00221269, 0.00133627, 0.00222527, -0.00000102, 0.00000003],
+		[-6.17587369, -0.00221123, 0.00133546, 0.00222381, -0.00000102, 0.00000003],
+		[-6.17620571, -0.00220978, 0.00133465, 0.00222235, -0.00000102, 0.00000003],
+		[-6.17653662, -0.00220833, 0.00133385, 0.00222089, -0.00000102, 0.00000003],
+		[-6.17686642, -0.00220689, 0.00133304, 0.00221943, -0.00000102, 0.00000003],
+		[-6.17719513, -0.00220544, 0.00133223, 0.00221798, -0.00000102, 0.00000003],
+		[-6.17752273, -0.00220400, 0.00133143, 0.00221652, -0.00000102, 0.00000003],
+		[-6.17784925, -0.00220255, 0.00133063, 0.00221507, -0.00000102, 0.00000003],
+		[-6.17817467, -0.00220111, 0.00132982, 0.00221362, -0.00000102, 0.00000002],
+		[-6.17849900, -0.00219967, 0.00132902, 0.00221217, -0.00000102, 0.00000002],
+		[-6.17882225, -0.00219823, 0.00132822, 0.00221072, -0.00000102, 0.00000002],
+		[-6.17914442, -0.00219680, 0.00132742, 0.00220927, -0.00000102, 0.00000002],
+		[-6.17946552, -0.00219536, 0.00132662, 0.00220782, -0.00000102, 0.00000002],
+		[-6.17978554, -0.00219393, 0.00132582, 0.00220638, -0.00000102, 0.00000002],
+		[-6.18010448, -0.00219250, 0.00132502, 0.00220494, -0.00000103, 0.00000002],
+		[-6.18042237, -0.00219107, 0.00132422, 0.00220350, -0.00000103, 0.00000002],
+		[-6.18073919, -0.00218964, 0.00132342, 0.00220206, -0.00000103, 0.00000002],
+		[-6.18105494, -0.00218821, 0.00132262, 0.00220062, -0.00000103, 0.00000002],
+		[-6.18136964, -0.00218679, 0.00132183, 0.00219919, -0.00000103, 0.00000002],
+		[-6.18168329, -0.00218536, 0.00132103, 0.00219775, -0.00000103, 0.00000002],
+		[-6.18199589, -0.00218394, 0.00132024, 0.00219632, -0.00000103, 0.00000002],
+		[-6.18230744, -0.00218252, 0.00131944, 0.00219489, -0.00000103, 0.00000002],
+		[-6.18261795, -0.00218110, 0.00131865, 0.00219346, -0.00000103, 0.00000002],
+		[-6.18292741, -0.00217968, 0.00131785, 0.00219203, -0.00000103, 0.00000002],
+		[-6.18323584, -0.00217827, 0.00131706, 0.00219060, -0.00000103, 0.00000002],
+		[-6.18354323, -0.00217685, 0.00131627, 0.00218918, -0.00000103, 0.00000002],
+		[-6.18384960, -0.00217544, 0.00131548, 0.00218776, -0.00000103, 0.00000002],
+		[-6.18415493, -0.00217403, 0.00131469, 0.00218633, -0.00000103, 0.00000002],
+		[-6.18445924, -0.00217262, 0.00131390, 0.00218491, -0.00000103, 0.00000002],
+		[-6.18476253, -0.00217121, 0.00131311, 0.00218350, -0.00000103, 0.00000002],
+		[-6.18506481, -0.00216980, 0.00131232, 0.00218208, -0.00000104, 0.00000002],
+		[-6.18536606, -0.00216840, 0.00131153, 0.00218066, -0.00000104, 0.00000002],
+		[-6.18566631, -0.00216699, 0.00131074, 0.00217925, -0.00000104, 0.00000002],
+		[-6.18596555, -0.00216559, 0.00130996, 0.00217784, -0.00000104, 0.00000002],
+		[-6.18626378, -0.00216419, 0.00130917, 0.00217643, -0.00000104, 0.00000002],
+		[-6.18656101, -0.00216279, 0.00130839, 0.00217502, -0.00000104, 0.00000002],
+		[-6.18685724, -0.00216139, 0.00130760, 0.00217361, -0.00000104, 0.00000002],
+		[-6.18715248, -0.00216000, 0.00130682, 0.00217220, -0.00000104, 0.00000002],
+		[-6.18744673, -0.00215860, 0.00130603, 0.00217080, -0.00000104, 0.00000002],
+		[-6.18773998, -0.00215721, 0.00130525, 0.00216939, -0.00000104, 0.00000002],
+		[-6.18803225, -0.00215582, 0.00130447, 0.00216799, -0.00000104, 0.00000002],
+		[-6.18832353, -0.00215443, 0.00130369, 0.00216659, -0.00000104, 0.00000002],
+		[-6.18861384, -0.00215304, 0.00130291, 0.00216519, -0.00000104, 0.00000002],
+		[-6.18890316, -0.00215165, 0.00130213, 0.00216380, -0.00000104, 0.00000002],
+		[-6.18919152, -0.00215026, 0.00130135, 0.00216240, -0.00000104, 0.00000002],
+		[-6.18947890, -0.00214888, 0.00130057, 0.00216101, -0.00000104, 0.00000002],
+		[-6.18976532, -0.00214750, 0.00129979, 0.00215961, -0.00000104, 0.00000002],
+		[-6.19005077, -0.00214612, 0.00129901, 0.00215822, -0.00000105, 0.00000002],
+		[-6.19033526, -0.00214474, 0.00129823, 0.00215683, -0.00000105, 0.00000002],
+		[-6.19061879, -0.00214336, 0.00129746, 0.00215545, -0.00000105, 0.00000002],
+		[-6.19090136, -0.00214198, 0.00129668, 0.00215406, -0.00000105, 0.00000002],
+		[-6.19118298, -0.00214061, 0.00129591, 0.00215268, -0.00000105, 0.00000002],
+		[-6.19146366, -0.00213923, 0.00129513, 0.00215129, -0.00000105, 0.00000002],
+		[-6.19174338, -0.00213786, 0.00129436, 0.00214991, -0.00000105, 0.00000002],
+		[-6.19202217, -0.00213649, 0.00129359, 0.00214853, -0.00000105, 0.00000002],
+		[-6.19230001, -0.00213512, 0.00129281, 0.00214715, -0.00000105, 0.00000002],
+		[-6.19257691, -0.00213375, 0.00129204, 0.00214577, -0.00000105, 0.00000002],
+		[-6.19285288, -0.00213239, 0.00129127, 0.00214440, -0.00000105, 0.00000002],
+		[-6.19312792, -0.00213102, 0.00129050, 0.00214302, -0.00000105, 0.00000002],
+		[-6.19340203, -0.00212966, 0.00128973, 0.00214165, -0.00000105, 0.00000002],
+		[-6.19367521, -0.00212830, 0.00128896, 0.00214028, -0.00000105, 0.00000002],
+		[-6.19394748, -0.00212694, 0.00128819, 0.00213891, -0.00000105, 0.00000002],
+		[-6.19421882, -0.00212558, 0.00128743, 0.00213754, -0.00000105, 0.00000002],
+		[-6.19448924, -0.00212422, 0.00128666, 0.00213617, -0.00000105, 0.00000002],
+		[-6.19475875, -0.00212286, 0.00128589, 0.00213481, -0.00000105, 0.00000002],
+		[-6.19502735, -0.00212151, 0.00128513, 0.00213344, -0.00000105, 0.00000002],
+		[-6.19529504, -0.00212016, 0.00128436, 0.00213208, -0.00000106, 0.00000002],
+		[-6.19556183, -0.00211880, 0.00128360, 0.00213072, -0.00000106, 0.00000002],
+		[-6.19582771, -0.00211745, 0.00128283, 0.00212936, -0.00000106, 0.00000002],
+		[-6.19609270, -0.00211611, 0.00128207, 0.00212800, -0.00000106, 0.00000002],
+		[-6.19635678, -0.00211476, 0.00128131, 0.00212665, -0.00000106, 0.00000002],
+		[-6.19661998, -0.00211341, 0.00128054, 0.00212529, -0.00000106, 0.00000002],
+		[-6.19688228, -0.00211207, 0.00127978, 0.00212394, -0.00000106, 0.00000002],
+		[-6.19714369, -0.00211073, 0.00127902, 0.00212259, -0.00000106, 0.00000002],
+		[-6.19740422, -0.00210938, 0.00127826, 0.00212123, -0.00000106, 0.00000002],
+		[-6.19766387, -0.00210804, 0.00127750, 0.00211989, -0.00000106, 0.00000002],
+		[-6.19792264, -0.00210671, 0.00127674, 0.00211854, -0.00000106, 0.00000002],
+		[-6.19818053, -0.00210537, 0.00127599, 0.00211719, -0.00000106, 0.00000002],
+		[-6.19843754, -0.00210403, 0.00127523, 0.00211585, -0.00000106, 0.00000002],
+		[-6.19869369, -0.00210270, 0.00127447, 0.00211450, -0.00000106, 0.00000002],
+		[-6.19894896, -0.00210137, 0.00127372, 0.00211316, -0.00000106, 0.00000002],
+		[-6.19920337, -0.00210004, 0.00127296, 0.00211182, -0.00000106, 0.00000002],
+		[-6.19945692, -0.00209871, 0.00127221, 0.00211048, -0.00000106, 0.00000002],
+		[-6.19970961, -0.00209738, 0.00127145, 0.00210914, -0.00000106, 0.00000002],
+		[-6.19996144, -0.00209605, 0.00127070, 0.00210781, -0.00000106, 0.00000002],
+		[-6.20021242, -0.00209473, 0.00126995, 0.00210647, -0.00000107, 0.00000002],
+		[-6.20046254, -0.00209340, 0.00126919, 0.00210514, -0.00000107, 0.00000002],
+		[-6.20071181, -0.00209208, 0.00126844, 0.00210381, -0.00000107, 0.00000002],
+		[-6.20096024, -0.00209076, 0.00126769, 0.00210248, -0.00000107, 0.00000002],
+		[-6.20120782, -0.00208944, 0.00126694, 0.00210115, -0.00000107, 0.00000002],
+		[-6.20145457, -0.00208812, 0.00126619, 0.00209982, -0.00000107, 0.00000002],
+		[-6.20170047, -0.00208680, 0.00126544, 0.00209850, -0.00000107, 0.00000002],
+		[-6.20194554, -0.00208549, 0.00126469, 0.00209717, -0.00000107, 0.00000002],
+		[-6.20218978, -0.00208417, 0.00126395, 0.00209585, -0.00000107, 0.00000002],
+		[-6.20243318, -0.00208286, 0.00126320, 0.00209453, -0.00000107, 0.00000002],
+		[-6.20267576, -0.00208155, 0.00126245, 0.00209321, -0.00000107, 0.00000002],
+		[-6.20291751, -0.00208024, 0.00126171, 0.00209189, -0.00000107, 0.00000002],
+		[-6.20315844, -0.00207893, 0.00126096, 0.00209057, -0.00000107, 0.00000002],
+		[-6.20339855, -0.00207762, 0.00126022, 0.00208925, -0.00000107, 0.00000002],
+		[-6.20363785, -0.00207632, 0.00125947, 0.00208794, -0.00000107, 0.00000002],
+		[-6.20387633, -0.00207501, 0.00125873, 0.00208663, -0.00000107, 0.00000002],
+		[-6.20411399, -0.00207371, 0.00125799, 0.00208532, -0.00000107, 0.00000002],
+		[-6.20435085, -0.00207241, 0.00125725, 0.00208400, -0.00000107, 0.00000002],
+		[-6.20458690, -0.00207111, 0.00125650, 0.00208270, -0.00000107, 0.00000002],
+		[-6.20482215, -0.00206981, 0.00125576, 0.00208139, -0.00000107, 0.00000002],
+		[-6.20505660, -0.00206852, 0.00125502, 0.00208008, -0.00000107, 0.00000002],
+		[-6.20529024, -0.00206722, 0.00125428, 0.00207878, -0.00000108, 0.00000002],
+		[-6.20552310, -0.00206593, 0.00125355, 0.00207748, -0.00000108, 0.00000002],
+		[-6.20575515, -0.00206463, 0.00125281, 0.00207617, -0.00000108, 0.00000002],
+		[-6.20598642, -0.00206334, 0.00125207, 0.00207487, -0.00000108, 0.00000002],
+		[-6.20621690, -0.00206205, 0.00125133, 0.00207357, -0.00000108, 0.00000002],
+		[-6.20644659, -0.00206076, 0.00125060, 0.00207228, -0.00000108, 0.00000002],
+		[-6.20667550, -0.00205947, 0.00124986, 0.00207098, -0.00000108, 0.00000002],
+		[-6.20690362, -0.00205819, 0.00124913, 0.00206969, -0.00000108, 0.00000002],
+		[-6.20713097, -0.00205690, 0.00124839, 0.00206839, -0.00000108, 0.00000002],
+		[-6.20735754, -0.00205562, 0.00124766, 0.00206710, -0.00000108, 0.00000002],
+		[-6.20758334, -0.00205434, 0.00124693, 0.00206581, -0.00000108, 0.00000002],
+		[-6.20780837, -0.00205306, 0.00124619, 0.00206452, -0.00000108, 0.00000001],
+		[-6.20803263, -0.00205178, 0.00124546, 0.00206323, -0.00000108, 0.00000001],
+		[-6.20825612, -0.00205050, 0.00124473, 0.00206195, -0.00000108, 0.00000001],
+		[-6.20847885, -0.00204923, 0.00124400, 0.00206066, -0.00000108, 0.00000001],
+		[-6.20870082, -0.00204795, 0.00124327, 0.00205938, -0.00000108, 0.00000001],
+		[-6.20892203, -0.00204668, 0.00124254, 0.00205810, -0.00000108, 0.00000001],
+		[-6.20914249, -0.00204540, 0.00124181, 0.00205681, -0.00000108, 0.00000001],
+		[-6.20936219, -0.00204413, 0.00124109, 0.00205554, -0.00000108, 0.00000001],
+		[-6.20958114, -0.00204286, 0.00124036, 0.00205426, -0.00000108, 0.00000001],
+		[-6.20979934, -0.00204160, 0.00123963, 0.00205298, -0.00000108, 0.00000001],
+		[-6.21001679, -0.00204033, 0.00123891, 0.00205171, -0.00000108, 0.00000001],
+		[-6.21023350, -0.00203906, 0.00123818, 0.00205043, -0.00000108, 0.00000001],
+		[-6.21044947, -0.00203780, 0.00123746, 0.00204916, -0.00000109, 0.00000001],
+		[-6.21066470, -0.00203654, 0.00123673, 0.00204789, -0.00000109, 0.00000001],
+		[-6.21087920, -0.00203528, 0.00123601, 0.00204662, -0.00000109, 0.00000001],
+		[-6.21109295, -0.00203402, 0.00123529, 0.00204535, -0.00000109, 0.00000001],
+		[-6.21130598, -0.00203276, 0.00123456, 0.00204408, -0.00000109, 0.00000001],
+		[-6.21151828, -0.00203150, 0.00123384, 0.00204282, -0.00000109, 0.00000001],
+		[-6.21172985, -0.00203024, 0.00123312, 0.00204155, -0.00000109, 0.00000001],
+		[-6.21194069, -0.00202899, 0.00123240, 0.00204029, -0.00000109, 0.00000001],
+		[-6.21215082, -0.00202774, 0.00123168, 0.00203903, -0.00000109, 0.00000001],
+		[-6.21236022, -0.00202648, 0.00123096, 0.00203777, -0.00000109, 0.00000001],
+		[-6.21256890, -0.00202523, 0.00123025, 0.00203651, -0.00000109, 0.00000001],
+		[-6.21277687, -0.00202398, 0.00122953, 0.00203525, -0.00000109, 0.00000001],
+		[-6.21298413, -0.00202274, 0.00122881, 0.00203399, -0.00000109, 0.00000001],
+		[-6.21319067, -0.00202149, 0.00122809, 0.00203274, -0.00000109, 0.00000001],
+		[-6.21339651, -0.00202025, 0.00122738, 0.00203149, -0.00000109, 0.00000001],
+		[-6.21360164, -0.00201900, 0.00122666, 0.00203023, -0.00000109, 0.00000001],
+		[-6.21380607, -0.00201776, 0.00122595, 0.00202898, -0.00000109, 0.00000001],
+		[-6.21400979, -0.00201652, 0.00122523, 0.00202773, -0.00000109, 0.00000001],
+		[-6.21421282, -0.00201528, 0.00122452, 0.00202649, -0.00000109, 0.00000001],
+		[-6.21441515, -0.00201404, 0.00122381, 0.00202524, -0.00000109, 0.00000001],
+		[-6.21461678, -0.00201280, 0.00122310, 0.00202399, -0.00000109, 0.00000001],
+		[-6.21481773, -0.00201157, 0.00122239, 0.00202275, -0.00000109, 0.00000001],
+		[-6.21501798, -0.00201033, 0.00122167, 0.00202151, -0.00000109, 0.00000001],
+		[-6.21521754, -0.00200910, 0.00122096, 0.00202026, -0.00000109, 0.00000001],
+		[-6.21541642, -0.00200787, 0.00122026, 0.00201902, -0.00000110, 0.00000001],
+		[-6.21561461, -0.00200664, 0.00121955, 0.00201779, -0.00000110, 0.00000001],
+		[-6.21581213, -0.00200541, 0.00121884, 0.00201655, -0.00000110, 0.00000001],
+		[-6.21600896, -0.00200418, 0.00121813, 0.00201531, -0.00000110, 0.00000001],
+		[-6.21620512, -0.00200295, 0.00121742, 0.00201408, -0.00000110, 0.00000001],
+		[-6.21640060, -0.00200173, 0.00121672, 0.00201284, -0.00000110, 0.00000001],
+		[-6.21659541, -0.00200050, 0.00121601, 0.00201161, -0.00000110, 0.00000001],
+		[-6.21678955, -0.00199928, 0.00121531, 0.00201038, -0.00000110, 0.00000001],
+		[-6.21698302, -0.00199806, 0.00121460, 0.00200915, -0.00000110, 0.00000001],
+		[-6.21717583, -0.00199684, 0.00121390, 0.00200792, -0.00000110, 0.00000001],
+		[-6.21736797, -0.00199562, 0.00121320, 0.00200670, -0.00000110, 0.00000001],
+		[-6.21755945, -0.00199440, 0.00121249, 0.00200547, -0.00000110, 0.00000001],
+		[-6.21775028, -0.00199319, 0.00121179, 0.00200425, -0.00000110, 0.00000001],
+		[-6.21794044, -0.00199197, 0.00121109, 0.00200302, -0.00000110, 0.00000001],
+		[-6.21812995, -0.00199076, 0.00121039, 0.00200180, -0.00000110, 0.00000001],
+		[-6.21831881, -0.00198955, 0.00120969, 0.00200058, -0.00000110, 0.00000001],
+		[-6.21850702, -0.00198833, 0.00120899, 0.00199936, -0.00000110, 0.00000001],
+		[-6.21869457, -0.00198712, 0.00120829, 0.00199815, -0.00000110, 0.00000001],
+		[-6.21888149, -0.00198592, 0.00120759, 0.00199693, -0.00000110, 0.00000001],
+		[-6.21906775, -0.00198471, 0.00120689, 0.00199571, -0.00000110, 0.00000001],
+		[-6.21925338, -0.00198350, 0.00120620, 0.00199450, -0.00000110, 0.00000001],
+		[-6.21943836, -0.00198230, 0.00120550, 0.00199329, -0.00000110, 0.00000001],
+		[-6.21962271, -0.00198110, 0.00120481, 0.00199208, -0.00000110, 0.00000001],
+		[-6.21980642, -0.00197989, 0.00120411, 0.00199087, -0.00000110, 0.00000001],
+		[-6.21998950, -0.00197869, 0.00120342, 0.00198966, -0.00000110, 0.00000001],
+		[-6.22017194, -0.00197749, 0.00120272, 0.00198845, -0.00000110, 0.00000001],
+		[-6.22035376, -0.00197630, 0.00120203, 0.00198724, -0.00000110, 0.00000001],
+		[-6.22053495, -0.00197510, 0.00120134, 0.00198604, -0.00000110, 0.00000001],
+		[-6.22071551, -0.00197390, 0.00120064, 0.00198484, -0.00000111, 0.00000001],
+		[-6.22089545, -0.00197271, 0.00119995, 0.00198363, -0.00000111, 0.00000001],
+		[-6.22107477, -0.00197152, 0.00119926, 0.00198243, -0.00000111, 0.00000001],
+		[-6.22125347, -0.00197032, 0.00119857, 0.00198123, -0.00000111, 0.00000001],
+		[-6.22143155, -0.00196913, 0.00119788, 0.00198003, -0.00000111, 0.00000001],
+		[-6.22160902, -0.00196794, 0.00119719, 0.00197884, -0.00000111, 0.00000001],
+		[-6.22178587, -0.00196676, 0.00119650, 0.00197764, -0.00000111, 0.00000001],
+		[-6.22196211, -0.00196557, 0.00119582, 0.00197645, -0.00000111, 0.00000001],
+		[-6.22213774, -0.00196438, 0.00119513, 0.00197525, -0.00000111, 0.00000001],
+		[-6.22231277, -0.00196320, 0.00119444, 0.00197406, -0.00000111, 0.00000001],
+		[-6.22248719, -0.00196202, 0.00119376, 0.00197287, -0.00000111, 0.00000001],
+		[-6.22266101, -0.00196083, 0.00119307, 0.00197168, -0.00000111, 0.00000001],
+		[-6.22283422, -0.00195965, 0.00119239, 0.00197049, -0.00000111, 0.00000001],
+		[-6.22300684, -0.00195848, 0.00119170, 0.00196931, -0.00000111, 0.00000001],
+		[-6.22317886, -0.00195730, 0.00119102, 0.00196812, -0.00000111, 0.00000001],
+		[-6.22335028, -0.00195612, 0.00119034, 0.00196694, -0.00000111, 0.00000001],
+		[-6.22352111, -0.00195495, 0.00118965, 0.00196575, -0.00000111, 0.00000001],
+		[-6.22369135, -0.00195377, 0.00118897, 0.00196457, -0.00000111, 0.00000001],
+		[-6.22386100, -0.00195260, 0.00118829, 0.00196339, -0.00000111, 0.00000001],
+		[-6.22403007, -0.00195143, 0.00118761, 0.00196221, -0.00000111, 0.00000001],
+		[-6.22419854, -0.00195026, 0.00118693, 0.00196103, -0.00000111, 0.00000001],
+		[-6.22436644, -0.00194909, 0.00118625, 0.00195986, -0.00000111, 0.00000001],
+		[-6.22453375, -0.00194792, 0.00118557, 0.00195868, -0.00000111, 0.00000001],
+		[-6.22470048, -0.00194675, 0.00118490, 0.00195751, -0.00000111, 0.00000001],
+		[-6.22486664, -0.00194559, 0.00118422, 0.00195633, -0.00000111, 0.00000001],
+		[-6.22503222, -0.00194442, 0.00118354, 0.00195516, -0.00000111, 0.00000001],
+		[-6.22519722, -0.00194326, 0.00118287, 0.00195399, -0.00000111, 0.00000001],
+		[-6.22536166, -0.00194210, 0.00118219, 0.00195282, -0.00000111, 0.00000001],
+		[-6.22552552, -0.00194094, 0.00118152, 0.00195165, -0.00000111, 0.00000001],
+		[-6.22568881, -0.00193978, 0.00118084, 0.00195049, -0.00000111, 0.00000001],
+		[-6.22585154, -0.00193862, 0.00118017, 0.00194932, -0.00000112, 0.00000001],
+		[-6.22601370, -0.00193746, 0.00117950, 0.00194816, -0.00000112, 0.00000001],
+		[-6.22617531, -0.00193631, 0.00117882, 0.00194699, -0.00000112, 0.00000001],
+		[-6.22633635, -0.00193515, 0.00117815, 0.00194583, -0.00000112, 0.00000001],
+		[-6.22649683, -0.00193400, 0.00117748, 0.00194467, -0.00000112, 0.00000001],
+		[-6.22665675, -0.00193285, 0.00117681, 0.00194351, -0.00000112, 0.00000001],
+		[-6.22681612, -0.00193170, 0.00117614, 0.00194235, -0.00000112, 0.00000001],
+		[-6.22697494, -0.00193055, 0.00117547, 0.00194120, -0.00000112, 0.00000001],
+		[-6.22713320, -0.00192940, 0.00117480, 0.00194004, -0.00000112, 0.00000001],
+		[-6.22729092, -0.00192825, 0.00117413, 0.00193889, -0.00000112, 0.00000001],
+		[-6.22744808, -0.00192711, 0.00117346, 0.00193773, -0.00000112, 0.00000001],
+		[-6.22760470, -0.00192596, 0.00117280, 0.00193658, -0.00000112, 0.00000001],
+		[-6.22776078, -0.00192482, 0.00117213, 0.00193543, -0.00000112, 0.00000001],
+		[-6.22791631, -0.00192368, 0.00117147, 0.00193428, -0.00000112, 0.00000001],
+		[-6.22807131, -0.00192253, 0.00117080, 0.00193313, -0.00000112, 0.00000001],
+		[-6.22822576, -0.00192139, 0.00117014, 0.00193198, -0.00000112, 0.00000001],
+		[-6.22837968, -0.00192026, 0.00116947, 0.00193084, -0.00000112, 0.00000001],
+		[-6.22853306, -0.00191912, 0.00116881, 0.00192969, -0.00000112, 0.00000001],
+		[-6.22868591, -0.00191798, 0.00116815, 0.00192855, -0.00000112, 0.00000001],
+		[-6.22883823, -0.00191685, 0.00116748, 0.00192741, -0.00000112, 0.00000001],
+		[-6.22899002, -0.00191571, 0.00116682, 0.00192627, -0.00000112, 0.00000001],
+		[-6.22914128, -0.00191458, 0.00116616, 0.00192513, -0.00000112, 0.00000001],
+		[-6.22929201, -0.00191345, 0.00116550, 0.00192399, -0.00000112, 0.00000001],
+		[-6.22944222, -0.00191232, 0.00116484, 0.00192285, -0.00000112, 0.00000001],
+		[-6.22959190, -0.00191119, 0.00116418, 0.00192171, -0.00000112, 0.00000001],
+		[-6.22974107, -0.00191006, 0.00116352, 0.00192058, -0.00000112, 0.00000001],
+		[-6.22988971, -0.00190893, 0.00116286, 0.00191944, -0.00000112, 0.00000001],
+		[-6.23003784, -0.00190781, 0.00116221, 0.00191831, -0.00000112, 0.00000001],
+		[-6.23018545, -0.00190669, 0.00116155, 0.00191718, -0.00000112, 0.00000001],
+		[-6.23033255, -0.00190556, 0.00116089, 0.00191605, -0.00000112, 0.00000001],
+		[-6.23047913, -0.00190444, 0.00116024, 0.00191492, -0.00000112, 0.00000001],
+		[-6.23062521, -0.00190332, 0.00115958, 0.00191379, -0.00000112, 0.00000001],
+		[-6.23077077, -0.00190220, 0.00115893, 0.00191267, -0.00000112, 0.00000001],
+		[-6.23091583, -0.00190108, 0.00115828, 0.00191154, -0.00000112, 0.00000001],
+		[-6.23106038, -0.00189996, 0.00115762, 0.00191042, -0.00000113, 0.00000001],
+		[-6.23120443, -0.00189885, 0.00115697, 0.00190929, -0.00000113, 0.00000001],
+		[-6.23134798, -0.00189773, 0.00115632, 0.00190817, -0.00000113, 0.00000001],
+		[-6.23149102, -0.00189662, 0.00115567, 0.00190705, -0.00000113, 0.00000001],
+		[-6.23163357, -0.00189551, 0.00115501, 0.00190593, -0.00000113, 0.00000001],
+		[-6.23177562, -0.00189439, 0.00115436, 0.00190481, -0.00000113, 0.00000001],
+		[-6.23191717, -0.00189328, 0.00115371, 0.00190369, -0.00000113, 0.00000001],
+		[-6.23205823, -0.00189218, 0.00115307, 0.00190258, -0.00000113, 0.00000001],
+		[-6.23219880, -0.00189107, 0.00115242, 0.00190146, -0.00000113, 0.00000001],
+		[-6.23233888, -0.00188996, 0.00115177, 0.00190035, -0.00000113, 0.00000001],
+		[-6.23247846, -0.00188886, 0.00115112, 0.00189924, -0.00000113, 0.00000001],
+		[-6.23261756, -0.00188775, 0.00115047, 0.00189812, -0.00000113, 0.00000001],
+		[-6.23275618, -0.00188665, 0.00114983, 0.00189701, -0.00000113, 0.00000001],
+		[-6.23289431, -0.00188555, 0.00114918, 0.00189591, -0.00000113, 0.00000001],
+		[-6.23303196, -0.00188444, 0.00114854, 0.00189480, -0.00000113, 0.00000001],
+		[-6.23316912, -0.00188334, 0.00114789, 0.00189369, -0.00000113, 0.00000001],
+		[-6.23330581, -0.00188225, 0.00114725, 0.00189258, -0.00000113, 0.00000001],
+		[-6.23344202, -0.00188115, 0.00114661, 0.00189148, -0.00000113, 0.00000001],
+		[-6.23357776, -0.00188005, 0.00114596, 0.00189038, -0.00000113, 0.00000001],
+		[-6.23371302, -0.00187896, 0.00114532, 0.00188927, -0.00000113, 0.00000001],
+		[-6.23384781, -0.00187786, 0.00114468, 0.00188817, -0.00000113, 0.00000001],
+		[-6.23398212, -0.00187677, 0.00114404, 0.00188707, -0.00000113, 0.00000001],
+		[-6.23411597, -0.00187568, 0.00114340, 0.00188598, -0.00000113, 0.00000001],
+		[-6.23424935, -0.00187459, 0.00114276, 0.00188488, -0.00000113, 0.00000001],
+		[-6.23438226, -0.00187350, 0.00114212, 0.00188378, -0.00000113, 0.00000001],
+		[-6.23451471, -0.00187241, 0.00114148, 0.00188269, -0.00000113, 0.00000001],
+		[-6.23464669, -0.00187132, 0.00114084, 0.00188159, -0.00000113, 0.00000001],
+		[-6.23477821, -0.00187024, 0.00114021, 0.00188050, -0.00000113, 0.00000001],
+		[-6.23490927, -0.00186915, 0.00113957, 0.00187941, -0.00000113, 0.00000001],
+		[-6.23503988, -0.00186807, 0.00113893, 0.00187832, -0.00000113, 0.00000001],
+		[-6.23517002, -0.00186698, 0.00113830, 0.00187723, -0.00000113, 0.00000001],
+		[-6.23529971, -0.00186590, 0.00113766, 0.00187614, -0.00000113, 0.00000001],
+		[-6.23542895, -0.00186482, 0.00113703, 0.00187505, -0.00000113, 0.00000001],
+		[-6.23555773, -0.00186374, 0.00113639, 0.00187396, -0.00000113, 0.00000001],
+		[-6.23568606, -0.00186267, 0.00113576, 0.00187288, -0.00000113, 0.00000001],
+		[-6.23581395, -0.00186159, 0.00113513, 0.00187180, -0.00000113, 0.00000001],
+		[-6.23594138, -0.00186051, 0.00113449, 0.00187071, -0.00000113, 0.00000001],
+		[-6.23606837, -0.00185944, 0.00113386, 0.00186963, -0.00000113, 0.00000001],
+		[-6.23619491, -0.00185836, 0.00113323, 0.00186855, -0.00000113, 0.00000001],
+		[-6.23632102, -0.00185729, 0.00113260, 0.00186747, -0.00000113, 0.00000001],
+		[-6.23644667, -0.00185622, 0.00113197, 0.00186639, -0.00000114, 0.00000001],
+		[-6.23657189, -0.00185515, 0.00113134, 0.00186532, -0.00000114, 0.00000001],
+		[-6.23669667, -0.00185408, 0.00113071, 0.00186424, -0.00000114, 0.00000001],
+		[-6.23682101, -0.00185301, 0.00113009, 0.00186317, -0.00000114, 0.00000001],
+		[-6.23694492, -0.00185195, 0.00112946, 0.00186209, -0.00000114, 0.00000001],
+		[-6.23706839, -0.00185088, 0.00112883, 0.00186102, -0.00000114, 0.00000001],
+		[-6.23719143, -0.00184981, 0.00112820, 0.00185995, -0.00000114, 0.00000001],
+		[-6.23731403, -0.00184875, 0.00112758, 0.00185888, -0.00000114, 0.00000001],
+		[-6.23743621, -0.00184769, 0.00112695, 0.00185781, -0.00000114, 0.00000001],
+		[-6.23755795, -0.00184663, 0.00112633, 0.00185674, -0.00000114, 0.00000001],
+		[-6.23767927, -0.00184557, 0.00112570, 0.00185567, -0.00000114, 0.00000001],
+		[-6.23780017, -0.00184451, 0.00112508, 0.00185461, -0.00000114, 0.00000001],
+		[-6.23792064, -0.00184345, 0.00112446, 0.00185354, -0.00000114, 0.00000001],
+		[-6.23804068, -0.00184239, 0.00112383, 0.00185248, -0.00000114, 0.00000001],
+		[-6.23816031, -0.00184134, 0.00112321, 0.00185142, -0.00000114, 0.00000001],
+		[-6.23827952, -0.00184028, 0.00112259, 0.00185035, -0.00000114, 0.00000001],
+		[-6.23839830, -0.00183923, 0.00112197, 0.00184929, -0.00000114, 0.00000001],
+		[-6.23851667, -0.00183817, 0.00112135, 0.00184823, -0.00000114, 0.00000001],
+		[-6.23863462, -0.00183712, 0.00112073, 0.00184718, -0.00000114, 0.00000001],
+		[-6.23875216, -0.00183607, 0.00112011, 0.00184612, -0.00000114, 0.00000001],
+		[-6.23886929, -0.00183502, 0.00111949, 0.00184506, -0.00000114, 0.00000001],
+		[-6.23898600, -0.00183398, 0.00111887, 0.00184401, -0.00000114, 0.00000001],
+		[-6.23910231, -0.00183293, 0.00111826, 0.00184295, -0.00000114, 0.00000001],
+		[-6.23921820, -0.00183188, 0.00111764, 0.00184190, -0.00000114, 0.00000001],
+		[-6.23933369, -0.00183084, 0.00111702, 0.00184085, -0.00000114, 0.00000001],
+		[-6.23944877, -0.00182979, 0.00111641, 0.00183980, -0.00000114, 0.00000001],
+		[-6.23956345, -0.00182875, 0.00111579, 0.00183875, -0.00000114, 0.00000001],
+		[-6.23967773, -0.00182771, 0.00111518, 0.00183770, -0.00000114, 0.00000001],
+		[-6.23979160, -0.00182667, 0.00111456, 0.00183665, -0.00000114, 0.00000001],
+		[-6.23990507, -0.00182563, 0.00111395, 0.00183561, -0.00000114, 0.00000001],
+		[-6.24001814, -0.00182459, 0.00111334, 0.00183456, -0.00000114, 0.00000001],
+		[-6.24013082, -0.00182355, 0.00111273, 0.00183352, -0.00000114, 0.00000001],
+		[-6.24024309, -0.00182251, 0.00111211, 0.00183248, -0.00000114, 0.00000001],
+		[-6.24035498, -0.00182148, 0.00111150, 0.00183143, -0.00000114, 0.00000001],
+		[-6.24046647, -0.00182045, 0.00111089, 0.00183039, -0.00000114, 0.00000001],
+		[-6.24057756, -0.00181941, 0.00111028, 0.00182935, -0.00000114, 0.00000001],
+		[-6.24068827, -0.00181838, 0.00110967, 0.00182831, -0.00000114, 0.00000001],
+		[-6.24079858, -0.00181735, 0.00110906, 0.00182728, -0.00000114, 0.00000001],
+		[-6.24090851, -0.00181632, 0.00110846, 0.00182624, -0.00000114, 0.00000001],
+		[-6.24101805, -0.00181529, 0.00110785, 0.00182521, -0.00000114, 0.00000001],
+		[-6.24112720, -0.00181426, 0.00110724, 0.00182417, -0.00000114, 0.00000001],
+		[-6.24123597, -0.00181324, 0.00110663, 0.00182314, -0.00000114, 0.00000001],
+		[-6.24134436, -0.00181221, 0.00110603, 0.00182211, -0.00000114, 0.00000001],
+		[-6.24145237, -0.00181118, 0.00110542, 0.00182107, -0.00000114, 0.00000001],
+		[-6.24155999, -0.00181016, 0.00110482, 0.00182004, -0.00000114, 0.00000001],
+		[-6.24166723, -0.00180914, 0.00110421, 0.00181902, -0.00000114, 0.00000001],
+		[-6.24177410, -0.00180812, 0.00110361, 0.00181799, -0.00000114, 0.00000001],
+		[-6.24188059, -0.00180710, 0.00110300, 0.00181696, -0.00000115, 0.00000001],
+		[-6.24198671, -0.00180608, 0.00110240, 0.00181593, -0.00000115, 0.00000001],
+		[-6.24209245, -0.00180506, 0.00110180, 0.00181491, -0.00000115, 0.00000001],
+		[-6.24219781, -0.00180404, 0.00110120, 0.00181389, -0.00000115, 0.00000001],
+		[-6.24230281, -0.00180302, 0.00110060, 0.00181286, -0.00000115, 0.00000001],
+		[-6.24240743, -0.00180201, 0.00110000, 0.00181184, -0.00000115, 0.00000001],
+		[-6.24251169, -0.00180100, 0.00109940, 0.00181082, -0.00000115, 0.00000001],
+		[-6.24261558, -0.00179998, 0.00109880, 0.00180980, -0.00000115, 0.00000001],
+		[-6.24271910, -0.00179897, 0.00109820, 0.00180878, -0.00000115, 0.00000001],
+		[-6.24282226, -0.00179796, 0.00109760, 0.00180777, -0.00000115, 0.00000001],
+		[-6.24292505, -0.00179695, 0.00109700, 0.00180675, -0.00000115, 0.00000001],
+		[-6.24302748, -0.00179594, 0.00109640, 0.00180573, -0.00000115, 0.00000001],
+		[-6.24312955, -0.00179493, 0.00109581, 0.00180472, -0.00000115, 0.00000001],
+		[-6.24323126, -0.00179392, 0.00109521, 0.00180371, -0.00000115, 0.00000001],
+		[-6.24333261, -0.00179292, 0.00109461, 0.00180269, -0.00000115, 0.00000001],
+		[-6.24343360, -0.00179191, 0.00109402, 0.00180168, -0.00000115, 0.00000001],
+		[-6.24353423, -0.00179091, 0.00109342, 0.00180067, -0.00000115, 0.00000001],
+		[-6.24363451, -0.00178991, 0.00109283, 0.00179966, -0.00000115, 0.00000001],
+		[-6.24373444, -0.00178891, 0.00109224, 0.00179866, -0.00000115, 0.00000001],
+		[-6.24383401, -0.00178790, 0.00109164, 0.00179765, -0.00000115, 0.00000001],
+		[-6.24393323, -0.00178690, 0.00109105, 0.00179664, -0.00000115, 0.00000001],
+		[-6.24403210, -0.00178591, 0.00109046, 0.00179564, -0.00000115, 0.00000001],
+		[-6.24413062, -0.00178491, 0.00108987, 0.00179463, -0.00000115, 0.00000001],
+		[-6.24422879, -0.00178391, 0.00108928, 0.00179363, -0.00000115, 0.00000001],
+		[-6.24432661, -0.00178292, 0.00108869, 0.00179263, -0.00000115, 0.00000001],
+		[-6.24442409, -0.00178192, 0.00108810, 0.00179163, -0.00000115, 0.00000001],
+		[-6.24452123, -0.00178093, 0.00108751, 0.00179063, -0.00000115, 0.00000000],
+		[-6.24461802, -0.00177993, 0.00108692, 0.00178963, -0.00000115, 0.00000000],
+		[-6.24471446, -0.00177894, 0.00108633, 0.00178863, -0.00000115, 0.00000000],
+		[-6.24481057, -0.00177795, 0.00108574, 0.00178764, -0.00000115, 0.00000000],
+		[-6.24490634, -0.00177696, 0.00108516, 0.00178664, -0.00000115, 0.00000000],
+		[-6.24500177, -0.00177597, 0.00108457, 0.00178565, -0.00000115, 0.00000000],
+		[-6.24509686, -0.00177499, 0.00108398, 0.00178465, -0.00000115, 0.00000000],
+		[-6.24519161, -0.00177400, 0.00108340, 0.00178366, -0.00000115, 0.00000000],
+		[-6.24528603, -0.00177301, 0.00108281, 0.00178267, -0.00000115, 0.00000000],
+		[-6.24538012, -0.00177203, 0.00108223, 0.00178168, -0.00000115, 0.00000000],
+		[-6.24547387, -0.00177105, 0.00108164, 0.00178069, -0.00000115, 0.00000000],
+		[-6.24556729, -0.00177006, 0.00108106, 0.00177970, -0.00000115, 0.00000000],
+		[-6.24566038, -0.00176908, 0.00108048, 0.00177871, -0.00000115, 0.00000000],
+		[-6.24575314, -0.00176810, 0.00107990, 0.00177772, -0.00000115, 0.00000000],
+		[-6.24584557, -0.00176712, 0.00107931, 0.00177674, -0.00000115, 0.00000000],
+		[-6.24593768, -0.00176614, 0.00107873, 0.00177575, -0.00000115, 0.00000000],
+		[-6.24602946, -0.00176517, 0.00107815, 0.00177477, -0.00000115, 0.00000000],
+		[-6.24612091, -0.00176419, 0.00107757, 0.00177379, -0.00000115, 0.00000000],
+		[-6.24621204, -0.00176321, 0.00107699, 0.00177281, -0.00000115, 0.00000000],
+		[-6.24630285, -0.00176224, 0.00107641, 0.00177183, -0.00000115, 0.00000000],
+		[-6.24639333, -0.00176127, 0.00107584, 0.00177085, -0.00000115, 0.00000000],
+		[-6.24648350, -0.00176029, 0.00107526, 0.00176987, -0.00000115, 0.00000000],
+		[-6.24657334, -0.00175932, 0.00107468, 0.00176889, -0.00000115, 0.00000000],
+		[-6.24666287, -0.00175835, 0.00107410, 0.00176791, -0.00000115, 0.00000000],
+		[-6.24675208, -0.00175738, 0.00107353, 0.00176694, -0.00000115, 0.00000000],
+		[-6.24684097, -0.00175641, 0.00107295, 0.00176596, -0.00000115, 0.00000000],
+		[-6.24692955, -0.00175545, 0.00107238, 0.00176499, -0.00000115, 0.00000000],
+		[-6.24701781, -0.00175448, 0.00107180, 0.00176402, -0.00000115, 0.00000000],
+		[-6.24710576, -0.00175351, 0.00107123, 0.00176305, -0.00000115, 0.00000000],
+		[-6.24719340, -0.00175255, 0.00107065, 0.00176207, -0.00000115, 0.00000000],
+		[-6.24728073, -0.00175158, 0.00107008, 0.00176110, -0.00000115, 0.00000000],
+		[-6.24736775, -0.00175062, 0.00106951, 0.00176014, -0.00000115, 0.00000000],
+		[-6.24745446, -0.00174966, 0.00106893, 0.00175917, -0.00000115, 0.00000000],
+		[-6.24754086, -0.00174870, 0.00106836, 0.00175820, -0.00000115, 0.00000000],
+		[-6.24762695, -0.00174774, 0.00106779, 0.00175724, -0.00000116, 0.00000000],
+		[-6.24771274, -0.00174678, 0.00106722, 0.00175627, -0.00000116, 0.00000000],
+		[-6.24779823, -0.00174582, 0.00106665, 0.00175531, -0.00000116, 0.00000000],
+		[-6.24788341, -0.00174487, 0.00106608, 0.00175434, -0.00000116, 0.00000000],
+		[-6.24796829, -0.00174391, 0.00106551, 0.00175338, -0.00000116, 0.00000000],
+		[-6.24805287, -0.00174296, 0.00106494, 0.00175242, -0.00000116, 0.00000000],
+		[-6.24813715, -0.00174200, 0.00106438, 0.00175146, -0.00000116, 0.00000000],
+		[-6.24822113, -0.00174105, 0.00106381, 0.00175050, -0.00000116, 0.00000000],
+		[-6.24830481, -0.00174010, 0.00106324, 0.00174955, -0.00000116, 0.00000000],
+		[-6.24838819, -0.00173915, 0.00106267, 0.00174859, -0.00000116, 0.00000000],
+		[-6.24847128, -0.00173819, 0.00106211, 0.00174763, -0.00000116, 0.00000000],
+		[-6.24855407, -0.00173725, 0.00106154, 0.00174668, -0.00000116, 0.00000000],
+		[-6.24863657, -0.00173630, 0.00106098, 0.00174572, -0.00000116, 0.00000000],
+		[-6.24871878, -0.00173535, 0.00106041, 0.00174477, -0.00000116, 0.00000000],
+		[-6.24880069, -0.00173440, 0.00105985, 0.00174382, -0.00000116, 0.00000000],
+		[-6.24888231, -0.00173346, 0.00105929, 0.00174287, -0.00000116, 0.00000000],
+		[-6.24896365, -0.00173251, 0.00105872, 0.00174192, -0.00000116, 0.00000000],
+		[-6.24904469, -0.00173157, 0.00105816, 0.00174097, -0.00000116, 0.00000000],
+		[-6.24912545, -0.00173063, 0.00105760, 0.00174002, -0.00000116, 0.00000000],
+		[-6.24920591, -0.00172969, 0.00105704, 0.00173907, -0.00000116, 0.00000000],
+		[-6.24928610, -0.00172875, 0.00105648, 0.00173813, -0.00000116, 0.00000000],
+		[-6.24936599, -0.00172781, 0.00105592, 0.00173718, -0.00000116, 0.00000000],
+		[-6.24944561, -0.00172687, 0.00105536, 0.00173624, -0.00000116, 0.00000000],
+		[-6.24952494, -0.00172593, 0.00105480, 0.00173529, -0.00000116, 0.00000000],
+		[-6.24960399, -0.00172499, 0.00105424, 0.00173435, -0.00000116, 0.00000000],
+		[-6.24968275, -0.00172406, 0.00105368, 0.00173341, -0.00000116, 0.00000000],
+		[-6.24976124, -0.00172312, 0.00105312, 0.00173247, -0.00000116, 0.00000000],
+		[-6.24983945, -0.00172219, 0.00105257, 0.00173153, -0.00000116, 0.00000000],
+		[-6.24991738, -0.00172126, 0.00105201, 0.00173059, -0.00000116, 0.00000000],
+		[-6.24999503, -0.00172032, 0.00105145, 0.00172965, -0.00000116, 0.00000000],
+		[-6.25007241, -0.00171939, 0.00105090, 0.00172871, -0.00000116, 0.00000000],
+		[-6.25014951, -0.00171846, 0.00105034, 0.00172778, -0.00000116, 0.00000000],
+		[-6.25022634, -0.00171753, 0.00104979, 0.00172684, -0.00000116, 0.00000000],
+		[-6.25030289, -0.00171660, 0.00104923, 0.00172591, -0.00000116, 0.00000000],
+		[-6.25037917, -0.00171568, 0.00104868, 0.00172498, -0.00000116, 0.00000000],
+		[-6.25045518, -0.00171475, 0.00104813, 0.00172404, -0.00000116, 0.00000000],
+		[-6.25053092, -0.00171382, 0.00104758, 0.00172311, -0.00000116, 0.00000000],
+		[-6.25060639, -0.00171290, 0.00104702, 0.00172218, -0.00000116, 0.00000000],
+		[-6.25068159, -0.00171198, 0.00104647, 0.00172125, -0.00000116, 0.00000000],
+		[-6.25075652, -0.00171105, 0.00104592, 0.00172032, -0.00000116, 0.00000000],
+		[-6.25083119, -0.00171013, 0.00104537, 0.00171940, -0.00000116, 0.00000000],
+		[-6.25090559, -0.00170921, 0.00104482, 0.00171847, -0.00000116, 0.00000000],
+		[-6.25097972, -0.00170829, 0.00104427, 0.00171754, -0.00000116, 0.00000000],
+		[-6.25105359, -0.00170737, 0.00104372, 0.00171662, -0.00000116, 0.00000000],
+		[-6.25112720, -0.00170645, 0.00104317, 0.00171570, -0.00000116, 0.00000000],
+		[-6.25120055, -0.00170554, 0.00104262, 0.00171477, -0.00000116, 0.00000000],
+		[-6.25127363, -0.00170462, 0.00104208, 0.00171385, -0.00000116, 0.00000000],
+		[-6.25134646, -0.00170370, 0.00104153, 0.00171293, -0.00000116, 0.00000000],
+		[-6.25141902, -0.00170279, 0.00104098, 0.00171201, -0.00000116, 0.00000000],
+		[-6.25149133, -0.00170188, 0.00104044, 0.00171109, -0.00000116, 0.00000000],
+		[-6.25156338, -0.00170096, 0.00103989, 0.00171017, -0.00000116, 0.00000000],
+		[-6.25163517, -0.00170005, 0.00103935, 0.00170926, -0.00000116, 0.00000000],
+		[-6.25170670, -0.00169914, 0.00103880, 0.00170834, -0.00000116, 0.00000000],
+		[-6.25177798, -0.00169823, 0.00103826, 0.00170742, -0.00000116, 0.00000000],
+		[-6.25184901, -0.00169732, 0.00103771, 0.00170651, -0.00000116, 0.00000000],
+		[-6.25191978, -0.00169641, 0.00103717, 0.00170560, -0.00000116, 0.00000000],
+		[-6.25199031, -0.00169551, 0.00103663, 0.00170468, -0.00000116, 0.00000000],
+		[-6.25206057, -0.00169460, 0.00103609, 0.00170377, -0.00000116, 0.00000000],
+		[-6.25213059, -0.00169369, 0.00103555, 0.00170286, -0.00000116, 0.00000000],
+		[-6.25220036, -0.00169279, 0.00103500, 0.00170195, -0.00000116, 0.00000000],
+		[-6.25226988, -0.00169189, 0.00103446, 0.00170104, -0.00000116, 0.00000000],
+		[-6.25233916, -0.00169098, 0.00103392, 0.00170013, -0.00000116, 0.00000000],
+		[-6.25240818, -0.00169008, 0.00103338, 0.00169923, -0.00000116, 0.00000000],
+		[-6.25247696, -0.00168918, 0.00103285, 0.00169832, -0.00000116, 0.00000000],
+		[-6.25254550, -0.00168828, 0.00103231, 0.00169741, -0.00000116, 0.00000000],
+		[-6.25261379, -0.00168738, 0.00103177, 0.00169651, -0.00000116, 0.00000000],
+		[-6.25268183, -0.00168648, 0.00103123, 0.00169560, -0.00000116, 0.00000000],
+		[-6.25274963, -0.00168559, 0.00103069, 0.00169470, -0.00000116, 0.00000000],
+		[-6.25281720, -0.00168469, 0.00103016, 0.00169380, -0.00000116, 0.00000000],
+		[-6.25288452, -0.00168379, 0.00102962, 0.00169290, -0.00000116, 0.00000000],
+		[-6.25295160, -0.00168290, 0.00102909, 0.00169200, -0.00000116, 0.00000000],
+		[-6.25301844, -0.00168200, 0.00102855, 0.00169110, -0.00000116, 0.00000000],
+		[-6.25308504, -0.00168111, 0.00102802, 0.00169020, -0.00000116, 0.00000000],
+		[-6.25315140, -0.00168022, 0.00102748, 0.00168930, -0.00000116, 0.00000000],
+		[-6.25321753, -0.00167933, 0.00102695, 0.00168841, -0.00000116, 0.00000000],
+		[-6.25328342, -0.00167844, 0.00102641, 0.00168751, -0.00000116, 0.00000000],
+		[-6.25334907, -0.00167755, 0.00102588, 0.00168662, -0.00000116, 0.00000000],
+		[-6.25341450, -0.00167666, 0.00102535, 0.00168572, -0.00000116, 0.00000000],
+		[-6.25347968, -0.00167577, 0.00102482, 0.00168483, -0.00000116, 0.00000000],
+		[-6.25354464, -0.00167489, 0.00102429, 0.00168394, -0.00000116, 0.00000000],
+		[-6.25360936, -0.00167400, 0.00102376, 0.00168305, -0.00000116, 0.00000000],
+		[-6.25367385, -0.00167312, 0.00102323, 0.00168216, -0.00000116, 0.00000000],
+		[-6.25373811, -0.00167223, 0.00102270, 0.00168127, -0.00000116, 0.00000000],
+		[-6.25380215, -0.00167135, 0.00102217, 0.00168038, -0.00000116, 0.00000000],
+		[-6.25386595, -0.00167047, 0.00102164, 0.00167949, -0.00000117, 0.00000000],
+		[-6.25392952, -0.00166958, 0.00102111, 0.00167860, -0.00000117, 0.00000000],
+		[-6.25399287, -0.00166870, 0.00102058, 0.00167772, -0.00000117, 0.00000000],
+		[-6.25405599, -0.00166782, 0.00102005, 0.00167683, -0.00000117, 0.00000000],
+		[-6.25411889, -0.00166694, 0.00101953, 0.00167595, -0.00000117, 0.00000000],
+		[-6.25418156, -0.00166607, 0.00101900, 0.00167507, -0.00000117, 0.00000000],
+		[-6.25424401, -0.00166519, 0.00101847, 0.00167418, -0.00000117, 0.00000000],
+		[-6.25430623, -0.00166431, 0.00101795, 0.00167330, -0.00000117, 0.00000000],
+		[-6.25436823, -0.00166344, 0.00101742, 0.00167242, -0.00000117, 0.00000000],
+		[-6.25443001, -0.00166256, 0.00101690, 0.00167154, -0.00000117, 0.00000000],
+		[-6.25449157, -0.00166169, 0.00101638, 0.00167066, -0.00000117, 0.00000000],
+		[-6.25455291, -0.00166082, 0.00101585, 0.00166978, -0.00000117, 0.00000000],
+		[-6.25461403, -0.00165994, 0.00101533, 0.00166891, -0.00000117, 0.00000000],
+		[-6.25467493, -0.00165907, 0.00101481, 0.00166803, -0.00000117, 0.00000000],
+		[-6.25473561, -0.00165820, 0.00101428, 0.00166715, -0.00000117, 0.00000000],
+		[-6.25479608, -0.00165733, 0.00101376, 0.00166628, -0.00000117, 0.00000000],
+		[-6.25485633, -0.00165647, 0.00101324, 0.00166541, -0.00000117, 0.00000000],
+		[-6.25491636, -0.00165560, 0.00101272, 0.00166453, -0.00000117, 0.00000000],
+		[-6.25497618, -0.00165473, 0.00101220, 0.00166366, -0.00000117, 0.00000000],
+		[-6.25503579, -0.00165386, 0.00101168, 0.00166279, -0.00000117, 0.00000000],
+		[-6.25509518, -0.00165300, 0.00101116, 0.00166192, -0.00000117, 0.00000000],
+		[-6.25515436, -0.00165214, 0.00101064, 0.00166105, -0.00000117, 0.00000000],
+		[-6.25521333, -0.00165127, 0.00101012, 0.00166018, -0.00000117, 0.00000000],
+		[-6.25527209, -0.00165041, 0.00100961, 0.00165931, -0.00000117, 0.00000000],
+		[-6.25533063, -0.00164955, 0.00100909, 0.00165845, -0.00000117, 0.00000000],
+		[-6.25538897, -0.00164869, 0.00100857, 0.00165758, -0.00000117, 0.00000000],
+		[-6.25544710, -0.00164783, 0.00100806, 0.00165672, -0.00000117, 0.00000000],
+		[-6.25550502, -0.00164697, 0.00100754, 0.00165585, -0.00000117, 0.00000000],
+		[-6.25556273, -0.00164611, 0.00100702, 0.00165499, -0.00000117, 0.00000000],
+		[-6.25562024, -0.00164525, 0.00100651, 0.00165413, -0.00000117, 0.00000000],
+		[-6.25567754, -0.00164440, 0.00100599, 0.00165326, -0.00000117, 0.00000000],
+		[-6.25573464, -0.00164354, 0.00100548, 0.00165240, -0.00000117, 0.00000000],
+		[-6.25579153, -0.00164268, 0.00100497, 0.00165154, -0.00000117, 0.00000000],
+		[-6.25584821, -0.00164183, 0.00100445, 0.00165068, -0.00000117, 0.00000000],
+		[-6.25590470, -0.00164098, 0.00100394, 0.00164982, -0.00000117, 0.00000000],
+		[-6.25596098, -0.00164012, 0.00100343, 0.00164897, -0.00000117, 0.00000000],
+		[-6.25601706, -0.00163927, 0.00100292, 0.00164811, -0.00000117, 0.00000000],
+		[-6.25607294, -0.00163842, 0.00100241, 0.00164725, -0.00000117, 0.00000000],
+		[-6.25612862, -0.00163757, 0.00100189, 0.00164640, -0.00000117, 0.00000000],
+		[-6.25618410, -0.00163672, 0.00100138, 0.00164554, -0.00000117, 0.00000000],
+		[-6.25623938, -0.00163587, 0.00100087, 0.00164469, -0.00000117, 0.00000000],
+		[-6.25629447, -0.00163503, 0.00100036, 0.00164384, -0.00000117, 0.00000000],
+		[-6.25634936, -0.00163418, 0.00099986, 0.00164299, -0.00000117, 0.00000000],
+		[-6.25640405, -0.00163333, 0.00099935, 0.00164214, -0.00000117, 0.00000000],
+		[-6.25645854, -0.00163249, 0.00099884, 0.00164129, -0.00000117, 0.00000000],
+		[-6.25651284, -0.00163164, 0.00099833, 0.00164044, -0.00000117, 0.00000000],
+		[-6.25656694, -0.00163080, 0.00099782, 0.00163959, -0.00000117, 0.00000000],
+		[-6.25662085, -0.00162996, 0.00099732, 0.00163874, -0.00000117, 0.00000000],
+		[-6.25667457, -0.00162912, 0.00099681, 0.00163789, -0.00000117, 0.00000000],
+		[-6.25672809, -0.00162828, 0.00099631, 0.00163705, -0.00000117, 0.00000000],
+		[-6.25678143, -0.00162744, 0.00099580, 0.00163620, -0.00000117, 0.00000000],
+		[-6.25683457, -0.00162660, 0.00099530, 0.00163536, -0.00000117, 0.00000000],
+		[-6.25688752, -0.00162576, 0.00099479, 0.00163451, -0.00000117, 0.00000000],
+		[-6.25694028, -0.00162492, 0.00099429, 0.00163367, -0.00000117, 0.00000000],
+		[-6.25699285, -0.00162408, 0.00099378, 0.00163283, -0.00000117, 0.00000000],
+		[-6.25704524, -0.00162325, 0.00099328, 0.00163199, -0.00000117, 0.00000000],
+		[-6.25709743, -0.00162241, 0.00099278, 0.00163115, -0.00000117, 0.00000000],
+		[-6.25714944, -0.00162158, 0.00099228, 0.00163031, -0.00000117, 0.00000000],
+		[-6.25720127, -0.00162074, 0.00099177, 0.00162947, -0.00000117, 0.00000000],
+		[-6.25725290, -0.00161991, 0.00099127, 0.00162863, -0.00000117, 0.00000000],
+		[-6.25730435, -0.00161908, 0.00099077, 0.00162780, -0.00000117, 0.00000000],
+		[-6.25735562, -0.00161825, 0.00099027, 0.00162696, -0.00000117, 0.00000000],
+		[-6.25740670, -0.00161742, 0.00098977, 0.00162613, -0.00000117, 0.00000000],
+		[-6.25745761, -0.00161659, 0.00098927, 0.00162529, -0.00000117, 0.00000000],
+		[-6.25750832, -0.00161576, 0.00098877, 0.00162446, -0.00000117, 0.00000000],
+		[-6.25755886, -0.00161493, 0.00098828, 0.00162362, -0.00000117, 0.00000000],
+		[-6.25760921, -0.00161411, 0.00098778, 0.00162279, -0.00000117, 0.00000000],
+		[-6.25765939, -0.00161328, 0.00098728, 0.00162196, -0.00000117, 0.00000000],
+		[-6.25770938, -0.00161245, 0.00098678, 0.00162113, -0.00000117, 0.00000000],
+		[-6.25775920, -0.00161163, 0.00098629, 0.00162030, -0.00000117, 0.00000000],
+		[-6.25780883, -0.00161080, 0.00098579, 0.00161947, -0.00000117, 0.00000000],
+		[-6.25785829, -0.00160998, 0.00098529, 0.00161864, -0.00000117, 0.00000000],
+		[-6.25790757, -0.00160916, 0.00098480, 0.00161782, -0.00000117, 0.00000000],
+		[-6.25795667, -0.00160834, 0.00098430, 0.00161699, -0.00000117, 0.00000000],
+		[-6.25800560, -0.00160752, 0.00098381, 0.00161616, -0.00000117, 0.00000000],
+		[-6.25805435, -0.00160670, 0.00098332, 0.00161534, -0.00000117, 0.00000000],
+		[-6.25810293, -0.00160588, 0.00098282, 0.00161452, -0.00000117, 0.00000000],
+		[-6.25815133, -0.00160506, 0.00098233, 0.00161369, -0.00000117, 0.00000000],
+		[-6.25819956, -0.00160424, 0.00098184, 0.00161287, -0.00000117, 0.00000000],
+		[-6.25824762, -0.00160342, 0.00098134, 0.00161205, -0.00000117, 0.00000000],
+		[-6.25829550, -0.00160261, 0.00098085, 0.00161123, -0.00000117, 0.00000000],
+		[-6.25834321, -0.00160179, 0.00098036, 0.00161041, -0.00000117, 0.00000000],
+		[-6.25839075, -0.00160098, 0.00097987, 0.00160959, -0.00000117, 0.00000000],
+		[-6.25843812, -0.00160017, 0.00097938, 0.00160877, -0.00000117, 0.00000000],
+		[-6.25848532, -0.00159935, 0.00097889, 0.00160795, -0.00000117, 0.00000000],
+		[-6.25853235, -0.00159854, 0.00097840, 0.00160713, -0.00000117, 0.00000000],
+		[-6.25857922, -0.00159773, 0.00097791, 0.00160632, -0.00000117, 0.00000000],
+		[-6.25862591, -0.00159692, 0.00097742, 0.00160550, -0.00000117, 0.00000000],
+		[-6.25867244, -0.00159611, 0.00097693, 0.00160469, -0.00000117, 0.00000000],
+		[-6.25871879, -0.00159530, 0.00097645, 0.00160387, -0.00000117, 0.00000000],
+		[-6.25876499, -0.00159449, 0.00097596, 0.00160306, -0.00000117, 0.00000000],
+		[-6.25881101, -0.00159368, 0.00097547, 0.00160225, -0.00000117, 0.00000000],
+		[-6.25885688, -0.00159288, 0.00097499, 0.00160144, -0.00000117, 0.00000000],
+		[-6.25890257, -0.00159207, 0.00097450, 0.00160063, -0.00000117, 0.00000000],
+		[-6.25894810, -0.00159127, 0.00097402, 0.00159982, -0.00000117, 0.00000000],
+		[-6.25899347, -0.00159046, 0.00097353, 0.00159901, -0.00000117, 0.00000000],
+		[-6.25903868, -0.00158966, 0.00097305, 0.00159820, -0.00000117, 0.00000000],
+		[-6.25908372, -0.00158886, 0.00097256, 0.00159739, -0.00000117, 0.00000000],
+		[-6.25912861, -0.00158805, 0.00097208, 0.00159659, -0.00000117, 0.00000000],
+		[-6.25917333, -0.00158725, 0.00097159, 0.00159578, -0.00000117, 0.00000000],
+		[-6.25921789, -0.00158645, 0.00097111, 0.00159497, -0.00000117, 0.00000000],
+		[-6.25926229, -0.00158565, 0.00097063, 0.00159417, -0.00000117, 0.00000000],
+		[-6.25930653, -0.00158485, 0.00097015, 0.00159337, -0.00000117, 0.00000000],
+		[-6.25935061, -0.00158406, 0.00096966, 0.00159256, -0.00000117, 0.00000000],
+		[-6.25939453, -0.00158326, 0.00096918, 0.00159176, -0.00000117, 0.00000000],
+		[-6.25943830, -0.00158246, 0.00096870, 0.00159096, -0.00000117, 0.00000000],
+		[-6.25948191, -0.00158167, 0.00096822, 0.00159016, -0.00000117, 0.00000000],
+		[-6.25952536, -0.00158087, 0.00096774, 0.00158936, -0.00000117, 0.00000000],
+		[-6.25956866, -0.00158008, 0.00096726, 0.00158856, -0.00000117, 0.00000000],
+		[-6.25961180, -0.00157928, 0.00096678, 0.00158776, -0.00000117, 0.00000000],
+		[-6.25965478, -0.00157849, 0.00096631, 0.00158696, -0.00000117, 0.00000000],
+		[-6.25969761, -0.00157770, 0.00096583, 0.00158617, -0.00000117, 0.00000000],
+		[-6.25974029, -0.00157691, 0.00096535, 0.00158537, -0.00000117, 0.00000000],
+		[-6.25978282, -0.00157612, 0.00096487, 0.00158458, -0.00000117, 0.00000000],
+		[-6.25982519, -0.00157533, 0.00096440, 0.00158378, -0.00000117, 0.00000000],
+		[-6.25986741, -0.00157454, 0.00096392, 0.00158299, -0.00000117, 0.00000000],
+		[-6.25990947, -0.00157375, 0.00096344, 0.00158220, -0.00000117, 0.00000000],
+		[-6.25995139, -0.00157296, 0.00096297, 0.00158140, -0.00000117, 0.00000000],
+		[-6.25999315, -0.00157217, 0.00096249, 0.00158061, -0.00000117, 0.00000000],
+		[-6.26003477, -0.00157139, 0.00096202, 0.00157982, -0.00000117, 0.00000000],
+		[-6.26007624, -0.00157060, 0.00096154, 0.00157903, -0.00000117, 0.00000000],
+		[-6.26011755, -0.00156982, 0.00096107, 0.00157824, -0.00000117, 0.00000000],
+		[-6.26015872, -0.00156903, 0.00096060, 0.00157745, -0.00000117, 0.00000000],
+		[-6.26019974, -0.00156825, 0.00096012, 0.00157667, -0.00000117, 0.00000000],
+		[-6.26024061, -0.00156747, 0.00095965, 0.00157588, -0.00000117, 0.00000000],
+		[-6.26028134, -0.00156669, 0.00095918, 0.00157509, -0.00000117, 0.00000000],
+		[-6.26032192, -0.00156591, 0.00095871, 0.00157431, -0.00000117, 0.00000000],
+		[-6.26036235, -0.00156513, 0.00095823, 0.00157352, -0.00000117, 0.00000000],
+		[-6.26040264, -0.00156435, 0.00095776, 0.00157274, -0.00000117, 0.00000000],
+		[-6.26044279, -0.00156357, 0.00095729, 0.00157195, -0.00000117, 0.00000000],
+		[-6.26048279, -0.00156279, 0.00095682, 0.00157117, -0.00000117, 0.00000000],
+		[-6.26052264, -0.00156201, 0.00095635, 0.00157039, -0.00000117, 0.00000000],
+		[-6.26056235, -0.00156124, 0.00095588, 0.00156961, -0.00000117, 0.00000000],
+		[-6.26060192, -0.00156046, 0.00095542, 0.00156883, -0.00000117, 0.00000000],
+		[-6.26064135, -0.00155969, 0.00095495, 0.00156805, -0.00000117, 0.00000000],
+		[-6.26068064, -0.00155891, 0.00095448, 0.00156727, -0.00000117, 0.00000000],
+		[-6.26071978, -0.00155814, 0.00095401, 0.00156649, -0.00000117, 0.00000000],
+		[-6.26075879, -0.00155737, 0.00095354, 0.00156572, -0.00000117, 0.00000000],
+		[-6.26079765, -0.00155659, 0.00095308, 0.00156494, -0.00000117, 0.00000000],
+		[-6.26083637, -0.00155582, 0.00095261, 0.00156416, -0.00000117, 0.00000000],
+		[-6.26087496, -0.00155505, 0.00095215, 0.00156339, -0.00000117, 0.00000000],
+		[-6.26091341, -0.00155428, 0.00095168, 0.00156261, -0.00000117, 0.00000000],
+		[-6.26095171, -0.00155351, 0.00095122, 0.00156184, -0.00000117, 0.00000000],
+		[-6.26098988, -0.00155274, 0.00095075, 0.00156107, -0.00000117, 0.00000000],
+		[-6.26102792, -0.00155198, 0.00095029, 0.00156029, -0.00000117, 0.00000000],
+		[-6.26106581, -0.00155121, 0.00094982, 0.00155952, -0.00000117, 0.00000000],
+		[-6.26110357, -0.00155044, 0.00094936, 0.00155875, -0.00000117, 0.00000000],
+		[-6.26114120, -0.00154968, 0.00094890, 0.00155798, -0.00000117, 0.00000000],
+		[-6.26117869, -0.00154891, 0.00094843, 0.00155721, -0.00000117, 0.00000000],
+		[-6.26121604, -0.00154815, 0.00094797, 0.00155644, -0.00000117, 0.00000000],
+		[-6.26125326, -0.00154739, 0.00094751, 0.00155568, -0.00000117, 0.00000000],
+		[-6.26129035, -0.00154662, 0.00094705, 0.00155491, -0.00000117, 0.00000000],
+		[-6.26132730, -0.00154586, 0.00094659, 0.00155414, -0.00000117, 0.00000000],
+		[-6.26136412, -0.00154510, 0.00094613, 0.00155338, -0.00000117, 0.00000000],
+		[-6.26140081, -0.00154434, 0.00094567, 0.00155261, -0.00000117, 0.00000000],
+		[-6.26143736, -0.00154358, 0.00094521, 0.00155185, -0.00000117, 0.00000000],
+		[-6.26147379, -0.00154282, 0.00094475, 0.00155109, -0.00000117, 0.00000000],
+		[-6.26151008, -0.00154206, 0.00094429, 0.00155032, -0.00000117, 0.00000000],
+		[-6.26154624, -0.00154131, 0.00094383, 0.00154956, -0.00000117, 0.00000000],
+		[-6.26158228, -0.00154055, 0.00094337, 0.00154880, -0.00000117, 0.00000000],
+		[-6.26161818, -0.00153979, 0.00094292, 0.00154804, -0.00000117, 0.00000000],
+		[-6.26165395, -0.00153904, 0.00094246, 0.00154728, -0.00000117, 0.00000000],
+		[-6.26168960, -0.00153828, 0.00094200, 0.00154652, -0.00000117, 0.00000000],
+		[-6.26172512, -0.00153753, 0.00094155, 0.00154576, -0.00000117, 0.00000000],
+		[-6.26176051, -0.00153677, 0.00094109, 0.00154500, -0.00000117, 0.00000000],
+		[-6.26179577, -0.00153602, 0.00094063, 0.00154425, -0.00000117, 0.00000000],
+		[-6.26183090, -0.00153527, 0.00094018, 0.00154349, -0.00000117, 0.00000000],
+		[-6.26186591, -0.00153452, 0.00093972, 0.00154273, -0.00000117, 0.00000000],
+		[-6.26190080, -0.00153377, 0.00093927, 0.00154198, -0.00000117, 0.00000000],
+		[-6.26193555, -0.00153302, 0.00093882, 0.00154123, -0.00000117, 0.00000000],
+		[-6.26197019, -0.00153227, 0.00093836, 0.00154047, -0.00000117, 0.00000000],
+		[-6.26200470, -0.00153152, 0.00093791, 0.00153972, -0.00000117, 0.00000000],
+		[-6.26203908, -0.00153077, 0.00093746, 0.00153897, -0.00000117, 0.00000000],
+		[-6.26207334, -0.00153003, 0.00093700, 0.00153822, -0.00000118, 0.00000000],
+		[-6.26210748, -0.00152928, 0.00093655, 0.00153746, -0.00000118, 0.00000000],
+		[-6.26214149, -0.00152853, 0.00093610, 0.00153671, -0.00000118, 0.00000000],
+		[-6.26217539, -0.00152779, 0.00093565, 0.00153597, -0.00000118, 0.00000000],
+		[-6.26220916, -0.00152705, 0.00093520, 0.00153522, -0.00000118, 0.00000000],
+		[-6.26224280, -0.00152630, 0.00093475, 0.00153447, -0.00000118, 0.00000000],
+		[-6.26227633, -0.00152556, 0.00093430, 0.00153372, -0.00000118, 0.00000000],
+		[-6.26230974, -0.00152482, 0.00093385, 0.00153298, -0.00000118, 0.00000000],
+		[-6.26234303, -0.00152408, 0.00093340, 0.00153223, -0.00000118, 0.00000000],
+		[-6.26237620, -0.00152333, 0.00093295, 0.00153148, -0.00000118, 0.00000000],
+		[-6.26240924, -0.00152259, 0.00093250, 0.00153074, -0.00000118, 0.00000000],
+		[-6.26244217, -0.00152186, 0.00093205, 0.00153000, -0.00000118, 0.00000000],
+		[-6.26247499, -0.00152112, 0.00093161, 0.00152925, -0.00000118, 0.00000000],
+		[-6.26250768, -0.00152038, 0.00093116, 0.00152851, -0.00000118, 0.00000000],
+		[-6.26254025, -0.00151964, 0.00093071, 0.00152777, -0.00000118, 0.00000000],
+		[-6.26257271, -0.00151890, 0.00093027, 0.00152703, -0.00000118, 0.00000000],
+		[-6.26260505, -0.00151817, 0.00092982, 0.00152629, -0.00000118, 0.00000000],
+		[-6.26263728, -0.00151743, 0.00092937, 0.00152555, -0.00000118, 0.00000000],
+		[-6.26266939, -0.00151670, 0.00092893, 0.00152481, -0.00000118, 0.00000000],
+		[-6.26270138, -0.00151596, 0.00092848, 0.00152407, -0.00000118, 0.00000000],
+		[-6.26273326, -0.00151523, 0.00092804, 0.00152333, -0.00000118, 0.00000000],
+		[-6.26276503, -0.00151450, 0.00092760, 0.00152260, -0.00000118, 0.00000000],
+		[-6.26279668, -0.00151377, 0.00092715, 0.00152186, -0.00000118, 0.00000000],
+		[-6.26282822, -0.00151304, 0.00092671, 0.00152113, -0.00000118, 0.00000000],
+		[-6.26285964, -0.00151231, 0.00092627, 0.00152039, -0.00000118, 0.00000000],
+		[-6.26289095, -0.00151158, 0.00092582, 0.00151966, -0.00000118, 0.00000000],
+		[-6.26292215, -0.00151085, 0.00092538, 0.00151892, -0.00000118, 0.00000000],
+		[-6.26295323, -0.00151012, 0.00092494, 0.00151819, -0.00000118, 0.00000000],
+		[-6.26298421, -0.00150939, 0.00092450, 0.00151746, -0.00000118, 0.00000000],
+		[-6.26301507, -0.00150866, 0.00092406, 0.00151673, -0.00000118, 0.00000000],
+		[-6.26304582, -0.00150794, 0.00092362, 0.00151600, -0.00000118, 0.00000000],
+		[-6.26307646, -0.00150721, 0.00092318, 0.00151527, -0.00000118, 0.00000000],
+		[-6.26310699, -0.00150649, 0.00092274, 0.00151454, -0.00000118, 0.00000000],
+		[-6.26313741, -0.00150576, 0.00092230, 0.00151381, -0.00000118, 0.00000000],
+		[-6.26316772, -0.00150504, 0.00092186, 0.00151308, -0.00000118, 0.00000000],
+		[-6.26319793, -0.00150431, 0.00092142, 0.00151235, -0.00000118, 0.00000000],
+		[-6.26322802, -0.00150359, 0.00092098, 0.00151163, -0.00000118, 0.00000000],
+		[-6.26325801, -0.00150287, 0.00092055, 0.00151090, -0.00000118, 0.00000000],
+		[-6.26328788, -0.00150215, 0.00092011, 0.00151018, -0.00000118, 0.00000000],
+		[-6.26331765, -0.00150143, 0.00091967, 0.00150945, -0.00000118, 0.00000000],
+		[-6.26334732, -0.00150071, 0.00091924, 0.00150873, -0.00000118, 0.00000000],
+		[-6.26337687, -0.00149999, 0.00091880, 0.00150800, -0.00000118, 0.00000000],
+		[-6.26340633, -0.00149927, 0.00091836, 0.00150728, -0.00000118, 0.00000000],
+		[-6.26343567, -0.00149855, 0.00091793, 0.00150656, -0.00000118, 0.00000000],
+		[-6.26346491, -0.00149784, 0.00091749, 0.00150584, -0.00000118, 0.00000000],
+		[-6.26349404, -0.00149712, 0.00091706, 0.00150512, -0.00000118, 0.00000000],
+		[-6.26352307, -0.00149640, 0.00091662, 0.00150440, -0.00000118, 0.00000000],
+		[-6.26355200, -0.00149569, 0.00091619, 0.00150368, -0.00000118, 0.00000000],
+		[-6.26358082, -0.00149498, 0.00091576, 0.00150296, -0.00000118, 0.00000000],
+		[-6.26360954, -0.00149426, 0.00091532, 0.00150224, -0.00000118, 0.00000000],
+		[-6.26363815, -0.00149355, 0.00091489, 0.00150152, -0.00000118, 0.00000000],
+		[-6.26366666, -0.00149284, 0.00091446, 0.00150081, -0.00000118, 0.00000000],
+		[-6.26369507, -0.00149212, 0.00091403, 0.00150009, -0.00000118, 0.00000000],
+		[-6.26372338, -0.00149141, 0.00091359, 0.00149938, -0.00000118, 0.00000000],
+		[-6.26375159, -0.00149070, 0.00091316, 0.00149866, -0.00000118, 0.00000000],
+		[-6.26377969, -0.00148999, 0.00091273, 0.00149795, -0.00000118, 0.00000000],
+		[-6.26380769, -0.00148928, 0.00091230, 0.00149723, -0.00000118, 0.00000000],
+		[-6.26383560, -0.00148857, 0.00091187, 0.00149652, -0.00000118, 0.00000000],
+		[-6.26386340, -0.00148787, 0.00091144, 0.00149581, -0.00000118, 0.00000000],
+		[-6.26389110, -0.00148716, 0.00091101, 0.00149510, -0.00000118, 0.00000000],
+		[-6.26391870, -0.00148645, 0.00091058, 0.00149439, -0.00000118, 0.00000000],
+		[-6.26394621, -0.00148575, 0.00091016, 0.00149368, -0.00000118, 0.00000000],
+		[-6.26397361, -0.00148504, 0.00090973, 0.00149297, -0.00000118, 0.00000000],
+		[-6.26400092, -0.00148434, 0.00090930, 0.00149226, -0.00000118, 0.00000000],
+		[-6.26402813, -0.00148363, 0.00090887, 0.00149155, -0.00000118, 0.00000000],
+		[-6.26405524, -0.00148293, 0.00090844, 0.00149084, -0.00000118, 0.00000000],
+		[-6.26408225, -0.00148223, 0.00090802, 0.00149014, -0.00000118, 0.00000000],
+		[-6.26410916, -0.00148152, 0.00090759, 0.00148943, -0.00000118, 0.00000000],
+		[-6.26413598, -0.00148082, 0.00090717, 0.00148872, -0.00000118, 0.00000000],
+		[-6.26416271, -0.00148012, 0.00090674, 0.00148802, -0.00000118, 0.00000000],
+		[-6.26418933, -0.00147942, 0.00090631, 0.00148732, -0.00000118, 0.00000000],
+		[-6.26421586, -0.00147872, 0.00090589, 0.00148661, -0.00000118, 0.00000000],
+		[-6.26424230, -0.00147802, 0.00090547, 0.00148591, -0.00000118, 0.00000000],
+		[-6.26426864, -0.00147733, 0.00090504, 0.00148521, -0.00000118, 0.00000000],
+		[-6.26429489, -0.00147663, 0.00090462, 0.00148450, -0.00000118, 0.00000000],
+		[-6.26432104, -0.00147593, 0.00090419, 0.00148380, -0.00000118, 0.00000000],
+		[-6.26434710, -0.00147523, 0.00090377, 0.00148310, -0.00000118, 0.00000000],
+		[-6.26437306, -0.00147454, 0.00090335, 0.00148240, -0.00000118, 0.00000000],
+		[-6.26439893, -0.00147384, 0.00090293, 0.00148170, -0.00000118, 0.00000000],
+		[-6.26442471, -0.00147315, 0.00090250, 0.00148101, -0.00000118, 0.00000000],
+		[-6.26445040, -0.00147246, 0.00090208, 0.00148031, -0.00000118, 0.00000000],
+		[-6.26447599, -0.00147176, 0.00090166, 0.00147961, -0.00000118, 0.00000000],
+		[-6.26450150, -0.00147107, 0.00090124, 0.00147891, -0.00000118, 0.00000000],
+		[-6.26452691, -0.00147038, 0.00090082, 0.00147822, -0.00000118, 0.00000000],
+		[-6.26455222, -0.00146969, 0.00090040, 0.00147752, -0.00000118, 0.00000000],
+		[-6.26457745, -0.00146900, 0.00089998, 0.00147683, -0.00000118, 0.00000000],
+		[-6.26460259, -0.00146831, 0.00089956, 0.00147613, -0.00000118, 0.00000000],
+		[-6.26462764, -0.00146762, 0.00089914, 0.00147544, -0.00000118, 0.00000000],
+		[-6.26465259, -0.00146693, 0.00089872, 0.00147475, -0.00000118, 0.00000000],
+		[-6.26467746, -0.00146624, 0.00089831, 0.00147406, -0.00000118, 0.00000000],
+		[-6.26470224, -0.00146555, 0.00089789, 0.00147336, -0.00000118, 0.00000000],
+		[-6.26472693, -0.00146486, 0.00089747, 0.00147267, -0.00000118, 0.00000000],
+		[-6.26475153, -0.00146418, 0.00089705, 0.00147198, -0.00000118, 0.00000000],
+		[-6.26477604, -0.00146349, 0.00089664, 0.00147129, -0.00000118, 0.00000000],
+		[-6.26480047, -0.00146281, 0.00089622, 0.00147060, -0.00000118, 0.00000000],
+		[-6.26482481, -0.00146212, 0.00089580, 0.00146992, -0.00000118, 0.00000000],
+		[-6.26484906, -0.00146144, 0.00089539, 0.00146923, -0.00000118, 0.00000000],
+		[-6.26487322, -0.00146076, 0.00089497, 0.00146854, -0.00000118, 0.00000000],
+		[-6.26489730, -0.00146007, 0.00089456, 0.00146785, -0.00000118, 0.00000000],
+		[-6.26492129, -0.00145939, 0.00089414, 0.00146717, -0.00000118, 0.00000000],
+		[-6.26494519, -0.00145871, 0.00089373, 0.00146648, -0.00000118, 0.00000000],
+		[-6.26496901, -0.00145803, 0.00089332, 0.00146580, -0.00000118, 0.00000000],
+		[-6.26499274, -0.00145735, 0.00089290, 0.00146511, -0.00000118, 0.00000000],
+		[-6.26501639, -0.00145667, 0.00089249, 0.00146443, -0.00000118, 0.00000000],
+		[-6.26503995, -0.00145599, 0.00089208, 0.00146375, -0.00000118, 0.00000000],
+		[-6.26506343, -0.00145531, 0.00089166, 0.00146307, -0.00000118, 0.00000000],
+		[-6.26508682, -0.00145463, 0.00089125, 0.00146238, -0.00000118, 0.00000000],
+		[-6.26511013, -0.00145396, 0.00089084, 0.00146170, -0.00000118, 0.00000000],
+		[-6.26513336, -0.00145328, 0.00089043, 0.00146102, -0.00000118, 0.00000000],
+		[-6.26515650, -0.00145261, 0.00089002, 0.00146034, -0.00000118, 0.00000000],
+		[-6.26517956, -0.00145193, 0.00088961, 0.00145966, -0.00000118, 0.00000000],
+		[-6.26520254, -0.00145126, 0.00088920, 0.00145898, -0.00000118, 0.00000000],
+		[-6.26522543, -0.00145058, 0.00088879, 0.00145831, -0.00000118, 0.00000000],
+		[-6.26524824, -0.00144991, 0.00088838, 0.00145763, -0.00000118, 0.00000000],
+		[-6.26527098, -0.00144924, 0.00088797, 0.00145695, -0.00000118, 0.00000000],
+		[-6.26529363, -0.00144856, 0.00088756, 0.00145628, -0.00000118, 0.00000000],
+		[-6.26531619, -0.00144789, 0.00088715, 0.00145560, -0.00000118, 0.00000000],
+		[-6.26533868, -0.00144722, 0.00088674, 0.00145493, -0.00000118, 0.00000000],
+		[-6.26536109, -0.00144655, 0.00088634, 0.00145425, -0.00000118, 0.00000000],
+		[-6.26538341, -0.00144588, 0.00088593, 0.00145358, -0.00000118, 0.00000000],
+		[-6.26540566, -0.00144521, 0.00088552, 0.00145291, -0.00000118, 0.00000000],
+		[-6.26542783, -0.00144454, 0.00088511, 0.00145223, -0.00000118, 0.00000000],
+		[-6.26544992, -0.00144387, 0.00088471, 0.00145156, -0.00000118, 0.00000000],
+		[-6.26547192, -0.00144321, 0.00088430, 0.00145089, -0.00000118, 0.00000000],
+		[-6.26549385, -0.00144254, 0.00088390, 0.00145022, -0.00000118, 0.00000000],
+		[-6.26551570, -0.00144187, 0.00088349, 0.00144955, -0.00000118, 0.00000000],
+		[-6.26553748, -0.00144121, 0.00088309, 0.00144888, -0.00000118, 0.00000000],
+		[-6.26555917, -0.00144054, 0.00088268, 0.00144821, -0.00000118, 0.00000000],
+		[-6.26558079, -0.00143988, 0.00088228, 0.00144754, -0.00000118, 0.00000000],
+		[-6.26560233, -0.00143922, 0.00088187, 0.00144687, -0.00000118, 0.00000000],
+		[-6.26562379, -0.00143855, 0.00088147, 0.00144621, -0.00000118, 0.00000000],
+		[-6.26564518, -0.00143789, 0.00088107, 0.00144554, -0.00000118, 0.00000000],
+		[-6.26566648, -0.00143723, 0.00088066, 0.00144488, -0.00000118, 0.00000000],
+		[-6.26568772, -0.00143657, 0.00088026, 0.00144421, -0.00000118, 0.00000000],
+		[-6.26570887, -0.00143590, 0.00087986, 0.00144355, -0.00000118, 0.00000000],
+		[-6.26572995, -0.00143524, 0.00087946, 0.00144288, -0.00000118, 0.00000000],
+		[-6.26575096, -0.00143458, 0.00087906, 0.00144222, -0.00000118, 0.00000000],
+		[-6.26577189, -0.00143393, 0.00087865, 0.00144155, -0.00000118, 0.00000000],
+		[-6.26579274, -0.00143327, 0.00087825, 0.00144089, -0.00000118, 0.00000000],
+		[-6.26581352, -0.00143261, 0.00087785, 0.00144023, -0.00000118, 0.00000000],
+		[-6.26583423, -0.00143195, 0.00087745, 0.00143957, -0.00000118, 0.00000000],
+		[-6.26585486, -0.00143130, 0.00087705, 0.00143891, -0.00000118, 0.00000000],
+		[-6.26587542, -0.00143064, 0.00087665, 0.00143825, -0.00000118, 0.00000000],
+		[-6.26589591, -0.00142998, 0.00087626, 0.00143759, -0.00000118, 0.00000000],
+		[-6.26591632, -0.00142933, 0.00087586, 0.00143693, -0.00000118, 0.00000000],
+		[-6.26593666, -0.00142867, 0.00087546, 0.00143627, -0.00000118, 0.00000000],
+		[-6.26595692, -0.00142802, 0.00087506, 0.00143562, -0.00000118, 0.00000000],
+		[-6.26597711, -0.00142737, 0.00087466, 0.00143496, -0.00000118, 0.00000000],
+		[-6.26599724, -0.00142671, 0.00087426, 0.00143430, -0.00000118, 0.00000000],
+		[-6.26601728, -0.00142606, 0.00087387, 0.00143365, -0.00000118, 0.00000000],
+		[-6.26603726, -0.00142541, 0.00087347, 0.00143299, -0.00000118, 0.00000000],
+		[-6.26605717, -0.00142476, 0.00087307, 0.00143234, -0.00000118, 0.00000000],
+		[-6.26607700, -0.00142411, 0.00087268, 0.00143168, -0.00000118, 0.00000000],
+		[-6.26609676, -0.00142346, 0.00087228, 0.00143103, -0.00000118, 0.00000000],
+		[-6.26611646, -0.00142281, 0.00087189, 0.00143038, -0.00000118, 0.00000000],
+		[-6.26613608, -0.00142216, 0.00087149, 0.00142972, -0.00000118, 0.00000000],
+		[-6.26615563, -0.00142151, 0.00087110, 0.00142907, -0.00000118, 0.00000000],
+		[-6.26617512, -0.00142087, 0.00087070, 0.00142842, -0.00000118, 0.00000000],
+		[-6.26619453, -0.00142022, 0.00087031, 0.00142777, -0.00000118, 0.00000000],
+		[-6.26621387, -0.00141957, 0.00086992, 0.00142712, -0.00000118, 0.00000000],
+		[-6.26623315, -0.00141893, 0.00086952, 0.00142647, -0.00000118, 0.00000000],
+		[-6.26625235, -0.00141828, 0.00086913, 0.00142582, -0.00000118, 0.00000000],
+		[-6.26627149, -0.00141764, 0.00086874, 0.00142517, -0.00000118, 0.00000000],
+		[-6.26629056, -0.00141699, 0.00086835, 0.00142452, -0.00000118, 0.00000000],
+		[-6.26630956, -0.00141635, 0.00086795, 0.00142388, -0.00000118, 0.00000000],
+		[-6.26632849, -0.00141571, 0.00086756, 0.00142323, -0.00000118, 0.00000000],
+		[-6.26634735, -0.00141506, 0.00086717, 0.00142258, -0.00000118, 0.00000000],
+		[-6.26636615, -0.00141442, 0.00086678, 0.00142194, -0.00000118, 0.00000000],
+		[-6.26638488, -0.00141378, 0.00086639, 0.00142129, -0.00000118, 0.00000000],
+		[-6.26640355, -0.00141314, 0.00086600, 0.00142065, -0.00000118, 0.00000000],
+		[-6.26642214, -0.00141250, 0.00086561, 0.00142001, -0.00000118, 0.00000000],
+		[-6.26644067, -0.00141186, 0.00086522, 0.00141936, -0.00000118, 0.00000000],
+		[-6.26645914, -0.00141122, 0.00086483, 0.00141872, -0.00000118, 0.00000000],
+		[-6.26647754, -0.00141058, 0.00086444, 0.00141808, -0.00000118, 0.00000000],
+		[-6.26649587, -0.00140995, 0.00086405, 0.00141744, -0.00000118, 0.00000000],
+		[-6.26651414, -0.00140931, 0.00086366, 0.00141680, -0.00000118, 0.00000000],
+		[-6.26653234, -0.00140867, 0.00086328, 0.00141616, -0.00000118, 0.00000000],
+		[-6.26655048, -0.00140804, 0.00086289, 0.00141552, -0.00000118, 0.00000000],
+		[-6.26656855, -0.00140740, 0.00086250, 0.00141488, -0.00000118, 0.00000000],
+		[-6.26658656, -0.00140677, 0.00086211, 0.00141424, -0.00000118, 0.00000000],
+		[-6.26660450, -0.00140613, 0.00086173, 0.00141360, -0.00000118, 0.00000000],
+		[-6.26662238, -0.00140550, 0.00086134, 0.00141296, -0.00000118, 0.00000000],
+		[-6.26664020, -0.00140486, 0.00086096, 0.00141233, -0.00000118, 0.00000000],
+		[-6.26665795, -0.00140423, 0.00086057, 0.00141169, -0.00000118, 0.00000000],
+		[-6.26667564, -0.00140360, 0.00086018, 0.00141105, -0.00000118, 0.00000000],
+		[-6.26669326, -0.00140297, 0.00085980, 0.00141042, -0.00000118, 0.00000000],
+		[-6.26671083, -0.00140234, 0.00085942, 0.00140978, -0.00000118, 0.00000000],
+		[-6.26672833, -0.00140171, 0.00085903, 0.00140915, -0.00000118, 0.00000000],
+		[-6.26674577, -0.00140108, 0.00085865, 0.00140852, -0.00000118, 0.00000000],
+		[-6.26676314, -0.00140045, 0.00085826, 0.00140788, -0.00000118, 0.00000000],
+		[-6.26678046, -0.00139982, 0.00085788, 0.00140725, -0.00000118, 0.00000000],
+		[-6.26679771, -0.00139919, 0.00085750, 0.00140662, -0.00000118, 0.00000000],
+		[-6.26681490, -0.00139856, 0.00085711, 0.00140599, -0.00000118, 0.00000000],
+		[-6.26683203, -0.00139793, 0.00085673, 0.00140536, -0.00000118, 0.00000000],
+		[-6.26684910, -0.00139731, 0.00085635, 0.00140472, -0.00000118, 0.00000000],
+		[-6.26686611, -0.00139668, 0.00085597, 0.00140409, -0.00000118, 0.00000000],
+		[-6.26688306, -0.00139605, 0.00085559, 0.00140347, -0.00000118, 0.00000000],
+		[-6.26689994, -0.00139543, 0.00085521, 0.00140284, -0.00000118, 0.00000000],
+		[-6.26691677, -0.00139481, 0.00085482, 0.00140221, -0.00000118, 0.00000000],
+		[-6.26693354, -0.00139418, 0.00085444, 0.00140158, -0.00000118, 0.00000000],
+		[-6.26695024, -0.00139356, 0.00085406, 0.00140095, -0.00000118, 0.00000000],
+		[-6.26696689, -0.00139293, 0.00085368, 0.00140033, -0.00000118, 0.00000000],
+		[-6.26698348, -0.00139231, 0.00085331, 0.00139970, -0.00000118, 0.00000000],
+		[-6.26700001, -0.00139169, 0.00085293, 0.00139908, -0.00000118, 0.00000000],
+		[-6.26701648, -0.00139107, 0.00085255, 0.00139845, -0.00000118, 0.00000000],
+		[-6.26703289, -0.00139045, 0.00085217, 0.00139783, -0.00000118, 0.00000000],
+		[-6.26704925, -0.00138983, 0.00085179, 0.00139720, -0.00000118, 0.00000000],
+		[-6.26706554, -0.00138921, 0.00085141, 0.00139658, -0.00000118, 0.00000000],
+		[-6.26708178, -0.00138859, 0.00085104, 0.00139596, -0.00000118, 0.00000000],
+		[-6.26709796, -0.00138797, 0.00085066, 0.00139534, -0.00000118, 0.00000000],
+		[-6.26711408, -0.00138735, 0.00085028, 0.00139471, -0.00000118, 0.00000000],
+		[-6.26713015, -0.00138674, 0.00084990, 0.00139409, -0.00000118, 0.00000000],
+		[-6.26714616, -0.00138612, 0.00084953, 0.00139347, -0.00000118, 0.00000000],
+		[-6.26716211, -0.00138550, 0.00084915, 0.00139285, -0.00000118, 0.00000000],
+		[-6.26717800, -0.00138489, 0.00084878, 0.00139223, -0.00000118, 0.00000000],
+		[-6.26719384, -0.00138427, 0.00084840, 0.00139161, -0.00000118, 0.00000000],
+		[-6.26720962, -0.00138366, 0.00084803, 0.00139100, -0.00000118, 0.00000000],
+		[-6.26722535, -0.00138304, 0.00084765, 0.00139038, -0.00000118, 0.00000000],
+		[-6.26724102, -0.00138243, 0.00084728, 0.00138976, -0.00000118, 0.00000000],
+		[-6.26725663, -0.00138181, 0.00084690, 0.00138914, -0.00000118, 0.00000000],
+		[-6.26727219, -0.00138120, 0.00084653, 0.00138853, -0.00000118, 0.00000000],
+		[-6.26728769, -0.00138059, 0.00084616, 0.00138791, -0.00000118, 0.00000000],
+		[-6.26730314, -0.00137998, 0.00084578, 0.00138730, -0.00000118, 0.00000000],
+		[-6.26731854, -0.00137937, 0.00084541, 0.00138668, -0.00000118, 0.00000000],
+		[-6.26733388, -0.00137876, 0.00084504, 0.00138607, -0.00000118, 0.00000000],
+		[-6.26734916, -0.00137815, 0.00084467, 0.00138545, -0.00000118, 0.00000000],
+		[-6.26736439, -0.00137754, 0.00084429, 0.00138484, -0.00000118, 0.00000000],
+		[-6.26737957, -0.00137693, 0.00084392, 0.00138423, -0.00000118, 0.00000000],
+		[-6.26739469, -0.00137632, 0.00084355, 0.00138362, -0.00000118, 0.00000000],
+		[-6.26740976, -0.00137571, 0.00084318, 0.00138301, -0.00000118, 0.00000000],
+		[-6.26742477, -0.00137510, 0.00084281, 0.00138239, -0.00000118, 0.00000000],
+		[-6.26743974, -0.00137450, 0.00084244, 0.00138178, -0.00000118, 0.00000000],
+		[-6.26745464, -0.00137389, 0.00084207, 0.00138117, -0.00000118, 0.00000000],
+		[-6.26746950, -0.00137328, 0.00084170, 0.00138056, -0.00000118, 0.00000000],
+		[-6.26748430, -0.00137268, 0.00084133, 0.00137996, -0.00000117, 0.00000000],
+		[-6.26749906, -0.00137207, 0.00084096, 0.00137935, -0.00000117, 0.00000000],
+		[-6.26751375, -0.00137147, 0.00084059, 0.00137874, -0.00000117, 0.00000000],
+		[-6.26752840, -0.00137087, 0.00084022, 0.00137813, -0.00000117, 0.00000000],
+		[-6.26754300, -0.00137026, 0.00083986, 0.00137753, -0.00000117, 0.00000000],
+		[-6.26755754, -0.00136966, 0.00083949, 0.00137692, -0.00000117, 0.00000000],
+		[-6.26757203, -0.00136906, 0.00083912, 0.00137631, -0.00000117, 0.00000000],
+		[-6.26758647, -0.00136846, 0.00083875, 0.00137571, -0.00000117, 0.00000000],
+		[-6.26760086, -0.00136786, 0.00083839, 0.00137510, -0.00000117, 0.00000000],
+		[-6.26761520, -0.00136725, 0.00083802, 0.00137450, -0.00000117, 0.00000000],
+		[-6.26762949, -0.00136665, 0.00083765, 0.00137390, -0.00000117, 0.00000000],
+		[-6.26764372, -0.00136605, 0.00083729, 0.00137329, -0.00000117, 0.00000000],
+		[-6.26765791, -0.00136546, 0.00083692, 0.00137269, -0.00000117, 0.00000000],
+		[-6.26767205, -0.00136486, 0.00083656, 0.00137209, -0.00000117, 0.00000000],
+		[-6.26768613, -0.00136426, 0.00083619, 0.00137149, -0.00000117, 0.00000000],
+		[-6.26770017, -0.00136366, 0.00083583, 0.00137089, -0.00000117, 0.00000000],
+		[-6.26771416, -0.00136306, 0.00083546, 0.00137029, -0.00000117, 0.00000000],
+		[-6.26772809, -0.00136247, 0.00083510, 0.00136969, -0.00000117, 0.00000000],
+		[-6.26774198, -0.00136187, 0.00083474, 0.00136909, -0.00000117, 0.00000000],
+		[-6.26775582, -0.00136128, 0.00083437, 0.00136849, -0.00000117, 0.00000000],
+		[-6.26776961, -0.00136068, 0.00083401, 0.00136789, -0.00000117, 0.00000000],
+		[-6.26778335, -0.00136009, 0.00083365, 0.00136729, -0.00000117, 0.00000000],
+		[-6.26779704, -0.00135949, 0.00083328, 0.00136669, -0.00000117, 0.00000000],
+		[-6.26781069, -0.00135890, 0.00083292, 0.00136610, -0.00000117, 0.00000000],
+		[-6.26782428, -0.00135831, 0.00083256, 0.00136550, -0.00000117, 0.00000000],
+		[-6.26783783, -0.00135771, 0.00083220, 0.00136490, -0.00000117, 0.00000000],
+		[-6.26785133, -0.00135712, 0.00083184, 0.00136431, -0.00000117, 0.00000000],
+		[-6.26786479, -0.00135653, 0.00083148, 0.00136371, -0.00000117, 0.00000000],
+		[-6.26787819, -0.00135594, 0.00083111, 0.00136312, -0.00000117, 0.00000000],
+		[-6.26789155, -0.00135535, 0.00083075, 0.00136253, -0.00000117, 0.00000000],
+		[-6.26790486, -0.00135476, 0.00083039, 0.00136193, -0.00000117, 0.00000000],
+		[-6.26791812, -0.00135417, 0.00083003, 0.00136134, -0.00000117, 0.00000000],
+		[-6.26793134, -0.00135358, 0.00082967, 0.00136075, -0.00000117, 0.00000000],
+		[-6.26794451, -0.00135299, 0.00082931, 0.00136016, -0.00000117, 0.00000000],
+		[-6.26795764, -0.00135240, 0.00082896, 0.00135956, -0.00000117, 0.00000000],
+		[-6.26797071, -0.00135182, 0.00082860, 0.00135897, -0.00000117, 0.00000000],
+		[-6.26798374, -0.00135123, 0.00082824, 0.00135838, -0.00000117, 0.00000000],
+		[-6.26799673, -0.00135064, 0.00082788, 0.00135779, -0.00000117, 0.00000000],
+		[-6.26800967, -0.00135006, 0.00082752, 0.00135720, -0.00000117, 0.00000000],
+		[-6.26802256, -0.00134947, 0.00082717, 0.00135662, -0.00000117, 0.00000000],
+		[-6.26803541, -0.00134889, 0.00082681, 0.00135603, -0.00000117, 0.00000000],
+		[-6.26804822, -0.00134830, 0.00082645, 0.00135544, -0.00000117, 0.00000000],
+		[-6.26806098, -0.00134772, 0.00082609, 0.00135485, -0.00000117, 0.00000000],
+		[-6.26807369, -0.00134713, 0.00082574, 0.00135427, -0.00000117, 0.00000000],
+		[-6.26808636, -0.00134655, 0.00082538, 0.00135368, -0.00000117, 0.00000000],
+		[-6.26809898, -0.00134597, 0.00082503, 0.00135309, -0.00000117, 0.00000000],
+		[-6.26811156, -0.00134539, 0.00082467, 0.00135251, -0.00000117, 0.00000000],
+		[-6.26812410, -0.00134481, 0.00082432, 0.00135192, -0.00000117, 0.00000000],
+		[-6.26813659, -0.00134422, 0.00082396, 0.00135134, -0.00000117, 0.00000000],
+		[-6.26814904, -0.00134364, 0.00082361, 0.00135075, -0.00000117, 0.00000000],
+		[-6.26816144, -0.00134306, 0.00082325, 0.00135017, -0.00000117, 0.00000000],
+		[-6.26817380, -0.00134248, 0.00082290, 0.00134959, -0.00000117, 0.00000000],
+		[-6.26818612, -0.00134191, 0.00082255, 0.00134901, -0.00000117, 0.00000000],
+		[-6.26819839, -0.00134133, 0.00082219, 0.00134842, -0.00000117, 0.00000000],
+		[-6.26821062, -0.00134075, 0.00082184, 0.00134784, -0.00000117, 0.00000000],
+		[-6.26822281, -0.00134017, 0.00082149, 0.00134726, -0.00000117, 0.00000000],
+		[-6.26823495, -0.00133959, 0.00082113, 0.00134668, -0.00000117, 0.00000000],
+		[-6.26824705, -0.00133902, 0.00082078, 0.00134610, -0.00000117, 0.00000000],
+		[-6.26825911, -0.00133844, 0.00082043, 0.00134552, -0.00000117, 0.00000000],
+		[-6.26827113, -0.00133787, 0.00082008, 0.00134494, -0.00000117, 0.00000000],
+		[-6.26828310, -0.00133729, 0.00081973, 0.00134437, -0.00000117, 0.00000000],
+		[-6.26829504, -0.00133672, 0.00081938, 0.00134379, -0.00000117, 0.00000000],
+		[-6.26830693, -0.00133614, 0.00081902, 0.00134321, -0.00000117, 0.00000000],
+		[-6.26831878, -0.00133557, 0.00081867, 0.00134263, -0.00000117, 0.00000000],
+		[-6.26833058, -0.00133499, 0.00081832, 0.00134206, -0.00000117, 0.00000000],
+		[-6.26834235, -0.00133442, 0.00081797, 0.00134148, -0.00000117, 0.00000000],
+		[-6.26835407, -0.00133385, 0.00081762, 0.00134090, -0.00000117, 0.00000000],
+		[-6.26836576, -0.00133328, 0.00081728, 0.00134033, -0.00000117, 0.00000000],
+		[-6.26837740, -0.00133271, 0.00081693, 0.00133976, -0.00000117, 0.00000000],
+		[-6.26838900, -0.00133214, 0.00081658, 0.00133918, -0.00000117, 0.00000000],
+		[-6.26840056, -0.00133157, 0.00081623, 0.00133861, -0.00000117, 0.00000000],
+		[-6.26841209, -0.00133100, 0.00081588, 0.00133803, -0.00000117, 0.00000000],
+		[-6.26842357, -0.00133043, 0.00081553, 0.00133746, -0.00000117, 0.00000000],
+		[-6.26843501, -0.00132986, 0.00081519, 0.00133689, -0.00000117, 0.00000000],
+		[-6.26844641, -0.00132929, 0.00081484, 0.00133632, -0.00000117, 0.00000000],
+		[-6.26845777, -0.00132872, 0.00081449, 0.00133575, -0.00000117, 0.00000000],
+		[-6.26846909, -0.00132815, 0.00081414, 0.00133518, -0.00000117, 0.00000000],
+		[-6.26848037, -0.00132759, 0.00081380, 0.00133461, -0.00000117, 0.00000000],
+		[-6.26849161, -0.00132702, 0.00081345, 0.00133404, -0.00000117, 0.00000000],
+		[-6.26850281, -0.00132645, 0.00081311, 0.00133347, -0.00000117, 0.00000000],
+		[-6.26851397, -0.00132589, 0.00081276, 0.00133290, -0.00000117, 0.00000000],
+		[-6.26852510, -0.00132532, 0.00081242, 0.00133233, -0.00000117, 0.00000000],
+		[-6.26853618, -0.00132476, 0.00081207, 0.00133176, -0.00000117, 0.00000000],
+		[-6.26854723, -0.00132419, 0.00081173, 0.00133120, -0.00000117, 0.00000000],
+		[-6.26855824, -0.00132363, 0.00081138, 0.00133063, -0.00000117, 0.00000000],
+		[-6.26856921, -0.00132307, 0.00081104, 0.00133006, -0.00000117, 0.00000000],
+		[-6.26858014, -0.00132251, 0.00081069, 0.00132950, -0.00000117, 0.00000000],
+		[-6.26859103, -0.00132194, 0.00081035, 0.00132893, -0.00000117, 0.00000000],
+		[-6.26860188, -0.00132138, 0.00081001, 0.00132837, -0.00000117, 0.00000000],
+		[-6.26861270, -0.00132082, 0.00080966, 0.00132780, -0.00000117, 0.00000000],
+		[-6.26862348, -0.00132026, 0.00080932, 0.00132724, -0.00000117, 0.00000000],
+		[-6.26863422, -0.00131970, 0.00080898, 0.00132667, -0.00000117, 0.00000000],
+		[-6.26864493, -0.00131914, 0.00080864, 0.00132611, -0.00000117, 0.00000000],
+		[-6.26865559, -0.00131858, 0.00080829, 0.00132555, -0.00000117, 0.00000000],
+		[-6.26866622, -0.00131802, 0.00080795, 0.00132499, -0.00000117, 0.00000000],
+		[-6.26867681, -0.00131746, 0.00080761, 0.00132442, -0.00000117, 0.00000000],
+		[-6.26868737, -0.00131690, 0.00080727, 0.00132386, -0.00000117, 0.00000000],
+		[-6.26869789, -0.00131635, 0.00080693, 0.00132330, -0.00000117, 0.00000000],
+		[-6.26870837, -0.00131579, 0.00080659, 0.00132274, -0.00000117, 0.00000000],
+		[-6.26871882, -0.00131523, 0.00080625, 0.00132218, -0.00000117, 0.00000000],
+		[-6.26872923, -0.00131468, 0.00080591, 0.00132162, -0.00000117, 0.00000000],
+		[-6.26873960, -0.00131412, 0.00080557, 0.00132106, -0.00000117, 0.00000000],
+		[-6.26874993, -0.00131357, 0.00080523, 0.00132050, -0.00000117, 0.00000000],
+		[-6.26876024, -0.00131301, 0.00080489, 0.00131995, -0.00000117, 0.00000000],
+		[-6.26877050, -0.00131246, 0.00080455, 0.00131939, -0.00000117, 0.00000000],
+		[-6.26878073, -0.00131190, 0.00080421, 0.00131883, -0.00000117, 0.00000000],
+		[-6.26879092, -0.00131135, 0.00080387, 0.00131828, -0.00000117, 0.00000000],
+		[-6.26880108, -0.00131080, 0.00080354, 0.00131772, -0.00000117, 0.00000000],
+		[-6.26881120, -0.00131024, 0.00080320, 0.00131716, -0.00000117, 0.00000000],
+		[-6.26882129, -0.00130969, 0.00080286, 0.00131661, -0.00000117, 0.00000000],
+		[-6.26883135, -0.00130914, 0.00080252, 0.00131605, -0.00000117, 0.00000000],
+		[-6.26884136, -0.00130859, 0.00080219, 0.00131550, -0.00000117, 0.00000000],
+		[-6.26885135, -0.00130804, 0.00080185, 0.00131495, -0.00000117, 0.00000000],
+		[-6.26886129, -0.00130749, 0.00080151, 0.00131439, -0.00000117, 0.00000000],
+		[-6.26887121, -0.00130694, 0.00080118, 0.00131384, -0.00000117, 0.00000000],
+		[-6.26888109, -0.00130639, 0.00080084, 0.00131329, -0.00000117, 0.00000000],
+		[-6.26889093, -0.00130584, 0.00080051, 0.00131274, -0.00000117, 0.00000000],
+		[-6.26890074, -0.00130529, 0.00080017, 0.00131218, -0.00000117, 0.00000000],
+		[-6.26891052, -0.00130474, 0.00079984, 0.00131163, -0.00000117, 0.00000000],
+		[-6.26892026, -0.00130420, 0.00079950, 0.00131108, -0.00000117, 0.00000000],
+		[-6.26892997, -0.00130365, 0.00079917, 0.00131053, -0.00000117, 0.00000000],
+		[-6.26893965, -0.00130310, 0.00079883, 0.00130998, -0.00000117, 0.00000000],
+		[-6.26894929, -0.00130256, 0.00079850, 0.00130943, -0.00000117, 0.00000000],
+		[-6.26895890, -0.00130201, 0.00079816, 0.00130888, -0.00000117, 0.00000000],
+		[-6.26896848, -0.00130146, 0.00079783, 0.00130834, -0.00000117, 0.00000000],
+		[-6.26897802, -0.00130092, 0.00079750, 0.00130779, -0.00000117, 0.00000000],
+		[-6.26898753, -0.00130038, 0.00079717, 0.00130724, -0.00000117, 0.00000000],
+		[-6.26899700, -0.00129983, 0.00079683, 0.00130669, -0.00000117, 0.00000000],
+		[-6.26900645, -0.00129929, 0.00079650, 0.00130615, -0.00000117, 0.00000000],
+		[-6.26901586, -0.00129875, 0.00079617, 0.00130560, -0.00000117, 0.00000000],
+		[-6.26902524, -0.00129820, 0.00079584, 0.00130506, -0.00000117, 0.00000000],
+		[-6.26903458, -0.00129766, 0.00079550, 0.00130451, -0.00000117, 0.00000000],
+		[-6.26904390, -0.00129712, 0.00079517, 0.00130397, -0.00000117, 0.00000000],
+		[-6.26905318, -0.00129658, 0.00079484, 0.00130342, -0.00000117, 0.00000000],
+		[-6.26906243, -0.00129604, 0.00079451, 0.00130288, -0.00000117, 0.00000000],
+		[-6.26907164, -0.00129550, 0.00079418, 0.00130233, -0.00000117, 0.00000000],
+		[-6.26908083, -0.00129496, 0.00079385, 0.00130179, -0.00000117, 0.00000000],
+		[-6.26908998, -0.00129442, 0.00079352, 0.00130125, -0.00000117, 0.00000000],
+		[-6.26909911, -0.00129388, 0.00079319, 0.00130071, -0.00000117, 0.00000000],
+		[-6.26910820, -0.00129334, 0.00079286, 0.00130016, -0.00000117, 0.00000000],
+		[-6.26911726, -0.00129280, 0.00079253, 0.00129962, -0.00000117, 0.00000000],
+		[-6.26912629, -0.00129226, 0.00079220, 0.00129908, -0.00000117, 0.00000000],
+		[-6.26913528, -0.00129173, 0.00079188, 0.00129854, -0.00000117, 0.00000000],
+		[-6.26914425, -0.00129119, 0.00079155, 0.00129800, -0.00000117, 0.00000000],
+		[-6.26915318, -0.00129065, 0.00079122, 0.00129746, -0.00000117, 0.00000000],
+		[-6.26916209, -0.00129012, 0.00079089, 0.00129692, -0.00000117, 0.00000000],
+		[-6.26917096, -0.00128958, 0.00079056, 0.00129639, -0.00000117, 0.00000000],
+		[-6.26917981, -0.00128905, 0.00079024, 0.00129585, -0.00000117, 0.00000000],
+		[-6.26918862, -0.00128851, 0.00078991, 0.00129531, -0.00000117, 0.00000000],
+		[-6.26919740, -0.00128798, 0.00078958, 0.00129477, -0.00000117, 0.00000000],
+		[-6.26920615, -0.00128744, 0.00078926, 0.00129424, -0.00000117, 0.00000000],
+		[-6.26921488, -0.00128691, 0.00078893, 0.00129370, -0.00000117, 0.00000000],
+		[-6.26922357, -0.00128638, 0.00078860, 0.00129316, -0.00000117, 0.00000000],
+		[-6.26923223, -0.00128585, 0.00078828, 0.00129263, -0.00000117, 0.00000000],
+		[-6.26924086, -0.00128531, 0.00078795, 0.00129209, -0.00000117, 0.00000000],
+		[-6.26924947, -0.00128478, 0.00078763, 0.00129156, -0.00000117, 0.00000000],
+		[-6.26925804, -0.00128425, 0.00078730, 0.00129102, -0.00000117, 0.00000000],
+		[-6.26926658, -0.00128372, 0.00078698, 0.00129049, -0.00000117, 0.00000000],
+		[-6.26927510, -0.00128319, 0.00078665, 0.00128996, -0.00000117, 0.00000000],
+		[-6.26928358, -0.00128266, 0.00078633, 0.00128942, -0.00000117, 0.00000000],
+		[-6.26929204, -0.00128213, 0.00078601, 0.00128889, -0.00000117, 0.00000000],
+		[-6.26930047, -0.00128160, 0.00078568, 0.00128836, -0.00000117, 0.00000000],
+		[-6.26930887, -0.00128107, 0.00078536, 0.00128783, -0.00000117, 0.00000000],
+		[-6.26931724, -0.00128054, 0.00078504, 0.00128730, -0.00000117, 0.00000000],
+		[-6.26932558, -0.00128002, 0.00078471, 0.00128677, -0.00000117, 0.00000000],
+		[-6.26933389, -0.00127949, 0.00078439, 0.00128624, -0.00000117, 0.00000000],
+		[-6.26934217, -0.00127896, 0.00078407, 0.00128571, -0.00000117, 0.00000000],
+		[-6.26935043, -0.00127844, 0.00078375, 0.00128518, -0.00000117, 0.00000000],
+		[-6.26935866, -0.00127791, 0.00078342, 0.00128465, -0.00000117, 0.00000000],
+		[-6.26936686, -0.00127738, 0.00078310, 0.00128412, -0.00000117, 0.00000000],
+		[-6.26937503, -0.00127686, 0.00078278, 0.00128359, -0.00000117, 0.00000000],
+		[-6.26938317, -0.00127634, 0.00078246, 0.00128306, -0.00000117, 0.00000000],
+		[-6.26939129, -0.00127581, 0.00078214, 0.00128254, -0.00000117, 0.00000000],
+		[-6.26939937, -0.00127529, 0.00078182, 0.00128201, -0.00000117, 0.00000000],
+		[-6.26940743, -0.00127476, 0.00078150, 0.00128148, -0.00000117, 0.00000000],
+		[-6.26941547, -0.00127424, 0.00078118, 0.00128096, -0.00000117, 0.00000000],
+		[-6.26942347, -0.00127372, 0.00078086, 0.00128043, -0.00000117, 0.00000000],
+		[-6.26943145, -0.00127320, 0.00078054, 0.00127991, -0.00000117, 0.00000000],
+		[-6.26943940, -0.00127267, 0.00078022, 0.00127938, -0.00000117, 0.00000000],
+		[-6.26944732, -0.00127215, 0.00077990, 0.00127886, -0.00000117, 0.00000000],
+		[-6.26945522, -0.00127163, 0.00077958, 0.00127833, -0.00000117, 0.00000000],
+		[-6.26946309, -0.00127111, 0.00077926, 0.00127781, -0.00000117, 0.00000000],
+		[-6.26947093, -0.00127059, 0.00077895, 0.00127729, -0.00000117, 0.00000000],
+		[-6.26947875, -0.00127007, 0.00077863, 0.00127677, -0.00000117, 0.00000000],
+		[-6.26948654, -0.00126955, 0.00077831, 0.00127624, -0.00000117, 0.00000000],
+		[-6.26949430, -0.00126903, 0.00077799, 0.00127572, -0.00000117, 0.00000000],
+		[-6.26950204, -0.00126852, 0.00077768, 0.00127520, -0.00000117, 0.00000000],
+		[-6.26950975, -0.00126800, 0.00077736, 0.00127468, -0.00000117, 0.00000000],
+		[-6.26951743, -0.00126748, 0.00077704, 0.00127416, -0.00000117, 0.00000000],
+		[-6.26952509, -0.00126696, 0.00077673, 0.00127364, -0.00000117, 0.00000000],
+		[-6.26953272, -0.00126645, 0.00077641, 0.00127312, -0.00000117, 0.00000000],
+		[-6.26954033, -0.00126593, 0.00077609, 0.00127260, -0.00000117, 0.00000000],
+		[-6.26954791, -0.00126541, 0.00077578, 0.00127208, -0.00000117, 0.00000000],
+		[-6.26955546, -0.00126490, 0.00077546, 0.00127156, -0.00000117, 0.00000000],
+		[-6.26956299, -0.00126438, 0.00077515, 0.00127104, -0.00000117, 0.00000000],
+		[-6.26957049, -0.00126387, 0.00077483, 0.00127053, -0.00000117, 0.00000000],
+		[-6.26957797, -0.00126335, 0.00077452, 0.00127001, -0.00000117, 0.00000000],
+		[-6.26958542, -0.00126284, 0.00077420, 0.00126949, -0.00000117, 0.00000000],
+		[-6.26959285, -0.00126233, 0.00077389, 0.00126898, -0.00000117, 0.00000000],
+		[-6.26960025, -0.00126181, 0.00077357, 0.00126846, -0.00000117, 0.00000000],
+		[-6.26960763, -0.00126130, 0.00077326, 0.00126795, -0.00000117, 0.00000000],
+		[-6.26961498, -0.00126079, 0.00077295, 0.00126743, -0.00000117, 0.00000000],
+		[-6.26962230, -0.00126028, 0.00077263, 0.00126692, -0.00000117, 0.00000000],
+		[-6.26962961, -0.00125977, 0.00077232, 0.00126640, -0.00000117, 0.00000000],
+		[-6.26963688, -0.00125926, 0.00077201, 0.00126589, -0.00000117, 0.00000000],
+		[-6.26964414, -0.00125874, 0.00077170, 0.00126537, -0.00000117, 0.00000000],
+		[-6.26965137, -0.00125823, 0.00077138, 0.00126486, -0.00000117, 0.00000000],
+		[-6.26965857, -0.00125772, 0.00077107, 0.00126435, -0.00000117, 0.00000000],
+		[-6.26966575, -0.00125722, 0.00077076, 0.00126384, -0.00000117, 0.00000000],
+		[-6.26967290, -0.00125671, 0.00077045, 0.00126333, -0.00000117, 0.00000000],
+		[-6.26968003, -0.00125620, 0.00077014, 0.00126281, -0.00000117, 0.00000000],
+		[-6.26968714, -0.00125569, 0.00076983, 0.00126230, -0.00000117, 0.00000000],
+		[-6.26969422, -0.00125518, 0.00076952, 0.00126179, -0.00000117, 0.00000000],
+		[-6.26970128, -0.00125468, 0.00076920, 0.00126128, -0.00000117, 0.00000000],
+		[-6.26970832, -0.00125417, 0.00076889, 0.00126077, -0.00000117, 0.00000000],
+		[-6.26971533, -0.00125366, 0.00076858, 0.00126026, -0.00000117, 0.00000000],
+		[-6.26972232, -0.00125316, 0.00076827, 0.00125975, -0.00000117, 0.00000000],
+		[-6.26972928, -0.00125265, 0.00076797, 0.00125925, -0.00000117, 0.00000000],
+		[-6.26973622, -0.00125214, 0.00076766, 0.00125874, -0.00000117, 0.00000000],
+		[-6.26974314, -0.00125164, 0.00076735, 0.00125823, -0.00000117, 0.00000000],
+		[-6.26975003, -0.00125114, 0.00076704, 0.00125772, -0.00000117, 0.00000000],
+		[-6.26975691, -0.00125063, 0.00076673, 0.00125722, -0.00000117, 0.00000000],
+		[-6.26976375, -0.00125013, 0.00076642, 0.00125671, -0.00000117, 0.00000000],
+		[-6.26977058, -0.00124962, 0.00076611, 0.00125620, -0.00000117, 0.00000000],
+		[-6.26977738, -0.00124912, 0.00076581, 0.00125570, -0.00000117, 0.00000000],
+		[-6.26978416, -0.00124862, 0.00076550, 0.00125519, -0.00000117, 0.00000000],
+		[-6.26979092, -0.00124812, 0.00076519, 0.00125469, -0.00000117, 0.00000000],
+		[-6.26979765, -0.00124762, 0.00076488, 0.00125418, -0.00000117, 0.00000000],
+		[-6.26980436, -0.00124711, 0.00076458, 0.00125368, -0.00000117, 0.00000000],
+		[-6.26981105, -0.00124661, 0.00076427, 0.00125318, -0.00000117, 0.00000000],
+		[-6.26981772, -0.00124611, 0.00076396, 0.00125267, -0.00000117, 0.00000000],
+		[-6.26982436, -0.00124561, 0.00076366, 0.00125217, -0.00000117, 0.00000000],
+		[-6.26983098, -0.00124511, 0.00076335, 0.00125167, -0.00000117, 0.00000000],
+		[-6.26983758, -0.00124461, 0.00076305, 0.00125116, -0.00000117, 0.00000000],
+		[-6.26984416, -0.00124412, 0.00076274, 0.00125066, -0.00000117, 0.00000000],
+		[-6.26985071, -0.00124362, 0.00076244, 0.00125016, -0.00000117, 0.00000000],
+		[-6.26985725, -0.00124312, 0.00076213, 0.00124966, -0.00000117, 0.00000000],
+		[-6.26986376, -0.00124262, 0.00076183, 0.00124916, -0.00000117, 0.00000000],
+		[-6.26987025, -0.00124212, 0.00076152, 0.00124866, -0.00000117, 0.00000000],
+		[-6.26987672, -0.00124163, 0.00076122, 0.00124816, -0.00000117, 0.00000000],
+		[-6.26988316, -0.00124113, 0.00076091, 0.00124766, -0.00000117, 0.00000000],
+		[-6.26988959, -0.00124063, 0.00076061, 0.00124716, -0.00000117, 0.00000000],
+		[-6.26989599, -0.00124014, 0.00076031, 0.00124666, -0.00000117, 0.00000000],
+		[-6.26990237, -0.00123964, 0.00076000, 0.00124617, -0.00000117, 0.00000000],
+		[-6.26990873, -0.00123915, 0.00075970, 0.00124567, -0.00000117, 0.00000000],
+		[-6.26991507, -0.00123865, 0.00075940, 0.00124517, -0.00000117, 0.00000000],
+		[-6.26992139, -0.00123816, 0.00075909, 0.00124467, -0.00000117, 0.00000000],
+		[-6.26992769, -0.00123767, 0.00075879, 0.00124418, -0.00000117, 0.00000000],
+		[-6.26993396, -0.00123717, 0.00075849, 0.00124368, -0.00000117, 0.00000000],
+		[-6.26994022, -0.00123668, 0.00075819, 0.00124319, -0.00000117, 0.00000000],
+		[-6.26994645, -0.00123619, 0.00075789, 0.00124269, -0.00000117, 0.00000000],
+		[-6.26995267, -0.00123569, 0.00075758, 0.00124219, -0.00000117, 0.00000000],
+		[-6.26995886, -0.00123520, 0.00075728, 0.00124170, -0.00000117, 0.00000000],
+		[-6.26996503, -0.00123471, 0.00075698, 0.00124121, -0.00000117, 0.00000000],
+		[-6.26997119, -0.00123422, 0.00075668, 0.00124071, -0.00000117, 0.00000000],
+		[-6.26997732, -0.00123373, 0.00075638, 0.00124022, -0.00000117, 0.00000000],
+		[-6.26998343, -0.00123324, 0.00075608, 0.00123973, -0.00000117, 0.00000000],
+		[-6.26998952, -0.00123275, 0.00075578, 0.00123923, -0.00000117, 0.00000000],
+		[-6.26999559, -0.00123226, 0.00075548, 0.00123874, -0.00000117, 0.00000000],
+		[-6.27000164, -0.00123177, 0.00075518, 0.00123825, -0.00000117, 0.00000000],
+		[-6.27000767, -0.00123128, 0.00075488, 0.00123776, -0.00000117, 0.00000000],
+		[-6.27001368, -0.00123079, 0.00075458, 0.00123727, -0.00000117, 0.00000000],
+		[-6.27001968, -0.00123031, 0.00075428, 0.00123678, -0.00000117, 0.00000000],
+		[-6.27002565, -0.00122982, 0.00075399, 0.00123629, -0.00000117, 0.00000000],
+		[-6.27003160, -0.00122933, 0.00075369, 0.00123580, -0.00000117, 0.00000000],
+		[-6.27003753, -0.00122884, 0.00075339, 0.00123531, -0.00000117, 0.00000000],
+		[-6.27004344, -0.00122836, 0.00075309, 0.00123482, -0.00000117, 0.00000000],
+		[-6.27004933, -0.00122787, 0.00075279, 0.00123433, -0.00000117, 0.00000000],
+		[-6.27005521, -0.00122739, 0.00075250, 0.00123384, -0.00000117, 0.00000000],
+		[-6.27006106, -0.00122690, 0.00075220, 0.00123335, -0.00000117, 0.00000000],
+		[-6.27006690, -0.00122642, 0.00075190, 0.00123286, -0.00000117, 0.00000000],
+		[-6.27007271, -0.00122593, 0.00075160, 0.00123238, -0.00000117, 0.00000000],
+		[-6.27007851, -0.00122545, 0.00075131, 0.00123189, -0.00000117, 0.00000000],
+		[-6.27008428, -0.00122496, 0.00075101, 0.00123140, -0.00000117, 0.00000000],
+		[-6.27009004, -0.00122448, 0.00075072, 0.00123092, -0.00000117, 0.00000000],
+		[-6.27009578, -0.00122400, 0.00075042, 0.00123043, -0.00000117, 0.00000000],
+		[-6.27010150, -0.00122351, 0.00075012, 0.00122995, -0.00000117, 0.00000000],
+		[-6.27010720, -0.00122303, 0.00074983, 0.00122946, -0.00000117, 0.00000000],
+		[-6.27011288, -0.00122255, 0.00074953, 0.00122898, -0.00000117, 0.00000000],
+		[-6.27011855, -0.00122207, 0.00074924, 0.00122849, -0.00000117, 0.00000000],
+		[-6.27012419, -0.00122159, 0.00074894, 0.00122801, -0.00000117, 0.00000000],
+		[-6.27012982, -0.00122111, 0.00074865, 0.00122752, -0.00000117, 0.00000000],
+		[-6.27013543, -0.00122063, 0.00074836, 0.00122704, -0.00000117, 0.00000000],
+		[-6.27014102, -0.00122015, 0.00074806, 0.00122656, -0.00000117, 0.00000000],
+		[-6.27014659, -0.00121967, 0.00074777, 0.00122608, -0.00000117, 0.00000000],
+		[-6.27015214, -0.00121919, 0.00074747, 0.00122559, -0.00000117, 0.00000000],
+		[-6.27015767, -0.00121871, 0.00074718, 0.00122511, -0.00000117, 0.00000000],
+		[-6.27016319, -0.00121823, 0.00074689, 0.00122463, -0.00000117, 0.00000000],
+		[-6.27016869, -0.00121775, 0.00074659, 0.00122415, -0.00000117, 0.00000000],
+		[-6.27017417, -0.00121727, 0.00074630, 0.00122367, -0.00000117, 0.00000000],
+		[-6.27017963, -0.00121680, 0.00074601, 0.00122319, -0.00000117, 0.00000000],
+		[-6.27018508, -0.00121632, 0.00074572, 0.00122271, -0.00000117, 0.00000000],
+		[-6.27019050, -0.00121584, 0.00074543, 0.00122223, -0.00000117, 0.00000000],
+		[-6.27019591, -0.00121537, 0.00074513, 0.00122175, -0.00000117, 0.00000000],
+		[-6.27020130, -0.00121489, 0.00074484, 0.00122127, -0.00000117, 0.00000000],
+		[-6.27020668, -0.00121441, 0.00074455, 0.00122080, -0.00000117, 0.00000000],
+		[-6.27021203, -0.00121394, 0.00074426, 0.00122032, -0.00000117, 0.00000000],
+		[-6.27021737, -0.00121346, 0.00074397, 0.00121984, -0.00000117, 0.00000000],
+		[-6.27022270, -0.00121299, 0.00074368, 0.00121936, -0.00000117, 0.00000000],
+		[-6.27022800, -0.00121252, 0.00074339, 0.00121889, -0.00000117, 0.00000000],
+		[-6.27023329, -0.00121204, 0.00074310, 0.00121841, -0.00000117, 0.00000000],
+		[-6.27023856, -0.00121157, 0.00074281, 0.00121793, -0.00000117, 0.00000000],
+		[-6.27024381, -0.00121110, 0.00074252, 0.00121746, -0.00000117, 0.00000000],
+		[-6.27024904, -0.00121062, 0.00074223, 0.00121698, -0.00000117, 0.00000000],
+		[-6.27025426, -0.00121015, 0.00074194, 0.00121651, -0.00000117, 0.00000000],
+		[-6.27025946, -0.00120968, 0.00074165, 0.00121603, -0.00000117, 0.00000000],
+		[-6.27026465, -0.00120921, 0.00074136, 0.00121556, -0.00000117, 0.00000000],
+		[-6.27026982, -0.00120874, 0.00074107, 0.00121509, -0.00000117, 0.00000000],
+		[-6.27027497, -0.00120827, 0.00074078, 0.00121461, -0.00000117, 0.00000000],
+		[-6.27028010, -0.00120780, 0.00074050, 0.00121414, -0.00000117, 0.00000000],
+		[-6.27028522, -0.00120732, 0.00074021, 0.00121367, -0.00000116, 0.00000000],
+		[-6.27029032, -0.00120686, 0.00073992, 0.00121319, -0.00000116, 0.00000000],
+		[-6.27029541, -0.00120639, 0.00073963, 0.00121272, -0.00000116, 0.00000000],
+		[-6.27030047, -0.00120592, 0.00073934, 0.00121225, -0.00000116, 0.00000000],
+		[-6.27030552, -0.00120545, 0.00073906, 0.00121178, -0.00000116, 0.00000000],
+		[-6.27031056, -0.00120498, 0.00073877, 0.00121131, -0.00000116, 0.00000000],
+		[-6.27031558, -0.00120451, 0.00073848, 0.00121084, -0.00000116, 0.00000000],
+		[-6.27032058, -0.00120404, 0.00073820, 0.00121037, -0.00000116, 0.00000000],
+		[-6.27032557, -0.00120358, 0.00073791, 0.00120990, -0.00000116, 0.00000000],
+		[-6.27033054, -0.00120311, 0.00073763, 0.00120943, -0.00000116, 0.00000000],
+		[-6.27033549, -0.00120264, 0.00073734, 0.00120896, -0.00000116, 0.00000000],
+		[-6.27034043, -0.00120218, 0.00073705, 0.00120849, -0.00000116, 0.00000000],
+		[-6.27034536, -0.00120171, 0.00073677, 0.00120802, -0.00000116, 0.00000000],
+		[-6.27035026, -0.00120125, 0.00073648, 0.00120755, -0.00000116, 0.00000000],
+		[-6.27035515, -0.00120078, 0.00073620, 0.00120709, -0.00000116, 0.00000000],
+		[-6.27036003, -0.00120032, 0.00073591, 0.00120662, -0.00000116, 0.00000000],
+		[-6.27036489, -0.00119985, 0.00073563, 0.00120615, -0.00000116, 0.00000000],
+		[-6.27036973, -0.00119939, 0.00073535, 0.00120569, -0.00000116, 0.00000000],
+		[-6.27037456, -0.00119892, 0.00073506, 0.00120522, -0.00000116, 0.00000000],
+		[-6.27037937, -0.00119846, 0.00073478, 0.00120475, -0.00000116, 0.00000000],
+		[-6.27038417, -0.00119800, 0.00073449, 0.00120429, -0.00000116, 0.00000000],
+		[-6.27038895, -0.00119754, 0.00073421, 0.00120382, -0.00000116, 0.00000000],
+		[-6.27039372, -0.00119707, 0.00073393, 0.00120336, -0.00000116, 0.00000000],
+		[-6.27039847, -0.00119661, 0.00073364, 0.00120289, -0.00000116, 0.00000000],
+		[-6.27040321, -0.00119615, 0.00073336, 0.00120243, -0.00000116, 0.00000000],
+		[-6.27040793, -0.00119569, 0.00073308, 0.00120197, -0.00000116, 0.00000000],
+		[-6.27041263, -0.00119523, 0.00073280, 0.00120150, -0.00000116, 0.00000000],
+		[-6.27041732, -0.00119477, 0.00073251, 0.00120104, -0.00000116, 0.00000000],
+		[-6.27042200, -0.00119431, 0.00073223, 0.00120058, -0.00000116, 0.00000000],
+		[-6.27042666, -0.00119385, 0.00073195, 0.00120011, -0.00000116, 0.00000000],
+		[-6.27043131, -0.00119339, 0.00073167, 0.00119965, -0.00000116, 0.00000000],
+		[-6.27043594, -0.00119293, 0.00073139, 0.00119919, -0.00000116, 0.00000000],
+		[-6.27044055, -0.00119247, 0.00073111, 0.00119873, -0.00000116, 0.00000000],
+		[-6.27044516, -0.00119201, 0.00073083, 0.00119827, -0.00000116, 0.00000000],
+		[-6.27044974, -0.00119155, 0.00073054, 0.00119781, -0.00000116, 0.00000000],
+		[-6.27045432, -0.00119110, 0.00073026, 0.00119735, -0.00000116, 0.00000000],
+		[-6.27045887, -0.00119064, 0.00072998, 0.00119689, -0.00000116, 0.00000000],
+		[-6.27046342, -0.00119018, 0.00072970, 0.00119643, -0.00000116, 0.00000000],
+		[-6.27046795, -0.00118973, 0.00072942, 0.00119597, -0.00000116, 0.00000000],
+		[-6.27047246, -0.00118927, 0.00072914, 0.00119551, -0.00000116, 0.00000000],
+		[-6.27047696, -0.00118881, 0.00072887, 0.00119505, -0.00000116, 0.00000000],
+		[-6.27048145, -0.00118836, 0.00072859, 0.00119459, -0.00000116, 0.00000000],
+		[-6.27048592, -0.00118790, 0.00072831, 0.00119414, -0.00000116, 0.00000000],
+		[-6.27049038, -0.00118745, 0.00072803, 0.00119368, -0.00000116, 0.00000000],
+		[-6.27049482, -0.00118699, 0.00072775, 0.00119322, -0.00000116, 0.00000000],
+		[-6.27049925, -0.00118654, 0.00072747, 0.00119277, -0.00000116, 0.00000000],
+		[-6.27050366, -0.00118609, 0.00072719, 0.00119231, -0.00000116, 0.00000000],
+		[-6.27050807, -0.00118563, 0.00072692, 0.00119185, -0.00000116, 0.00000000],
+		[-6.27051245, -0.00118518, 0.00072664, 0.00119140, -0.00000116, 0.00000000],
+		[-6.27051683, -0.00118473, 0.00072636, 0.00119094, -0.00000116, 0.00000000],
+		[-6.27052119, -0.00118427, 0.00072608, 0.00119049, -0.00000116, 0.00000000],
+		[-6.27052553, -0.00118382, 0.00072581, 0.00119003, -0.00000116, 0.00000000],
+		[-6.27052986, -0.00118337, 0.00072553, 0.00118958, -0.00000116, 0.00000000],
+		[-6.27053418, -0.00118292, 0.00072525, 0.00118912, -0.00000116, 0.00000000],
+		[-6.27053849, -0.00118247, 0.00072498, 0.00118867, -0.00000116, 0.00000000],
+		[-6.27054278, -0.00118202, 0.00072470, 0.00118822, -0.00000116, 0.00000000],
+		[-6.27054706, -0.00118157, 0.00072442, 0.00118776, -0.00000116, 0.00000000],
+		[-6.27055132, -0.00118112, 0.00072415, 0.00118731, -0.00000116, 0.00000000],
+		[-6.27055557, -0.00118067, 0.00072387, 0.00118686, -0.00000116, 0.00000000],
+		[-6.27055981, -0.00118022, 0.00072360, 0.00118641, -0.00000116, 0.00000000],
+		[-6.27056403, -0.00117977, 0.00072332, 0.00118596, -0.00000116, 0.00000000],
+		[-6.27056825, -0.00117932, 0.00072305, 0.00118550, -0.00000116, 0.00000000],
+		[-6.27057244, -0.00117887, 0.00072277, 0.00118505, -0.00000116, 0.00000000],
+		[-6.27057663, -0.00117842, 0.00072250, 0.00118460, -0.00000116, 0.00000000],
+		[-6.27058080, -0.00117798, 0.00072222, 0.00118415, -0.00000116, 0.00000000],
+		[-6.27058496, -0.00117753, 0.00072195, 0.00118370, -0.00000116, 0.00000000],
+		[-6.27058910, -0.00117708, 0.00072167, 0.00118325, -0.00000116, 0.00000000],
+		[-6.27059324, -0.00117663, 0.00072140, 0.00118280, -0.00000116, 0.00000000],
+		[-6.27059736, -0.00117619, 0.00072113, 0.00118236, -0.00000116, 0.00000000],
+		[-6.27060146, -0.00117574, 0.00072085, 0.00118191, -0.00000116, 0.00000000],
+		[-6.27060556, -0.00117530, 0.00072058, 0.00118146, -0.00000116, 0.00000000],
+		[-6.27060964, -0.00117485, 0.00072031, 0.00118101, -0.00000116, 0.00000000],
+		[-6.27061371, -0.00117441, 0.00072004, 0.00118056, -0.00000116, 0.00000000],
+		[-6.27061776, -0.00117396, 0.00071976, 0.00118012, -0.00000116, 0.00000000],
+		[-6.27062180, -0.00117352, 0.00071949, 0.00117967, -0.00000116, 0.00000000],
+		[-6.27062583, -0.00117307, 0.00071922, 0.00117922, -0.00000116, 0.00000000],
+		[-6.27062985, -0.00117263, 0.00071895, 0.00117878, -0.00000116, 0.00000000],
+		[-6.27063386, -0.00117219, 0.00071867, 0.00117833, -0.00000116, 0.00000000],
+		[-6.27063785, -0.00117174, 0.00071840, 0.00117789, -0.00000116, 0.00000000],
+		[-6.27064183, -0.00117130, 0.00071813, 0.00117744, -0.00000116, 0.00000000],
+		[-6.27064580, -0.00117086, 0.00071786, 0.00117700, -0.00000116, 0.00000000],
+		[-6.27064976, -0.00117042, 0.00071759, 0.00117655, -0.00000116, 0.00000000],
+		[-6.27065370, -0.00116997, 0.00071732, 0.00117611, -0.00000116, 0.00000000],
+		[-6.27065763, -0.00116953, 0.00071705, 0.00117566, -0.00000116, 0.00000000],
+		[-6.27066155, -0.00116909, 0.00071678, 0.00117522, -0.00000116, 0.00000000],
+		[-6.27066546, -0.00116865, 0.00071651, 0.00117478, -0.00000116, 0.00000000],
+		[-6.27066935, -0.00116821, 0.00071624, 0.00117433, -0.00000116, 0.00000000],
+		[-6.27067323, -0.00116777, 0.00071597, 0.00117389, -0.00000116, 0.00000000],
+		[-6.27067711, -0.00116733, 0.00071570, 0.00117345, -0.00000116, 0.00000000],
+		[-6.27068096, -0.00116689, 0.00071543, 0.00117301, -0.00000116, 0.00000000],
+		[-6.27068481, -0.00116645, 0.00071516, 0.00117257, -0.00000116, 0.00000000],
+		[-6.27068865, -0.00116601, 0.00071489, 0.00117212, -0.00000116, 0.00000000],
+		[-6.27069247, -0.00116558, 0.00071462, 0.00117168, -0.00000116, 0.00000000],
+		[-6.27069628, -0.00116514, 0.00071435, 0.00117124, -0.00000116, 0.00000000],
+		[-6.27070008, -0.00116470, 0.00071409, 0.00117080, -0.00000116, 0.00000000],
+		[-6.27070387, -0.00116426, 0.00071382, 0.00117036, -0.00000116, 0.00000000],
+		[-6.27070765, -0.00116383, 0.00071355, 0.00116992, -0.00000116, 0.00000000],
+		[-6.27071141, -0.00116339, 0.00071328, 0.00116948, -0.00000116, 0.00000000],
+		[-6.27071516, -0.00116295, 0.00071301, 0.00116905, -0.00000116, 0.00000000],
+		[-6.27071891, -0.00116252, 0.00071275, 0.00116861, -0.00000116, 0.00000000],
+		[-6.27072264, -0.00116208, 0.00071248, 0.00116817, -0.00000116, 0.00000000],
+		[-6.27072636, -0.00116165, 0.00071221, 0.00116773, -0.00000116, 0.00000000],
+		[-6.27073006, -0.00116121, 0.00071195, 0.00116729, -0.00000116, 0.00000000],
+		[-6.27073376, -0.00116078, 0.00071168, 0.00116686, -0.00000116, 0.00000000],
+		[-6.27073744, -0.00116034, 0.00071141, 0.00116642, -0.00000116, 0.00000000],
+		[-6.27074112, -0.00115991, 0.00071115, 0.00116598, -0.00000116, 0.00000000],
+		[-6.27074478, -0.00115947, 0.00071088, 0.00116555, -0.00000116, 0.00000000],
+		[-6.27074843, -0.00115904, 0.00071062, 0.00116511, -0.00000116, 0.00000000],
+		[-6.27075207, -0.00115861, 0.00071035, 0.00116468, -0.00000116, 0.00000000],
+		[-6.27075570, -0.00115817, 0.00071008, 0.00116424, -0.00000116, 0.00000000],
+		[-6.27075932, -0.00115774, 0.00070982, 0.00116381, -0.00000116, 0.00000000],
+		[-6.27076293, -0.00115731, 0.00070955, 0.00116337, -0.00000116, 0.00000000],
+		[-6.27076652, -0.00115688, 0.00070929, 0.00116294, -0.00000116, 0.00000000],
+		[-6.27077011, -0.00115644, 0.00070902, 0.00116250, -0.00000116, 0.00000000],
+		[-6.27077368, -0.00115601, 0.00070876, 0.00116207, -0.00000116, 0.00000000],
+		[-6.27077724, -0.00115558, 0.00070850, 0.00116164, -0.00000116, 0.00000000],
+		[-6.27078080, -0.00115515, 0.00070823, 0.00116120, -0.00000116, 0.00000000],
+		[-6.27078434, -0.00115472, 0.00070797, 0.00116077, -0.00000116, 0.00000000],
+		[-6.27078787, -0.00115429, 0.00070770, 0.00116034, -0.00000116, 0.00000000],
+		[-6.27079139, -0.00115386, 0.00070744, 0.00115991, -0.00000116, 0.00000000],
+		[-6.27079490, -0.00115343, 0.00070718, 0.00115947, -0.00000116, 0.00000000],
+		[-6.27079840, -0.00115300, 0.00070692, 0.00115904, -0.00000116, 0.00000000],
+		[-6.27080189, -0.00115257, 0.00070665, 0.00115861, -0.00000116, 0.00000000],
+		[-6.27080537, -0.00115215, 0.00070639, 0.00115818, -0.00000116, 0.00000000],
+		[-6.27080883, -0.00115172, 0.00070613, 0.00115775, -0.00000116, 0.00000000],
+		[-6.27081229, -0.00115129, 0.00070586, 0.00115732, -0.00000116, 0.00000000],
+		[-6.27081574, -0.00115086, 0.00070560, 0.00115689, -0.00000116, 0.00000000],
+		[-6.27081917, -0.00115044, 0.00070534, 0.00115646, -0.00000116, 0.00000000],
+		[-6.27082260, -0.00115001, 0.00070508, 0.00115603, -0.00000116, 0.00000000],
+		[-6.27082601, -0.00114958, 0.00070482, 0.00115560, -0.00000116, 0.00000000],
+		[-6.27082942, -0.00114916, 0.00070456, 0.00115517, -0.00000116, 0.00000000],
+		[-6.27083281, -0.00114873, 0.00070430, 0.00115475, -0.00000116, 0.00000000],
+		[-6.27083620, -0.00114830, 0.00070403, 0.00115432, -0.00000116, 0.00000000],
+		[-6.27083957, -0.00114788, 0.00070377, 0.00115389, -0.00000116, 0.00000000],
+		[-6.27084294, -0.00114745, 0.00070351, 0.00115346, -0.00000116, 0.00000000],
+		[-6.27084629, -0.00114703, 0.00070325, 0.00115304, -0.00000116, 0.00000000],
+		[-6.27084964, -0.00114661, 0.00070299, 0.00115261, -0.00000116, 0.00000000],
+		[-6.27085297, -0.00114618, 0.00070273, 0.00115218, -0.00000116, 0.00000000],
+		[-6.27085630, -0.00114576, 0.00070247, 0.00115176, -0.00000116, 0.00000000],
+		[-6.27085961, -0.00114533, 0.00070221, 0.00115133, -0.00000116, 0.00000000],
+		[-6.27086292, -0.00114491, 0.00070195, 0.00115091, -0.00000116, 0.00000000],
+		[-6.27086621, -0.00114449, 0.00070169, 0.00115048, -0.00000116, 0.00000000],
+		[-6.27086950, -0.00114407, 0.00070144, 0.00115006, -0.00000116, 0.00000000],
+		[-6.27087277, -0.00114364, 0.00070118, 0.00114963, -0.00000116, 0.00000000],
+		[-6.27087604, -0.00114322, 0.00070092, 0.00114921, -0.00000116, 0.00000000],
+		[-6.27087929, -0.00114280, 0.00070066, 0.00114878, -0.00000116, 0.00000000],
+		[-6.27088254, -0.00114238, 0.00070040, 0.00114836, -0.00000116, 0.00000000],
+		[-6.27088577, -0.00114196, 0.00070014, 0.00114794, -0.00000116, 0.00000000],
+		[-6.27088900, -0.00114154, 0.00069989, 0.00114751, -0.00000116, 0.00000000],
+		[-6.27089222, -0.00114112, 0.00069963, 0.00114709, -0.00000116, 0.00000000],
+		[-6.27089543, -0.00114070, 0.00069937, 0.00114667, -0.00000116, 0.00000000],
+		[-6.27089862, -0.00114028, 0.00069911, 0.00114625, -0.00000116, 0.00000000],
+		[-6.27090181, -0.00113986, 0.00069886, 0.00114582, -0.00000116, 0.00000000],
+		[-6.27090499, -0.00113944, 0.00069860, 0.00114540, -0.00000116, 0.00000000],
+		[-6.27090816, -0.00113902, 0.00069834, 0.00114498, -0.00000116, 0.00000000],
+		[-6.27091132, -0.00113860, 0.00069809, 0.00114456, -0.00000116, 0.00000000],
+		[-6.27091447, -0.00113818, 0.00069783, 0.00114414, -0.00000116, 0.00000000],
+		[-6.27091762, -0.00113777, 0.00069757, 0.00114372, -0.00000116, 0.00000000],
+		[-6.27092075, -0.00113735, 0.00069732, 0.00114330, -0.00000116, 0.00000000],
+		[-6.27092387, -0.00113693, 0.00069706, 0.00114288, -0.00000116, 0.00000000],
+		[-6.27092699, -0.00113651, 0.00069681, 0.00114246, -0.00000116, 0.00000000],
+		[-6.27093009, -0.00113610, 0.00069655, 0.00114204, -0.00000116, 0.00000000],
+		[-6.27093319, -0.00113568, 0.00069629, 0.00114162, -0.00000116, 0.00000000],
+		[-6.27093627, -0.00113527, 0.00069604, 0.00114121, -0.00000116, 0.00000000],
+		[-6.27093935, -0.00113485, 0.00069578, 0.00114079, -0.00000116, 0.00000000],
+		[-6.27094242, -0.00113443, 0.00069553, 0.00114037, -0.00000116, 0.00000000],
+		[-6.27094548, -0.00113402, 0.00069528, 0.00113995, -0.00000116, 0.00000000],
+		[-6.27094853, -0.00113360, 0.00069502, 0.00113954, -0.00000116, 0.00000000],
+		[-6.27095157, -0.00113319, 0.00069477, 0.00113912, -0.00000116, 0.00000000],
+		[-6.27095461, -0.00113278, 0.00069451, 0.00113870, -0.00000116, 0.00000000],
+		[-6.27095763, -0.00113236, 0.00069426, 0.00113829, -0.00000116, 0.00000000],
+		[-6.27096065, -0.00113195, 0.00069401, 0.00113787, -0.00000116, 0.00000000],
+		[-6.27096365, -0.00113154, 0.00069375, 0.00113745, -0.00000116, 0.00000000],
+		[-6.27096665, -0.00113112, 0.00069350, 0.00113704, -0.00000116, 0.00000000],
+		[-6.27096964, -0.00113071, 0.00069325, 0.00113662, -0.00000116, 0.00000000],
+		[-6.27097262, -0.00113030, 0.00069299, 0.00113621, -0.00000116, 0.00000000],
+		[-6.27097559, -0.00112989, 0.00069274, 0.00113580, -0.00000116, 0.00000000],
+		[-6.27097856, -0.00112947, 0.00069249, 0.00113538, -0.00000116, 0.00000000],
+		[-6.27098151, -0.00112906, 0.00069224, 0.00113497, -0.00000116, 0.00000000],
+		[-6.27098446, -0.00112865, 0.00069198, 0.00113455, -0.00000116, 0.00000000],
+		[-6.27098739, -0.00112824, 0.00069173, 0.00113414, -0.00000116, 0.00000000],
+		[-6.27099032, -0.00112783, 0.00069148, 0.00113373, -0.00000116, 0.00000000],
+		[-6.27099324, -0.00112742, 0.00069123, 0.00113332, -0.00000116, 0.00000000],
+		[-6.27099616, -0.00112701, 0.00069098, 0.00113290, -0.00000116, 0.00000000],
+		[-6.27099906, -0.00112660, 0.00069072, 0.00113249, -0.00000116, 0.00000000],
+		[-6.27100196, -0.00112619, 0.00069047, 0.00113208, -0.00000116, 0.00000000],
+		[-6.27100484, -0.00112578, 0.00069022, 0.00113167, -0.00000116, 0.00000000],
+		[-6.27100772, -0.00112537, 0.00068997, 0.00113126, -0.00000116, 0.00000000],
+		[-6.27101059, -0.00112496, 0.00068972, 0.00113085, -0.00000116, 0.00000000],
+		[-6.27101345, -0.00112455, 0.00068947, 0.00113044, -0.00000116, 0.00000000],
+		[-6.27101631, -0.00112415, 0.00068922, 0.00113003, -0.00000116, 0.00000000],
+		[-6.27101915, -0.00112374, 0.00068897, 0.00112962, -0.00000116, 0.00000000],
+		[-6.27102199, -0.00112333, 0.00068872, 0.00112921, -0.00000116, 0.00000000],
+		[-6.27102482, -0.00112292, 0.00068847, 0.00112880, -0.00000116, 0.00000000],
+		[-6.27102764, -0.00112252, 0.00068822, 0.00112839, -0.00000116, 0.00000000],
+		[-6.27103045, -0.00112211, 0.00068797, 0.00112798, -0.00000116, 0.00000000],
+		[-6.27103326, -0.00112171, 0.00068772, 0.00112757, -0.00000116, 0.00000000],
+		[-6.27103606, -0.00112130, 0.00068747, 0.00112716, -0.00000116, 0.00000000],
+		[-6.27103885, -0.00112089, 0.00068723, 0.00112675, -0.00000116, 0.00000000],
+		[-6.27104163, -0.00112049, 0.00068698, 0.00112635, -0.00000116, 0.00000000],
+		[-6.27104440, -0.00112008, 0.00068673, 0.00112594, -0.00000116, 0.00000000],
+		[-6.27104717, -0.00111968, 0.00068648, 0.00112553, -0.00000116, 0.00000000],
+		[-6.27104992, -0.00111927, 0.00068623, 0.00112513, -0.00000116, 0.00000000],
+		[-6.27105267, -0.00111887, 0.00068599, 0.00112472, -0.00000116, 0.00000000],
+		[-6.27105541, -0.00111847, 0.00068574, 0.00112431, -0.00000116, 0.00000000],
+		[-6.27105815, -0.00111806, 0.00068549, 0.00112391, -0.00000116, 0.00000000],
+		[-6.27106088, -0.00111766, 0.00068524, 0.00112350, -0.00000116, 0.00000000],
+		[-6.27106359, -0.00111726, 0.00068500, 0.00112310, -0.00000116, 0.00000000],
+		[-6.27106630, -0.00111685, 0.00068475, 0.00112269, -0.00000116, 0.00000000],
+		[-6.27106901, -0.00111645, 0.00068450, 0.00112229, -0.00000116, 0.00000000],
+		[-6.27107170, -0.00111605, 0.00068426, 0.00112188, -0.00000116, 0.00000000],
+		[-6.27107439, -0.00111565, 0.00068401, 0.00112148, -0.00000116, 0.00000000],
+		[-6.27107707, -0.00111525, 0.00068376, 0.00112107, -0.00000116, 0.00000000],
+		[-6.27107974, -0.00111484, 0.00068352, 0.00112067, -0.00000116, 0.00000000],
+		[-6.27108241, -0.00111444, 0.00068327, 0.00112027, -0.00000116, 0.00000000],
+		[-6.27108507, -0.00111404, 0.00068302, 0.00111987, -0.00000116, 0.00000000],
+		[-6.27108772, -0.00111364, 0.00068278, 0.00111946, -0.00000116, 0.00000000],
+		[-6.27109036, -0.00111324, 0.00068253, 0.00111906, -0.00000116, 0.00000000],
+		[-6.27109300, -0.00111284, 0.00068229, 0.00111866, -0.00000116, 0.00000000],
+		[-6.27109562, -0.00111244, 0.00068204, 0.00111826, -0.00000116, 0.00000000],
+		[-6.27109825, -0.00111204, 0.00068180, 0.00111786, -0.00000116, 0.00000000],
+		[-6.27110086, -0.00111164, 0.00068155, 0.00111745, -0.00000116, 0.00000000],
+		[-6.27110347, -0.00111125, 0.00068131, 0.00111705, -0.00000116, 0.00000000],
+		[-6.27110606, -0.00111085, 0.00068106, 0.00111665, -0.00000116, 0.00000000],
+		[-6.27110866, -0.00111045, 0.00068082, 0.00111625, -0.00000116, 0.00000000],
+		[-6.27111124, -0.00111005, 0.00068058, 0.00111585, -0.00000116, 0.00000000],
+		[-6.27111382, -0.00110965, 0.00068033, 0.00111545, -0.00000116, 0.00000000],
+		[-6.27111639, -0.00110926, 0.00068009, 0.00111505, -0.00000116, 0.00000000],
+		[-6.27111895, -0.00110886, 0.00067985, 0.00111465, -0.00000116, 0.00000000],
+		[-6.27112151, -0.00110846, 0.00067960, 0.00111425, -0.00000116, 0.00000000],
+		[-6.27112405, -0.00110807, 0.00067936, 0.00111386, -0.00000116, 0.00000000],
+		[-6.27112660, -0.00110767, 0.00067912, 0.00111346, -0.00000116, 0.00000000],
+		[-6.27112913, -0.00110728, 0.00067887, 0.00111306, -0.00000116, 0.00000000],
+		[-6.27113166, -0.00110688, 0.00067863, 0.00111266, -0.00000116, 0.00000000],
+		[-6.27113418, -0.00110648, 0.00067839, 0.00111226, -0.00000116, 0.00000000],
+		[-6.27113669, -0.00110609, 0.00067815, 0.00111187, -0.00000116, 0.00000000],
+		[-6.27113920, -0.00110569, 0.00067790, 0.00111147, -0.00000116, 0.00000000],
+		[-6.27114170, -0.00110530, 0.00067766, 0.00111107, -0.00000116, 0.00000000],
+		[-6.27114419, -0.00110491, 0.00067742, 0.00111068, -0.00000116, 0.00000000],
+		[-6.27114668, -0.00110451, 0.00067718, 0.00111028, -0.00000116, 0.00000000],
+		[-6.27114915, -0.00110412, 0.00067694, 0.00110989, -0.00000116, 0.00000000],
+		[-6.27115163, -0.00110372, 0.00067670, 0.00110949, -0.00000116, 0.00000000],
+		[-6.27115409, -0.00110333, 0.00067646, 0.00110910, -0.00000116, 0.00000000],
+		[-6.27115655, -0.00110294, 0.00067621, 0.00110870, -0.00000116, 0.00000000],
+		[-6.27115900, -0.00110255, 0.00067597, 0.00110831, -0.00000116, 0.00000000],
+		[-6.27116145, -0.00110215, 0.00067573, 0.00110791, -0.00000116, 0.00000000],
+		[-6.27116389, -0.00110176, 0.00067549, 0.00110752, -0.00000116, 0.00000000],
+		[-6.27116632, -0.00110137, 0.00067525, 0.00110712, -0.00000116, 0.00000000],
+		[-6.27116874, -0.00110098, 0.00067501, 0.00110673, -0.00000116, 0.00000000],
+		[-6.27117116, -0.00110059, 0.00067477, 0.00110634, -0.00000115, 0.00000000],
+		[-6.27117357, -0.00110020, 0.00067453, 0.00110594, -0.00000115, 0.00000000],
+		[-6.27117598, -0.00109981, 0.00067429, 0.00110555, -0.00000115, 0.00000000],
+		[-6.27117838, -0.00109942, 0.00067405, 0.00110516, -0.00000115, 0.00000000],
+		[-6.27118077, -0.00109903, 0.00067381, 0.00110477, -0.00000115, 0.00000000],
+		[-6.27118315, -0.00109864, 0.00067358, 0.00110437, -0.00000115, 0.00000000],
+		[-6.27118553, -0.00109825, 0.00067334, 0.00110398, -0.00000115, 0.00000000],
+		[-6.27118791, -0.00109786, 0.00067310, 0.00110359, -0.00000115, 0.00000000],
+		[-6.27119027, -0.00109747, 0.00067286, 0.00110320, -0.00000115, 0.00000000],
+		[-6.27119263, -0.00109708, 0.00067262, 0.00110281, -0.00000115, 0.00000000],
+		[-6.27119499, -0.00109669, 0.00067238, 0.00110242, -0.00000115, 0.00000000],
+		[-6.27119733, -0.00109630, 0.00067214, 0.00110203, -0.00000115, 0.00000000],
+		[-6.27119968, -0.00109592, 0.00067191, 0.00110164, -0.00000115, 0.00000000],
+		[-6.27120201, -0.00109553, 0.00067167, 0.00110125, -0.00000115, 0.00000000],
+		[-6.27120434, -0.00109514, 0.00067143, 0.00110086, -0.00000115, 0.00000000],
+		[-6.27120666, -0.00109475, 0.00067119, 0.00110047, -0.00000115, 0.00000000],
+		[-6.27120898, -0.00109437, 0.00067096, 0.00110008, -0.00000115, 0.00000000],
+		[-6.27121129, -0.00109398, 0.00067072, 0.00109969, -0.00000115, 0.00000000],
+		[-6.27121359, -0.00109360, 0.00067048, 0.00109930, -0.00000115, 0.00000000],
+		[-6.27121589, -0.00109321, 0.00067025, 0.00109892, -0.00000115, 0.00000000],
+		[-6.27121818, -0.00109282, 0.00067001, 0.00109853, -0.00000115, 0.00000000],
+		[-6.27122046, -0.00109244, 0.00066977, 0.00109814, -0.00000115, 0.00000000],
+		[-6.27122274, -0.00109205, 0.00066954, 0.00109775, -0.00000115, 0.00000000],
+		[-6.27122501, -0.00109167, 0.00066930, 0.00109737, -0.00000115, 0.00000000],
+		[-6.27122728, -0.00109128, 0.00066907, 0.00109698, -0.00000115, 0.00000000],
+		[-6.27122954, -0.00109090, 0.00066883, 0.00109659, -0.00000115, 0.00000000],
+		[-6.27123179, -0.00109052, 0.00066859, 0.00109621, -0.00000115, 0.00000000],
+		[-6.27123404, -0.00109013, 0.00066836, 0.00109582, -0.00000115, 0.00000000],
+		[-6.27123629, -0.00108975, 0.00066812, 0.00109544, -0.00000115, 0.00000000],
+		[-6.27123852, -0.00108937, 0.00066789, 0.00109505, -0.00000115, 0.00000000],
+		[-6.27124075, -0.00108898, 0.00066765, 0.00109467, -0.00000115, 0.00000000],
+		[-6.27124298, -0.00108860, 0.00066742, 0.00109428, -0.00000115, 0.00000000],
+		[-6.27124520, -0.00108822, 0.00066718, 0.00109390, -0.00000115, 0.00000000],
+		[-6.27124741, -0.00108784, 0.00066695, 0.00109351, -0.00000115, 0.00000000],
+		[-6.27124962, -0.00108745, 0.00066672, 0.00109313, -0.00000115, 0.00000000],
+		[-6.27125182, -0.00108707, 0.00066648, 0.00109275, -0.00000115, 0.00000000],
+		[-6.27125401, -0.00108669, 0.00066625, 0.00109236, -0.00000115, 0.00000000],
+		[-6.27125620, -0.00108631, 0.00066601, 0.00109198, -0.00000115, 0.00000000],
+		[-6.27125839, -0.00108593, 0.00066578, 0.00109160, -0.00000115, 0.00000000],
+		[-6.27126057, -0.00108555, 0.00066555, 0.00109121, -0.00000115, 0.00000000],
+		[-6.27126274, -0.00108517, 0.00066531, 0.00109083, -0.00000115, 0.00000000],
+		[-6.27126490, -0.00108479, 0.00066508, 0.00109045, -0.00000115, 0.00000000],
+		[-6.27126707, -0.00108441, 0.00066485, 0.00109007, -0.00000115, 0.00000000],
+		[-6.27126922, -0.00108403, 0.00066461, 0.00108969, -0.00000115, 0.00000000],
+		[-6.27127137, -0.00108365, 0.00066438, 0.00108930, -0.00000115, 0.00000000],
+		[-6.27127351, -0.00108327, 0.00066415, 0.00108892, -0.00000115, 0.00000000],
+		[-6.27127565, -0.00108289, 0.00066392, 0.00108854, -0.00000115, 0.00000000],
+		[-6.27127779, -0.00108251, 0.00066369, 0.00108816, -0.00000115, 0.00000000],
+		[-6.27127991, -0.00108214, 0.00066345, 0.00108778, -0.00000115, 0.00000000],
+		[-6.27128204, -0.00108176, 0.00066322, 0.00108740, -0.00000115, 0.00000000],
+		[-6.27128415, -0.00108138, 0.00066299, 0.00108702, -0.00000115, 0.00000000],
+		[-6.27128626, -0.00108100, 0.00066276, 0.00108664, -0.00000115, 0.00000000],
+		[-6.27128837, -0.00108063, 0.00066253, 0.00108626, -0.00000115, 0.00000000],
+		[-6.27129047, -0.00108025, 0.00066230, 0.00108588, -0.00000115, 0.00000000],
+		[-6.27129256, -0.00107987, 0.00066206, 0.00108551, -0.00000115, 0.00000000],
+		[-6.27129465, -0.00107950, 0.00066183, 0.00108513, -0.00000115, 0.00000000],
+		[-6.27129674, -0.00107912, 0.00066160, 0.00108475, -0.00000115, 0.00000000],
+		[-6.27129881, -0.00107874, 0.00066137, 0.00108437, -0.00000115, 0.00000000],
+		[-6.27130089, -0.00107837, 0.00066114, 0.00108399, -0.00000115, 0.00000000],
+		[-6.27130295, -0.00107799, 0.00066091, 0.00108362, -0.00000115, 0.00000000],
+		[-6.27130502, -0.00107762, 0.00066068, 0.00108324, -0.00000115, 0.00000000],
+		[-6.27130707, -0.00107724, 0.00066045, 0.00108286, -0.00000115, 0.00000000],
+		[-6.27130913, -0.00107687, 0.00066022, 0.00108249, -0.00000115, 0.00000000],
+		[-6.27131117, -0.00107649, 0.00065999, 0.00108211, -0.00000115, 0.00000000],
+		[-6.27131321, -0.00107612, 0.00065976, 0.00108173, -0.00000115, 0.00000000],
+		[-6.27131525, -0.00107575, 0.00065953, 0.00108136, -0.00000115, 0.00000000],
+		[-6.27131728, -0.00107537, 0.00065931, 0.00108098, -0.00000115, 0.00000000],
+		[-6.27131930, -0.00107500, 0.00065908, 0.00108061, -0.00000115, 0.00000000],
+		[-6.27132133, -0.00107463, 0.00065885, 0.00108023, -0.00000115, 0.00000000],
+		[-6.27132334, -0.00107425, 0.00065862, 0.00107986, -0.00000115, 0.00000000],
+		[-6.27132535, -0.00107388, 0.00065839, 0.00107948, -0.00000115, 0.00000000],
+		[-6.27132736, -0.00107351, 0.00065816, 0.00107911, -0.00000115, 0.00000000],
+		[-6.27132936, -0.00107314, 0.00065793, 0.00107873, -0.00000115, 0.00000000],
+		[-6.27133135, -0.00107277, 0.00065771, 0.00107836, -0.00000115, 0.00000000],
+		[-6.27133334, -0.00107239, 0.00065748, 0.00107799, -0.00000115, 0.00000000],
+		[-6.27133532, -0.00107202, 0.00065725, 0.00107761, -0.00000115, 0.00000000],
+		[-6.27133730, -0.00107165, 0.00065702, 0.00107724, -0.00000115, 0.00000000],
+		[-6.27133928, -0.00107128, 0.00065680, 0.00107687, -0.00000115, 0.00000000],
+		[-6.27134125, -0.00107091, 0.00065657, 0.00107650, -0.00000115, 0.00000000],
+		[-6.27134321, -0.00107054, 0.00065634, 0.00107612, -0.00000115, 0.00000000],
+		[-6.27134517, -0.00107017, 0.00065611, 0.00107575, -0.00000115, 0.00000000],
+		[-6.27134713, -0.00106980, 0.00065589, 0.00107538, -0.00000115, 0.00000000],
+		[-6.27134908, -0.00106943, 0.00065566, 0.00107501, -0.00000115, 0.00000000],
+		[-6.27135102, -0.00106906, 0.00065543, 0.00107464, -0.00000115, 0.00000000],
+		[-6.27135296, -0.00106870, 0.00065521, 0.00107427, -0.00000115, 0.00000000],
+		[-6.27135490, -0.00106833, 0.00065498, 0.00107390, -0.00000115, 0.00000000],
+		[-6.27135683, -0.00106796, 0.00065476, 0.00107353, -0.00000115, 0.00000000],
+		[-6.27135875, -0.00106759, 0.00065453, 0.00107316, -0.00000115, 0.00000000],
+		[-6.27136067, -0.00106722, 0.00065430, 0.00107279, -0.00000115, 0.00000000],
+		[-6.27136259, -0.00106685, 0.00065408, 0.00107242, -0.00000115, 0.00000000],
+		[-6.27136450, -0.00106649, 0.00065385, 0.00107205, -0.00000115, 0.00000000],
+		[-6.27136641, -0.00106612, 0.00065363, 0.00107168, -0.00000115, 0.00000000],
+		[-6.27136831, -0.00106575, 0.00065340, 0.00107131, -0.00000115, 0.00000000],
+		[-6.27137021, -0.00106539, 0.00065318, 0.00107094, -0.00000115, 0.00000000],
+		[-6.27137210, -0.00106502, 0.00065295, 0.00107057, -0.00000115, 0.00000000],
+		[-6.27137399, -0.00106465, 0.00065273, 0.00107020, -0.00000115, 0.00000000],
+		[-6.27137587, -0.00106429, 0.00065250, 0.00106984, -0.00000115, 0.00000000],
+		[-6.27137775, -0.00106392, 0.00065228, 0.00106947, -0.00000115, 0.00000000],
+		[-6.27137962, -0.00106356, 0.00065206, 0.00106910, -0.00000115, 0.00000000],
+		[-6.27138149, -0.00106319, 0.00065183, 0.00106873, -0.00000115, 0.00000000],
+		[-6.27138335, -0.00106283, 0.00065161, 0.00106837, -0.00000115, 0.00000000],
+		[-6.27138521, -0.00106246, 0.00065139, 0.00106800, -0.00000115, 0.00000000],
+		[-6.27138707, -0.00106210, 0.00065116, 0.00106763, -0.00000115, 0.00000000],
+		[-6.27138892, -0.00106173, 0.00065094, 0.00106727, -0.00000115, 0.00000000],
+		[-6.27139077, -0.00106137, 0.00065072, 0.00106690, -0.00000115, 0.00000000],
+		[-6.27139261, -0.00106101, 0.00065049, 0.00106654, -0.00000115, 0.00000000],
+		[-6.27139445, -0.00106064, 0.00065027, 0.00106617, -0.00000115, 0.00000000],
+		[-6.27139628, -0.00106028, 0.00065005, 0.00106581, -0.00000115, 0.00000000],
+		[-6.27139811, -0.00105992, 0.00064982, 0.00106544, -0.00000115, 0.00000000],
+		[-6.27139993, -0.00105956, 0.00064960, 0.00106508, -0.00000115, 0.00000000],
+		[-6.27140175, -0.00105919, 0.00064938, 0.00106471, -0.00000115, 0.00000000],
+		[-6.27140356, -0.00105883, 0.00064916, 0.00106435, -0.00000115, 0.00000000],
+		[-6.27140537, -0.00105847, 0.00064893, 0.00106399, -0.00000115, 0.00000000],
+		[-6.27140718, -0.00105811, 0.00064871, 0.00106362, -0.00000115, 0.00000000],
+		[-6.27140898, -0.00105775, 0.00064849, 0.00106326, -0.00000115, 0.00000000],
+		[-6.27141078, -0.00105739, 0.00064827, 0.00106290, -0.00000115, 0.00000000],
+		[-6.27141257, -0.00105702, 0.00064805, 0.00106253, -0.00000115, 0.00000000],
+		[-6.27141436, -0.00105666, 0.00064783, 0.00106217, -0.00000115, 0.00000000],
+		[-6.27141614, -0.00105630, 0.00064761, 0.00106181, -0.00000115, 0.00000000],
+		[-6.27141792, -0.00105594, 0.00064739, 0.00106145, -0.00000115, 0.00000000],
+		[-6.27141970, -0.00105558, 0.00064716, 0.00106108, -0.00000115, 0.00000000],
+		[-6.27142147, -0.00105522, 0.00064694, 0.00106072, -0.00000115, 0.00000000],
+		[-6.27142324, -0.00105486, 0.00064672, 0.00106036, -0.00000115, 0.00000000],
+		[-6.27142500, -0.00105451, 0.00064650, 0.00106000, -0.00000115, 0.00000000],
+		[-6.27142676, -0.00105415, 0.00064628, 0.00105964, -0.00000115, 0.00000000],
+		[-6.27142851, -0.00105379, 0.00064606, 0.00105928, -0.00000115, 0.00000000],
+		[-6.27143026, -0.00105343, 0.00064584, 0.00105892, -0.00000115, 0.00000000],
+		[-6.27143201, -0.00105307, 0.00064562, 0.00105856, -0.00000115, 0.00000000],
+		[-6.27143375, -0.00105271, 0.00064540, 0.00105820, -0.00000115, 0.00000000],
+		[-6.27143549, -0.00105236, 0.00064518, 0.00105784, -0.00000115, 0.00000000],
+		[-6.27143722, -0.00105200, 0.00064496, 0.00105748, -0.00000115, 0.00000000],
+		[-6.27143895, -0.00105164, 0.00064475, 0.00105712, -0.00000115, 0.00000000],
+		[-6.27144068, -0.00105128, 0.00064453, 0.00105676, -0.00000115, 0.00000000],
+		[-6.27144240, -0.00105093, 0.00064431, 0.00105640, -0.00000115, 0.00000000],
+		[-6.27144412, -0.00105057, 0.00064409, 0.00105604, -0.00000115, 0.00000000],
+		[-6.27144583, -0.00105021, 0.00064387, 0.00105569, -0.00000115, 0.00000000],
+		[-6.27144754, -0.00104986, 0.00064365, 0.00105533, -0.00000115, 0.00000000],
+		[-6.27144924, -0.00104950, 0.00064343, 0.00105497, -0.00000115, 0.00000000],
+		[-6.27145094, -0.00104915, 0.00064322, 0.00105461, -0.00000115, 0.00000000],
+		[-6.27145264, -0.00104879, 0.00064300, 0.00105425, -0.00000115, 0.00000000],
+		[-6.27145433, -0.00104844, 0.00064278, 0.00105390, -0.00000115, 0.00000000],
+		[-6.27145602, -0.00104808, 0.00064256, 0.00105354, -0.00000115, 0.00000000],
+		[-6.27145771, -0.00104773, 0.00064234, 0.00105318, -0.00000115, 0.00000000],
+		[-6.27145939, -0.00104737, 0.00064213, 0.00105283, -0.00000115, 0.00000000],
+		[-6.27146107, -0.00104702, 0.00064191, 0.00105247, -0.00000115, 0.00000000],
+		[-6.27146274, -0.00104667, 0.00064169, 0.00105212, -0.00000115, 0.00000000],
+		[-6.27146441, -0.00104631, 0.00064148, 0.00105176, -0.00000115, 0.00000000],
+		[-6.27146607, -0.00104596, 0.00064126, 0.00105141, -0.00000115, 0.00000000],
+		[-6.27146774, -0.00104561, 0.00064104, 0.00105105, -0.00000115, 0.00000000],
+		[-6.27146939, -0.00104525, 0.00064083, 0.00105070, -0.00000115, 0.00000000],
+		[-6.27147105, -0.00104490, 0.00064061, 0.00105034, -0.00000115, 0.00000000],
+		[-6.27147270, -0.00104455, 0.00064039, 0.00104999, -0.00000115, 0.00000000],
+		[-6.27147434, -0.00104420, 0.00064018, 0.00104963, -0.00000115, 0.00000000],
+		[-6.27147599, -0.00104384, 0.00063996, 0.00104928, -0.00000115, 0.00000000],
+		[-6.27147762, -0.00104349, 0.00063975, 0.00104893, -0.00000115, 0.00000000],
+		[-6.27147926, -0.00104314, 0.00063953, 0.00104857, -0.00000115, 0.00000000],
+		[-6.27148089, -0.00104279, 0.00063931, 0.00104822, -0.00000115, 0.00000000],
+		[-6.27148252, -0.00104244, 0.00063910, 0.00104787, -0.00000115, 0.00000000],
+		[-6.27148414, -0.00104209, 0.00063888, 0.00104751, -0.00000115, 0.00000000],
+		[-6.27148576, -0.00104174, 0.00063867, 0.00104716, -0.00000115, 0.00000000],
+		[-6.27148738, -0.00104139, 0.00063845, 0.00104681, -0.00000115, 0.00000000],
+		[-6.27148899, -0.00104104, 0.00063824, 0.00104646, -0.00000115, 0.00000000],
+		[-6.27149060, -0.00104069, 0.00063802, 0.00104610, -0.00000115, 0.00000000],
+		[-6.27149220, -0.00104034, 0.00063781, 0.00104575, -0.00000115, 0.00000000],
+		[-6.27149380, -0.00103999, 0.00063760, 0.00104540, -0.00000115, 0.00000000],
+		[-6.27149540, -0.00103964, 0.00063738, 0.00104505, -0.00000115, 0.00000000],
+		[-6.27149699, -0.00103929, 0.00063717, 0.00104470, -0.00000115, 0.00000000],
+		[-6.27149859, -0.00103894, 0.00063695, 0.00104435, -0.00000115, 0.00000000],
+		[-6.27150017, -0.00103859, 0.00063674, 0.00104400, -0.00000115, 0.00000000],
+		[-6.27150175, -0.00103824, 0.00063653, 0.00104365, -0.00000115, 0.00000000],
+		[-6.27150333, -0.00103790, 0.00063631, 0.00104330, -0.00000115, 0.00000000],
+		[-6.27150491, -0.00103755, 0.00063610, 0.00104295, -0.00000115, 0.00000000],
+		[-6.27150648, -0.00103720, 0.00063589, 0.00104260, -0.00000115, 0.00000000],
+		[-6.27150805, -0.00103685, 0.00063567, 0.00104225, -0.00000115, 0.00000000],
+		[-6.27150962, -0.00103651, 0.00063546, 0.00104190, -0.00000115, 0.00000000],
+		[-6.27151118, -0.00103616, 0.00063525, 0.00104155, -0.00000115, 0.00000000],
+		[-6.27151274, -0.00103581, 0.00063503, 0.00104120, -0.00000115, 0.00000000],
+		[-6.27151429, -0.00103547, 0.00063482, 0.00104086, -0.00000115, 0.00000000],
+		[-6.27151584, -0.00103512, 0.00063461, 0.00104051, -0.00000115, 0.00000000],
+		[-6.27151739, -0.00103478, 0.00063440, 0.00104016, -0.00000115, 0.00000000],
+		[-6.27151893, -0.00103443, 0.00063419, 0.00103981, -0.00000115, 0.00000000],
+		[-6.27152048, -0.00103408, 0.00063397, 0.00103947, -0.00000115, 0.00000000],
+		[-6.27152201, -0.00103374, 0.00063376, 0.00103912, -0.00000115, 0.00000000],
+		[-6.27152355, -0.00103339, 0.00063355, 0.00103877, -0.00000115, 0.00000000],
+		[-6.27152508, -0.00103305, 0.00063334, 0.00103843, -0.00000115, 0.00000000],
+		[-6.27152660, -0.00103270, 0.00063313, 0.00103808, -0.00000115, 0.00000000],
+		[-6.27152813, -0.00103236, 0.00063292, 0.00103773, -0.00000115, 0.00000000],
+		[-6.27152965, -0.00103202, 0.00063271, 0.00103739, -0.00000115, 0.00000000],
+		[-6.27153117, -0.00103167, 0.00063249, 0.00103704, -0.00000115, 0.00000000],
+		[-6.27153268, -0.00103133, 0.00063228, 0.00103670, -0.00000115, 0.00000000],
+		[-6.27153419, -0.00103099, 0.00063207, 0.00103635, -0.00000115, 0.00000000],
+		[-6.27153570, -0.00103064, 0.00063186, 0.00103601, -0.00000115, 0.00000000],
+		[-6.27153720, -0.00103030, 0.00063165, 0.00103566, -0.00000115, 0.00000000],
+		[-6.27153870, -0.00102996, 0.00063144, 0.00103532, -0.00000115, 0.00000000],
+		[-6.27154020, -0.00102961, 0.00063123, 0.00103497, -0.00000115, 0.00000000],
+		[-6.27154169, -0.00102927, 0.00063102, 0.00103463, -0.00000115, 0.00000000],
+		[-6.27154318, -0.00102893, 0.00063081, 0.00103428, -0.00000115, 0.00000000],
+		[-6.27154467, -0.00102859, 0.00063060, 0.00103394, -0.00000115, 0.00000000],
+		[-6.27154615, -0.00102825, 0.00063039, 0.00103360, -0.00000115, 0.00000000],
+		[-6.27154763, -0.00102791, 0.00063018, 0.00103325, -0.00000115, 0.00000000],
+		[-6.27154911, -0.00102756, 0.00062997, 0.00103291, -0.00000115, 0.00000000],
+		[-6.27155059, -0.00102722, 0.00062976, 0.00103257, -0.00000115, 0.00000000],
+		[-6.27155206, -0.00102688, 0.00062956, 0.00103223, -0.00000115, 0.00000000],
+		[-6.27155352, -0.00102654, 0.00062935, 0.00103188, -0.00000115, 0.00000000],
+		[-6.27155499, -0.00102620, 0.00062914, 0.00103154, -0.00000115, 0.00000000],
+		[-6.27155645, -0.00102586, 0.00062893, 0.00103120, -0.00000115, 0.00000000],
+		[-6.27155791, -0.00102552, 0.00062872, 0.00103086, -0.00000115, 0.00000000],
+		[-6.27155936, -0.00102518, 0.00062851, 0.00103052, -0.00000115, 0.00000000],
+		[-6.27156082, -0.00102484, 0.00062830, 0.00103018, -0.00000115, 0.00000000],
+		[-6.27156226, -0.00102451, 0.00062810, 0.00102983, -0.00000115, 0.00000000],
+		[-6.27156371, -0.00102417, 0.00062789, 0.00102949, -0.00000115, 0.00000000],
+		[-6.27156515, -0.00102383, 0.00062768, 0.00102915, -0.00000115, 0.00000000],
+		[-6.27156659, -0.00102349, 0.00062747, 0.00102881, -0.00000115, 0.00000000],
+		[-6.27156803, -0.00102315, 0.00062727, 0.00102847, -0.00000115, 0.00000000],
+		[-6.27156946, -0.00102281, 0.00062706, 0.00102813, -0.00000115, 0.00000000],
+		[-6.27157089, -0.00102248, 0.00062685, 0.00102779, -0.00000115, 0.00000000],
+		[-6.27157232, -0.00102214, 0.00062664, 0.00102745, -0.00000115, 0.00000000],
+		[-6.27157374, -0.00102180, 0.00062644, 0.00102712, -0.00000115, 0.00000000],
+		[-6.27157517, -0.00102146, 0.00062623, 0.00102678, -0.00000115, 0.00000000],
+		[-6.27157658, -0.00102113, 0.00062602, 0.00102644, -0.00000115, 0.00000000],
+		[-6.27157800, -0.00102079, 0.00062582, 0.00102610, -0.00000115, 0.00000000],
+		[-6.27157941, -0.00102045, 0.00062561, 0.00102576, -0.00000115, 0.00000000],
+		[-6.27158082, -0.00102012, 0.00062540, 0.00102542, -0.00000115, 0.00000000],
+		[-6.27158223, -0.00101978, 0.00062520, 0.00102509, -0.00000115, 0.00000000],
+		[-6.27158363, -0.00101945, 0.00062499, 0.00102475, -0.00000115, 0.00000000],
+		[-6.27158503, -0.00101911, 0.00062479, 0.00102441, -0.00000115, 0.00000000],
+		[-6.27158643, -0.00101878, 0.00062458, 0.00102407, -0.00000115, 0.00000000],
+		[-6.27158782, -0.00101844, 0.00062438, 0.00102374, -0.00000115, 0.00000000],
+		[-6.27158921, -0.00101811, 0.00062417, 0.00102340, -0.00000115, 0.00000000],
+		[-6.27159060, -0.00101777, 0.00062396, 0.00102306, -0.00000115, 0.00000000],
+		[-6.27159199, -0.00101744, 0.00062376, 0.00102273, -0.00000115, 0.00000000],
+		[-6.27159337, -0.00101710, 0.00062355, 0.00102239, -0.00000115, 0.00000000],
+		[-6.27159475, -0.00101677, 0.00062335, 0.00102206, -0.00000115, 0.00000000],
+		[-6.27159613, -0.00101644, 0.00062314, 0.00102172, -0.00000115, 0.00000000],
+		[-6.27159750, -0.00101610, 0.00062294, 0.00102138, -0.00000115, 0.00000000],
+		[-6.27159887, -0.00101577, 0.00062274, 0.00102105, -0.00000115, 0.00000000],
+		[-6.27160024, -0.00101544, 0.00062253, 0.00102071, -0.00000115, 0.00000000],
+		[-6.27160160, -0.00101510, 0.00062233, 0.00102038, -0.00000115, 0.00000000],
+		[-6.27160297, -0.00101477, 0.00062212, 0.00102005, -0.00000115, 0.00000000],
+		[-6.27160433, -0.00101444, 0.00062192, 0.00101971, -0.00000115, 0.00000000],
+		[-6.27160568, -0.00101410, 0.00062171, 0.00101938, -0.00000115, 0.00000000],
+		[-6.27160704, -0.00101377, 0.00062151, 0.00101904, -0.00000115, 0.00000000],
+		[-6.27160839, -0.00101344, 0.00062131, 0.00101871, -0.00000115, 0.00000000],
+		[-6.27160974, -0.00101311, 0.00062110, 0.00101838, -0.00000115, 0.00000000],
+		[-6.27161108, -0.00101278, 0.00062090, 0.00101804, -0.00000115, 0.00000000],
+		[-6.27161243, -0.00101245, 0.00062070, 0.00101771, -0.00000115, 0.00000000],
+		[-6.27161377, -0.00101212, 0.00062049, 0.00101738, -0.00000115, 0.00000000],
+		[-6.27161511, -0.00101179, 0.00062029, 0.00101705, -0.00000115, 0.00000000],
+		[-6.27161644, -0.00101146, 0.00062009, 0.00101671, -0.00000115, 0.00000000],
+		[-6.27161777, -0.00101112, 0.00061989, 0.00101638, -0.00000115, 0.00000000],
+		[-6.27161910, -0.00101079, 0.00061968, 0.00101605, -0.00000115, 0.00000000],
+		[-6.27162043, -0.00101046, 0.00061948, 0.00101572, -0.00000115, 0.00000000],
+		[-6.27162175, -0.00101014, 0.00061928, 0.00101539, -0.00000115, 0.00000000],
+		[-6.27162307, -0.00100981, 0.00061908, 0.00101505, -0.00000115, 0.00000000],
+		[-6.27162439, -0.00100948, 0.00061887, 0.00101472, -0.00000115, 0.00000000],
+		[-6.27162571, -0.00100915, 0.00061867, 0.00101439, -0.00000115, 0.00000000],
+		[-6.27162702, -0.00100882, 0.00061847, 0.00101406, -0.00000115, 0.00000000],
+		[-6.27162833, -0.00100849, 0.00061827, 0.00101373, -0.00000115, 0.00000000],
+		[-6.27162964, -0.00100816, 0.00061807, 0.00101340, -0.00000115, 0.00000000],
+		[-6.27163095, -0.00100783, 0.00061787, 0.00101307, -0.00000115, 0.00000000],
+		[-6.27163225, -0.00100751, 0.00061767, 0.00101274, -0.00000115, 0.00000000],
+		[-6.27163355, -0.00100718, 0.00061746, 0.00101241, -0.00000115, 0.00000000],
+		[-6.27163485, -0.00100685, 0.00061726, 0.00101208, -0.00000115, 0.00000000],
+		[-6.27163614, -0.00100652, 0.00061706, 0.00101175, -0.00000115, 0.00000000],
+		[-6.27163743, -0.00100620, 0.00061686, 0.00101143, -0.00000115, 0.00000000],
+		[-6.27163872, -0.00100587, 0.00061666, 0.00101110, -0.00000115, 0.00000000],
+		[-6.27164001, -0.00100554, 0.00061646, 0.00101077, -0.00000115, 0.00000000],
+		[-6.27164130, -0.00100522, 0.00061626, 0.00101044, -0.00000115, 0.00000000],
+		[-6.27164258, -0.00100489, 0.00061606, 0.00101011, -0.00000115, 0.00000000],
+		[-6.27164386, -0.00100456, 0.00061586, 0.00100978, -0.00000115, 0.00000000],
+		[-6.27164513, -0.00100424, 0.00061566, 0.00100946, -0.00000115, 0.00000000],
+		[-6.27164641, -0.00100391, 0.00061546, 0.00100913, -0.00000114, 0.00000000],
+		[-6.27164768, -0.00100359, 0.00061526, 0.00100880, -0.00000114, 0.00000000],
+		[-6.27164895, -0.00100326, 0.00061506, 0.00100848, -0.00000114, 0.00000000],
+		[-6.27165022, -0.00100294, 0.00061486, 0.00100815, -0.00000114, 0.00000000],
+		[-6.27165148, -0.00100261, 0.00061466, 0.00100782, -0.00000114, 0.00000000],
+		[-6.27165274, -0.00100229, 0.00061446, 0.00100750, -0.00000114, 0.00000000],
+		[-6.27165400, -0.00100196, 0.00061427, 0.00100717, -0.00000114, 0.00000000],
+		[-6.27165526, -0.00100164, 0.00061407, 0.00100684, -0.00000114, 0.00000000],
+		[-6.27165651, -0.00100132, 0.00061387, 0.00100652, -0.00000114, 0.00000000],
+		[-6.27165777, -0.00100099, 0.00061367, 0.00100619, -0.00000114, 0.00000000],
+		[-6.27165902, -0.00100067, 0.00061347, 0.00100587, -0.00000114, 0.00000000],
+		[-6.27166026, -0.00100035, 0.00061327, 0.00100554, -0.00000114, 0.00000000],
+		[-6.27166151, -0.00100002, 0.00061307, 0.00100522, -0.00000114, 0.00000000],
+		[-6.27166275, -0.00099970, 0.00061288, 0.00100489, -0.00000114, 0.00000000],
+		[-6.27166399, -0.00099938, 0.00061268, 0.00100457, -0.00000114, 0.00000000],
+		[-6.27166523, -0.00099905, 0.00061248, 0.00100424, -0.00000114, 0.00000000],
+		[-6.27166646, -0.00099873, 0.00061228, 0.00100392, -0.00000114, 0.00000000],
+		[-6.27166770, -0.00099841, 0.00061208, 0.00100360, -0.00000114, 0.00000000],
+		[-6.27166893, -0.00099809, 0.00061189, 0.00100327, -0.00000114, 0.00000000],
+		[-6.27167015, -0.00099777, 0.00061169, 0.00100295, -0.00000114, 0.00000000],
+		[-6.27167138, -0.00099745, 0.00061149, 0.00100263, -0.00000114, 0.00000000],
+		[-6.27167260, -0.00099712, 0.00061130, 0.00100230, -0.00000114, 0.00000000],
+		[-6.27167382, -0.00099680, 0.00061110, 0.00100198, -0.00000114, 0.00000000],
+		[-6.27167504, -0.00099648, 0.00061090, 0.00100166, -0.00000114, 0.00000000],
+		[-6.27167626, -0.00099616, 0.00061070, 0.00100134, -0.00000114, 0.00000000],
+		[-6.27167747, -0.00099584, 0.00061051, 0.00100101, -0.00000114, 0.00000000],
+		[-6.27167868, -0.00099552, 0.00061031, 0.00100069, -0.00000114, 0.00000000],
+		[-6.27167989, -0.00099520, 0.00061012, 0.00100037, -0.00000114, 0.00000000],
+		[-6.27168110, -0.00099488, 0.00060992, 0.00100005, -0.00000114, 0.00000000],
+		[-6.27168231, -0.00099456, 0.00060972, 0.00099973, -0.00000114, 0.00000000],
+		[-6.27168351, -0.00099424, 0.00060953, 0.00099941, -0.00000114, 0.00000000],
+		[-6.27168471, -0.00099392, 0.00060933, 0.00099909, -0.00000114, 0.00000000],
+		[-6.27168591, -0.00099360, 0.00060914, 0.00099877, -0.00000114, 0.00000000],
+		[-6.27168710, -0.00099329, 0.00060894, 0.00099844, -0.00000114, 0.00000000],
+		[-6.27168829, -0.00099297, 0.00060874, 0.00099812, -0.00000114, 0.00000000],
+		[-6.27168949, -0.00099265, 0.00060855, 0.00099780, -0.00000114, 0.00000000],
+		[-6.27169067, -0.00099233, 0.00060835, 0.00099748, -0.00000114, 0.00000000],
+		[-6.27169186, -0.00099201, 0.00060816, 0.00099716, -0.00000114, 0.00000000],
+		[-6.27169305, -0.00099170, 0.00060796, 0.00099685, -0.00000114, 0.00000000],
+		[-6.27169423, -0.00099138, 0.00060777, 0.00099653, -0.00000114, 0.00000000],
+		[-6.27169541, -0.00099106, 0.00060757, 0.00099621, -0.00000114, 0.00000000],
+		[-6.27169659, -0.00099074, 0.00060738, 0.00099589, -0.00000114, 0.00000000],
+		[-6.27169776, -0.00099043, 0.00060719, 0.00099557, -0.00000114, 0.00000000],
+		[-6.27169893, -0.00099011, 0.00060699, 0.00099525, -0.00000114, 0.00000000],
+		[-6.27170011, -0.00098979, 0.00060680, 0.00099493, -0.00000114, 0.00000000],
+		[-6.27170128, -0.00098948, 0.00060660, 0.00099461, -0.00000114, 0.00000000],
+		[-6.27170244, -0.00098916, 0.00060641, 0.00099430, -0.00000114, 0.00000000],
+		[-6.27170361, -0.00098884, 0.00060622, 0.00099398, -0.00000114, 0.00000000],
+		[-6.27170477, -0.00098853, 0.00060602, 0.00099366, -0.00000114, 0.00000000],
+		[-6.27170593, -0.00098821, 0.00060583, 0.00099334, -0.00000114, 0.00000000],
+		[-6.27170709, -0.00098790, 0.00060563, 0.00099303, -0.00000114, 0.00000000],
+		[-6.27170825, -0.00098758, 0.00060544, 0.00099271, -0.00000114, 0.00000000],
+		[-6.27170940, -0.00098727, 0.00060525, 0.00099239, -0.00000114, 0.00000000],
+		[-6.27171055, -0.00098695, 0.00060505, 0.00099208, -0.00000114, 0.00000000],
+		[-6.27171170, -0.00098664, 0.00060486, 0.00099176, -0.00000114, 0.00000000],
+		[-6.27171285, -0.00098633, 0.00060467, 0.00099145, -0.00000114, 0.00000000],
+		[-6.27171399, -0.00098601, 0.00060448, 0.00099113, -0.00000114, 0.00000000],
+		[-6.27171514, -0.00098570, 0.00060428, 0.00099081, -0.00000114, 0.00000000],
+		[-6.27171628, -0.00098538, 0.00060409, 0.00099050, -0.00000114, 0.00000000],
+		[-6.27171742, -0.00098507, 0.00060390, 0.00099018, -0.00000114, 0.00000000],
+		[-6.27171856, -0.00098476, 0.00060371, 0.00098987, -0.00000114, 0.00000000],
+		[-6.27171969, -0.00098444, 0.00060351, 0.00098955, -0.00000114, 0.00000000],
+		[-6.27172082, -0.00098413, 0.00060332, 0.00098924, -0.00000114, 0.00000000],
+		[-6.27172196, -0.00098382, 0.00060313, 0.00098893, -0.00000114, 0.00000000],
+		[-6.27172309, -0.00098351, 0.00060294, 0.00098861, -0.00000114, 0.00000000],
+		[-6.27172421, -0.00098319, 0.00060275, 0.00098830, -0.00000114, 0.00000000],
+		[-6.27172534, -0.00098288, 0.00060256, 0.00098798, -0.00000114, 0.00000000],
+		[-6.27172646, -0.00098257, 0.00060236, 0.00098767, -0.00000114, 0.00000000],
+		[-6.27172758, -0.00098226, 0.00060217, 0.00098736, -0.00000114, 0.00000000],
+		[-6.27172870, -0.00098195, 0.00060198, 0.00098704, -0.00000114, 0.00000000],
+		[-6.27172982, -0.00098163, 0.00060179, 0.00098673, -0.00000114, 0.00000000],
+		[-6.27173093, -0.00098132, 0.00060160, 0.00098642, -0.00000114, 0.00000000],
+		[-6.27173205, -0.00098101, 0.00060141, 0.00098610, -0.00000114, 0.00000000],
+		[-6.27173316, -0.00098070, 0.00060122, 0.00098579, -0.00000114, 0.00000000],
+		[-6.27173427, -0.00098039, 0.00060103, 0.00098548, -0.00000114, 0.00000000],
+		[-6.27173537, -0.00098008, 0.00060084, 0.00098517, -0.00000114, 0.00000000],
+		[-6.27173648, -0.00097977, 0.00060065, 0.00098486, -0.00000114, 0.00000000],
+		[-6.27173758, -0.00097946, 0.00060046, 0.00098454, -0.00000114, 0.00000000],
+		[-6.27173868, -0.00097915, 0.00060027, 0.00098423, -0.00000114, 0.00000000],
+		[-6.27173978, -0.00097884, 0.00060008, 0.00098392, -0.00000114, 0.00000000],
+		[-6.27174088, -0.00097853, 0.00059989, 0.00098361, -0.00000114, 0.00000000],
+		[-6.27174198, -0.00097822, 0.00059970, 0.00098330, -0.00000114, 0.00000000],
+		[-6.27174307, -0.00097791, 0.00059951, 0.00098299, -0.00000114, 0.00000000],
+		[-6.27174416, -0.00097761, 0.00059932, 0.00098268, -0.00000114, 0.00000000],
+		[-6.27174525, -0.00097730, 0.00059913, 0.00098237, -0.00000114, 0.00000000],
+		[-6.27174634, -0.00097699, 0.00059894, 0.00098206, -0.00000114, 0.00000000],
+		[-6.27174743, -0.00097668, 0.00059875, 0.00098175, -0.00000114, 0.00000000],
+		[-6.27174851, -0.00097637, 0.00059856, 0.00098144, -0.00000114, 0.00000000],
+		[-6.27174959, -0.00097606, 0.00059837, 0.00098113, -0.00000114, 0.00000000],
+		[-6.27175067, -0.00097576, 0.00059818, 0.00098082, -0.00000114, 0.00000000],
+		[-6.27175175, -0.00097545, 0.00059800, 0.00098051, -0.00000114, 0.00000000],
+		[-6.27175283, -0.00097514, 0.00059781, 0.00098020, -0.00000114, 0.00000000],
+		[-6.27175390, -0.00097484, 0.00059762, 0.00097989, -0.00000114, 0.00000000],
+		[-6.27175497, -0.00097453, 0.00059743, 0.00097958, -0.00000114, 0.00000000],
+		[-6.27175605, -0.00097422, 0.00059724, 0.00097928, -0.00000114, 0.00000000],
+		[-6.27175712, -0.00097392, 0.00059705, 0.00097897, -0.00000114, 0.00000000],
+		[-6.27175818, -0.00097361, 0.00059687, 0.00097866, -0.00000114, 0.00000000],
+		[-6.27175925, -0.00097330, 0.00059668, 0.00097835, -0.00000114, 0.00000000],
+		[-6.27176031, -0.00097300, 0.00059649, 0.00097805, -0.00000114, 0.00000000],
+		[-6.27176137, -0.00097269, 0.00059630, 0.00097774, -0.00000114, 0.00000000],
+		[-6.27176243, -0.00097239, 0.00059612, 0.00097743, -0.00000114, 0.00000000],
+		[-6.27176349, -0.00097208, 0.00059593, 0.00097712, -0.00000114, 0.00000000],
+		[-6.27176455, -0.00097178, 0.00059574, 0.00097682, -0.00000114, 0.00000000],
+		[-6.27176560, -0.00097147, 0.00059555, 0.00097651, -0.00000114, 0.00000000],
+		[-6.27176666, -0.00097117, 0.00059537, 0.00097620, -0.00000114, 0.00000000],
+		[-6.27176771, -0.00097086, 0.00059518, 0.00097590, -0.00000114, 0.00000000],
+		[-6.27176876, -0.00097056, 0.00059499, 0.00097559, -0.00000114, 0.00000000],
+		[-6.27176980, -0.00097025, 0.00059481, 0.00097529, -0.00000114, 0.00000000],
+		[-6.27177085, -0.00096995, 0.00059462, 0.00097498, -0.00000114, 0.00000000],
+		[-6.27177189, -0.00096965, 0.00059443, 0.00097468, -0.00000114, 0.00000000],
+		[-6.27177294, -0.00096934, 0.00059425, 0.00097437, -0.00000114, 0.00000000],
+		[-6.27177398, -0.00096904, 0.00059406, 0.00097407, -0.00000114, 0.00000000],
+		[-6.27177502, -0.00096874, 0.00059388, 0.00097376, -0.00000114, 0.00000000],
+		[-6.27177605, -0.00096843, 0.00059369, 0.00097346, -0.00000114, 0.00000000],
+		[-6.27177709, -0.00096813, 0.00059350, 0.00097315, -0.00000114, 0.00000000],
+		[-6.27177812, -0.00096783, 0.00059332, 0.00097285, -0.00000114, 0.00000000],
+		[-6.27177915, -0.00096752, 0.00059313, 0.00097254, -0.00000114, 0.00000000],
+		[-6.27178018, -0.00096722, 0.00059295, 0.00097224, -0.00000114, 0.00000000],
+		[-6.27178121, -0.00096692, 0.00059276, 0.00097194, -0.00000114, 0.00000000],
+		[-6.27178224, -0.00096662, 0.00059258, 0.00097163, -0.00000114, 0.00000000],
+		[-6.27178326, -0.00096632, 0.00059239, 0.00097133, -0.00000114, 0.00000000],
+		[-6.27178429, -0.00096602, 0.00059221, 0.00097103, -0.00000114, 0.00000000],
+		[-6.27178531, -0.00096571, 0.00059202, 0.00097072, -0.00000114, 0.00000000],
+		[-6.27178633, -0.00096541, 0.00059184, 0.00097042, -0.00000114, 0.00000000],
+		[-6.27178735, -0.00096511, 0.00059165, 0.00097012, -0.00000114, 0.00000000],
+		[-6.27178836, -0.00096481, 0.00059147, 0.00096981, -0.00000114, 0.00000000],
+		[-6.27178938, -0.00096451, 0.00059128, 0.00096951, -0.00000114, 0.00000000],
+		[-6.27179039, -0.00096421, 0.00059110, 0.00096921, -0.00000114, 0.00000000],
+		[-6.27179140, -0.00096391, 0.00059091, 0.00096891, -0.00000114, 0.00000000],
+		[-6.27179242, -0.00096361, 0.00059073, 0.00096861, -0.00000114, 0.00000000],
+		[-6.27179342, -0.00096331, 0.00059055, 0.00096831, -0.00000114, 0.00000000],
+		[-6.27179443, -0.00096301, 0.00059036, 0.00096800, -0.00000114, 0.00000000],
+		[-6.27179544, -0.00096271, 0.00059018, 0.00096770, -0.00000114, 0.00000000],
+		[-6.27179644, -0.00096241, 0.00058999, 0.00096740, -0.00000114, 0.00000000],
+		[-6.27179744, -0.00096211, 0.00058981, 0.00096710, -0.00000114, 0.00000000],
+		[-6.27179844, -0.00096181, 0.00058963, 0.00096680, -0.00000114, 0.00000000],
+		[-6.27179944, -0.00096152, 0.00058944, 0.00096650, -0.00000114, 0.00000000],
+		[-6.27180044, -0.00096122, 0.00058926, 0.00096620, -0.00000114, 0.00000000],
+		[-6.27180143, -0.00096092, 0.00058908, 0.00096590, -0.00000114, 0.00000000],
+		[-6.27180243, -0.00096062, 0.00058890, 0.00096560, -0.00000114, 0.00000000],
+		[-6.27180342, -0.00096032, 0.00058871, 0.00096530, -0.00000114, 0.00000000],
+		[-6.27180441, -0.00096002, 0.00058853, 0.00096500, -0.00000114, 0.00000000],
+		[-6.27180540, -0.00095973, 0.00058835, 0.00096470, -0.00000114, 0.00000000],
+		[-6.27180639, -0.00095943, 0.00058816, 0.00096440, -0.00000114, 0.00000000],
+		[-6.27180737, -0.00095913, 0.00058798, 0.00096410, -0.00000114, 0.00000000],
+		[-6.27180836, -0.00095884, 0.00058780, 0.00096381, -0.00000114, 0.00000000],
+		[-6.27180934, -0.00095854, 0.00058762, 0.00096351, -0.00000114, 0.00000000],
+		[-6.27181032, -0.00095824, 0.00058744, 0.00096321, -0.00000114, 0.00000000],
+		[-6.27181130, -0.00095795, 0.00058725, 0.00096291, -0.00000114, 0.00000000],
+		[-6.27181228, -0.00095765, 0.00058707, 0.00096261, -0.00000114, 0.00000000],
+		[-6.27181325, -0.00095735, 0.00058689, 0.00096232, -0.00000114, 0.00000000],
+		[-6.27181423, -0.00095706, 0.00058671, 0.00096202, -0.00000114, 0.00000000],
+		[-6.27181520, -0.00095676, 0.00058653, 0.00096172, -0.00000114, 0.00000000],
+		[-6.27181618, -0.00095647, 0.00058635, 0.00096142, -0.00000114, 0.00000000],
+		[-6.27181715, -0.00095617, 0.00058616, 0.00096113, -0.00000114, 0.00000000],
+		[-6.27181811, -0.00095588, 0.00058598, 0.00096083, -0.00000114, 0.00000000],
+		[-6.27181908, -0.00095558, 0.00058580, 0.00096053, -0.00000114, 0.00000000],
+		[-6.27182005, -0.00095529, 0.00058562, 0.00096024, -0.00000114, 0.00000000],
+		[-6.27182101, -0.00095499, 0.00058544, 0.00095994, -0.00000114, 0.00000000],
+		[-6.27182198, -0.00095470, 0.00058526, 0.00095964, -0.00000114, 0.00000000],
+		[-6.27182294, -0.00095440, 0.00058508, 0.00095935, -0.00000114, 0.00000000],
+		[-6.27182390, -0.00095411, 0.00058490, 0.00095905, -0.00000114, 0.00000000],
+		[-6.27182486, -0.00095381, 0.00058472, 0.00095876, -0.00000114, 0.00000000],
+		[-6.27182581, -0.00095352, 0.00058454, 0.00095846, -0.00000114, 0.00000000],
+		[-6.27182677, -0.00095323, 0.00058436, 0.00095817, -0.00000114, 0.00000000],
+		[-6.27182772, -0.00095293, 0.00058418, 0.00095787, -0.00000114, 0.00000000],
+		[-6.27182867, -0.00095264, 0.00058400, 0.00095758, -0.00000114, 0.00000000],
+		[-6.27182963, -0.00095235, 0.00058382, 0.00095728, -0.00000114, 0.00000000],
+		[-6.27183058, -0.00095205, 0.00058364, 0.00095699, -0.00000114, 0.00000000],
+		[-6.27183152, -0.00095176, 0.00058346, 0.00095669, -0.00000114, 0.00000000],
+		[-6.27183247, -0.00095147, 0.00058328, 0.00095640, -0.00000114, 0.00000000],
+		[-6.27183342, -0.00095118, 0.00058310, 0.00095611, -0.00000114, 0.00000000],
+		[-6.27183436, -0.00095088, 0.00058292, 0.00095581, -0.00000114, 0.00000000],
+		[-6.27183530, -0.00095059, 0.00058274, 0.00095552, -0.00000114, 0.00000000],
+		[-6.27183624, -0.00095030, 0.00058256, 0.00095523, -0.00000114, 0.00000000],
+		[-6.27183718, -0.00095001, 0.00058238, 0.00095493, -0.00000114, 0.00000000],
+		[-6.27183812, -0.00094972, 0.00058221, 0.00095464, -0.00000114, 0.00000000],
+		[-6.27183906, -0.00094943, 0.00058203, 0.00095435, -0.00000114, 0.00000000],
+		[-6.27183999, -0.00094914, 0.00058185, 0.00095405, -0.00000114, 0.00000000],
+		[-6.27184093, -0.00094884, 0.00058167, 0.00095376, -0.00000114, 0.00000000],
+		[-6.27184186, -0.00094855, 0.00058149, 0.00095347, -0.00000114, 0.00000000],
+		[-6.27184279, -0.00094826, 0.00058131, 0.00095318, -0.00000114, 0.00000000],
+		[-6.27184372, -0.00094797, 0.00058113, 0.00095288, -0.00000114, 0.00000000],
+		[-6.27184465, -0.00094768, 0.00058096, 0.00095259, -0.00000114, 0.00000000],
+		[-6.27184558, -0.00094739, 0.00058078, 0.00095230, -0.00000114, 0.00000000],
+		[-6.27184650, -0.00094710, 0.00058060, 0.00095201, -0.00000114, 0.00000000],
+		[-6.27184743, -0.00094681, 0.00058042, 0.00095172, -0.00000114, 0.00000000],
+		[-6.27184835, -0.00094652, 0.00058025, 0.00095143, -0.00000114, 0.00000000],
+		[-6.27184927, -0.00094623, 0.00058007, 0.00095114, -0.00000114, 0.00000000],
+		[-6.27185019, -0.00094595, 0.00057989, 0.00095085, -0.00000114, 0.00000000],
+		[-6.27185111, -0.00094566, 0.00057971, 0.00095056, -0.00000114, 0.00000000],
+		[-6.27185203, -0.00094537, 0.00057954, 0.00095027, -0.00000114, 0.00000000],
+		[-6.27185294, -0.00094508, 0.00057936, 0.00094998, -0.00000114, 0.00000000],
+		[-6.27185386, -0.00094479, 0.00057918, 0.00094969, -0.00000114, 0.00000000],
+		[-6.27185477, -0.00094450, 0.00057901, 0.00094940, -0.00000114, 0.00000000],
+		[-6.27185568, -0.00094421, 0.00057883, 0.00094911, -0.00000114, 0.00000000],
+		[-6.27185659, -0.00094393, 0.00057865, 0.00094882, -0.00000114, 0.00000000],
+		[-6.27185750, -0.00094364, 0.00057848, 0.00094853, -0.00000114, 0.00000000],
+		[-6.27185841, -0.00094335, 0.00057830, 0.00094824, -0.00000114, 0.00000000],
+		[-6.27185932, -0.00094306, 0.00057812, 0.00094795, -0.00000114, 0.00000000],
+		[-6.27186022, -0.00094278, 0.00057795, 0.00094766, -0.00000114, 0.00000000],
+		[-6.27186113, -0.00094249, 0.00057777, 0.00094737, -0.00000114, 0.00000000],
+		[-6.27186203, -0.00094220, 0.00057759, 0.00094708, -0.00000114, 0.00000000],
+		[-6.27186293, -0.00094192, 0.00057742, 0.00094680, -0.00000114, 0.00000000],
+		[-6.27186383, -0.00094163, 0.00057724, 0.00094651, -0.00000114, 0.00000000],
+		[-6.27186473, -0.00094134, 0.00057707, 0.00094622, -0.00000114, 0.00000000],
+		[-6.27186563, -0.00094106, 0.00057689, 0.00094593, -0.00000114, 0.00000000],
+		[-6.27186652, -0.00094077, 0.00057672, 0.00094564, -0.00000114, 0.00000000],
+		[-6.27186742, -0.00094049, 0.00057654, 0.00094536, -0.00000114, 0.00000000],
+		[-6.27186831, -0.00094020, 0.00057636, 0.00094507, -0.00000114, 0.00000000],
+		[-6.27186920, -0.00093991, 0.00057619, 0.00094478, -0.00000114, 0.00000000],
+		[-6.27187010, -0.00093963, 0.00057601, 0.00094450, -0.00000114, 0.00000000],
+		[-6.27187098, -0.00093934, 0.00057584, 0.00094421, -0.00000114, 0.00000000],
+		[-6.27187187, -0.00093906, 0.00057567, 0.00094392, -0.00000114, 0.00000000],
+		[-6.27187276, -0.00093877, 0.00057549, 0.00094364, -0.00000114, 0.00000000],
+		[-6.27187365, -0.00093849, 0.00057532, 0.00094335, -0.00000114, 0.00000000],
+		[-6.27187453, -0.00093821, 0.00057514, 0.00094306, -0.00000114, 0.00000000],
+		[-6.27187541, -0.00093792, 0.00057497, 0.00094278, -0.00000114, 0.00000000],
+		[-6.27187630, -0.00093764, 0.00057479, 0.00094249, -0.00000114, 0.00000000],
+		[-6.27187718, -0.00093735, 0.00057462, 0.00094221, -0.00000114, 0.00000000],
+		[-6.27187806, -0.00093707, 0.00057444, 0.00094192, -0.00000114, 0.00000000],
+		[-6.27187894, -0.00093679, 0.00057427, 0.00094164, -0.00000114, 0.00000000],
+		[-6.27187981, -0.00093650, 0.00057410, 0.00094135, -0.00000114, 0.00000000],
+		[-6.27188069, -0.00093622, 0.00057392, 0.00094107, -0.00000114, 0.00000000],
+		[-6.27188156, -0.00093594, 0.00057375, 0.00094078, -0.00000114, 0.00000000],
+		[-6.27188244, -0.00093565, 0.00057358, 0.00094050, -0.00000114, 0.00000000],
+		[-6.27188331, -0.00093537, 0.00057340, 0.00094021, -0.00000114, 0.00000000],
+		[-6.27188418, -0.00093509, 0.00057323, 0.00093993, -0.00000114, 0.00000000],
+		[-6.27188505, -0.00093481, 0.00057306, 0.00093965, -0.00000114, 0.00000000],
+		[-6.27188592, -0.00093452, 0.00057288, 0.00093936, -0.00000114, 0.00000000],
+		[-6.27188679, -0.00093424, 0.00057271, 0.00093908, -0.00000114, 0.00000000],
+		[-6.27188765, -0.00093396, 0.00057254, 0.00093880, -0.00000114, 0.00000000],
+		[-6.27188852, -0.00093368, 0.00057236, 0.00093851, -0.00000114, 0.00000000],
+		[-6.27188938, -0.00093340, 0.00057219, 0.00093823, -0.00000114, 0.00000000],
+		[-6.27189025, -0.00093312, 0.00057202, 0.00093795, -0.00000114, 0.00000000],
+		[-6.27189111, -0.00093283, 0.00057185, 0.00093766, -0.00000114, 0.00000000],
+		[-6.27189197, -0.00093255, 0.00057167, 0.00093738, -0.00000114, 0.00000000],
+		[-6.27189283, -0.00093227, 0.00057150, 0.00093710, -0.00000114, 0.00000000],
+		[-6.27189369, -0.00093199, 0.00057133, 0.00093682, -0.00000114, 0.00000000],
+		[-6.27189454, -0.00093171, 0.00057116, 0.00093654, -0.00000114, 0.00000000],
+		[-6.27189540, -0.00093143, 0.00057098, 0.00093625, -0.00000114, 0.00000000],
+		[-6.27189625, -0.00093115, 0.00057081, 0.00093597, -0.00000114, 0.00000000],
+		[-6.27189711, -0.00093087, 0.00057064, 0.00093569, -0.00000114, 0.00000000],
+		[-6.27189796, -0.00093059, 0.00057047, 0.00093541, -0.00000114, 0.00000000],
+		[-6.27189881, -0.00093031, 0.00057030, 0.00093513, -0.00000114, 0.00000000],
+		[-6.27189966, -0.00093003, 0.00057013, 0.00093485, -0.00000114, 0.00000000],
+		[-6.27190051, -0.00092975, 0.00056995, 0.00093457, -0.00000114, 0.00000000],
+		[-6.27190136, -0.00092947, 0.00056978, 0.00093429, -0.00000114, 0.00000000],
+		[-6.27190220, -0.00092919, 0.00056961, 0.00093401, -0.00000114, 0.00000000],
+		[-6.27190305, -0.00092892, 0.00056944, 0.00093372, -0.00000114, 0.00000000],
+		[-6.27190389, -0.00092864, 0.00056927, 0.00093344, -0.00000114, 0.00000000],
+		[-6.27190474, -0.00092836, 0.00056910, 0.00093316, -0.00000114, 0.00000000],
+		[-6.27190558, -0.00092808, 0.00056893, 0.00093288, -0.00000114, 0.00000000],
+		[-6.27190642, -0.00092780, 0.00056876, 0.00093261, -0.00000114, 0.00000000],
+		[-6.27190726, -0.00092752, 0.00056859, 0.00093233, -0.00000114, 0.00000000],
+		[-6.27190810, -0.00092725, 0.00056842, 0.00093205, -0.00000114, 0.00000000],
+		[-6.27190893, -0.00092697, 0.00056825, 0.00093177, -0.00000114, 0.00000000],
+		[-6.27190977, -0.00092669, 0.00056808, 0.00093149, -0.00000114, 0.00000000],
+		[-6.27191061, -0.00092641, 0.00056791, 0.00093121, -0.00000114, 0.00000000],
+		[-6.27191144, -0.00092614, 0.00056774, 0.00093093, -0.00000114, 0.00000000],
+		[-6.27191227, -0.00092586, 0.00056757, 0.00093065, -0.00000114, 0.00000000],
+		[-6.27191311, -0.00092558, 0.00056740, 0.00093037, -0.00000114, 0.00000000],
+		[-6.27191394, -0.00092531, 0.00056723, 0.00093010, -0.00000114, 0.00000000],
+		[-6.27191477, -0.00092503, 0.00056706, 0.00092982, -0.00000114, 0.00000000],
+		[-6.27191559, -0.00092475, 0.00056689, 0.00092954, -0.00000114, 0.00000000],
+		[-6.27191642, -0.00092448, 0.00056672, 0.00092926, -0.00000114, 0.00000000],
+		[-6.27191725, -0.00092420, 0.00056655, 0.00092899, -0.00000114, 0.00000000],
+		[-6.27191807, -0.00092393, 0.00056638, 0.00092871, -0.00000114, 0.00000000],
+		[-6.27191890, -0.00092365, 0.00056621, 0.00092843, -0.00000114, 0.00000000],
+		[-6.27191972, -0.00092338, 0.00056604, 0.00092815, -0.00000114, 0.00000000],
+		[-6.27192054, -0.00092310, 0.00056587, 0.00092788, -0.00000114, 0.00000000],
+		[-6.27192136, -0.00092282, 0.00056570, 0.00092760, -0.00000114, 0.00000000],
+		[-6.27192218, -0.00092255, 0.00056553, 0.00092732, -0.00000114, 0.00000000],
+		[-6.27192300, -0.00092227, 0.00056537, 0.00092705, -0.00000114, 0.00000000],
+		[-6.27192382, -0.00092200, 0.00056520, 0.00092677, -0.00000114, 0.00000000],
+		[-6.27192464, -0.00092173, 0.00056503, 0.00092650, -0.00000114, 0.00000000],
+		[-6.27192545, -0.00092145, 0.00056486, 0.00092622, -0.00000114, 0.00000000],
+		[-6.27192627, -0.00092118, 0.00056469, 0.00092594, -0.00000114, 0.00000000],
+		[-6.27192708, -0.00092090, 0.00056452, 0.00092567, -0.00000114, 0.00000000],
+		[-6.27192790, -0.00092063, 0.00056436, 0.00092539, -0.00000114, 0.00000000],
+		[-6.27192871, -0.00092036, 0.00056419, 0.00092512, -0.00000114, 0.00000000],
+		[-6.27192952, -0.00092008, 0.00056402, 0.00092484, -0.00000114, 0.00000000],
+		[-6.27193033, -0.00091981, 0.00056385, 0.00092457, -0.00000114, 0.00000000],
+		[-6.27193114, -0.00091954, 0.00056368, 0.00092429, -0.00000114, 0.00000000],
+		[-6.27193194, -0.00091926, 0.00056352, 0.00092402, -0.00000114, 0.00000000],
+		[-6.27193275, -0.00091899, 0.00056335, 0.00092374, -0.00000114, 0.00000000],
+		[-6.27193356, -0.00091872, 0.00056318, 0.00092347, -0.00000114, 0.00000000],
+		[-6.27193436, -0.00091844, 0.00056301, 0.00092320, -0.00000114, 0.00000000],
+		[-6.27193516, -0.00091817, 0.00056285, 0.00092292, -0.00000114, 0.00000000],
+		[-6.27193597, -0.00091790, 0.00056268, 0.00092265, -0.00000114, 0.00000000],
+		[-6.27193677, -0.00091763, 0.00056251, 0.00092238, -0.00000114, 0.00000000],
+		[-6.27193757, -0.00091736, 0.00056235, 0.00092210, -0.00000114, 0.00000000],
+		[-6.27193837, -0.00091708, 0.00056218, 0.00092183, -0.00000114, 0.00000000],
+		[-6.27193917, -0.00091681, 0.00056201, 0.00092156, -0.00000114, 0.00000000],
+		[-6.27193996, -0.00091654, 0.00056185, 0.00092128, -0.00000114, 0.00000000],
+		[-6.27194076, -0.00091627, 0.00056168, 0.00092101, -0.00000114, 0.00000000],
+		[-6.27194155, -0.00091600, 0.00056151, 0.00092074, -0.00000114, 0.00000000],
+		[-6.27194235, -0.00091573, 0.00056135, 0.00092046, -0.00000114, 0.00000000],
+		[-6.27194314, -0.00091546, 0.00056118, 0.00092019, -0.00000114, 0.00000000],
+		[-6.27194394, -0.00091519, 0.00056102, 0.00091992, -0.00000114, 0.00000000],
+		[-6.27194473, -0.00091492, 0.00056085, 0.00091965, -0.00000114, 0.00000000],
+		[-6.27194552, -0.00091465, 0.00056068, 0.00091938, -0.00000114, 0.00000000],
+		[-6.27194631, -0.00091438, 0.00056052, 0.00091911, -0.00000114, 0.00000000],
+		[-6.27194710, -0.00091411, 0.00056035, 0.00091883, -0.00000114, 0.00000000],
+		[-6.27194788, -0.00091384, 0.00056019, 0.00091856, -0.00000114, 0.00000000],
+		[-6.27194867, -0.00091357, 0.00056002, 0.00091829, -0.00000114, 0.00000000],
+		[-6.27194946, -0.00091330, 0.00055986, 0.00091802, -0.00000114, 0.00000000],
+		[-6.27195024, -0.00091303, 0.00055969, 0.00091775, -0.00000114, 0.00000000],
+		[-6.27195102, -0.00091276, 0.00055953, 0.00091748, -0.00000114, 0.00000000],
+		[-6.27195181, -0.00091249, 0.00055936, 0.00091721, -0.00000114, 0.00000000],
+		[-6.27195259, -0.00091222, 0.00055920, 0.00091694, -0.00000114, 0.00000000],
+		[-6.27195337, -0.00091195, 0.00055903, 0.00091667, -0.00000114, 0.00000000],
+		[-6.27195415, -0.00091168, 0.00055887, 0.00091640, -0.00000114, 0.00000000],
+		[-6.27195493, -0.00091141, 0.00055870, 0.00091613, -0.00000114, 0.00000000],
+		[-6.27195571, -0.00091115, 0.00055854, 0.00091586, -0.00000114, 0.00000000],
+		[-6.27195648, -0.00091088, 0.00055837, 0.00091559, -0.00000114, 0.00000000],
+		[-6.27195726, -0.00091061, 0.00055821, 0.00091532, -0.00000114, 0.00000000],
+		[-6.27195803, -0.00091034, 0.00055804, 0.00091505, -0.00000114, 0.00000000],
+		[-6.27195881, -0.00091007, 0.00055788, 0.00091478, -0.00000114, 0.00000000],
+		[-6.27195958, -0.00090981, 0.00055771, 0.00091451, -0.00000114, 0.00000000],
+		[-6.27196035, -0.00090954, 0.00055755, 0.00091424, -0.00000114, 0.00000000],
+		[-6.27196113, -0.00090927, 0.00055739, 0.00091397, -0.00000114, 0.00000000],
+		[-6.27196190, -0.00090901, 0.00055722, 0.00091371, -0.00000114, 0.00000000],
+		[-6.27196267, -0.00090874, 0.00055706, 0.00091344, -0.00000114, 0.00000000],
+		[-6.27196344, -0.00090847, 0.00055690, 0.00091317, -0.00000114, 0.00000000],
+		[-6.27196420, -0.00090821, 0.00055673, 0.00091290, -0.00000114, 0.00000000],
+		[-6.27196497, -0.00090794, 0.00055657, 0.00091263, -0.00000114, 0.00000000],
+		[-6.27196574, -0.00090767, 0.00055641, 0.00091237, -0.00000114, 0.00000000],
+		[-6.27196650, -0.00090741, 0.00055624, 0.00091210, -0.00000114, 0.00000000],
+		[-6.27196726, -0.00090714, 0.00055608, 0.00091183, -0.00000114, 0.00000000],
+		[-6.27196803, -0.00090688, 0.00055592, 0.00091156, -0.00000114, 0.00000000],
+		[-6.27196879, -0.00090661, 0.00055575, 0.00091130, -0.00000114, 0.00000000],
+		[-6.27196955, -0.00090634, 0.00055559, 0.00091103, -0.00000114, 0.00000000],
+		[-6.27197031, -0.00090608, 0.00055543, 0.00091076, -0.00000114, 0.00000000],
+		[-6.27197107, -0.00090581, 0.00055526, 0.00091050, -0.00000114, 0.00000000],
+		[-6.27197183, -0.00090555, 0.00055510, 0.00091023, -0.00000114, 0.00000000],
+		[-6.27197259, -0.00090528, 0.00055494, 0.00090997, -0.00000114, 0.00000000],
+		[-6.27197335, -0.00090502, 0.00055478, 0.00090970, -0.00000114, 0.00000000],
+		[-6.27197410, -0.00090476, 0.00055461, 0.00090943, -0.00000114, 0.00000000],
+		[-6.27197486, -0.00090449, 0.00055445, 0.00090917, -0.00000114, 0.00000000],
+		[-6.27197561, -0.00090423, 0.00055429, 0.00090890, -0.00000114, 0.00000000],
+		[-6.27197637, -0.00090396, 0.00055413, 0.00090864, -0.00000114, 0.00000000],
+		[-6.27197712, -0.00090370, 0.00055397, 0.00090837, -0.00000114, 0.00000000],
+		[-6.27197787, -0.00090344, 0.00055380, 0.00090811, -0.00000114, 0.00000000],
+		[-6.27197862, -0.00090317, 0.00055364, 0.00090784, -0.00000114, 0.00000000],
+		[-6.27197937, -0.00090291, 0.00055348, 0.00090758, -0.00000114, 0.00000000],
+		[-6.27198012, -0.00090264, 0.00055332, 0.00090731, -0.00000114, 0.00000000],
+		[-6.27198087, -0.00090238, 0.00055316, 0.00090705, -0.00000114, 0.00000000],
+		[-6.27198162, -0.00090212, 0.00055300, 0.00090678, -0.00000114, 0.00000000],
+		[-6.27198236, -0.00090186, 0.00055284, 0.00090652, -0.00000114, 0.00000000],
+		[-6.27198311, -0.00090159, 0.00055267, 0.00090625, -0.00000114, 0.00000000],
+		[-6.27198385, -0.00090133, 0.00055251, 0.00090599, -0.00000113, 0.00000000],
+		[-6.27198460, -0.00090107, 0.00055235, 0.00090573, -0.00000113, 0.00000000],
+		[-6.27198534, -0.00090081, 0.00055219, 0.00090546, -0.00000113, 0.00000000],
+		[-6.27198608, -0.00090054, 0.00055203, 0.00090520, -0.00000113, 0.00000000],
+		[-6.27198682, -0.00090028, 0.00055187, 0.00090494, -0.00000113, 0.00000000],
+		[-6.27198756, -0.00090002, 0.00055171, 0.00090467, -0.00000113, 0.00000000],
+		[-6.27198830, -0.00089976, 0.00055155, 0.00090441, -0.00000113, 0.00000000],
+		[-6.27198904, -0.00089950, 0.00055139, 0.00090415, -0.00000113, 0.00000000],
+		[-6.27198978, -0.00089924, 0.00055123, 0.00090388, -0.00000113, 0.00000000],
+		[-6.27199052, -0.00089898, 0.00055107, 0.00090362, -0.00000113, 0.00000000],
+		[-6.27199126, -0.00089871, 0.00055091, 0.00090336, -0.00000113, 0.00000000],
+		[-6.27199199, -0.00089845, 0.00055075, 0.00090310, -0.00000113, 0.00000000],
+		[-6.27199273, -0.00089819, 0.00055059, 0.00090284, -0.00000113, 0.00000000],
+		[-6.27199346, -0.00089793, 0.00055043, 0.00090257, -0.00000113, 0.00000000],
+		[-6.27199419, -0.00089767, 0.00055027, 0.00090231, -0.00000113, 0.00000000],
+		[-6.27199493, -0.00089741, 0.00055011, 0.00090205, -0.00000113, 0.00000000],
+		[-6.27199566, -0.00089715, 0.00054995, 0.00090179, -0.00000113, 0.00000000],
+		[-6.27199639, -0.00089689, 0.00054979, 0.00090153, -0.00000113, 0.00000000],
+		[-6.27199712, -0.00089663, 0.00054963, 0.00090127, -0.00000113, 0.00000000],
+		[-6.27199785, -0.00089637, 0.00054947, 0.00090100, -0.00000113, 0.00000000],
+		[-6.27199857, -0.00089611, 0.00054931, 0.00090074, -0.00000113, 0.00000000],
+		[-6.27199930, -0.00089585, 0.00054915, 0.00090048, -0.00000113, 0.00000000],
+		[-6.27200003, -0.00089559, 0.00054899, 0.00090022, -0.00000113, 0.00000000],
+		[-6.27200076, -0.00089534, 0.00054883, 0.00089996, -0.00000113, 0.00000000],
+		[-6.27200148, -0.00089508, 0.00054868, 0.00089970, -0.00000113, 0.00000000],
+		[-6.27200220, -0.00089482, 0.00054852, 0.00089944, -0.00000113, 0.00000000],
+		[-6.27200293, -0.00089456, 0.00054836, 0.00089918, -0.00000113, 0.00000000],
+		[-6.27200365, -0.00089430, 0.00054820, 0.00089892, -0.00000113, 0.00000000],
+		[-6.27200437, -0.00089404, 0.00054804, 0.00089866, -0.00000113, 0.00000000],
+		[-6.27200509, -0.00089378, 0.00054788, 0.00089840, -0.00000113, 0.00000000],
+		[-6.27200581, -0.00089353, 0.00054772, 0.00089814, -0.00000113, 0.00000000],
+		[-6.27200653, -0.00089327, 0.00054757, 0.00089788, -0.00000113, 0.00000000],
+		[-6.27200725, -0.00089301, 0.00054741, 0.00089763, -0.00000113, 0.00000000],
+		[-6.27200797, -0.00089275, 0.00054725, 0.00089737, -0.00000113, 0.00000000],
+		[-6.27200869, -0.00089250, 0.00054709, 0.00089711, -0.00000113, 0.00000000],
+		[-6.27200940, -0.00089224, 0.00054693, 0.00089685, -0.00000113, 0.00000000],
+		[-6.27201012, -0.00089198, 0.00054678, 0.00089659, -0.00000113, 0.00000000],
+		[-6.27201083, -0.00089172, 0.00054662, 0.00089633, -0.00000113, 0.00000000],
+		[-6.27201155, -0.00089147, 0.00054646, 0.00089607, -0.00000113, 0.00000000],
+		[-6.27201226, -0.00089121, 0.00054630, 0.00089582, -0.00000113, 0.00000000],
+		[-6.27201297, -0.00089095, 0.00054615, 0.00089556, -0.00000113, 0.00000000],
+		[-6.27201369, -0.00089070, 0.00054599, 0.00089530, -0.00000113, 0.00000000],
+		[-6.27201440, -0.00089044, 0.00054583, 0.00089504, -0.00000113, 0.00000000],
+		[-6.27201511, -0.00089019, 0.00054568, 0.00089479, -0.00000113, 0.00000000],
+		[-6.27201582, -0.00088993, 0.00054552, 0.00089453, -0.00000113, 0.00000000],
+		[-6.27201653, -0.00088967, 0.00054536, 0.00089427, -0.00000113, 0.00000000],
+		[-6.27201723, -0.00088942, 0.00054520, 0.00089401, -0.00000113, 0.00000000],
+		[-6.27201794, -0.00088916, 0.00054505, 0.00089376, -0.00000113, 0.00000000],
+		[-6.27201865, -0.00088891, 0.00054489, 0.00089350, -0.00000113, 0.00000000],
+		[-6.27201935, -0.00088865, 0.00054473, 0.00089324, -0.00000113, 0.00000000],
+		[-6.27202006, -0.00088840, 0.00054458, 0.00089299, -0.00000113, 0.00000000],
+		[-6.27202076, -0.00088814, 0.00054442, 0.00089273, -0.00000113, 0.00000000],
+		[-6.27202147, -0.00088789, 0.00054427, 0.00089248, -0.00000113, 0.00000000],
+		[-6.27202217, -0.00088763, 0.00054411, 0.00089222, -0.00000113, 0.00000000],
+		[-6.27202287, -0.00088738, 0.00054395, 0.00089196, -0.00000113, 0.00000000],
+		[-6.27202357, -0.00088713, 0.00054380, 0.00089171, -0.00000113, 0.00000000],
+		[-6.27202427, -0.00088687, 0.00054364, 0.00089145, -0.00000113, 0.00000000],
+		[-6.27202497, -0.00088662, 0.00054349, 0.00089120, -0.00000113, 0.00000000],
+		[-6.27202567, -0.00088636, 0.00054333, 0.00089094, -0.00000113, 0.00000000],
+		[-6.27202637, -0.00088611, 0.00054317, 0.00089069, -0.00000113, 0.00000000],
+		[-6.27202707, -0.00088586, 0.00054302, 0.00089043, -0.00000113, 0.00000000],
+		[-6.27202777, -0.00088560, 0.00054286, 0.00089018, -0.00000113, 0.00000000],
+		[-6.27202846, -0.00088535, 0.00054271, 0.00088992, -0.00000113, 0.00000000],
+		[-6.27202916, -0.00088510, 0.00054255, 0.00088967, -0.00000113, 0.00000000],
+		[-6.27202985, -0.00088484, 0.00054240, 0.00088941, -0.00000113, 0.00000000],
+		[-6.27203055, -0.00088459, 0.00054224, 0.00088916, -0.00000113, 0.00000000],
+		[-6.27203124, -0.00088434, 0.00054209, 0.00088891, -0.00000113, 0.00000000],
+		[-6.27203193, -0.00088409, 0.00054193, 0.00088865, -0.00000113, 0.00000000],
+		[-6.27203262, -0.00088383, 0.00054178, 0.00088840, -0.00000113, 0.00000000],
+		[-6.27203332, -0.00088358, 0.00054162, 0.00088814, -0.00000113, 0.00000000],
+		[-6.27203401, -0.00088333, 0.00054147, 0.00088789, -0.00000113, 0.00000000],
+		[-6.27203470, -0.00088308, 0.00054131, 0.00088764, -0.00000113, 0.00000000],
+		[-6.27203539, -0.00088282, 0.00054116, 0.00088738, -0.00000113, 0.00000000],
+		[-6.27203607, -0.00088257, 0.00054100, 0.00088713, -0.00000113, 0.00000000],
+		[-6.27203676, -0.00088232, 0.00054085, 0.00088688, -0.00000113, 0.00000000],
+		[-6.27203745, -0.00088207, 0.00054069, 0.00088663, -0.00000113, 0.00000000],
+		[-6.27203813, -0.00088182, 0.00054054, 0.00088637, -0.00000113, 0.00000000],
+		[-6.27203882, -0.00088157, 0.00054039, 0.00088612, -0.00000113, 0.00000000],
+		[-6.27203950, -0.00088132, 0.00054023, 0.00088587, -0.00000113, 0.00000000],
+		[-6.27204019, -0.00088107, 0.00054008, 0.00088562, -0.00000113, 0.00000000],
+		[-6.27204087, -0.00088082, 0.00053992, 0.00088536, -0.00000113, 0.00000000],
+		[-6.27204156, -0.00088056, 0.00053977, 0.00088511, -0.00000113, 0.00000000],
+		[-6.27204224, -0.00088031, 0.00053962, 0.00088486, -0.00000113, 0.00000000],
+		[-6.27204292, -0.00088006, 0.00053946, 0.00088461, -0.00000113, 0.00000000],
+		[-6.27204360, -0.00087981, 0.00053931, 0.00088436, -0.00000113, 0.00000000],
+		[-6.27204428, -0.00087956, 0.00053916, 0.00088411, -0.00000113, 0.00000000],
+		[-6.27204496, -0.00087931, 0.00053900, 0.00088385, -0.00000113, 0.00000000],
+		[-6.27204564, -0.00087906, 0.00053885, 0.00088360, -0.00000113, 0.00000000],
+		[-6.27204632, -0.00087881, 0.00053870, 0.00088335, -0.00000113, 0.00000000],
+		[-6.27204699, -0.00087857, 0.00053854, 0.00088310, -0.00000113, 0.00000000],
+		[-6.27204767, -0.00087832, 0.00053839, 0.00088285, -0.00000113, 0.00000000],
+		[-6.27204835, -0.00087807, 0.00053824, 0.00088260, -0.00000113, 0.00000000],
+		[-6.27204902, -0.00087782, 0.00053809, 0.00088235, -0.00000113, 0.00000000],
+		[-6.27204970, -0.00087757, 0.00053793, 0.00088210, -0.00000113, 0.00000000],
+		[-6.27205037, -0.00087732, 0.00053778, 0.00088185, -0.00000113, 0.00000000],
+		[-6.27205104, -0.00087707, 0.00053763, 0.00088160, -0.00000113, 0.00000000],
+		[-6.27205172, -0.00087682, 0.00053748, 0.00088135, -0.00000113, 0.00000000],
+		[-6.27205239, -0.00087658, 0.00053732, 0.00088110, -0.00000113, 0.00000000],
+		[-6.27205306, -0.00087633, 0.00053717, 0.00088085, -0.00000113, 0.00000000],
+		[-6.27205373, -0.00087608, 0.00053702, 0.00088060, -0.00000113, 0.00000000],
+		[-6.27205440, -0.00087583, 0.00053687, 0.00088035, -0.00000113, 0.00000000],
+		[-6.27205507, -0.00087558, 0.00053671, 0.00088010, -0.00000113, 0.00000000],
+		[-6.27205574, -0.00087534, 0.00053656, 0.00087985, -0.00000113, 0.00000000],
+		[-6.27205641, -0.00087509, 0.00053641, 0.00087961, -0.00000113, 0.00000000],
+		[-6.27205707, -0.00087484, 0.00053626, 0.00087936, -0.00000113, 0.00000000],
+		[-6.27205774, -0.00087459, 0.00053611, 0.00087911, -0.00000113, 0.00000000],
+		[-6.27205841, -0.00087435, 0.00053596, 0.00087886, -0.00000113, 0.00000000],
+		[-6.27205907, -0.00087410, 0.00053580, 0.00087861, -0.00000113, 0.00000000],
+		[-6.27205974, -0.00087385, 0.00053565, 0.00087836, -0.00000113, 0.00000000],
+		[-6.27206040, -0.00087361, 0.00053550, 0.00087812, -0.00000113, 0.00000000],
+		[-6.27206106, -0.00087336, 0.00053535, 0.00087787, -0.00000113, 0.00000000],
+		[-6.27206173, -0.00087311, 0.00053520, 0.00087762, -0.00000113, 0.00000000],
+		[-6.27206239, -0.00087287, 0.00053505, 0.00087737, -0.00000113, 0.00000000],
+		[-6.27206305, -0.00087262, 0.00053490, 0.00087713, -0.00000113, 0.00000000],
+		[-6.27206371, -0.00087238, 0.00053475, 0.00087688, -0.00000113, 0.00000000],
+		[-6.27206437, -0.00087213, 0.00053460, 0.00087663, -0.00000113, 0.00000000],
+		[-6.27206503, -0.00087188, 0.00053445, 0.00087638, -0.00000113, 0.00000000],
+		[-6.27206569, -0.00087164, 0.00053429, 0.00087614, -0.00000113, 0.00000000],
+		[-6.27206635, -0.00087139, 0.00053414, 0.00087589, -0.00000113, 0.00000000],
+		[-6.27206701, -0.00087115, 0.00053399, 0.00087564, -0.00000113, 0.00000000],
+		[-6.27206767, -0.00087090, 0.00053384, 0.00087540, -0.00000113, 0.00000000],
+		[-6.27206832, -0.00087066, 0.00053369, 0.00087515, -0.00000113, 0.00000000],
+		[-6.27206898, -0.00087041, 0.00053354, 0.00087491, -0.00000113, 0.00000000],
+		[-6.27206963, -0.00087017, 0.00053339, 0.00087466, -0.00000113, 0.00000000],
+		[-6.27207029, -0.00086992, 0.00053324, 0.00087441, -0.00000113, 0.00000000],
+		[-6.27207094, -0.00086968, 0.00053309, 0.00087417, -0.00000113, 0.00000000],
+		[-6.27207160, -0.00086944, 0.00053294, 0.00087392, -0.00000113, 0.00000000],
+		[-6.27207225, -0.00086919, 0.00053279, 0.00087368, -0.00000113, 0.00000000],
+		[-6.27207290, -0.00086895, 0.00053264, 0.00087343, -0.00000113, 0.00000000],
+		[-6.27207355, -0.00086870, 0.00053249, 0.00087319, -0.00000113, 0.00000000],
+		[-6.27207420, -0.00086846, 0.00053234, 0.00087294, -0.00000113, 0.00000000],
+		[-6.27207485, -0.00086822, 0.00053219, 0.00087270, -0.00000113, 0.00000000],
+		[-6.27207550, -0.00086797, 0.00053205, 0.00087245, -0.00000113, 0.00000000],
+		[-6.27207615, -0.00086773, 0.00053190, 0.00087221, -0.00000113, 0.00000000],
+		[-6.27207680, -0.00086749, 0.00053175, 0.00087196, -0.00000113, 0.00000000],
+		[-6.27207745, -0.00086724, 0.00053160, 0.00087172, -0.00000113, 0.00000000],
+		[-6.27207810, -0.00086700, 0.00053145, 0.00087147, -0.00000113, 0.00000000],
+		[-6.27207874, -0.00086676, 0.00053130, 0.00087123, -0.00000113, 0.00000000],
+		[-6.27207939, -0.00086652, 0.00053115, 0.00087099, -0.00000113, 0.00000000],
+		[-6.27208004, -0.00086627, 0.00053100, 0.00087074, -0.00000113, 0.00000000],
+		[-6.27208068, -0.00086603, 0.00053085, 0.00087050, -0.00000113, 0.00000000],
+		[-6.27208132, -0.00086579, 0.00053070, 0.00087026, -0.00000113, 0.00000000],
+		[-6.27208197, -0.00086555, 0.00053056, 0.00087001, -0.00000113, 0.00000000],
+		[-6.27208261, -0.00086530, 0.00053041, 0.00086977, -0.00000113, 0.00000000],
+		[-6.27208325, -0.00086506, 0.00053026, 0.00086953, -0.00000113, 0.00000000],
+		[-6.27208390, -0.00086482, 0.00053011, 0.00086928, -0.00000113, 0.00000000],
+		[-6.27208454, -0.00086458, 0.00052996, 0.00086904, -0.00000113, 0.00000000],
+		[-6.27208518, -0.00086434, 0.00052981, 0.00086880, -0.00000113, 0.00000000],
+		[-6.27208582, -0.00086410, 0.00052967, 0.00086856, -0.00000113, 0.00000000],
+		[-6.27208646, -0.00086386, 0.00052952, 0.00086831, -0.00000113, 0.00000000],
+		[-6.27208710, -0.00086361, 0.00052937, 0.00086807, -0.00000113, 0.00000000],
+		[-6.27208774, -0.00086337, 0.00052922, 0.00086783, -0.00000113, 0.00000000],
+		[-6.27208837, -0.00086313, 0.00052908, 0.00086759, -0.00000113, 0.00000000],
+		[-6.27208901, -0.00086289, 0.00052893, 0.00086734, -0.00000113, 0.00000000],
+		[-6.27208965, -0.00086265, 0.00052878, 0.00086710, -0.00000113, 0.00000000],
+		[-6.27209028, -0.00086241, 0.00052863, 0.00086686, -0.00000113, 0.00000000],
+		[-6.27209092, -0.00086217, 0.00052849, 0.00086662, -0.00000113, 0.00000000],
+		[-6.27209155, -0.00086193, 0.00052834, 0.00086638, -0.00000113, 0.00000000],
+		[-6.27209219, -0.00086169, 0.00052819, 0.00086614, -0.00000113, 0.00000000],
+		[-6.27209282, -0.00086145, 0.00052804, 0.00086590, -0.00000113, 0.00000000],
+		[-6.27209346, -0.00086121, 0.00052790, 0.00086565, -0.00000113, 0.00000000],
+		[-6.27209409, -0.00086097, 0.00052775, 0.00086541, -0.00000113, 0.00000000],
+		[-6.27209472, -0.00086073, 0.00052760, 0.00086517, -0.00000113, 0.00000000],
+		[-6.27209535, -0.00086049, 0.00052746, 0.00086493, -0.00000113, 0.00000000],
+		[-6.27209598, -0.00086025, 0.00052731, 0.00086469, -0.00000113, 0.00000000],
+		[-6.27209661, -0.00086002, 0.00052716, 0.00086445, -0.00000113, 0.00000000],
+		[-6.27209724, -0.00085978, 0.00052702, 0.00086421, -0.00000113, 0.00000000],
+		[-6.27209787, -0.00085954, 0.00052687, 0.00086397, -0.00000113, 0.00000000],
+		[-6.27209850, -0.00085930, 0.00052672, 0.00086373, -0.00000113, 0.00000000],
+		[-6.27209913, -0.00085906, 0.00052658, 0.00086349, -0.00000113, 0.00000000],
+		[-6.27209976, -0.00085882, 0.00052643, 0.00086325, -0.00000113, 0.00000000],
+		[-6.27210038, -0.00085858, 0.00052628, 0.00086301, -0.00000113, 0.00000000],
+		[-6.27210101, -0.00085835, 0.00052614, 0.00086277, -0.00000113, 0.00000000],
+		[-6.27210164, -0.00085811, 0.00052599, 0.00086253, -0.00000113, 0.00000000],
+		[-6.27210226, -0.00085787, 0.00052585, 0.00086230, -0.00000113, 0.00000000],
+		[-6.27210289, -0.00085763, 0.00052570, 0.00086206, -0.00000113, 0.00000000],
+		[-6.27210351, -0.00085740, 0.00052555, 0.00086182, -0.00000113, 0.00000000],
+		[-6.27210414, -0.00085716, 0.00052541, 0.00086158, -0.00000113, 0.00000000],
+		[-6.27210476, -0.00085692, 0.00052526, 0.00086134, -0.00000113, 0.00000000],
+		[-6.27210538, -0.00085668, 0.00052512, 0.00086110, -0.00000113, 0.00000000],
+		[-6.27210600, -0.00085645, 0.00052497, 0.00086086, -0.00000113, 0.00000000],
+		[-6.27210663, -0.00085621, 0.00052483, 0.00086063, -0.00000113, 0.00000000],
+		[-6.27210725, -0.00085597, 0.00052468, 0.00086039, -0.00000113, 0.00000000],
+		[-6.27210787, -0.00085574, 0.00052454, 0.00086015, -0.00000113, 0.00000000],
+		[-6.27210849, -0.00085550, 0.00052439, 0.00085991, -0.00000113, 0.00000000],
+		[-6.27210911, -0.00085526, 0.00052425, 0.00085967, -0.00000113, 0.00000000],
+		[-6.27210973, -0.00085503, 0.00052410, 0.00085944, -0.00000113, 0.00000000],
+		[-6.27211034, -0.00085479, 0.00052396, 0.00085920, -0.00000113, 0.00000000],
+		[-6.27211096, -0.00085456, 0.00052381, 0.00085896, -0.00000113, 0.00000000],
+		[-6.27211158, -0.00085432, 0.00052367, 0.00085873, -0.00000113, 0.00000000],
+		[-6.27211220, -0.00085408, 0.00052352, 0.00085849, -0.00000113, 0.00000000],
+		[-6.27211281, -0.00085385, 0.00052338, 0.00085825, -0.00000113, 0.00000000],
+		[-6.27211343, -0.00085361, 0.00052323, 0.00085801, -0.00000113, 0.00000000],
+		[-6.27211404, -0.00085338, 0.00052309, 0.00085778, -0.00000113, 0.00000000],
+		[-6.27211466, -0.00085314, 0.00052295, 0.00085754, -0.00000113, 0.00000000],
+		[-6.27211527, -0.00085291, 0.00052280, 0.00085731, -0.00000113, 0.00000000],
+		[-6.27211589, -0.00085267, 0.00052266, 0.00085707, -0.00000113, 0.00000000],
+		[-6.27211650, -0.00085244, 0.00052251, 0.00085683, -0.00000113, 0.00000000],
+		[-6.27211711, -0.00085220, 0.00052237, 0.00085660, -0.00000113, 0.00000000],
+		[-6.27211772, -0.00085197, 0.00052222, 0.00085636, -0.00000113, 0.00000000],
+		[-6.27211833, -0.00085173, 0.00052208, 0.00085613, -0.00000113, 0.00000000],
+		[-6.27211895, -0.00085150, 0.00052194, 0.00085589, -0.00000113, 0.00000000],
+		[-6.27211956, -0.00085127, 0.00052179, 0.00085565, -0.00000113, 0.00000000],
+		[-6.27212017, -0.00085103, 0.00052165, 0.00085542, -0.00000113, 0.00000000],
+		[-6.27212078, -0.00085080, 0.00052151, 0.00085518, -0.00000113, 0.00000000],
+		[-6.27212138, -0.00085056, 0.00052136, 0.00085495, -0.00000113, 0.00000000],
+		[-6.27212199, -0.00085033, 0.00052122, 0.00085471, -0.00000113, 0.00000000],
+		[-6.27212260, -0.00085010, 0.00052108, 0.00085448, -0.00000113, 0.00000000],
+		[-6.27212321, -0.00084986, 0.00052093, 0.00085425, -0.00000113, 0.00000000],
+		[-6.27212381, -0.00084963, 0.00052079, 0.00085401, -0.00000113, 0.00000000],
+		[-6.27212442, -0.00084940, 0.00052065, 0.00085378, -0.00000113, 0.00000000],
+		[-6.27212503, -0.00084916, 0.00052050, 0.00085354, -0.00000113, 0.00000000],
+		[-6.27212563, -0.00084893, 0.00052036, 0.00085331, -0.00000113, 0.00000000],
+		[-6.27212624, -0.00084870, 0.00052022, 0.00085307, -0.00000113, 0.00000000],
+		[-6.27212684, -0.00084847, 0.00052008, 0.00085284, -0.00000113, 0.00000000],
+		[-6.27212744, -0.00084823, 0.00051993, 0.00085261, -0.00000113, 0.00000000],
+		[-6.27212805, -0.00084800, 0.00051979, 0.00085237, -0.00000113, 0.00000000],
+		[-6.27212865, -0.00084777, 0.00051965, 0.00085214, -0.00000113, 0.00000000],
+		[-6.27212925, -0.00084754, 0.00051951, 0.00085191, -0.00000113, 0.00000000],
+		[-6.27212986, -0.00084730, 0.00051936, 0.00085167, -0.00000113, 0.00000000],
+		[-6.27213046, -0.00084707, 0.00051922, 0.00085144, -0.00000113, 0.00000000],
+		[-6.27213106, -0.00084684, 0.00051908, 0.00085121, -0.00000113, 0.00000000],
+		[-6.27213166, -0.00084661, 0.00051894, 0.00085097, -0.00000113, 0.00000000],
+		[-6.27213226, -0.00084638, 0.00051879, 0.00085074, -0.00000113, 0.00000000],
+		[-6.27213286, -0.00084615, 0.00051865, 0.00085051, -0.00000113, 0.00000000],
+		[-6.27213345, -0.00084592, 0.00051851, 0.00085028, -0.00000113, 0.00000000],
+		[-6.27213405, -0.00084568, 0.00051837, 0.00085004, -0.00000113, 0.00000000],
+		[-6.27213465, -0.00084545, 0.00051823, 0.00084981, -0.00000113, 0.00000000],
+		[-6.27213525, -0.00084522, 0.00051809, 0.00084958, -0.00000113, 0.00000000],
+		[-6.27213585, -0.00084499, 0.00051794, 0.00084935, -0.00000113, 0.00000000],
+		[-6.27213644, -0.00084476, 0.00051780, 0.00084912, -0.00000113, 0.00000000],
+		[-6.27213704, -0.00084453, 0.00051766, 0.00084888, -0.00000113, 0.00000000],
+		[-6.27213763, -0.00084430, 0.00051752, 0.00084865, -0.00000113, 0.00000000],
+		[-6.27213823, -0.00084407, 0.00051738, 0.00084842, -0.00000113, 0.00000000],
+		[-6.27213882, -0.00084384, 0.00051724, 0.00084819, -0.00000113, 0.00000000],
+		[-6.27213942, -0.00084361, 0.00051710, 0.00084796, -0.00000113, 0.00000000],
+		[-6.27214001, -0.00084338, 0.00051696, 0.00084773, -0.00000113, 0.00000000],
+		[-6.27214060, -0.00084315, 0.00051681, 0.00084750, -0.00000113, 0.00000000],
+		[-6.27214120, -0.00084292, 0.00051667, 0.00084727, -0.00000113, 0.00000000],
+		[-6.27214179, -0.00084269, 0.00051653, 0.00084703, -0.00000113, 0.00000000],
+		[-6.27214238, -0.00084246, 0.00051639, 0.00084680, -0.00000113, 0.00000000],
+		[-6.27214297, -0.00084223, 0.00051625, 0.00084657, -0.00000113, 0.00000000],
+		[-6.27214356, -0.00084200, 0.00051611, 0.00084634, -0.00000113, 0.00000000],
+		[-6.27214415, -0.00084178, 0.00051597, 0.00084611, -0.00000113, 0.00000000],
+		[-6.27214474, -0.00084155, 0.00051583, 0.00084588, -0.00000113, 0.00000000],
+		[-6.27214533, -0.00084132, 0.00051569, 0.00084565, -0.00000113, 0.00000000],
+		[-6.27214592, -0.00084109, 0.00051555, 0.00084542, -0.00000113, 0.00000000],
+		[-6.27214651, -0.00084086, 0.00051541, 0.00084519, -0.00000113, 0.00000000],
+		[-6.27214709, -0.00084063, 0.00051527, 0.00084496, -0.00000113, 0.00000000],
+		[-6.27214768, -0.00084040, 0.00051513, 0.00084473, -0.00000113, 0.00000000],
+		[-6.27214827, -0.00084018, 0.00051499, 0.00084451, -0.00000113, 0.00000000],
+		[-6.27214885, -0.00083995, 0.00051485, 0.00084428, -0.00000113, 0.00000000],
+		[-6.27214944, -0.00083972, 0.00051471, 0.00084405, -0.00000113, 0.00000000],
+		[-6.27215002, -0.00083949, 0.00051457, 0.00084382, -0.00000113, 0.00000000],
+		[-6.27215061, -0.00083926, 0.00051443, 0.00084359, -0.00000113, 0.00000000],
+		[-6.27215119, -0.00083904, 0.00051429, 0.00084336, -0.00000113, 0.00000000],
+		[-6.27215178, -0.00083881, 0.00051415, 0.00084313, -0.00000113, 0.00000000],
+		[-6.27215236, -0.00083858, 0.00051401, 0.00084290, -0.00000113, 0.00000000],
+		[-6.27215294, -0.00083836, 0.00051387, 0.00084268, -0.00000113, 0.00000000],
+		[-6.27215353, -0.00083813, 0.00051373, 0.00084245, -0.00000113, 0.00000000],
+		[-6.27215411, -0.00083790, 0.00051359, 0.00084222, -0.00000113, 0.00000000],
+		[-6.27215469, -0.00083768, 0.00051345, 0.00084199, -0.00000113, 0.00000000],
+		[-6.27215527, -0.00083745, 0.00051332, 0.00084176, -0.00000113, 0.00000000],
+		[-6.27215585, -0.00083722, 0.00051318, 0.00084154, -0.00000113, 0.00000000],
+		[-6.27215643, -0.00083700, 0.00051304, 0.00084131, -0.00000113, 0.00000000],
+		[-6.27215701, -0.00083677, 0.00051290, 0.00084108, -0.00000113, 0.00000000],
+		[-6.27215759, -0.00083654, 0.00051276, 0.00084085, -0.00000113, 0.00000000],
+		[-6.27215817, -0.00083632, 0.00051262, 0.00084063, -0.00000113, 0.00000000],
+		[-6.27215875, -0.00083609, 0.00051248, 0.00084040, -0.00000113, 0.00000000],
+		[-6.27215933, -0.00083587, 0.00051234, 0.00084017, -0.00000113, 0.00000000],
+		[-6.27215990, -0.00083564, 0.00051221, 0.00083995, -0.00000113, 0.00000000],
+		[-6.27216048, -0.00083541, 0.00051207, 0.00083972, -0.00000113, 0.00000000],
+		[-6.27216106, -0.00083519, 0.00051193, 0.00083949, -0.00000113, 0.00000000],
+		[-6.27216164, -0.00083496, 0.00051179, 0.00083927, -0.00000113, 0.00000000],
+		[-6.27216221, -0.00083474, 0.00051165, 0.00083904, -0.00000113, 0.00000000],
+		[-6.27216279, -0.00083451, 0.00051151, 0.00083881, -0.00000113, 0.00000000],
+		[-6.27216336, -0.00083429, 0.00051138, 0.00083859, -0.00000113, 0.00000000],
+		[-6.27216394, -0.00083406, 0.00051124, 0.00083836, -0.00000113, 0.00000000],
+		[-6.27216451, -0.00083384, 0.00051110, 0.00083813, -0.00000113, 0.00000000],
+		[-6.27216508, -0.00083361, 0.00051096, 0.00083791, -0.00000113, 0.00000000],
+		[-6.27216566, -0.00083339, 0.00051083, 0.00083768, -0.00000113, 0.00000000],
+		[-6.27216623, -0.00083317, 0.00051069, 0.00083746, -0.00000113, 0.00000000],
+		[-6.27216680, -0.00083294, 0.00051055, 0.00083723, -0.00000113, 0.00000000],
+		[-6.27216737, -0.00083272, 0.00051041, 0.00083701, -0.00000113, 0.00000000],
+		[-6.27216794, -0.00083249, 0.00051028, 0.00083678, -0.00000113, 0.00000000],
+		[-6.27216851, -0.00083227, 0.00051014, 0.00083656, -0.00000113, 0.00000000],
+		[-6.27216909, -0.00083205, 0.00051000, 0.00083633, -0.00000113, 0.00000000],
+		[-6.27216966, -0.00083182, 0.00050986, 0.00083611, -0.00000113, 0.00000000],
+		[-6.27217022, -0.00083160, 0.00050973, 0.00083588, -0.00000113, 0.00000000],
+		[-6.27217079, -0.00083138, 0.00050959, 0.00083566, -0.00000113, 0.00000000],
+		[-6.27217136, -0.00083115, 0.00050945, 0.00083543, -0.00000113, 0.00000000],
+		[-6.27217193, -0.00083093, 0.00050932, 0.00083521, -0.00000113, 0.00000000],
+		[-6.27217250, -0.00083071, 0.00050918, 0.00083499, -0.00000113, 0.00000000],
+		[-6.27217307, -0.00083048, 0.00050904, 0.00083476, -0.00000113, 0.00000000],
+		[-6.27217363, -0.00083026, 0.00050891, 0.00083454, -0.00000113, 0.00000000],
+		[-6.27217420, -0.00083004, 0.00050877, 0.00083431, -0.00000113, 0.00000000],
+		[-6.27217477, -0.00082982, 0.00050863, 0.00083409, -0.00000113, 0.00000000],
+		[-6.27217533, -0.00082959, 0.00050850, 0.00083387, -0.00000113, 0.00000000],
+		[-6.27217590, -0.00082937, 0.00050836, 0.00083364, -0.00000113, 0.00000000],
+		[-6.27217646, -0.00082915, 0.00050822, 0.00083342, -0.00000113, 0.00000000],
+		[-6.27217703, -0.00082893, 0.00050809, 0.00083320, -0.00000113, 0.00000000],
+		[-6.27217759, -0.00082871, 0.00050795, 0.00083297, -0.00000113, 0.00000000],
+		[-6.27217815, -0.00082848, 0.00050782, 0.00083275, -0.00000113, 0.00000000],
+		[-6.27217872, -0.00082826, 0.00050768, 0.00083253, -0.00000113, 0.00000000],
+		[-6.27217928, -0.00082804, 0.00050754, 0.00083230, -0.00000113, 0.00000000],
+		[-6.27217984, -0.00082782, 0.00050741, 0.00083208, -0.00000113, 0.00000000],
+		[-6.27218040, -0.00082760, 0.00050727, 0.00083186, -0.00000113, 0.00000000],
+		[-6.27218097, -0.00082738, 0.00050714, 0.00083164, -0.00000113, 0.00000000],
+		[-6.27218153, -0.00082716, 0.00050700, 0.00083141, -0.00000113, 0.00000000],
+		[-6.27218209, -0.00082693, 0.00050686, 0.00083119, -0.00000113, 0.00000000],
+		[-6.27218265, -0.00082671, 0.00050673, 0.00083097, -0.00000113, 0.00000000],
+		[-6.27218321, -0.00082649, 0.00050659, 0.00083075, -0.00000113, 0.00000000],
+		[-6.27218377, -0.00082627, 0.00050646, 0.00083053, -0.00000113, 0.00000000],
+		[-6.27218433, -0.00082605, 0.00050632, 0.00083031, -0.00000113, 0.00000000],
+		[-6.27218488, -0.00082583, 0.00050619, 0.00083008, -0.00000113, 0.00000000],
+		[-6.27218544, -0.00082561, 0.00050605, 0.00082986, -0.00000113, 0.00000000],
+		[-6.27218600, -0.00082539, 0.00050592, 0.00082964, -0.00000113, 0.00000000],
+		[-6.27218656, -0.00082517, 0.00050578, 0.00082942, -0.00000113, 0.00000000],
+		[-6.27218711, -0.00082495, 0.00050565, 0.00082920, -0.00000113, 0.00000000],
+		[-6.27218767, -0.00082473, 0.00050551, 0.00082898, -0.00000113, 0.00000000],
+		[-6.27218823, -0.00082451, 0.00050538, 0.00082876, -0.00000113, 0.00000000],
+		[-6.27218878, -0.00082429, 0.00050524, 0.00082854, -0.00000113, 0.00000000],
+		[-6.27218934, -0.00082407, 0.00050511, 0.00082832, -0.00000113, 0.00000000],
+		[-6.27218989, -0.00082385, 0.00050497, 0.00082810, -0.00000113, 0.00000000],
+		[-6.27219045, -0.00082363, 0.00050484, 0.00082787, -0.00000113, 0.00000000],
+		[-6.27219100, -0.00082341, 0.00050471, 0.00082765, -0.00000113, 0.00000000],
+		[-6.27219155, -0.00082320, 0.00050457, 0.00082743, -0.00000113, 0.00000000],
+		[-6.27219211, -0.00082298, 0.00050444, 0.00082721, -0.00000113, 0.00000000],
+		[-6.27219266, -0.00082276, 0.00050430, 0.00082699, -0.00000113, 0.00000000],
+		[-6.27219321, -0.00082254, 0.00050417, 0.00082677, -0.00000113, 0.00000000],
+		[-6.27219376, -0.00082232, 0.00050403, 0.00082656, -0.00000113, 0.00000000],
+		[-6.27219432, -0.00082210, 0.00050390, 0.00082634, -0.00000113, 0.00000000],
+		[-6.27219487, -0.00082188, 0.00050377, 0.00082612, -0.00000113, 0.00000000],
+		[-6.27219542, -0.00082167, 0.00050363, 0.00082590, -0.00000113, 0.00000000],
+		[-6.27219597, -0.00082145, 0.00050350, 0.00082568, -0.00000113, 0.00000000],
+		[-6.27219652, -0.00082123, 0.00050337, 0.00082546, -0.00000113, 0.00000000],
+		[-6.27219707, -0.00082101, 0.00050323, 0.00082524, -0.00000113, 0.00000000],
+		[-6.27219762, -0.00082080, 0.00050310, 0.00082502, -0.00000113, 0.00000000],
+		[-6.27219817, -0.00082058, 0.00050296, 0.00082480, -0.00000113, 0.00000000],
+		[-6.27219872, -0.00082036, 0.00050283, 0.00082458, -0.00000113, 0.00000000],
+		[-6.27219926, -0.00082014, 0.00050270, 0.00082436, -0.00000113, 0.00000000],
+		[-6.27219981, -0.00081993, 0.00050256, 0.00082415, -0.00000113, 0.00000000],
+		[-6.27220036, -0.00081971, 0.00050243, 0.00082393, -0.00000113, 0.00000000],
+		[-6.27220091, -0.00081949, 0.00050230, 0.00082371, -0.00000113, 0.00000000],
+		[-6.27220145, -0.00081927, 0.00050216, 0.00082349, -0.00000113, 0.00000000],
+		[-6.27220200, -0.00081906, 0.00050203, 0.00082327, -0.00000113, 0.00000000],
+		[-6.27220254, -0.00081884, 0.00050190, 0.00082306, -0.00000113, 0.00000000],
+		[-6.27220309, -0.00081862, 0.00050177, 0.00082284, -0.00000113, 0.00000000],
+		[-6.27220363, -0.00081841, 0.00050163, 0.00082262, -0.00000113, 0.00000000],
+		[-6.27220418, -0.00081819, 0.00050150, 0.00082240, -0.00000113, 0.00000000],
+		[-6.27220472, -0.00081798, 0.00050137, 0.00082219, -0.00000113, 0.00000000],
+		[-6.27220527, -0.00081776, 0.00050124, 0.00082197, -0.00000113, 0.00000000],
+		[-6.27220581, -0.00081754, 0.00050110, 0.00082175, -0.00000113, 0.00000000],
+		[-6.27220635, -0.00081733, 0.00050097, 0.00082153, -0.00000113, 0.00000000],
+		[-6.27220690, -0.00081711, 0.00050084, 0.00082132, -0.00000113, 0.00000000],
+		[-6.27220744, -0.00081690, 0.00050071, 0.00082110, -0.00000113, 0.00000000],
+		[-6.27220798, -0.00081668, 0.00050057, 0.00082088, -0.00000113, 0.00000000],
+		[-6.27220852, -0.00081647, 0.00050044, 0.00082067, -0.00000113, 0.00000000],
+		[-6.27220906, -0.00081625, 0.00050031, 0.00082045, -0.00000113, 0.00000000],
+		[-6.27220960, -0.00081604, 0.00050018, 0.00082024, -0.00000113, 0.00000000],
+		[-6.27221014, -0.00081582, 0.00050005, 0.00082002, -0.00000113, 0.00000000],
+		[-6.27221068, -0.00081561, 0.00049991, 0.00081980, -0.00000113, 0.00000000],
+		[-6.27221122, -0.00081539, 0.00049978, 0.00081959, -0.00000113, 0.00000000],
+		[-6.27221176, -0.00081518, 0.00049965, 0.00081937, -0.00000113, 0.00000000],
+		[-6.27221230, -0.00081496, 0.00049952, 0.00081916, -0.00000113, 0.00000000],
+		[-6.27221284, -0.00081475, 0.00049939, 0.00081894, -0.00000113, 0.00000000],
+		[-6.27221338, -0.00081453, 0.00049926, 0.00081872, -0.00000113, 0.00000000],
+		[-6.27221391, -0.00081432, 0.00049912, 0.00081851, -0.00000113, 0.00000000],
+		[-6.27221445, -0.00081410, 0.00049899, 0.00081829, -0.00000113, 0.00000000],
+		[-6.27221499, -0.00081389, 0.00049886, 0.00081808, -0.00000113, 0.00000000],
+		[-6.27221552, -0.00081368, 0.00049873, 0.00081786, -0.00000113, 0.00000000],
+		[-6.27221606, -0.00081346, 0.00049860, 0.00081765, -0.00000113, 0.00000000],
+		[-6.27221660, -0.00081325, 0.00049847, 0.00081743, -0.00000113, 0.00000000],
+		[-6.27221713, -0.00081303, 0.00049834, 0.00081722, -0.00000113, 0.00000000],
+		[-6.27221767, -0.00081282, 0.00049821, 0.00081700, -0.00000113, 0.00000000],
+		[-6.27221820, -0.00081261, 0.00049807, 0.00081679, -0.00000113, 0.00000000],
+		[-6.27221874, -0.00081239, 0.00049794, 0.00081657, -0.00000113, 0.00000000],
+		[-6.27221927, -0.00081218, 0.00049781, 0.00081636, -0.00000113, 0.00000000],
+		[-6.27221980, -0.00081197, 0.00049768, 0.00081615, -0.00000113, 0.00000000],
+		[-6.27222034, -0.00081176, 0.00049755, 0.00081593, -0.00000113, 0.00000000],
+		[-6.27222087, -0.00081154, 0.00049742, 0.00081572, -0.00000113, 0.00000000],
+		[-6.27222140, -0.00081133, 0.00049729, 0.00081550, -0.00000113, 0.00000000],
+		[-6.27222193, -0.00081112, 0.00049716, 0.00081529, -0.00000113, 0.00000000],
+		[-6.27222247, -0.00081090, 0.00049703, 0.00081508, -0.00000113, 0.00000000],
+		[-6.27222300, -0.00081069, 0.00049690, 0.00081486, -0.00000113, 0.00000000],
+		[-6.27222353, -0.00081048, 0.00049677, 0.00081465, -0.00000113, 0.00000000],
+		[-6.27222406, -0.00081027, 0.00049664, 0.00081444, -0.00000113, 0.00000000],
+		[-6.27222459, -0.00081006, 0.00049651, 0.00081422, -0.00000113, 0.00000000],
+		[-6.27222512, -0.00080984, 0.00049638, 0.00081401, -0.00000113, 0.00000000],
+		[-6.27222565, -0.00080963, 0.00049625, 0.00081380, -0.00000113, 0.00000000],
+		[-6.27222618, -0.00080942, 0.00049612, 0.00081359, -0.00000113, 0.00000000],
+		[-6.27222671, -0.00080921, 0.00049599, 0.00081337, -0.00000113, 0.00000000],
+		[-6.27222723, -0.00080900, 0.00049586, 0.00081316, -0.00000113, 0.00000000],
+		[-6.27222776, -0.00080879, 0.00049573, 0.00081295, -0.00000113, 0.00000000],
+		[-6.27222829, -0.00080857, 0.00049560, 0.00081273, -0.00000113, 0.00000000],
+		[-6.27222882, -0.00080836, 0.00049547, 0.00081252, -0.00000113, 0.00000000],
+		[-6.27222934, -0.00080815, 0.00049534, 0.00081231, -0.00000113, 0.00000000],
+		[-6.27222987, -0.00080794, 0.00049521, 0.00081210, -0.00000113, 0.00000000],
+		[-6.27223040, -0.00080773, 0.00049508, 0.00081189, -0.00000113, 0.00000000],
+		[-6.27223092, -0.00080752, 0.00049495, 0.00081167, -0.00000113, 0.00000000],
+		[-6.27223145, -0.00080731, 0.00049482, 0.00081146, -0.00000113, 0.00000000],
+		[-6.27223197, -0.00080710, 0.00049469, 0.00081125, -0.00000113, 0.00000000],
+		[-6.27223250, -0.00080689, 0.00049457, 0.00081104, -0.00000113, 0.00000000],
+		[-6.27223302, -0.00080668, 0.00049444, 0.00081083, -0.00000113, 0.00000000],
+		[-6.27223355, -0.00080647, 0.00049431, 0.00081062, -0.00000113, 0.00000000],
+		[-6.27223407, -0.00080626, 0.00049418, 0.00081041, -0.00000113, 0.00000000],
+		[-6.27223460, -0.00080605, 0.00049405, 0.00081019, -0.00000113, 0.00000000],
+		[-6.27223512, -0.00080584, 0.00049392, 0.00080998, -0.00000113, 0.00000000],
+		[-6.27223564, -0.00080563, 0.00049379, 0.00080977, -0.00000113, 0.00000000],
+		[-6.27223616, -0.00080542, 0.00049366, 0.00080956, -0.00000113, 0.00000000],
+		[-6.27223669, -0.00080521, 0.00049354, 0.00080935, -0.00000113, 0.00000000],
+		[-6.27223721, -0.00080500, 0.00049341, 0.00080914, -0.00000113, 0.00000000],
+		[-6.27223773, -0.00080479, 0.00049328, 0.00080893, -0.00000113, 0.00000000],
+		[-6.27223825, -0.00080458, 0.00049315, 0.00080872, -0.00000113, 0.00000000],
+		[-6.27223877, -0.00080437, 0.00049302, 0.00080851, -0.00000113, 0.00000000],
+		[-6.27223929, -0.00080416, 0.00049289, 0.00080830, -0.00000113, 0.00000000],
+		[-6.27223981, -0.00080395, 0.00049277, 0.00080809, -0.00000113, 0.00000000],
+		[-6.27224033, -0.00080375, 0.00049264, 0.00080788, -0.00000113, 0.00000000],
+		[-6.27224085, -0.00080354, 0.00049251, 0.00080767, -0.00000113, 0.00000000],
+		[-6.27224137, -0.00080333, 0.00049238, 0.00080746, -0.00000113, 0.00000000],
+		[-6.27224189, -0.00080312, 0.00049225, 0.00080725, -0.00000113, 0.00000000],
+		[-6.27224241, -0.00080291, 0.00049213, 0.00080704, -0.00000113, 0.00000000],
+		[-6.27224292, -0.00080270, 0.00049200, 0.00080683, -0.00000113, 0.00000000],
+		[-6.27224344, -0.00080250, 0.00049187, 0.00080662, -0.00000113, 0.00000000],
+		[-6.27224396, -0.00080229, 0.00049174, 0.00080641, -0.00000113, 0.00000000],
+		[-6.27224447, -0.00080208, 0.00049162, 0.00080621, -0.00000113, 0.00000000],
+		[-6.27224499, -0.00080187, 0.00049149, 0.00080600, -0.00000113, 0.00000000],
+		[-6.27224551, -0.00080166, 0.00049136, 0.00080579, -0.00000113, 0.00000000],
+		[-6.27224602, -0.00080146, 0.00049123, 0.00080558, -0.00000113, 0.00000000],
+		[-6.27224654, -0.00080125, 0.00049111, 0.00080537, -0.00000113, 0.00000000],
+		[-6.27224705, -0.00080104, 0.00049098, 0.00080516, -0.00000113, 0.00000000],
+		[-6.27224757, -0.00080084, 0.00049085, 0.00080495, -0.00000113, 0.00000000],
+		[-6.27224808, -0.00080063, 0.00049072, 0.00080475, -0.00000113, 0.00000000],
+		[-6.27224860, -0.00080042, 0.00049060, 0.00080454, -0.00000113, 0.00000000],
+		[-6.27224911, -0.00080021, 0.00049047, 0.00080433, -0.00000113, 0.00000000],
+		[-6.27224962, -0.00080001, 0.00049034, 0.00080412, -0.00000113, 0.00000000],
+		[-6.27225014, -0.00079980, 0.00049022, 0.00080391, -0.00000113, 0.00000000],
+		[-6.27225065, -0.00079959, 0.00049009, 0.00080371, -0.00000113, 0.00000000],
+		[-6.27225116, -0.00079939, 0.00048996, 0.00080350, -0.00000113, 0.00000000],
+		[-6.27225168, -0.00079918, 0.00048984, 0.00080329, -0.00000113, 0.00000000],
+		[-6.27225219, -0.00079897, 0.00048971, 0.00080308, -0.00000113, 0.00000000],
+		[-6.27225270, -0.00079877, 0.00048958, 0.00080288, -0.00000113, 0.00000000],
+		[-6.27225321, -0.00079856, 0.00048946, 0.00080267, -0.00000113, 0.00000000],
+		[-6.27225372, -0.00079836, 0.00048933, 0.00080246, -0.00000113, 0.00000000],
+		[-6.27225423, -0.00079815, 0.00048921, 0.00080226, -0.00000113, 0.00000000],
+		[-6.27225474, -0.00079795, 0.00048908, 0.00080205, -0.00000113, 0.00000000],
+		[-6.27225525, -0.00079774, 0.00048895, 0.00080184, -0.00000113, 0.00000000],
+		[-6.27225576, -0.00079753, 0.00048883, 0.00080164, -0.00000113, 0.00000000],
+		[-6.27225627, -0.00079733, 0.00048870, 0.00080143, -0.00000113, 0.00000000],
+		[-6.27225678, -0.00079712, 0.00048857, 0.00080122, -0.00000113, 0.00000000],
+		[-6.27225729, -0.00079692, 0.00048845, 0.00080102, -0.00000113, 0.00000000],
+		[-6.27225780, -0.00079671, 0.00048832, 0.00080081, -0.00000113, 0.00000000],
+		[-6.27225830, -0.00079651, 0.00048820, 0.00080060, -0.00000113, 0.00000000],
+		[-6.27225881, -0.00079630, 0.00048807, 0.00080040, -0.00000113, 0.00000000],
+		[-6.27225932, -0.00079610, 0.00048795, 0.00080019, -0.00000113, 0.00000000],
+		[-6.27225983, -0.00079589, 0.00048782, 0.00079999, -0.00000113, 0.00000000],
+		[-6.27226033, -0.00079569, 0.00048769, 0.00079978, -0.00000113, 0.00000000],
+		[-6.27226084, -0.00079548, 0.00048757, 0.00079957, -0.00000113, 0.00000000],
+		[-6.27226134, -0.00079528, 0.00048744, 0.00079937, -0.00000113, 0.00000000],
+		[-6.27226185, -0.00079508, 0.00048732, 0.00079916, -0.00000113, 0.00000000],
+		[-6.27226235, -0.00079487, 0.00048719, 0.00079896, -0.00000113, 0.00000000],
+		[-6.27226286, -0.00079467, 0.00048707, 0.00079875, -0.00000113, 0.00000000],
+		[-6.27226336, -0.00079446, 0.00048694, 0.00079855, -0.00000113, 0.00000000],
+		[-6.27226387, -0.00079426, 0.00048682, 0.00079834, -0.00000113, 0.00000000],
+		[-6.27226437, -0.00079406, 0.00048669, 0.00079814, -0.00000113, 0.00000000],
+		[-6.27226488, -0.00079385, 0.00048657, 0.00079793, -0.00000113, 0.00000000],
+		[-6.27226538, -0.00079365, 0.00048644, 0.00079773, -0.00000113, 0.00000000],
+		[-6.27226588, -0.00079345, 0.00048632, 0.00079752, -0.00000113, 0.00000000],
+		[-6.27226639, -0.00079324, 0.00048619, 0.00079732, -0.00000113, 0.00000000],
+		[-6.27226689, -0.00079304, 0.00048607, 0.00079712, -0.00000113, 0.00000000],
+		[-6.27226739, -0.00079284, 0.00048594, 0.00079691, -0.00000113, 0.00000000],
+		[-6.27226789, -0.00079263, 0.00048582, 0.00079671, -0.00000113, 0.00000000],
+		[-6.27226839, -0.00079243, 0.00048570, 0.00079650, -0.00000113, 0.00000000],
+		[-6.27226889, -0.00079223, 0.00048557, 0.00079630, -0.00000113, 0.00000000],
+		[-6.27226939, -0.00079202, 0.00048545, 0.00079610, -0.00000113, 0.00000000],
+		[-6.27226990, -0.00079182, 0.00048532, 0.00079589, -0.00000113, 0.00000000],
+		[-6.27227040, -0.00079162, 0.00048520, 0.00079569, -0.00000113, 0.00000000],
+		[-6.27227090, -0.00079142, 0.00048507, 0.00079549, -0.00000113, 0.00000000],
+		[-6.27227139, -0.00079121, 0.00048495, 0.00079528, -0.00000113, 0.00000000],
+		[-6.27227189, -0.00079101, 0.00048483, 0.00079508, -0.00000113, 0.00000000],
+		[-6.27227239, -0.00079081, 0.00048470, 0.00079488, -0.00000113, 0.00000000],
+		[-6.27227289, -0.00079061, 0.00048458, 0.00079467, -0.00000113, 0.00000000],
+		[-6.27227339, -0.00079041, 0.00048445, 0.00079447, -0.00000113, 0.00000000],
+		[-6.27227389, -0.00079020, 0.00048433, 0.00079427, -0.00000113, 0.00000000],
+		[-6.27227439, -0.00079000, 0.00048421, 0.00079406, -0.00000113, 0.00000000],
+		[-6.27227488, -0.00078980, 0.00048408, 0.00079386, -0.00000113, 0.00000000],
+		[-6.27227538, -0.00078960, 0.00048396, 0.00079366, -0.00000113, 0.00000000],
+		[-6.27227588, -0.00078940, 0.00048384, 0.00079346, -0.00000113, 0.00000000],
+		[-6.27227637, -0.00078920, 0.00048371, 0.00079325, -0.00000113, 0.00000000],
+		[-6.27227687, -0.00078900, 0.00048359, 0.00079305, -0.00000113, 0.00000000],
+		[-6.27227736, -0.00078880, 0.00048347, 0.00079285, -0.00000113, 0.00000000],
+		[-6.27227786, -0.00078859, 0.00048334, 0.00079265, -0.00000113, 0.00000000],
+		[-6.27227836, -0.00078839, 0.00048322, 0.00079245, -0.00000113, 0.00000000],
+		[-6.27227885, -0.00078819, 0.00048310, 0.00079224, -0.00000113, 0.00000000],
+		[-6.27227934, -0.00078799, 0.00048297, 0.00079204, -0.00000113, 0.00000000],
+		[-6.27227984, -0.00078779, 0.00048285, 0.00079184, -0.00000113, 0.00000000],
+		[-6.27228033, -0.00078759, 0.00048273, 0.00079164, -0.00000113, 0.00000000],
+		[-6.27228083, -0.00078739, 0.00048260, 0.00079144, -0.00000113, 0.00000000],
+		[-6.27228132, -0.00078719, 0.00048248, 0.00079124, -0.00000113, 0.00000000],
+		[-6.27228181, -0.00078699, 0.00048236, 0.00079104, -0.00000113, 0.00000000],
+		[-6.27228231, -0.00078679, 0.00048224, 0.00079083, -0.00000113, 0.00000000],
+		[-6.27228280, -0.00078659, 0.00048211, 0.00079063, -0.00000113, 0.00000000],
+		[-6.27228329, -0.00078639, 0.00048199, 0.00079043, -0.00000113, 0.00000000],
+		[-6.27228378, -0.00078619, 0.00048187, 0.00079023, -0.00000113, 0.00000000],
+		[-6.27228427, -0.00078599, 0.00048175, 0.00079003, -0.00000113, 0.00000000],
+		[-6.27228476, -0.00078579, 0.00048162, 0.00078983, -0.00000113, 0.00000000],
+		[-6.27228526, -0.00078559, 0.00048150, 0.00078963, -0.00000113, 0.00000000],
+		[-6.27228575, -0.00078539, 0.00048138, 0.00078943, -0.00000113, 0.00000000],
+		[-6.27228624, -0.00078519, 0.00048126, 0.00078923, -0.00000113, 0.00000000],
+		[-6.27228673, -0.00078500, 0.00048113, 0.00078903, -0.00000113, 0.00000000],
+		[-6.27228722, -0.00078480, 0.00048101, 0.00078883, -0.00000113, 0.00000000],
+		[-6.27228771, -0.00078460, 0.00048089, 0.00078863, -0.00000113, 0.00000000],
+		[-6.27228819, -0.00078440, 0.00048077, 0.00078843, -0.00000113, 0.00000000],
+		[-6.27228868, -0.00078420, 0.00048065, 0.00078823, -0.00000113, 0.00000000],
+		[-6.27228917, -0.00078400, 0.00048052, 0.00078803, -0.00000113, 0.00000000],
+		[-6.27228966, -0.00078380, 0.00048040, 0.00078783, -0.00000113, 0.00000000],
+		[-6.27229015, -0.00078360, 0.00048028, 0.00078763, -0.00000113, 0.00000000],
+		[-6.27229064, -0.00078341, 0.00048016, 0.00078743, -0.00000113, 0.00000000],
+		[-6.27229112, -0.00078321, 0.00048004, 0.00078723, -0.00000113, 0.00000000],
+		[-6.27229161, -0.00078301, 0.00047992, 0.00078703, -0.00000113, 0.00000000],
+		[-6.27229210, -0.00078281, 0.00047979, 0.00078683, -0.00000113, 0.00000000],
+		[-6.27229258, -0.00078261, 0.00047967, 0.00078663, -0.00000113, 0.00000000],
+		[-6.27229307, -0.00078242, 0.00047955, 0.00078644, -0.00000113, 0.00000000],
+		[-6.27229356, -0.00078222, 0.00047943, 0.00078624, -0.00000113, 0.00000000],
+		[-6.27229404, -0.00078202, 0.00047931, 0.00078604, -0.00000113, 0.00000000],
+		[-6.27229453, -0.00078182, 0.00047919, 0.00078584, -0.00000113, 0.00000000],
+		[-6.27229501, -0.00078163, 0.00047907, 0.00078564, -0.00000113, 0.00000000],
+		[-6.27229550, -0.00078143, 0.00047895, 0.00078544, -0.00000113, 0.00000000],
+		[-6.27229598, -0.00078123, 0.00047882, 0.00078524, -0.00000113, 0.00000000],
+		[-6.27229646, -0.00078103, 0.00047870, 0.00078505, -0.00000113, 0.00000000],
+		[-6.27229695, -0.00078084, 0.00047858, 0.00078485, -0.00000113, 0.00000000],
+		[-6.27229743, -0.00078064, 0.00047846, 0.00078465, -0.00000113, 0.00000000],
+		[-6.27229791, -0.00078044, 0.00047834, 0.00078445, -0.00000113, 0.00000000],
+		[-6.27229840, -0.00078025, 0.00047822, 0.00078426, -0.00000113, 0.00000000],
+		[-6.27229888, -0.00078005, 0.00047810, 0.00078406, -0.00000113, 0.00000000],
+		[-6.27229936, -0.00077985, 0.00047798, 0.00078386, -0.00000113, 0.00000000],
+		[-6.27229984, -0.00077966, 0.00047786, 0.00078366, -0.00000113, 0.00000000],
+		[-6.27230033, -0.00077946, 0.00047774, 0.00078346, -0.00000113, 0.00000000],
+		[-6.27230081, -0.00077926, 0.00047762, 0.00078327, -0.00000113, 0.00000000],
+		[-6.27230129, -0.00077907, 0.00047750, 0.00078307, -0.00000113, 0.00000000],
+		[-6.27230177, -0.00077887, 0.00047738, 0.00078287, -0.00000113, 0.00000000],
+		[-6.27230225, -0.00077868, 0.00047726, 0.00078268, -0.00000113, 0.00000000],
+		[-6.27230273, -0.00077848, 0.00047714, 0.00078248, -0.00000113, 0.00000000],
+		[-6.27230321, -0.00077828, 0.00047702, 0.00078228, -0.00000113, 0.00000000],
+		[-6.27230369, -0.00077809, 0.00047690, 0.00078209, -0.00000113, 0.00000000],
+		[-6.27230417, -0.00077789, 0.00047678, 0.00078189, -0.00000113, 0.00000000],
+		[-6.27230465, -0.00077770, 0.00047666, 0.00078169, -0.00000113, 0.00000000],
+		[-6.27230513, -0.00077750, 0.00047654, 0.00078150, -0.00000113, 0.00000000],
+		[-6.27230561, -0.00077731, 0.00047642, 0.00078130, -0.00000113, 0.00000000],
+		[-6.27230609, -0.00077711, 0.00047630, 0.00078110, -0.00000113, 0.00000000],
+		[-6.27230656, -0.00077692, 0.00047618, 0.00078091, -0.00000113, 0.00000000],
+		[-6.27230704, -0.00077672, 0.00047606, 0.00078071, -0.00000113, 0.00000000],
+		[-6.27230752, -0.00077653, 0.00047594, 0.00078052, -0.00000113, 0.00000000],
+		[-6.27230800, -0.00077633, 0.00047582, 0.00078032, -0.00000113, 0.00000000],
+		[-6.27230847, -0.00077614, 0.00047570, 0.00078012, -0.00000113, 0.00000000],
+		[-6.27230895, -0.00077594, 0.00047558, 0.00077993, -0.00000113, 0.00000000],
+		[-6.27230943, -0.00077575, 0.00047546, 0.00077973, -0.00000113, 0.00000000],
+		[-6.27230990, -0.00077556, 0.00047534, 0.00077954, -0.00000113, 0.00000000],
+		[-6.27231038, -0.00077536, 0.00047522, 0.00077934, -0.00000113, 0.00000000],
+		[-6.27231085, -0.00077517, 0.00047510, 0.00077915, -0.00000113, 0.00000000],
+		[-6.27231133, -0.00077497, 0.00047498, 0.00077895, -0.00000113, 0.00000000],
+		[-6.27231180, -0.00077478, 0.00047487, 0.00077876, -0.00000113, 0.00000000],
+		[-6.27231228, -0.00077458, 0.00047475, 0.00077856, -0.00000113, 0.00000000],
+		[-6.27231275, -0.00077439, 0.00047463, 0.00077837, -0.00000113, 0.00000000],
+		[-6.27231323, -0.00077420, 0.00047451, 0.00077817, -0.00000113, 0.00000000],
+		[-6.27231370, -0.00077400, 0.00047439, 0.00077798, -0.00000113, 0.00000000],
+		[-6.27231417, -0.00077381, 0.00047427, 0.00077778, -0.00000113, 0.00000000],
+		[-6.27231465, -0.00077362, 0.00047415, 0.00077759, -0.00000113, 0.00000000],
+		[-6.27231512, -0.00077342, 0.00047403, 0.00077740, -0.00000113, 0.00000000],
+		[-6.27231559, -0.00077323, 0.00047392, 0.00077720, -0.00000113, 0.00000000],
+		[-6.27231607, -0.00077304, 0.00047380, 0.00077701, -0.00000113, 0.00000000],
+		[-6.27231654, -0.00077284, 0.00047368, 0.00077681, -0.00000113, 0.00000000],
+		[-6.27231701, -0.00077265, 0.00047356, 0.00077662, -0.00000113, 0.00000000],
+		[-6.27231748, -0.00077246, 0.00047344, 0.00077643, -0.00000113, 0.00000000],
+		[-6.27231795, -0.00077227, 0.00047332, 0.00077623, -0.00000113, 0.00000000],
+		[-6.27231842, -0.00077207, 0.00047321, 0.00077604, -0.00000113, 0.00000000],
+		[-6.27231889, -0.00077188, 0.00047309, 0.00077584, -0.00000113, 0.00000000],
+		[-6.27231936, -0.00077169, 0.00047297, 0.00077565, -0.00000113, 0.00000000],
+		[-6.27231984, -0.00077150, 0.00047285, 0.00077546, -0.00000113, 0.00000000],
+		[-6.27232031, -0.00077130, 0.00047273, 0.00077526, -0.00000113, 0.00000000],
+		[-6.27232077, -0.00077111, 0.00047262, 0.00077507, -0.00000113, 0.00000000],
+		[-6.27232124, -0.00077092, 0.00047250, 0.00077488, -0.00000113, 0.00000000],
+		[-6.27232171, -0.00077073, 0.00047238, 0.00077469, -0.00000113, 0.00000000],
+		[-6.27232218, -0.00077054, 0.00047226, 0.00077449, -0.00000113, 0.00000000],
+		[-6.27232265, -0.00077034, 0.00047215, 0.00077430, -0.00000113, 0.00000000],
+		[-6.27232312, -0.00077015, 0.00047203, 0.00077411, -0.00000113, 0.00000000],
+		[-6.27232359, -0.00076996, 0.00047191, 0.00077391, -0.00000113, 0.00000000],
+		[-6.27232406, -0.00076977, 0.00047179, 0.00077372, -0.00000113, 0.00000000],
+		[-6.27232452, -0.00076958, 0.00047168, 0.00077353, -0.00000113, 0.00000000],
+		[-6.27232499, -0.00076939, 0.00047156, 0.00077334, -0.00000113, 0.00000000],
+		[-6.27232546, -0.00076920, 0.00047144, 0.00077315, -0.00000113, 0.00000000],
+		[-6.27232592, -0.00076900, 0.00047132, 0.00077295, -0.00000113, 0.00000000],
+		[-6.27232639, -0.00076881, 0.00047121, 0.00077276, -0.00000113, 0.00000000],
+		[-6.27232686, -0.00076862, 0.00047109, 0.00077257, -0.00000113, 0.00000000],
+		[-6.27232732, -0.00076843, 0.00047097, 0.00077238, -0.00000113, 0.00000000],
+		[-6.27232779, -0.00076824, 0.00047086, 0.00077219, -0.00000113, 0.00000000],
+		[-6.27232825, -0.00076805, 0.00047074, 0.00077199, -0.00000113, 0.00000000],
+		[-6.27232872, -0.00076786, 0.00047062, 0.00077180, -0.00000113, 0.00000000],
+		[-6.27232918, -0.00076767, 0.00047050, 0.00077161, -0.00000113, 0.00000000],
+		[-6.27232965, -0.00076748, 0.00047039, 0.00077142, -0.00000113, 0.00000000],
+		[-6.27233011, -0.00076729, 0.00047027, 0.00077123, -0.00000113, 0.00000000],
+		[-6.27233058, -0.00076710, 0.00047015, 0.00077104, -0.00000113, 0.00000000],
+		[-6.27233104, -0.00076691, 0.00047004, 0.00077085, -0.00000113, 0.00000000],
+		[-6.27233150, -0.00076672, 0.00046992, 0.00077066, -0.00000113, 0.00000000],
+		[-6.27233197, -0.00076653, 0.00046981, 0.00077046, -0.00000113, 0.00000000],
+		[-6.27233243, -0.00076634, 0.00046969, 0.00077027, -0.00000113, 0.00000000],
+		[-6.27233289, -0.00076615, 0.00046957, 0.00077008, -0.00000113, 0.00000000],
+		[-6.27233336, -0.00076596, 0.00046946, 0.00076989, -0.00000113, 0.00000000],
+		[-6.27233382, -0.00076577, 0.00046934, 0.00076970, -0.00000113, 0.00000000],
+		[-6.27233428, -0.00076558, 0.00046922, 0.00076951, -0.00000113, 0.00000000],
+		[-6.27233474, -0.00076539, 0.00046911, 0.00076932, -0.00000113, 0.00000000],
+		[-6.27233520, -0.00076520, 0.00046899, 0.00076913, -0.00000113, 0.00000000],
+		[-6.27233566, -0.00076501, 0.00046888, 0.00076894, -0.00000113, 0.00000000],
+		[-6.27233612, -0.00076482, 0.00046876, 0.00076875, -0.00000113, 0.00000000],
+		[-6.27233658, -0.00076464, 0.00046864, 0.00076856, -0.00000113, 0.00000000],
+		[-6.27233705, -0.00076445, 0.00046853, 0.00076837, -0.00000113, 0.00000000],
+		[-6.27233751, -0.00076426, 0.00046841, 0.00076818, -0.00000113, 0.00000000],
+		[-6.27233797, -0.00076407, 0.00046830, 0.00076799, -0.00000113, 0.00000000],
+		[-6.27233843, -0.00076388, 0.00046818, 0.00076780, -0.00000113, 0.00000000],
+		[-6.27233888, -0.00076369, 0.00046806, 0.00076761, -0.00000113, 0.00000000],
+		[-6.27233934, -0.00076350, 0.00046795, 0.00076742, -0.00000113, 0.00000000],
+		[-6.27233980, -0.00076332, 0.00046783, 0.00076723, -0.00000113, 0.00000000],
+		[-6.27234026, -0.00076313, 0.00046772, 0.00076704, -0.00000113, 0.00000000],
+		[-6.27234072, -0.00076294, 0.00046760, 0.00076686, -0.00000113, 0.00000000],
+		[-6.27234118, -0.00076275, 0.00046749, 0.00076667, -0.00000113, 0.00000000],
+		[-6.27234163, -0.00076256, 0.00046737, 0.00076648, -0.00000113, 0.00000000],
+		[-6.27234209, -0.00076238, 0.00046726, 0.00076629, -0.00000113, 0.00000000],
+		[-6.27234255, -0.00076219, 0.00046714, 0.00076610, -0.00000113, 0.00000000],
+		[-6.27234301, -0.00076200, 0.00046703, 0.00076591, -0.00000113, 0.00000000],
+		[-6.27234346, -0.00076181, 0.00046691, 0.00076572, -0.00000113, 0.00000000],
+		[-6.27234392, -0.00076163, 0.00046680, 0.00076553, -0.00000113, 0.00000000],
+		[-6.27234438, -0.00076144, 0.00046668, 0.00076535, -0.00000113, 0.00000000],
+		[-6.27234483, -0.00076125, 0.00046657, 0.00076516, -0.00000113, 0.00000000],
+		[-6.27234529, -0.00076106, 0.00046645, 0.00076497, -0.00000113, 0.00000000],
+		[-6.27234574, -0.00076088, 0.00046634, 0.00076478, -0.00000113, 0.00000000],
+		[-6.27234620, -0.00076069, 0.00046622, 0.00076459, -0.00000113, 0.00000000],
+		[-6.27234665, -0.00076050, 0.00046611, 0.00076441, -0.00000113, 0.00000000],
+		[-6.27234711, -0.00076032, 0.00046599, 0.00076422, -0.00000113, 0.00000000],
+		[-6.27234756, -0.00076013, 0.00046588, 0.00076403, -0.00000113, 0.00000000],
+		[-6.27234802, -0.00075994, 0.00046576, 0.00076384, -0.00000113, 0.00000000],
+		[-6.27234847, -0.00075976, 0.00046565, 0.00076366, -0.00000113, 0.00000000],
+		[-6.27234892, -0.00075957, 0.00046554, 0.00076347, -0.00000113, 0.00000000],
+		[-6.27234938, -0.00075938, 0.00046542, 0.00076328, -0.00000113, 0.00000000],
+		[-6.27234983, -0.00075920, 0.00046531, 0.00076309, -0.00000113, 0.00000000],
+		[-6.27235028, -0.00075901, 0.00046519, 0.00076291, -0.00000113, 0.00000000],
+		[-6.27235074, -0.00075882, 0.00046508, 0.00076272, -0.00000113, 0.00000000],
+		[-6.27235119, -0.00075864, 0.00046496, 0.00076253, -0.00000113, 0.00000000],
+		[-6.27235164, -0.00075845, 0.00046485, 0.00076235, -0.00000113, 0.00000000],
+		[-6.27235209, -0.00075827, 0.00046474, 0.00076216, -0.00000113, 0.00000000],
+		[-6.27235255, -0.00075808, 0.00046462, 0.00076197, -0.00000113, 0.00000000],
+		[-6.27235300, -0.00075790, 0.00046451, 0.00076179, -0.00000113, 0.00000000],
+		[-6.27235345, -0.00075771, 0.00046440, 0.00076160, -0.00000113, 0.00000000],
+		[-6.27235390, -0.00075753, 0.00046428, 0.00076141, -0.00000113, 0.00000000],
+		[-6.27235435, -0.00075734, 0.00046417, 0.00076123, -0.00000113, 0.00000000],
+		[-6.27235480, -0.00075715, 0.00046405, 0.00076104, -0.00000113, 0.00000000],
+		[-6.27235525, -0.00075697, 0.00046394, 0.00076085, -0.00000113, 0.00000000],
+		[-6.27235570, -0.00075678, 0.00046383, 0.00076067, -0.00000113, 0.00000000],
+		[-6.27235615, -0.00075660, 0.00046371, 0.00076048, -0.00000113, 0.00000000],
+		[-6.27235660, -0.00075641, 0.00046360, 0.00076030, -0.00000113, 0.00000000],
+		[-6.27235705, -0.00075623, 0.00046349, 0.00076011, -0.00000113, 0.00000000],
+		[-6.27235750, -0.00075605, 0.00046337, 0.00075992, -0.00000113, 0.00000000],
+		[-6.27235795, -0.00075586, 0.00046326, 0.00075974, -0.00000113, 0.00000000],
+		[-6.27235840, -0.00075568, 0.00046315, 0.00075955, -0.00000113, 0.00000000],
+		[-6.27235884, -0.00075549, 0.00046303, 0.00075937, -0.00000113, 0.00000000],
+		[-6.27235929, -0.00075531, 0.00046292, 0.00075918, -0.00000113, 0.00000000],
+		[-6.27235974, -0.00075512, 0.00046281, 0.00075900, -0.00000113, 0.00000000],
+		[-6.27236019, -0.00075494, 0.00046269, 0.00075881, -0.00000113, 0.00000000],
+		[-6.27236063, -0.00075475, 0.00046258, 0.00075863, -0.00000113, 0.00000000],
+		[-6.27236108, -0.00075457, 0.00046247, 0.00075844, -0.00000113, 0.00000000],
+		[-6.27236153, -0.00075439, 0.00046236, 0.00075826, -0.00000113, 0.00000000],
+		[-6.27236197, -0.00075420, 0.00046224, 0.00075807, -0.00000113, 0.00000000],
+		[-6.27236242, -0.00075402, 0.00046213, 0.00075789, -0.00000113, 0.00000000],
+		[-6.27236287, -0.00075384, 0.00046202, 0.00075770, -0.00000113, 0.00000000],
+		[-6.27236331, -0.00075365, 0.00046191, 0.00075752, -0.00000113, 0.00000000],
+		[-6.27236376, -0.00075347, 0.00046179, 0.00075733, -0.00000113, 0.00000000],
+		[-6.27236420, -0.00075329, 0.00046168, 0.00075715, -0.00000113, 0.00000000],
+		[-6.27236465, -0.00075310, 0.00046157, 0.00075697, -0.00000113, 0.00000000],
+		[-6.27236509, -0.00075292, 0.00046146, 0.00075678, -0.00000113, 0.00000000],
+		[-6.27236554, -0.00075274, 0.00046134, 0.00075660, -0.00000113, 0.00000000],
+		[-6.27236598, -0.00075255, 0.00046123, 0.00075641, -0.00000113, 0.00000000],
+		[-6.27236643, -0.00075237, 0.00046112, 0.00075623, -0.00000113, 0.00000000],
+		[-6.27236687, -0.00075219, 0.00046101, 0.00075605, -0.00000113, 0.00000000],
+		[-6.27236731, -0.00075200, 0.00046089, 0.00075586, -0.00000113, 0.00000000],
+		[-6.27236776, -0.00075182, 0.00046078, 0.00075568, -0.00000113, 0.00000000],
+		[-6.27236820, -0.00075164, 0.00046067, 0.00075550, -0.00000113, 0.00000000],
+		[-6.27236864, -0.00075146, 0.00046056, 0.00075531, -0.00000113, 0.00000000],
+		[-6.27236909, -0.00075127, 0.00046045, 0.00075513, -0.00000113, 0.00000000],
+		[-6.27236953, -0.00075109, 0.00046034, 0.00075495, -0.00000113, 0.00000000],
+		[-6.27236997, -0.00075091, 0.00046022, 0.00075476, -0.00000113, 0.00000000],
+		[-6.27237041, -0.00075073, 0.00046011, 0.00075458, -0.00000113, 0.00000000],
+		[-6.27237085, -0.00075055, 0.00046000, 0.00075440, -0.00000113, 0.00000000],
+		[-6.27237130, -0.00075036, 0.00045989, 0.00075421, -0.00000113, 0.00000000],
+		[-6.27237174, -0.00075018, 0.00045978, 0.00075403, -0.00000113, 0.00000000],
+		[-6.27237218, -0.00075000, 0.00045967, 0.00075385, -0.00000113, 0.00000000],
+		[-6.27237262, -0.00074982, 0.00045955, 0.00075366, -0.00000113, 0.00000000],
+		[-6.27237306, -0.00074964, 0.00045944, 0.00075348, -0.00000113, 0.00000000],
+		[-6.27237350, -0.00074946, 0.00045933, 0.00075330, -0.00000113, 0.00000000],
+		[-6.27237394, -0.00074927, 0.00045922, 0.00075312, -0.00000113, 0.00000000],
+		[-6.27237438, -0.00074909, 0.00045911, 0.00075294, -0.00000113, 0.00000000],
+		[-6.27237482, -0.00074891, 0.00045900, 0.00075275, -0.00000113, 0.00000000],
+		[-6.27237526, -0.00074873, 0.00045889, 0.00075257, -0.00000113, 0.00000000],
+		[-6.27237570, -0.00074855, 0.00045878, 0.00075239, -0.00000113, 0.00000000],
+		[-6.27237614, -0.00074837, 0.00045866, 0.00075221, -0.00000113, 0.00000000],
+		[-6.27237657, -0.00074819, 0.00045855, 0.00075203, -0.00000113, 0.00000000],
+		[-6.27237701, -0.00074801, 0.00045844, 0.00075184, -0.00000113, 0.00000000],
+		[-6.27237745, -0.00074783, 0.00045833, 0.00075166, -0.00000113, 0.00000000],
+		[-6.27237789, -0.00074765, 0.00045822, 0.00075148, -0.00000113, 0.00000000],
+		[-6.27237833, -0.00074747, 0.00045811, 0.00075130, -0.00000113, 0.00000000],
+		[-6.27237876, -0.00074728, 0.00045800, 0.00075112, -0.00000113, 0.00000000],
+		[-6.27237920, -0.00074710, 0.00045789, 0.00075094, -0.00000113, 0.00000000],
+		[-6.27237964, -0.00074692, 0.00045778, 0.00075075, -0.00000113, 0.00000000],
+		[-6.27238007, -0.00074674, 0.00045767, 0.00075057, -0.00000113, 0.00000000],
+		[-6.27238051, -0.00074656, 0.00045756, 0.00075039, -0.00000113, 0.00000000],
+		[-6.27238095, -0.00074638, 0.00045745, 0.00075021, -0.00000113, 0.00000000],
+		[-6.27238138, -0.00074620, 0.00045734, 0.00075003, -0.00000113, 0.00000000],
+		[-6.27238182, -0.00074602, 0.00045723, 0.00074985, -0.00000113, 0.00000000],
+		[-6.27238225, -0.00074584, 0.00045712, 0.00074967, -0.00000113, 0.00000000],
+		[-6.27238269, -0.00074566, 0.00045701, 0.00074949, -0.00000113, 0.00000000],
+		[-6.27238312, -0.00074548, 0.00045690, 0.00074931, -0.00000113, 0.00000000],
+		[-6.27238356, -0.00074531, 0.00045679, 0.00074913, -0.00000113, 0.00000000],
+		[-6.27238399, -0.00074513, 0.00045668, 0.00074895, -0.00000113, 0.00000000],
+		[-6.27238443, -0.00074495, 0.00045657, 0.00074877, -0.00000113, 0.00000000],
+		[-6.27238486, -0.00074477, 0.00045646, 0.00074859, -0.00000113, 0.00000000],
+		[-6.27238530, -0.00074459, 0.00045635, 0.00074841, -0.00000113, 0.00000000],
+		[-6.27238573, -0.00074441, 0.00045624, 0.00074823, -0.00000113, 0.00000000],
+		[-6.27238616, -0.00074423, 0.00045613, 0.00074805, -0.00000113, 0.00000000],
+		[-6.27238660, -0.00074405, 0.00045602, 0.00074787, -0.00000113, 0.00000000],
+		[-6.27238703, -0.00074387, 0.00045591, 0.00074769, -0.00000113, 0.00000000],
+		[-6.27238746, -0.00074369, 0.00045580, 0.00074751, -0.00000113, 0.00000000],
+		[-6.27238790, -0.00074352, 0.00045569, 0.00074733, -0.00000113, 0.00000000],
+		[-6.27238833, -0.00074334, 0.00045558, 0.00074715, -0.00000113, 0.00000000],
+		[-6.27238876, -0.00074316, 0.00045547, 0.00074697, -0.00000113, 0.00000000],
+		[-6.27238919, -0.00074298, 0.00045536, 0.00074679, -0.00000113, 0.00000000],
+		[-6.27238962, -0.00074280, 0.00045525, 0.00074661, -0.00000113, 0.00000000],
+		[-6.27239006, -0.00074262, 0.00045514, 0.00074643, -0.00000113, 0.00000000],
+		[-6.27239049, -0.00074245, 0.00045503, 0.00074625, -0.00000113, 0.00000000],
+		[-6.27239092, -0.00074227, 0.00045492, 0.00074607, -0.00000113, 0.00000000],
+		[-6.27239135, -0.00074209, 0.00045481, 0.00074589, -0.00000113, 0.00000000],
+		[-6.27239178, -0.00074191, 0.00045470, 0.00074572, -0.00000113, 0.00000000],
+		[-6.27239221, -0.00074173, 0.00045459, 0.00074554, -0.00000113, 0.00000000],
+		[-6.27239264, -0.00074156, 0.00045449, 0.00074536, -0.00000113, 0.00000000],
+		[-6.27239307, -0.00074138, 0.00045438, 0.00074518, -0.00000113, 0.00000000],
+		[-6.27239350, -0.00074120, 0.00045427, 0.00074500, -0.00000113, 0.00000000],
+		[-6.27239393, -0.00074102, 0.00045416, 0.00074482, -0.00000113, 0.00000000],
+		[-6.27239436, -0.00074085, 0.00045405, 0.00074464, -0.00000113, 0.00000000],
+		[-6.27239479, -0.00074067, 0.00045394, 0.00074447, -0.00000113, 0.00000000],
+		[-6.27239522, -0.00074049, 0.00045383, 0.00074429, -0.00000113, 0.00000000],
+		[-6.27239564, -0.00074031, 0.00045372, 0.00074411, -0.00000113, 0.00000000],
+		[-6.27239607, -0.00074014, 0.00045362, 0.00074393, -0.00000113, 0.00000000],
+		[-6.27239650, -0.00073996, 0.00045351, 0.00074375, -0.00000113, 0.00000000],
+		[-6.27239693, -0.00073978, 0.00045340, 0.00074358, -0.00000112, 0.00000000],
+		[-6.27239736, -0.00073961, 0.00045329, 0.00074340, -0.00000112, 0.00000000],
+		[-6.27239778, -0.00073943, 0.00045318, 0.00074322, -0.00000112, 0.00000000],
+		[-6.27239821, -0.00073925, 0.00045307, 0.00074304, -0.00000112, 0.00000000],
+		[-6.27239864, -0.00073908, 0.00045296, 0.00074287, -0.00000112, 0.00000000],
+		[-6.27239906, -0.00073890, 0.00045286, 0.00074269, -0.00000112, 0.00000000],
+		[-6.27239949, -0.00073872, 0.00045275, 0.00074251, -0.00000112, 0.00000000],
+		[-6.27239992, -0.00073855, 0.00045264, 0.00074233, -0.00000112, 0.00000000],
+		[-6.27240034, -0.00073837, 0.00045253, 0.00074216, -0.00000112, 0.00000000],
+		[-6.27240077, -0.00073820, 0.00045242, 0.00074198, -0.00000112, 0.00000000],
+		[-6.27240119, -0.00073802, 0.00045232, 0.00074180, -0.00000112, 0.00000000],
+		[-6.27240162, -0.00073784, 0.00045221, 0.00074163, -0.00000112, 0.00000000],
+		[-6.27240205, -0.00073767, 0.00045210, 0.00074145, -0.00000112, 0.00000000],
+		[-6.27240247, -0.00073749, 0.00045199, 0.00074127, -0.00000112, 0.00000000],
+		[-6.27240289, -0.00073732, 0.00045188, 0.00074110, -0.00000112, 0.00000000],
+		[-6.27240332, -0.00073714, 0.00045178, 0.00074092, -0.00000112, 0.00000000],
+		[-6.27240374, -0.00073697, 0.00045167, 0.00074074, -0.00000112, 0.00000000],
+		[-6.27240417, -0.00073679, 0.00045156, 0.00074057, -0.00000112, 0.00000000],
+		[-6.27240459, -0.00073662, 0.00045145, 0.00074039, -0.00000112, 0.00000000],
+		[-6.27240502, -0.00073644, 0.00045135, 0.00074022, -0.00000112, 0.00000000],
+		[-6.27240544, -0.00073626, 0.00045124, 0.00074004, -0.00000112, 0.00000000],
+		[-6.27240586, -0.00073609, 0.00045113, 0.00073986, -0.00000112, 0.00000000],
+		[-6.27240628, -0.00073591, 0.00045102, 0.00073969, -0.00000112, 0.00000000],
+		[-6.27240671, -0.00073574, 0.00045092, 0.00073951, -0.00000112, 0.00000000],
+		[-6.27240713, -0.00073556, 0.00045081, 0.00073934, -0.00000112, 0.00000000],
+		[-6.27240755, -0.00073539, 0.00045070, 0.00073916, -0.00000112, 0.00000000],
+		[-6.27240797, -0.00073522, 0.00045060, 0.00073898, -0.00000112, 0.00000000],
+		[-6.27240840, -0.00073504, 0.00045049, 0.00073881, -0.00000112, 0.00000000],
+		[-6.27240882, -0.00073487, 0.00045038, 0.00073863, -0.00000112, 0.00000000],
+		[-6.27240924, -0.00073469, 0.00045027, 0.00073846, -0.00000112, 0.00000000],
+		[-6.27240966, -0.00073452, 0.00045017, 0.00073828, -0.00000112, 0.00000000],
+		[-6.27241008, -0.00073434, 0.00045006, 0.00073811, -0.00000112, 0.00000000],
+		[-6.27241050, -0.00073417, 0.00044995, 0.00073793, -0.00000112, 0.00000000],
+		[-6.27241092, -0.00073400, 0.00044985, 0.00073776, -0.00000112, 0.00000000],
+		[-6.27241134, -0.00073382, 0.00044974, 0.00073758, -0.00000112, 0.00000000],
+		[-6.27241176, -0.00073365, 0.00044963, 0.00073741, -0.00000112, 0.00000000],
+		[-6.27241218, -0.00073347, 0.00044953, 0.00073723, -0.00000112, 0.00000000],
+		[-6.27241260, -0.00073330, 0.00044942, 0.00073706, -0.00000112, 0.00000000],
+		[-6.27241302, -0.00073313, 0.00044931, 0.00073688, -0.00000112, 0.00000000],
+		[-6.27241344, -0.00073295, 0.00044921, 0.00073671, -0.00000112, 0.00000000],
+		[-6.27241386, -0.00073278, 0.00044910, 0.00073653, -0.00000112, 0.00000000],
+		[-6.27241428, -0.00073261, 0.00044899, 0.00073636, -0.00000112, 0.00000000],
+		[-6.27241470, -0.00073243, 0.00044889, 0.00073619, -0.00000112, 0.00000000],
+		[-6.27241512, -0.00073226, 0.00044878, 0.00073601, -0.00000112, 0.00000000],
+		[-6.27241554, -0.00073209, 0.00044868, 0.00073584, -0.00000112, 0.00000000],
+		[-6.27241595, -0.00073191, 0.00044857, 0.00073566, -0.00000112, 0.00000000],
+		[-6.27241637, -0.00073174, 0.00044846, 0.00073549, -0.00000112, 0.00000000],
+		[-6.27241679, -0.00073157, 0.00044836, 0.00073532, -0.00000112, 0.00000000],
+		[-6.27241721, -0.00073139, 0.00044825, 0.00073514, -0.00000112, 0.00000000],
+		[-6.27241762, -0.00073122, 0.00044815, 0.00073497, -0.00000112, 0.00000000],
+		[-6.27241804, -0.00073105, 0.00044804, 0.00073479, -0.00000112, 0.00000000],
+		[-6.27241846, -0.00073088, 0.00044793, 0.00073462, -0.00000112, 0.00000000],
+		[-6.27241887, -0.00073070, 0.00044783, 0.00073445, -0.00000112, 0.00000000],
+		[-6.27241929, -0.00073053, 0.00044772, 0.00073427, -0.00000112, 0.00000000],
+		[-6.27241971, -0.00073036, 0.00044762, 0.00073410, -0.00000112, 0.00000000],
+		[-6.27242012, -0.00073019, 0.00044751, 0.00073393, -0.00000112, 0.00000000],
+		[-6.27242054, -0.00073001, 0.00044741, 0.00073376, -0.00000112, 0.00000000],
+		[-6.27242095, -0.00072984, 0.00044730, 0.00073358, -0.00000112, 0.00000000],
+		[-6.27242137, -0.00072967, 0.00044719, 0.00073341, -0.00000112, 0.00000000],
+		[-6.27242178, -0.00072950, 0.00044709, 0.00073324, -0.00000112, 0.00000000],
+		[-6.27242220, -0.00072933, 0.00044698, 0.00073306, -0.00000112, 0.00000000],
+		[-6.27242261, -0.00072915, 0.00044688, 0.00073289, -0.00000112, 0.00000000],
+		[-6.27242303, -0.00072898, 0.00044677, 0.00073272, -0.00000112, 0.00000000],
+		[-6.27242344, -0.00072881, 0.00044667, 0.00073255, -0.00000112, 0.00000000],
+		[-6.27242386, -0.00072864, 0.00044656, 0.00073237, -0.00000112, 0.00000000],
+		[-6.27242427, -0.00072847, 0.00044646, 0.00073220, -0.00000112, 0.00000000],
+		[-6.27242468, -0.00072830, 0.00044635, 0.00073203, -0.00000112, 0.00000000],
+		[-6.27242510, -0.00072813, 0.00044625, 0.00073186, -0.00000112, 0.00000000],
+		[-6.27242551, -0.00072795, 0.00044614, 0.00073168, -0.00000112, 0.00000000],
+		[-6.27242592, -0.00072778, 0.00044604, 0.00073151, -0.00000112, 0.00000000],
+		[-6.27242634, -0.00072761, 0.00044593, 0.00073134, -0.00000112, 0.00000000],
+		[-6.27242675, -0.00072744, 0.00044583, 0.00073117, -0.00000112, 0.00000000],
+		[-6.27242716, -0.00072727, 0.00044572, 0.00073100, -0.00000112, 0.00000000],
+		[-6.27242757, -0.00072710, 0.00044562, 0.00073082, -0.00000112, 0.00000000],
+		[-6.27242798, -0.00072693, 0.00044551, 0.00073065, -0.00000112, 0.00000000],
+		[-6.27242840, -0.00072676, 0.00044541, 0.00073048, -0.00000112, 0.00000000],
+		[-6.27242881, -0.00072659, 0.00044530, 0.00073031, -0.00000112, 0.00000000],
+		[-6.27242922, -0.00072642, 0.00044520, 0.00073014, -0.00000112, 0.00000000],
+		[-6.27242963, -0.00072625, 0.00044509, 0.00072997, -0.00000112, 0.00000000],
+		[-6.27243004, -0.00072608, 0.00044499, 0.00072980, -0.00000112, 0.00000000],
+		[-6.27243045, -0.00072591, 0.00044488, 0.00072962, -0.00000112, 0.00000000],
+		[-6.27243086, -0.00072574, 0.00044478, 0.00072945, -0.00000112, 0.00000000],
+		[-6.27243127, -0.00072557, 0.00044468, 0.00072928, -0.00000112, 0.00000000],
+		[-6.27243168, -0.00072540, 0.00044457, 0.00072911, -0.00000112, 0.00000000],
+		[-6.27243209, -0.00072523, 0.00044447, 0.00072894, -0.00000112, 0.00000000],
+		[-6.27243250, -0.00072506, 0.00044436, 0.00072877, -0.00000112, 0.00000000],
+		[-6.27243291, -0.00072489, 0.00044426, 0.00072860, -0.00000112, 0.00000000],
+		[-6.27243332, -0.00072472, 0.00044416, 0.00072843, -0.00000112, 0.00000000],
+		[-6.27243373, -0.00072455, 0.00044405, 0.00072826, -0.00000112, 0.00000000],
+		[-6.27243414, -0.00072438, 0.00044395, 0.00072809, -0.00000112, 0.00000000],
+		[-6.27243455, -0.00072421, 0.00044384, 0.00072792, -0.00000112, 0.00000000],
+		[-6.27243496, -0.00072404, 0.00044374, 0.00072775, -0.00000112, 0.00000000],
+		[-6.27243536, -0.00072387, 0.00044364, 0.00072758, -0.00000112, 0.00000000],
+		[-6.27243577, -0.00072370, 0.00044353, 0.00072741, -0.00000112, 0.00000000],
+		[-6.27243618, -0.00072353, 0.00044343, 0.00072724, -0.00000112, 0.00000000],
+		[-6.27243659, -0.00072336, 0.00044332, 0.00072707, -0.00000112, 0.00000000],
+		[-6.27243700, -0.00072319, 0.00044322, 0.00072690, -0.00000112, 0.00000000],
+		[-6.27243740, -0.00072302, 0.00044312, 0.00072673, -0.00000112, 0.00000000],
+		[-6.27243781, -0.00072285, 0.00044301, 0.00072656, -0.00000112, 0.00000000],
+		[-6.27243822, -0.00072269, 0.00044291, 0.00072639, -0.00000112, 0.00000000],
+		[-6.27243862, -0.00072252, 0.00044281, 0.00072622, -0.00000112, 0.00000000],
+		[-6.27243903, -0.00072235, 0.00044270, 0.00072605, -0.00000112, 0.00000000],
+		[-6.27243944, -0.00072218, 0.00044260, 0.00072588, -0.00000112, 0.00000000],
+		[-6.27243984, -0.00072201, 0.00044250, 0.00072571, -0.00000112, 0.00000000],
+		[-6.27244025, -0.00072184, 0.00044239, 0.00072554, -0.00000112, 0.00000000],
+		[-6.27244065, -0.00072167, 0.00044229, 0.00072537, -0.00000112, 0.00000000],
+		[-6.27244106, -0.00072151, 0.00044219, 0.00072520, -0.00000112, 0.00000000],
+		[-6.27244146, -0.00072134, 0.00044208, 0.00072503, -0.00000112, 0.00000000],
+		[-6.27244187, -0.00072117, 0.00044198, 0.00072486, -0.00000112, 0.00000000],
+		[-6.27244227, -0.00072100, 0.00044188, 0.00072470, -0.00000112, 0.00000000],
+		[-6.27244268, -0.00072083, 0.00044177, 0.00072453, -0.00000112, 0.00000000],
+		[-6.27244308, -0.00072067, 0.00044167, 0.00072436, -0.00000112, 0.00000000],
+		[-6.27244349, -0.00072050, 0.00044157, 0.00072419, -0.00000112, 0.00000000],
+		[-6.27244389, -0.00072033, 0.00044147, 0.00072402, -0.00000112, 0.00000000],
+		[-6.27244429, -0.00072016, 0.00044136, 0.00072385, -0.00000112, 0.00000000],
+		[-6.27244470, -0.00072000, 0.00044126, 0.00072368, -0.00000112, 0.00000000],
+		[-6.27244510, -0.00071983, 0.00044116, 0.00072352, -0.00000112, 0.00000000],
+		[-6.27244550, -0.00071966, 0.00044105, 0.00072335, -0.00000112, 0.00000000],
+		[-6.27244591, -0.00071949, 0.00044095, 0.00072318, -0.00000112, 0.00000000],
+		[-6.27244631, -0.00071933, 0.00044085, 0.00072301, -0.00000112, 0.00000000],
+		[-6.27244671, -0.00071916, 0.00044075, 0.00072284, -0.00000112, 0.00000000],
+		[-6.27244712, -0.00071899, 0.00044064, 0.00072268, -0.00000112, 0.00000000],
+		[-6.27244752, -0.00071883, 0.00044054, 0.00072251, -0.00000112, 0.00000000],
+		[-6.27244792, -0.00071866, 0.00044044, 0.00072234, -0.00000112, 0.00000000],
+		[-6.27244832, -0.00071849, 0.00044034, 0.00072217, -0.00000112, 0.00000000],
+		[-6.27244872, -0.00071833, 0.00044024, 0.00072200, -0.00000112, 0.00000000],
+		[-6.27244912, -0.00071816, 0.00044013, 0.00072184, -0.00000112, 0.00000000],
+		[-6.27244953, -0.00071799, 0.00044003, 0.00072167, -0.00000112, 0.00000000],
+		[-6.27244993, -0.00071783, 0.00043993, 0.00072150, -0.00000112, 0.00000000],
+		[-6.27245033, -0.00071766, 0.00043983, 0.00072133, -0.00000112, 0.00000000],
+		[-6.27245073, -0.00071749, 0.00043972, 0.00072117, -0.00000112, 0.00000000],
+		[-6.27245113, -0.00071733, 0.00043962, 0.00072100, -0.00000112, 0.00000000],
+		[-6.27245153, -0.00071716, 0.00043952, 0.00072083, -0.00000112, 0.00000000],
+		[-6.27245193, -0.00071699, 0.00043942, 0.00072067, -0.00000112, 0.00000000],
+		[-6.27245233, -0.00071683, 0.00043932, 0.00072050, -0.00000112, 0.00000000],
+		[-6.27245273, -0.00071666, 0.00043922, 0.00072033, -0.00000112, 0.00000000],
+		[-6.27245313, -0.00071650, 0.00043911, 0.00072017, -0.00000112, 0.00000000],
+		[-6.27245353, -0.00071633, 0.00043901, 0.00072000, -0.00000112, 0.00000000],
+		[-6.27245393, -0.00071617, 0.00043891, 0.00071983, -0.00000112, 0.00000000],
+		[-6.27245432, -0.00071600, 0.00043881, 0.00071967, -0.00000112, 0.00000000],
+		[-6.27245472, -0.00071583, 0.00043871, 0.00071950, -0.00000112, 0.00000000],
+		[-6.27245512, -0.00071567, 0.00043861, 0.00071933, -0.00000112, 0.00000000],
+		[-6.27245552, -0.00071550, 0.00043850, 0.00071917, -0.00000112, 0.00000000],
+		[-6.27245592, -0.00071534, 0.00043840, 0.00071900, -0.00000112, 0.00000000],
+		[-6.27245632, -0.00071517, 0.00043830, 0.00071883, -0.00000112, 0.00000000],
+		[-6.27245671, -0.00071501, 0.00043820, 0.00071867, -0.00000112, 0.00000000],
+		[-6.27245711, -0.00071484, 0.00043810, 0.00071850, -0.00000112, 0.00000000],
+		[-6.27245751, -0.00071468, 0.00043800, 0.00071834, -0.00000112, 0.00000000],
+		[-6.27245791, -0.00071451, 0.00043790, 0.00071817, -0.00000112, 0.00000000],
+		[-6.27245830, -0.00071435, 0.00043779, 0.00071800, -0.00000112, 0.00000000],
+		[-6.27245870, -0.00071418, 0.00043769, 0.00071784, -0.00000112, 0.00000000],
+		[-6.27245910, -0.00071402, 0.00043759, 0.00071767, -0.00000112, 0.00000000],
+		[-6.27245949, -0.00071385, 0.00043749, 0.00071751, -0.00000112, 0.00000000],
+		[-6.27245989, -0.00071369, 0.00043739, 0.00071734, -0.00000112, 0.00000000],
+		[-6.27246028, -0.00071352, 0.00043729, 0.00071718, -0.00000112, 0.00000000],
+		[-6.27246068, -0.00071336, 0.00043719, 0.00071701, -0.00000112, 0.00000000],
+		[-6.27246108, -0.00071320, 0.00043709, 0.00071685, -0.00000112, 0.00000000],
+		[-6.27246147, -0.00071303, 0.00043699, 0.00071668, -0.00000112, 0.00000000],
+		[-6.27246187, -0.00071287, 0.00043689, 0.00071652, -0.00000112, 0.00000000],
+		[-6.27246226, -0.00071270, 0.00043679, 0.00071635, -0.00000112, 0.00000000],
+		[-6.27246266, -0.00071254, 0.00043669, 0.00071619, -0.00000112, 0.00000000],
+		[-6.27246305, -0.00071237, 0.00043658, 0.00071602, -0.00000112, 0.00000000],
+		[-6.27246345, -0.00071221, 0.00043648, 0.00071586, -0.00000112, 0.00000000],
+		[-6.27246384, -0.00071205, 0.00043638, 0.00071569, -0.00000112, 0.00000000],
+		[-6.27246423, -0.00071188, 0.00043628, 0.00071553, -0.00000112, 0.00000000],
+		[-6.27246463, -0.00071172, 0.00043618, 0.00071536, -0.00000112, 0.00000000],
+		[-6.27246502, -0.00071156, 0.00043608, 0.00071520, -0.00000112, 0.00000000],
+		[-6.27246541, -0.00071139, 0.00043598, 0.00071503, -0.00000112, 0.00000000],
+		[-6.27246581, -0.00071123, 0.00043588, 0.00071487, -0.00000112, 0.00000000],
+		[-6.27246620, -0.00071107, 0.00043578, 0.00071471, -0.00000112, 0.00000000],
+		[-6.27246659, -0.00071090, 0.00043568, 0.00071454, -0.00000112, 0.00000000],
+		[-6.27246699, -0.00071074, 0.00043558, 0.00071438, -0.00000112, 0.00000000],
+		[-6.27246738, -0.00071058, 0.00043548, 0.00071421, -0.00000112, 0.00000000],
+		[-6.27246777, -0.00071041, 0.00043538, 0.00071405, -0.00000112, 0.00000000],
+		[-6.27246816, -0.00071025, 0.00043528, 0.00071389, -0.00000112, 0.00000000],
+		[-6.27246856, -0.00071009, 0.00043518, 0.00071372, -0.00000112, 0.00000000],
+		[-6.27246895, -0.00070992, 0.00043508, 0.00071356, -0.00000112, 0.00000000],
+		[-6.27246934, -0.00070976, 0.00043498, 0.00071339, -0.00000112, 0.00000000],
+		[-6.27246973, -0.00070960, 0.00043488, 0.00071323, -0.00000112, 0.00000000],
+		[-6.27247012, -0.00070944, 0.00043478, 0.00071307, -0.00000112, 0.00000000],
+		[-6.27247051, -0.00070927, 0.00043468, 0.00071290, -0.00000112, 0.00000000],
+		[-6.27247090, -0.00070911, 0.00043458, 0.00071274, -0.00000112, 0.00000000],
+		[-6.27247129, -0.00070895, 0.00043448, 0.00071258, -0.00000112, 0.00000000],
+		[-6.27247168, -0.00070879, 0.00043438, 0.00071241, -0.00000112, 0.00000000],
+		[-6.27247207, -0.00070862, 0.00043428, 0.00071225, -0.00000112, 0.00000000],
+		[-6.27247246, -0.00070846, 0.00043418, 0.00071209, -0.00000112, 0.00000000],
+		[-6.27247285, -0.00070830, 0.00043409, 0.00071193, -0.00000112, 0.00000000],
+		[-6.27247324, -0.00070814, 0.00043399, 0.00071176, -0.00000112, 0.00000000],
+		[-6.27247363, -0.00070798, 0.00043389, 0.00071160, -0.00000112, 0.00000000],
+		[-6.27247402, -0.00070781, 0.00043379, 0.00071144, -0.00000112, 0.00000000],
+		[-6.27247441, -0.00070765, 0.00043369, 0.00071127, -0.00000112, 0.00000000],
+		[-6.27247480, -0.00070749, 0.00043359, 0.00071111, -0.00000112, 0.00000000],
+		[-6.27247519, -0.00070733, 0.00043349, 0.00071095, -0.00000112, 0.00000000],
+		[-6.27247558, -0.00070717, 0.00043339, 0.00071079, -0.00000112, 0.00000000],
+		[-6.27247597, -0.00070701, 0.00043329, 0.00071062, -0.00000112, 0.00000000],
+		[-6.27247636, -0.00070684, 0.00043319, 0.00071046, -0.00000112, 0.00000000],
+		[-6.27247674, -0.00070668, 0.00043309, 0.00071030, -0.00000112, 0.00000000],
+		[-6.27247713, -0.00070652, 0.00043299, 0.00071014, -0.00000112, 0.00000000],
+		[-6.27247752, -0.00070636, 0.00043290, 0.00070998, -0.00000112, 0.00000000],
+		[-6.27247791, -0.00070620, 0.00043280, 0.00070981, -0.00000112, 0.00000000],
+		[-6.27247829, -0.00070604, 0.00043270, 0.00070965, -0.00000112, 0.00000000],
+		[-6.27247868, -0.00070588, 0.00043260, 0.00070949, -0.00000112, 0.00000000],
+		[-6.27247907, -0.00070572, 0.00043250, 0.00070933, -0.00000112, 0.00000000],
+		[-6.27247945, -0.00070556, 0.00043240, 0.00070917, -0.00000112, 0.00000000],
+		[-6.27247984, -0.00070539, 0.00043230, 0.00070900, -0.00000112, 0.00000000],
+		[-6.27248023, -0.00070523, 0.00043220, 0.00070884, -0.00000112, 0.00000000],
+		[-6.27248061, -0.00070507, 0.00043211, 0.00070868, -0.00000112, 0.00000000],
+		[-6.27248100, -0.00070491, 0.00043201, 0.00070852, -0.00000112, 0.00000000],
+		[-6.27248139, -0.00070475, 0.00043191, 0.00070836, -0.00000112, 0.00000000],
+		[-6.27248177, -0.00070459, 0.00043181, 0.00070820, -0.00000112, 0.00000000],
+		[-6.27248216, -0.00070443, 0.00043171, 0.00070804, -0.00000112, 0.00000000],
+		[-6.27248254, -0.00070427, 0.00043161, 0.00070788, -0.00000112, 0.00000000],
+		[-6.27248293, -0.00070411, 0.00043152, 0.00070771, -0.00000112, 0.00000000],
+		[-6.27248331, -0.00070395, 0.00043142, 0.00070755, -0.00000112, 0.00000000],
+		[-6.27248370, -0.00070379, 0.00043132, 0.00070739, -0.00000112, 0.00000000],
+		[-6.27248408, -0.00070363, 0.00043122, 0.00070723, -0.00000112, 0.00000000],
+		[-6.27248447, -0.00070347, 0.00043112, 0.00070707, -0.00000112, 0.00000000],
+		[-6.27248485, -0.00070331, 0.00043103, 0.00070691, -0.00000112, 0.00000000],
+		[-6.27248523, -0.00070315, 0.00043093, 0.00070675, -0.00000112, 0.00000000],
+		[-6.27248562, -0.00070299, 0.00043083, 0.00070659, -0.00000112, 0.00000000],
+		[-6.27248600, -0.00070283, 0.00043073, 0.00070643, -0.00000112, 0.00000000],
+		[-6.27248638, -0.00070267, 0.00043063, 0.00070627, -0.00000112, 0.00000000],
+		[-6.27248677, -0.00070251, 0.00043054, 0.00070611, -0.00000112, 0.00000000],
+		[-6.27248715, -0.00070235, 0.00043044, 0.00070595, -0.00000112, 0.00000000],
+		[-6.27248753, -0.00070219, 0.00043034, 0.00070579, -0.00000112, 0.00000000],
+		[-6.27248792, -0.00070203, 0.00043024, 0.00070563, -0.00000112, 0.00000000],
+		[-6.27248830, -0.00070188, 0.00043014, 0.00070547, -0.00000112, 0.00000000],
+		[-6.27248868, -0.00070172, 0.00043005, 0.00070531, -0.00000112, 0.00000000],
+		[-6.27248906, -0.00070156, 0.00042995, 0.00070515, -0.00000112, 0.00000000],
+		[-6.27248945, -0.00070140, 0.00042985, 0.00070499, -0.00000112, 0.00000000],
+		[-6.27248983, -0.00070124, 0.00042975, 0.00070483, -0.00000112, 0.00000000],
+		[-6.27249021, -0.00070108, 0.00042966, 0.00070467, -0.00000112, 0.00000000],
+		[-6.27249059, -0.00070092, 0.00042956, 0.00070451, -0.00000112, 0.00000000],
+		[-6.27249097, -0.00070076, 0.00042946, 0.00070435, -0.00000112, 0.00000000],
+		[-6.27249135, -0.00070060, 0.00042937, 0.00070419, -0.00000112, 0.00000000],
+		[-6.27249173, -0.00070045, 0.00042927, 0.00070403, -0.00000112, 0.00000000],
+		[-6.27249211, -0.00070029, 0.00042917, 0.00070387, -0.00000112, 0.00000000],
+		[-6.27249250, -0.00070013, 0.00042907, 0.00070371, -0.00000112, 0.00000000],
+		[-6.27249288, -0.00069997, 0.00042898, 0.00070355, -0.00000112, 0.00000000],
+		[-6.27249326, -0.00069981, 0.00042888, 0.00070339, -0.00000112, 0.00000000],
+		[-6.27249364, -0.00069965, 0.00042878, 0.00070323, -0.00000112, 0.00000000],
+		[-6.27249402, -0.00069950, 0.00042869, 0.00070308, -0.00000112, 0.00000000],
+		[-6.27249440, -0.00069934, 0.00042859, 0.00070292, -0.00000112, 0.00000000],
+		[-6.27249477, -0.00069918, 0.00042849, 0.00070276, -0.00000112, 0.00000000],
+		[-6.27249515, -0.00069902, 0.00042840, 0.00070260, -0.00000112, 0.00000000],
+		[-6.27249553, -0.00069887, 0.00042830, 0.00070244, -0.00000112, 0.00000000],
+		[-6.27249591, -0.00069871, 0.00042820, 0.00070228, -0.00000112, 0.00000000],
+		[-6.27249629, -0.00069855, 0.00042810, 0.00070212, -0.00000112, 0.00000000],
+		[-6.27249667, -0.00069839, 0.00042801, 0.00070197, -0.00000112, 0.00000000],
+		[-6.27249705, -0.00069823, 0.00042791, 0.00070181, -0.00000112, 0.00000000],
+		[-6.27249743, -0.00069808, 0.00042781, 0.00070165, -0.00000112, 0.00000000],
+		[-6.27249780, -0.00069792, 0.00042772, 0.00070149, -0.00000112, 0.00000000],
+		[-6.27249818, -0.00069776, 0.00042762, 0.00070133, -0.00000112, 0.00000000],
+		[-6.27249856, -0.00069761, 0.00042753, 0.00070117, -0.00000112, 0.00000000],
+		[-6.27249894, -0.00069745, 0.00042743, 0.00070102, -0.00000112, 0.00000000],
+		[-6.27249931, -0.00069729, 0.00042733, 0.00070086, -0.00000112, 0.00000000],
+		[-6.27249969, -0.00069713, 0.00042724, 0.00070070, -0.00000112, 0.00000000],
+		[-6.27250007, -0.00069698, 0.00042714, 0.00070054, -0.00000112, 0.00000000],
+		[-6.27250045, -0.00069682, 0.00042704, 0.00070038, -0.00000112, 0.00000000],
+		[-6.27250082, -0.00069666, 0.00042695, 0.00070023, -0.00000112, 0.00000000],
+		[-6.27250120, -0.00069651, 0.00042685, 0.00070007, -0.00000112, 0.00000000],
+		[-6.27250158, -0.00069635, 0.00042676, 0.00069991, -0.00000112, 0.00000000],
+		[-6.27250195, -0.00069619, 0.00042666, 0.00069975, -0.00000112, 0.00000000],
+		[-6.27250233, -0.00069604, 0.00042656, 0.00069960, -0.00000112, 0.00000000],
+		[-6.27250270, -0.00069588, 0.00042647, 0.00069944, -0.00000112, 0.00000000],
+		[-6.27250308, -0.00069572, 0.00042637, 0.00069928, -0.00000112, 0.00000000],
+		[-6.27250345, -0.00069557, 0.00042628, 0.00069913, -0.00000112, 0.00000000],
+		[-6.27250383, -0.00069541, 0.00042618, 0.00069897, -0.00000112, 0.00000000],
+		[-6.27250420, -0.00069525, 0.00042608, 0.00069881, -0.00000112, 0.00000000],
+		[-6.27250458, -0.00069510, 0.00042599, 0.00069865, -0.00000112, 0.00000000],
+		[-6.27250495, -0.00069494, 0.00042589, 0.00069850, -0.00000112, 0.00000000],
+		[-6.27250533, -0.00069479, 0.00042580, 0.00069834, -0.00000112, 0.00000000],
+		[-6.27250570, -0.00069463, 0.00042570, 0.00069818, -0.00000112, 0.00000000],
+		[-6.27250608, -0.00069447, 0.00042561, 0.00069803, -0.00000112, 0.00000000],
+		[-6.27250645, -0.00069432, 0.00042551, 0.00069787, -0.00000112, 0.00000000],
+		[-6.27250683, -0.00069416, 0.00042541, 0.00069771, -0.00000112, 0.00000000],
+		[-6.27250720, -0.00069401, 0.00042532, 0.00069756, -0.00000112, 0.00000000],
+		[-6.27250757, -0.00069385, 0.00042522, 0.00069740, -0.00000112, 0.00000000],
+		[-6.27250795, -0.00069370, 0.00042513, 0.00069725, -0.00000112, 0.00000000],
+		[-6.27250832, -0.00069354, 0.00042503, 0.00069709, -0.00000112, 0.00000000],
+		[-6.27250869, -0.00069339, 0.00042494, 0.00069693, -0.00000112, 0.00000000],
+		[-6.27250906, -0.00069323, 0.00042484, 0.00069678, -0.00000112, 0.00000000],
+		[-6.27250944, -0.00069308, 0.00042475, 0.00069662, -0.00000112, 0.00000000],
+		[-6.27250981, -0.00069292, 0.00042465, 0.00069646, -0.00000112, 0.00000000],
+		[-6.27251018, -0.00069277, 0.00042456, 0.00069631, -0.00000112, 0.00000000],
+		[-6.27251055, -0.00069261, 0.00042446, 0.00069615, -0.00000112, 0.00000000],
+		[-6.27251093, -0.00069246, 0.00042437, 0.00069600, -0.00000112, 0.00000000],
+		[-6.27251130, -0.00069230, 0.00042427, 0.00069584, -0.00000112, 0.00000000],
+		[-6.27251167, -0.00069215, 0.00042418, 0.00069569, -0.00000112, 0.00000000],
+		[-6.27251204, -0.00069199, 0.00042408, 0.00069553, -0.00000112, 0.00000000],
+		[-6.27251241, -0.00069184, 0.00042399, 0.00069537, -0.00000112, 0.00000000],
+		[-6.27251278, -0.00069168, 0.00042389, 0.00069522, -0.00000112, 0.00000000],
+		[-6.27251315, -0.00069153, 0.00042380, 0.00069506, -0.00000112, 0.00000000],
+		[-6.27251353, -0.00069137, 0.00042370, 0.00069491, -0.00000112, 0.00000000],
+		[-6.27251390, -0.00069122, 0.00042361, 0.00069475, -0.00000112, 0.00000000],
+		[-6.27251427, -0.00069106, 0.00042351, 0.00069460, -0.00000112, 0.00000000],
+		[-6.27251464, -0.00069091, 0.00042342, 0.00069444, -0.00000112, 0.00000000],
+		[-6.27251501, -0.00069076, 0.00042332, 0.00069429, -0.00000112, 0.00000000],
+		[-6.27251538, -0.00069060, 0.00042323, 0.00069413, -0.00000112, 0.00000000],
+		[-6.27251575, -0.00069045, 0.00042314, 0.00069398, -0.00000112, 0.00000000],
+		[-6.27251612, -0.00069029, 0.00042304, 0.00069382, -0.00000112, 0.00000000],
+		[-6.27251649, -0.00069014, 0.00042295, 0.00069367, -0.00000112, 0.00000000],
+		[-6.27251685, -0.00068999, 0.00042285, 0.00069351, -0.00000112, 0.00000000],
+		[-6.27251722, -0.00068983, 0.00042276, 0.00069336, -0.00000112, 0.00000000],
+		[-6.27251759, -0.00068968, 0.00042266, 0.00069321, -0.00000112, 0.00000000],
+		[-6.27251796, -0.00068952, 0.00042257, 0.00069305, -0.00000112, 0.00000000],
+		[-6.27251833, -0.00068937, 0.00042248, 0.00069290, -0.00000112, 0.00000000],
+		[-6.27251870, -0.00068922, 0.00042238, 0.00069274, -0.00000112, 0.00000000],
+		[-6.27251907, -0.00068906, 0.00042229, 0.00069259, -0.00000112, 0.00000000],
+		[-6.27251943, -0.00068891, 0.00042219, 0.00069243, -0.00000112, 0.00000000],
+		[-6.27251980, -0.00068876, 0.00042210, 0.00069228, -0.00000112, 0.00000000],
+		[-6.27252017, -0.00068860, 0.00042200, 0.00069213, -0.00000112, 0.00000000],
+		[-6.27252054, -0.00068845, 0.00042191, 0.00069197, -0.00000112, 0.00000000],
+		[-6.27252091, -0.00068830, 0.00042182, 0.00069182, -0.00000112, 0.00000000],
+		[-6.27252127, -0.00068815, 0.00042172, 0.00069166, -0.00000112, 0.00000000],
+		[-6.27252164, -0.00068799, 0.00042163, 0.00069151, -0.00000112, 0.00000000],
+		[-6.27252201, -0.00068784, 0.00042154, 0.00069136, -0.00000112, 0.00000000],
+		[-6.27252237, -0.00068769, 0.00042144, 0.00069120, -0.00000112, 0.00000000],
+		[-6.27252274, -0.00068753, 0.00042135, 0.00069105, -0.00000112, 0.00000000],
+		[-6.27252311, -0.00068738, 0.00042125, 0.00069090, -0.00000112, 0.00000000],
+		[-6.27252347, -0.00068723, 0.00042116, 0.00069074, -0.00000112, 0.00000000],
+		[-6.27252384, -0.00068708, 0.00042107, 0.00069059, -0.00000112, 0.00000000],
+		[-6.27252420, -0.00068692, 0.00042097, 0.00069044, -0.00000112, 0.00000000],
+		[-6.27252457, -0.00068677, 0.00042088, 0.00069028, -0.00000112, 0.00000000],
+		[-6.27252494, -0.00068662, 0.00042079, 0.00069013, -0.00000112, 0.00000000],
+		[-6.27252530, -0.00068647, 0.00042069, 0.00068998, -0.00000112, 0.00000000],
+		[-6.27252567, -0.00068631, 0.00042060, 0.00068982, -0.00000112, 0.00000000],
+		[-6.27252603, -0.00068616, 0.00042051, 0.00068967, -0.00000112, 0.00000000],
+		[-6.27252640, -0.00068601, 0.00042041, 0.00068952, -0.00000112, 0.00000000],
+		[-6.27252676, -0.00068586, 0.00042032, 0.00068937, -0.00000112, 0.00000000],
+		[-6.27252712, -0.00068571, 0.00042023, 0.00068921, -0.00000112, 0.00000000],
+		[-6.27252749, -0.00068555, 0.00042013, 0.00068906, -0.00000112, 0.00000000],
+		[-6.27252785, -0.00068540, 0.00042004, 0.00068891, -0.00000112, 0.00000000],
+		[-6.27252822, -0.00068525, 0.00041995, 0.00068875, -0.00000112, 0.00000000],
+		[-6.27252858, -0.00068510, 0.00041985, 0.00068860, -0.00000112, 0.00000000],
+		[-6.27252895, -0.00068495, 0.00041976, 0.00068845, -0.00000112, 0.00000000],
+		[-6.27252931, -0.00068480, 0.00041967, 0.00068830, -0.00000112, 0.00000000],
+		[-6.27252967, -0.00068464, 0.00041958, 0.00068815, -0.00000112, 0.00000000],
+		[-6.27253004, -0.00068449, 0.00041948, 0.00068799, -0.00000112, 0.00000000],
+		[-6.27253040, -0.00068434, 0.00041939, 0.00068784, -0.00000112, 0.00000000],
+		[-6.27253076, -0.00068419, 0.00041930, 0.00068769, -0.00000112, 0.00000000],
+		[-6.27253112, -0.00068404, 0.00041920, 0.00068754, -0.00000112, 0.00000000],
+		[-6.27253149, -0.00068389, 0.00041911, 0.00068738, -0.00000112, 0.00000000],
+		[-6.27253185, -0.00068374, 0.00041902, 0.00068723, -0.00000112, 0.00000000],
+		[-6.27253221, -0.00068359, 0.00041893, 0.00068708, -0.00000112, 0.00000000],
+		[-6.27253257, -0.00068344, 0.00041883, 0.00068693, -0.00000112, 0.00000000],
+		[-6.27253293, -0.00068328, 0.00041874, 0.00068678, -0.00000112, 0.00000000],
+		[-6.27253330, -0.00068313, 0.00041865, 0.00068663, -0.00000112, 0.00000000],
+		[-6.27253366, -0.00068298, 0.00041856, 0.00068647, -0.00000112, 0.00000000],
+		[-6.27253402, -0.00068283, 0.00041846, 0.00068632, -0.00000112, 0.00000000],
+		[-6.27253438, -0.00068268, 0.00041837, 0.00068617, -0.00000112, 0.00000000],
+		[-6.27253474, -0.00068253, 0.00041828, 0.00068602, -0.00000112, 0.00000000],
+		[-6.27253510, -0.00068238, 0.00041819, 0.00068587, -0.00000112, 0.00000000],
+		[-6.27253546, -0.00068223, 0.00041810, 0.00068572, -0.00000112, 0.00000000],
+		[-6.27253582, -0.00068208, 0.00041800, 0.00068557, -0.00000112, 0.00000000],
+		[-6.27253618, -0.00068193, 0.00041791, 0.00068542, -0.00000112, 0.00000000],
+		[-6.27253654, -0.00068178, 0.00041782, 0.00068526, -0.00000112, 0.00000000],
+		[-6.27253690, -0.00068163, 0.00041773, 0.00068511, -0.00000112, 0.00000000],
+		[-6.27253726, -0.00068148, 0.00041763, 0.00068496, -0.00000112, 0.00000000],
+		[-6.27253762, -0.00068133, 0.00041754, 0.00068481, -0.00000112, 0.00000000],
+		[-6.27253798, -0.00068118, 0.00041745, 0.00068466, -0.00000112, 0.00000000],
+		[-6.27253834, -0.00068103, 0.00041736, 0.00068451, -0.00000112, 0.00000000],
+		[-6.27253870, -0.00068088, 0.00041727, 0.00068436, -0.00000112, 0.00000000],
+		[-6.27253906, -0.00068073, 0.00041718, 0.00068421, -0.00000112, 0.00000000],
+		[-6.27253942, -0.00068058, 0.00041708, 0.00068406, -0.00000112, 0.00000000],
+		[-6.27253978, -0.00068043, 0.00041699, 0.00068391, -0.00000112, 0.00000000],
+		[-6.27254014, -0.00068028, 0.00041690, 0.00068376, -0.00000112, 0.00000000],
+		[-6.27254050, -0.00068013, 0.00041681, 0.00068361, -0.00000112, 0.00000000],
+		[-6.27254086, -0.00067998, 0.00041672, 0.00068346, -0.00000112, 0.00000000],
+		[-6.27254121, -0.00067983, 0.00041662, 0.00068331, -0.00000112, 0.00000000],
+		[-6.27254157, -0.00067968, 0.00041653, 0.00068316, -0.00000112, 0.00000000],
+		[-6.27254193, -0.00067953, 0.00041644, 0.00068301, -0.00000112, 0.00000000],
+		[-6.27254229, -0.00067939, 0.00041635, 0.00068286, -0.00000112, 0.00000000],
+		[-6.27254264, -0.00067924, 0.00041626, 0.00068271, -0.00000112, 0.00000000],
+		[-6.27254300, -0.00067909, 0.00041617, 0.00068256, -0.00000112, 0.00000000],
+		[-6.27254336, -0.00067894, 0.00041608, 0.00068241, -0.00000112, 0.00000000],
+		[-6.27254372, -0.00067879, 0.00041598, 0.00068226, -0.00000112, 0.00000000],
+		[-6.27254407, -0.00067864, 0.00041589, 0.00068211, -0.00000112, 0.00000000],
+		[-6.27254443, -0.00067849, 0.00041580, 0.00068196, -0.00000112, 0.00000000],
+		[-6.27254479, -0.00067834, 0.00041571, 0.00068181, -0.00000112, 0.00000000],
+		[-6.27254514, -0.00067819, 0.00041562, 0.00068166, -0.00000112, 0.00000000],
+		[-6.27254550, -0.00067805, 0.00041553, 0.00068151, -0.00000112, 0.00000000],
+		[-6.27254585, -0.00067790, 0.00041544, 0.00068136, -0.00000112, 0.00000000],
+		[-6.27254621, -0.00067775, 0.00041535, 0.00068121, -0.00000112, 0.00000000],
+		[-6.27254657, -0.00067760, 0.00041526, 0.00068106, -0.00000112, 0.00000000],
+		[-6.27254692, -0.00067745, 0.00041516, 0.00068092, -0.00000112, 0.00000000],
+		[-6.27254728, -0.00067730, 0.00041507, 0.00068077, -0.00000112, 0.00000000],
+		[-6.27254763, -0.00067716, 0.00041498, 0.00068062, -0.00000112, 0.00000000],
+		[-6.27254799, -0.00067701, 0.00041489, 0.00068047, -0.00000112, 0.00000000],
+		[-6.27254834, -0.00067686, 0.00041480, 0.00068032, -0.00000112, 0.00000000],
+		[-6.27254870, -0.00067671, 0.00041471, 0.00068017, -0.00000112, 0.00000000],
+		[-6.27254905, -0.00067656, 0.00041462, 0.00068002, -0.00000112, 0.00000000],
+		[-6.27254941, -0.00067642, 0.00041453, 0.00067987, -0.00000112, 0.00000000],
+		[-6.27254976, -0.00067627, 0.00041444, 0.00067972, -0.00000112, 0.00000000],
+		[-6.27255012, -0.00067612, 0.00041435, 0.00067958, -0.00000112, 0.00000000],
+		[-6.27255047, -0.00067597, 0.00041426, 0.00067943, -0.00000112, 0.00000000],
+		[-6.27255082, -0.00067583, 0.00041417, 0.00067928, -0.00000112, 0.00000000],
+		[-6.27255118, -0.00067568, 0.00041408, 0.00067913, -0.00000112, 0.00000000],
+		[-6.27255153, -0.00067553, 0.00041399, 0.00067898, -0.00000112, 0.00000000],
+		[-6.27255188, -0.00067538, 0.00041390, 0.00067883, -0.00000112, 0.00000000],
+		[-6.27255224, -0.00067524, 0.00041381, 0.00067869, -0.00000112, 0.00000000],
+		[-6.27255259, -0.00067509, 0.00041372, 0.00067854, -0.00000112, 0.00000000],
+		[-6.27255294, -0.00067494, 0.00041362, 0.00067839, -0.00000112, 0.00000000],
+		[-6.27255330, -0.00067479, 0.00041353, 0.00067824, -0.00000112, 0.00000000],
+		[-6.27255365, -0.00067465, 0.00041344, 0.00067810, -0.00000112, 0.00000000],
+		[-6.27255400, -0.00067450, 0.00041335, 0.00067795, -0.00000112, 0.00000000],
+		[-6.27255435, -0.00067435, 0.00041326, 0.00067780, -0.00000112, 0.00000000],
+		[-6.27255470, -0.00067421, 0.00041317, 0.00067765, -0.00000112, 0.00000000],
+		[-6.27255506, -0.00067406, 0.00041308, 0.00067750, -0.00000112, 0.00000000],
+		[-6.27255541, -0.00067391, 0.00041299, 0.00067736, -0.00000112, 0.00000000],
+		[-6.27255576, -0.00067377, 0.00041290, 0.00067721, -0.00000112, 0.00000000],
+		[-6.27255611, -0.00067362, 0.00041281, 0.00067706, -0.00000112, 0.00000000],
+		[-6.27255646, -0.00067347, 0.00041272, 0.00067691, -0.00000112, 0.00000000],
+		[-6.27255681, -0.00067333, 0.00041263, 0.00067677, -0.00000112, 0.00000000],
+		[-6.27255717, -0.00067318, 0.00041254, 0.00067662, -0.00000112, 0.00000000],
+		[-6.27255752, -0.00067303, 0.00041245, 0.00067647, -0.00000112, 0.00000000],
+		[-6.27255787, -0.00067289, 0.00041236, 0.00067633, -0.00000112, 0.00000000],
+		[-6.27255822, -0.00067274, 0.00041228, 0.00067618, -0.00000112, 0.00000000],
+		[-6.27255857, -0.00067260, 0.00041219, 0.00067603, -0.00000112, 0.00000000],
+		[-6.27255892, -0.00067245, 0.00041210, 0.00067589, -0.00000112, 0.00000000],
+		[-6.27255927, -0.00067230, 0.00041201, 0.00067574, -0.00000112, 0.00000000],
+		[-6.27255962, -0.00067216, 0.00041192, 0.00067559, -0.00000112, 0.00000000],
+		[-6.27255997, -0.00067201, 0.00041183, 0.00067544, -0.00000112, 0.00000000],
+		[-6.27256032, -0.00067187, 0.00041174, 0.00067530, -0.00000112, 0.00000000],
+		[-6.27256067, -0.00067172, 0.00041165, 0.00067515, -0.00000112, 0.00000000],
+		[-6.27256102, -0.00067157, 0.00041156, 0.00067501, -0.00000112, 0.00000000],
+		[-6.27256137, -0.00067143, 0.00041147, 0.00067486, -0.00000112, 0.00000000],
+		[-6.27256171, -0.00067128, 0.00041138, 0.00067471, -0.00000112, 0.00000000],
+		[-6.27256206, -0.00067114, 0.00041129, 0.00067457, -0.00000112, 0.00000000],
+		[-6.27256241, -0.00067099, 0.00041120, 0.00067442, -0.00000112, 0.00000000],
+		[-6.27256276, -0.00067085, 0.00041111, 0.00067427, -0.00000112, 0.00000000],
+		[-6.27256311, -0.00067070, 0.00041102, 0.00067413, -0.00000112, 0.00000000],
+		[-6.27256346, -0.00067056, 0.00041093, 0.00067398, -0.00000112, 0.00000000],
+		[-6.27256381, -0.00067041, 0.00041085, 0.00067384, -0.00000112, 0.00000000],
+		[-6.27256415, -0.00067027, 0.00041076, 0.00067369, -0.00000112, 0.00000000],
+		[-6.27256450, -0.00067012, 0.00041067, 0.00067354, -0.00000112, 0.00000000],
+		[-6.27256485, -0.00066998, 0.00041058, 0.00067340, -0.00000112, 0.00000000],
+		[-6.27256520, -0.00066983, 0.00041049, 0.00067325, -0.00000112, 0.00000000],
+		[-6.27256554, -0.00066969, 0.00041040, 0.00067311, -0.00000112, 0.00000000],
+		[-6.27256589, -0.00066954, 0.00041031, 0.00067296, -0.00000112, 0.00000000],
+		[-6.27256624, -0.00066940, 0.00041022, 0.00067282, -0.00000112, 0.00000000],
+		[-6.27256658, -0.00066925, 0.00041013, 0.00067267, -0.00000112, 0.00000000],
+		[-6.27256693, -0.00066911, 0.00041005, 0.00067252, -0.00000112, 0.00000000],
+		[-6.27256728, -0.00066896, 0.00040996, 0.00067238, -0.00000112, 0.00000000],
+		[-6.27256762, -0.00066882, 0.00040987, 0.00067223, -0.00000112, 0.00000000],
+		[-6.27256797, -0.00066867, 0.00040978, 0.00067209, -0.00000112, 0.00000000],
+		[-6.27256832, -0.00066853, 0.00040969, 0.00067194, -0.00000112, 0.00000000],
+		[-6.27256866, -0.00066838, 0.00040960, 0.00067180, -0.00000112, 0.00000000],
+		[-6.27256901, -0.00066824, 0.00040951, 0.00067165, -0.00000112, 0.00000000],
+		[-6.27256935, -0.00066810, 0.00040943, 0.00067151, -0.00000112, 0.00000000],
+		[-6.27256970, -0.00066795, 0.00040934, 0.00067136, -0.00000112, 0.00000000],
+		[-6.27257004, -0.00066781, 0.00040925, 0.00067122, -0.00000112, 0.00000000],
+		[-6.27257039, -0.00066766, 0.00040916, 0.00067107, -0.00000112, 0.00000000],
+		[-6.27257073, -0.00066752, 0.00040907, 0.00067093, -0.00000112, 0.00000000],
+		[-6.27257108, -0.00066738, 0.00040898, 0.00067078, -0.00000112, 0.00000000],
+		[-6.27257142, -0.00066723, 0.00040890, 0.00067064, -0.00000112, 0.00000000],
+		[-6.27257177, -0.00066709, 0.00040881, 0.00067050, -0.00000112, 0.00000000],
+		[-6.27257211, -0.00066694, 0.00040872, 0.00067035, -0.00000112, 0.00000000],
+		[-6.27257246, -0.00066680, 0.00040863, 0.00067021, -0.00000112, 0.00000000],
+		[-6.27257280, -0.00066666, 0.00040854, 0.00067006, -0.00000112, 0.00000000],
+		[-6.27257315, -0.00066651, 0.00040846, 0.00066992, -0.00000112, 0.00000000],
+		[-6.27257349, -0.00066637, 0.00040837, 0.00066977, -0.00000112, 0.00000000],
+		[-6.27257383, -0.00066623, 0.00040828, 0.00066963, -0.00000112, 0.00000000],
+		[-6.27257418, -0.00066608, 0.00040819, 0.00066949, -0.00000112, 0.00000000],
+		[-6.27257452, -0.00066594, 0.00040810, 0.00066934, -0.00000112, 0.00000000],
+		[-6.27257486, -0.00066580, 0.00040802, 0.00066920, -0.00000112, 0.00000000],
+		[-6.27257521, -0.00066565, 0.00040793, 0.00066905, -0.00000112, 0.00000000],
+		[-6.27257555, -0.00066551, 0.00040784, 0.00066891, -0.00000112, 0.00000000],
+		[-6.27257589, -0.00066537, 0.00040775, 0.00066877, -0.00000112, 0.00000000],
+		[-6.27257623, -0.00066522, 0.00040766, 0.00066862, -0.00000112, 0.00000000],
+		[-6.27257658, -0.00066508, 0.00040758, 0.00066848, -0.00000112, 0.00000000],
+		[-6.27257692, -0.00066494, 0.00040749, 0.00066833, -0.00000112, 0.00000000],
+		[-6.27257726, -0.00066480, 0.00040740, 0.00066819, -0.00000112, 0.00000000],
+		[-6.27257760, -0.00066465, 0.00040731, 0.00066805, -0.00000112, 0.00000000],
+		[-6.27257795, -0.00066451, 0.00040723, 0.00066790, -0.00000112, 0.00000000],
+		[-6.27257829, -0.00066437, 0.00040714, 0.00066776, -0.00000112, 0.00000000],
+		[-6.27257863, -0.00066422, 0.00040705, 0.00066762, -0.00000112, 0.00000000],
+		[-6.27257897, -0.00066408, 0.00040696, 0.00066747, -0.00000112, 0.00000000],
+		[-6.27257931, -0.00066394, 0.00040688, 0.00066733, -0.00000112, 0.00000000],
+		[-6.27257965, -0.00066380, 0.00040679, 0.00066719, -0.00000112, 0.00000000],
+		[-6.27257999, -0.00066366, 0.00040670, 0.00066704, -0.00000112, 0.00000000],
+		[-6.27258033, -0.00066351, 0.00040662, 0.00066690, -0.00000112, 0.00000000],
+		[-6.27258068, -0.00066337, 0.00040653, 0.00066676, -0.00000112, 0.00000000],
+		[-6.27258102, -0.00066323, 0.00040644, 0.00066662, -0.00000112, 0.00000000],
+		[-6.27258136, -0.00066309, 0.00040635, 0.00066647, -0.00000112, 0.00000000],
+		[-6.27258170, -0.00066294, 0.00040627, 0.00066633, -0.00000112, 0.00000000],
+		[-6.27258204, -0.00066280, 0.00040618, 0.00066619, -0.00000112, 0.00000000],
+		[-6.27258238, -0.00066266, 0.00040609, 0.00066604, -0.00000112, 0.00000000],
+		[-6.27258272, -0.00066252, 0.00040601, 0.00066590, -0.00000112, 0.00000000],
+		[-6.27258306, -0.00066238, 0.00040592, 0.00066576, -0.00000112, 0.00000000],
+		[-6.27258340, -0.00066224, 0.00040583, 0.00066562, -0.00000112, 0.00000000],
+		[-6.27258373, -0.00066209, 0.00040574, 0.00066547, -0.00000112, 0.00000000],
+		[-6.27258407, -0.00066195, 0.00040566, 0.00066533, -0.00000112, 0.00000000],
+		[-6.27258441, -0.00066181, 0.00040557, 0.00066519, -0.00000112, 0.00000000],
+		[-6.27258475, -0.00066167, 0.00040548, 0.00066505, -0.00000112, 0.00000000],
+		[-6.27258509, -0.00066153, 0.00040540, 0.00066491, -0.00000112, 0.00000000],
+		[-6.27258543, -0.00066139, 0.00040531, 0.00066476, -0.00000112, 0.00000000],
+		[-6.27258577, -0.00066125, 0.00040522, 0.00066462, -0.00000112, 0.00000000],
+		[-6.27258611, -0.00066110, 0.00040514, 0.00066448, -0.00000112, 0.00000000],
+		[-6.27258644, -0.00066096, 0.00040505, 0.00066434, -0.00000112, 0.00000000],
+		[-6.27258678, -0.00066082, 0.00040496, 0.00066420, -0.00000112, 0.00000000],
+		[-6.27258712, -0.00066068, 0.00040488, 0.00066405, -0.00000112, 0.00000000],
+		[-6.27258746, -0.00066054, 0.00040479, 0.00066391, -0.00000112, 0.00000000],
+		[-6.27258780, -0.00066040, 0.00040471, 0.00066377, -0.00000112, 0.00000000],
+		[-6.27258813, -0.00066026, 0.00040462, 0.00066363, -0.00000112, 0.00000000],
+		[-6.27258847, -0.00066012, 0.00040453, 0.00066349, -0.00000112, 0.00000000],
+		[-6.27258881, -0.00065998, 0.00040445, 0.00066335, -0.00000112, 0.00000000],
+		[-6.27258914, -0.00065984, 0.00040436, 0.00066320, -0.00000112, 0.00000000],
+		[-6.27258948, -0.00065970, 0.00040427, 0.00066306, -0.00000112, 0.00000000],
+		[-6.27258982, -0.00065955, 0.00040419, 0.00066292, -0.00000112, 0.00000000],
+		[-6.27259015, -0.00065941, 0.00040410, 0.00066278, -0.00000112, 0.00000000],
+		[-6.27259049, -0.00065927, 0.00040401, 0.00066264, -0.00000112, 0.00000000],
+		[-6.27259083, -0.00065913, 0.00040393, 0.00066250, -0.00000112, 0.00000000],
+		[-6.27259116, -0.00065899, 0.00040384, 0.00066236, -0.00000112, 0.00000000],
+		[-6.27259150, -0.00065885, 0.00040376, 0.00066222, -0.00000112, 0.00000000],
+		[-6.27259184, -0.00065871, 0.00040367, 0.00066208, -0.00000112, 0.00000000],
+		[-6.27259217, -0.00065857, 0.00040358, 0.00066193, -0.00000112, 0.00000000],
+		[-6.27259251, -0.00065843, 0.00040350, 0.00066179, -0.00000112, 0.00000000],
+		[-6.27259284, -0.00065829, 0.00040341, 0.00066165, -0.00000112, 0.00000000],
+		[-6.27259318, -0.00065815, 0.00040333, 0.00066151, -0.00000112, 0.00000000],
+		[-6.27259351, -0.00065801, 0.00040324, 0.00066137, -0.00000112, 0.00000000],
+		[-6.27259385, -0.00065787, 0.00040316, 0.00066123, -0.00000112, 0.00000000],
+		[-6.27259418, -0.00065773, 0.00040307, 0.00066109, -0.00000112, 0.00000000],
+		[-6.27259452, -0.00065759, 0.00040298, 0.00066095, -0.00000112, 0.00000000],
+		[-6.27259485, -0.00065745, 0.00040290, 0.00066081, -0.00000112, 0.00000000],
+		[-6.27259519, -0.00065731, 0.00040281, 0.00066067, -0.00000112, 0.00000000],
+		[-6.27259552, -0.00065717, 0.00040273, 0.00066053, -0.00000112, 0.00000000],
+		[-6.27259585, -0.00065703, 0.00040264, 0.00066039, -0.00000112, 0.00000000],
+		[-6.27259619, -0.00065690, 0.00040256, 0.00066025, -0.00000112, 0.00000000],
+		[-6.27259652, -0.00065676, 0.00040247, 0.00066011, -0.00000112, 0.00000000],
+		[-6.27259686, -0.00065662, 0.00040239, 0.00065997, -0.00000112, 0.00000000],
+		[-6.27259719, -0.00065648, 0.00040230, 0.00065983, -0.00000112, 0.00000000],
+		[-6.27259752, -0.00065634, 0.00040221, 0.00065969, -0.00000112, 0.00000000],
+		[-6.27259786, -0.00065620, 0.00040213, 0.00065955, -0.00000112, 0.00000000],
+		[-6.27259819, -0.00065606, 0.00040204, 0.00065941, -0.00000112, 0.00000000],
+		[-6.27259852, -0.00065592, 0.00040196, 0.00065927, -0.00000112, 0.00000000],
+		[-6.27259885, -0.00065578, 0.00040187, 0.00065913, -0.00000112, 0.00000000],
+		[-6.27259919, -0.00065564, 0.00040179, 0.00065899, -0.00000112, 0.00000000],
+		[-6.27259952, -0.00065550, 0.00040170, 0.00065885, -0.00000112, 0.00000000],
+		[-6.27259985, -0.00065537, 0.00040162, 0.00065871, -0.00000112, 0.00000000],
+		[-6.27260018, -0.00065523, 0.00040153, 0.00065857, -0.00000112, 0.00000000],
+		[-6.27260052, -0.00065509, 0.00040145, 0.00065843, -0.00000112, 0.00000000],
+		[-6.27260085, -0.00065495, 0.00040136, 0.00065829, -0.00000112, 0.00000000],
+		[-6.27260118, -0.00065481, 0.00040128, 0.00065815, -0.00000112, 0.00000000],
+		[-6.27260151, -0.00065467, 0.00040119, 0.00065801, -0.00000112, 0.00000000],
+		[-6.27260184, -0.00065453, 0.00040111, 0.00065788, -0.00000112, 0.00000000],
+		[-6.27260217, -0.00065440, 0.00040102, 0.00065774, -0.00000112, 0.00000000],
+		[-6.27260251, -0.00065426, 0.00040094, 0.00065760, -0.00000112, 0.00000000],
+		[-6.27260284, -0.00065412, 0.00040085, 0.00065746, -0.00000112, 0.00000000],
+		[-6.27260317, -0.00065398, 0.00040077, 0.00065732, -0.00000112, 0.00000000],
+		[-6.27260350, -0.00065384, 0.00040068, 0.00065718, -0.00000112, 0.00000000],
+		[-6.27260383, -0.00065370, 0.00040060, 0.00065704, -0.00000112, 0.00000000],
+		[-6.27260416, -0.00065357, 0.00040051, 0.00065690, -0.00000112, 0.00000000],
+		[-6.27260449, -0.00065343, 0.00040043, 0.00065676, -0.00000112, 0.00000000],
+		[-6.27260482, -0.00065329, 0.00040035, 0.00065663, -0.00000112, 0.00000000],
+		[-6.27260515, -0.00065315, 0.00040026, 0.00065649, -0.00000112, 0.00000000],
+		[-6.27260548, -0.00065302, 0.00040018, 0.00065635, -0.00000112, 0.00000000],
+		[-6.27260581, -0.00065288, 0.00040009, 0.00065621, -0.00000112, 0.00000000],
+		[-6.27260614, -0.00065274, 0.00040001, 0.00065607, -0.00000112, 0.00000000],
+		[-6.27260647, -0.00065260, 0.00039992, 0.00065593, -0.00000112, 0.00000000],
+		[-6.27260680, -0.00065246, 0.00039984, 0.00065580, -0.00000112, 0.00000000],
+		[-6.27260713, -0.00065233, 0.00039975, 0.00065566, -0.00000112, 0.00000000],
+		[-6.27260746, -0.00065219, 0.00039967, 0.00065552, -0.00000112, 0.00000000],
+		[-6.27260779, -0.00065205, 0.00039959, 0.00065538, -0.00000112, 0.00000000],
+		[-6.27260812, -0.00065192, 0.00039950, 0.00065524, -0.00000112, 0.00000000],
+		[-6.27260844, -0.00065178, 0.00039942, 0.00065510, -0.00000112, 0.00000000],
+		[-6.27260877, -0.00065164, 0.00039933, 0.00065497, -0.00000112, 0.00000000],
+		[-6.27260910, -0.00065150, 0.00039925, 0.00065483, -0.00000112, 0.00000000],
+		[-6.27260943, -0.00065137, 0.00039917, 0.00065469, -0.00000112, 0.00000000],
+		[-6.27260976, -0.00065123, 0.00039908, 0.00065455, -0.00000112, 0.00000000],
+		[-6.27261009, -0.00065109, 0.00039900, 0.00065442, -0.00000112, 0.00000000],
+		[-6.27261041, -0.00065096, 0.00039891, 0.00065428, -0.00000112, 0.00000000],
+		[-6.27261074, -0.00065082, 0.00039883, 0.00065414, -0.00000112, 0.00000000],
+		[-6.27261107, -0.00065068, 0.00039875, 0.00065400, -0.00000112, 0.00000000],
+		[-6.27261140, -0.00065055, 0.00039866, 0.00065387, -0.00000112, 0.00000000],
+		[-6.27261172, -0.00065041, 0.00039858, 0.00065373, -0.00000112, 0.00000000],
+		[-6.27261205, -0.00065027, 0.00039849, 0.00065359, -0.00000112, 0.00000000],
+		[-6.27261238, -0.00065014, 0.00039841, 0.00065345, -0.00000112, 0.00000000],
+		[-6.27261271, -0.00065000, 0.00039833, 0.00065332, -0.00000112, 0.00000000],
+		[-6.27261303, -0.00064986, 0.00039824, 0.00065318, -0.00000112, 0.00000000],
+		[-6.27261336, -0.00064973, 0.00039816, 0.00065304, -0.00000112, 0.00000000],
+		[-6.27261369, -0.00064959, 0.00039808, 0.00065290, -0.00000112, 0.00000000],
+		[-6.27261401, -0.00064945, 0.00039799, 0.00065277, -0.00000112, 0.00000000],
+		[-6.27261434, -0.00064932, 0.00039791, 0.00065263, -0.00000112, 0.00000000],
+		[-6.27261466, -0.00064918, 0.00039782, 0.00065249, -0.00000112, 0.00000000],
+		[-6.27261499, -0.00064904, 0.00039774, 0.00065236, -0.00000112, 0.00000000],
+		[-6.27261532, -0.00064891, 0.00039766, 0.00065222, -0.00000112, 0.00000000],
+		[-6.27261564, -0.00064877, 0.00039757, 0.00065208, -0.00000112, 0.00000000],
+		[-6.27261597, -0.00064864, 0.00039749, 0.00065195, -0.00000112, 0.00000000],
+		[-6.27261629, -0.00064850, 0.00039741, 0.00065181, -0.00000112, 0.00000000],
+		[-6.27261662, -0.00064836, 0.00039732, 0.00065167, -0.00000112, 0.00000000],
+		[-6.27261694, -0.00064823, 0.00039724, 0.00065154, -0.00000112, 0.00000000],
+		[-6.27261727, -0.00064809, 0.00039716, 0.00065140, -0.00000112, 0.00000000],
+		[-6.27261759, -0.00064796, 0.00039707, 0.00065126, -0.00000112, 0.00000000],
+		[-6.27261792, -0.00064782, 0.00039699, 0.00065113, -0.00000112, 0.00000000],
+		[-6.27261824, -0.00064769, 0.00039691, 0.00065099, -0.00000112, 0.00000000],
+		[-6.27261857, -0.00064755, 0.00039683, 0.00065086, -0.00000112, 0.00000000],
+		[-6.27261889, -0.00064742, 0.00039674, 0.00065072, -0.00000112, 0.00000000],
+		[-6.27261921, -0.00064728, 0.00039666, 0.00065058, -0.00000112, 0.00000000],
+		[-6.27261954, -0.00064715, 0.00039658, 0.00065045, -0.00000112, 0.00000000],
+		[-6.27261986, -0.00064701, 0.00039649, 0.00065031, -0.00000112, 0.00000000],
+		[-6.27262019, -0.00064687, 0.00039641, 0.00065018, -0.00000112, 0.00000000],
+		[-6.27262051, -0.00064674, 0.00039633, 0.00065004, -0.00000112, 0.00000000],
+		[-6.27262083, -0.00064660, 0.00039624, 0.00064990, -0.00000112, 0.00000000],
+		[-6.27262116, -0.00064647, 0.00039616, 0.00064977, -0.00000112, 0.00000000],
+		[-6.27262148, -0.00064633, 0.00039608, 0.00064963, -0.00000112, 0.00000000],
+		[-6.27262180, -0.00064620, 0.00039600, 0.00064950, -0.00000112, 0.00000000],
+		[-6.27262213, -0.00064606, 0.00039591, 0.00064936, -0.00000112, 0.00000000],
+		[-6.27262245, -0.00064593, 0.00039583, 0.00064923, -0.00000112, 0.00000000],
+		[-6.27262277, -0.00064579, 0.00039575, 0.00064909, -0.00000112, 0.00000000],
+		[-6.27262309, -0.00064566, 0.00039567, 0.00064895, -0.00000112, 0.00000000],
+		[-6.27262342, -0.00064553, 0.00039558, 0.00064882, -0.00000112, 0.00000000],
+		[-6.27262374, -0.00064539, 0.00039550, 0.00064868, -0.00000112, 0.00000000],
+		[-6.27262406, -0.00064526, 0.00039542, 0.00064855, -0.00000112, 0.00000000],
+		[-6.27262438, -0.00064512, 0.00039534, 0.00064841, -0.00000112, 0.00000000],
+		[-6.27262470, -0.00064499, 0.00039525, 0.00064828, -0.00000112, 0.00000000],
+		[-6.27262503, -0.00064485, 0.00039517, 0.00064814, -0.00000112, 0.00000000],
+		[-6.27262535, -0.00064472, 0.00039509, 0.00064801, -0.00000112, 0.00000000],
+		[-6.27262567, -0.00064458, 0.00039501, 0.00064787, -0.00000112, 0.00000000],
+		[-6.27262599, -0.00064445, 0.00039492, 0.00064774, -0.00000112, 0.00000000],
+		[-6.27262631, -0.00064432, 0.00039484, 0.00064760, -0.00000112, 0.00000000],
+		[-6.27262663, -0.00064418, 0.00039476, 0.00064747, -0.00000112, 0.00000000],
+		[-6.27262695, -0.00064405, 0.00039468, 0.00064733, -0.00000112, 0.00000000],
+		[-6.27262727, -0.00064391, 0.00039460, 0.00064720, -0.00000112, 0.00000000],
+		[-6.27262759, -0.00064378, 0.00039451, 0.00064706, -0.00000112, 0.00000000],
+		[-6.27262792, -0.00064365, 0.00039443, 0.00064693, -0.00000112, 0.00000000],
+		[-6.27262824, -0.00064351, 0.00039435, 0.00064680, -0.00000112, 0.00000000],
+		[-6.27262856, -0.00064338, 0.00039427, 0.00064666, -0.00000112, 0.00000000],
+		[-6.27262888, -0.00064325, 0.00039418, 0.00064653, -0.00000112, 0.00000000],
+		[-6.27262920, -0.00064311, 0.00039410, 0.00064639, -0.00000112, 0.00000000],
+		[-6.27262952, -0.00064298, 0.00039402, 0.00064626, -0.00000112, 0.00000000],
+		[-6.27262984, -0.00064284, 0.00039394, 0.00064612, -0.00000112, 0.00000000],
+		[-6.27263015, -0.00064271, 0.00039386, 0.00064599, -0.00000112, 0.00000000],
+		[-6.27263047, -0.00064258, 0.00039378, 0.00064586, -0.00000112, 0.00000000],
+		[-6.27263079, -0.00064244, 0.00039369, 0.00064572, -0.00000112, 0.00000000],
+		[-6.27263111, -0.00064231, 0.00039361, 0.00064559, -0.00000112, 0.00000000],
+		[-6.27263143, -0.00064218, 0.00039353, 0.00064545, -0.00000112, 0.00000000],
+		[-6.27263175, -0.00064204, 0.00039345, 0.00064532, -0.00000112, 0.00000000],
+		[-6.27263207, -0.00064191, 0.00039337, 0.00064519, -0.00000112, 0.00000000],
+		[-6.27263239, -0.00064178, 0.00039329, 0.00064505, -0.00000112, 0.00000000],
+		[-6.27263271, -0.00064165, 0.00039320, 0.00064492, -0.00000112, 0.00000000],
+		[-6.27263302, -0.00064151, 0.00039312, 0.00064478, -0.00000112, 0.00000000],
+		[-6.27263334, -0.00064138, 0.00039304, 0.00064465, -0.00000112, 0.00000000],
+		[-6.27263366, -0.00064125, 0.00039296, 0.00064452, -0.00000112, 0.00000000],
+		[-6.27263398, -0.00064111, 0.00039288, 0.00064438, -0.00000112, 0.00000000],
+		[-6.27263430, -0.00064098, 0.00039280, 0.00064425, -0.00000112, 0.00000000],
+		[-6.27263461, -0.00064085, 0.00039271, 0.00064412, -0.00000112, 0.00000000],
+		[-6.27263493, -0.00064072, 0.00039263, 0.00064398, -0.00000112, 0.00000000],
+		[-6.27263525, -0.00064058, 0.00039255, 0.00064385, -0.00000112, 0.00000000],
+		[-6.27263557, -0.00064045, 0.00039247, 0.00064372, -0.00000112, 0.00000000],
+		[-6.27263588, -0.00064032, 0.00039239, 0.00064358, -0.00000112, 0.00000000],
+		[-6.27263620, -0.00064019, 0.00039231, 0.00064345, -0.00000112, 0.00000000],
+		[-6.27263652, -0.00064005, 0.00039223, 0.00064332, -0.00000112, 0.00000000],
+		[-6.27263683, -0.00063992, 0.00039215, 0.00064319, -0.00000112, 0.00000000],
+		[-6.27263715, -0.00063979, 0.00039206, 0.00064305, -0.00000112, 0.00000000],
+		[-6.27263747, -0.00063966, 0.00039198, 0.00064292, -0.00000112, 0.00000000],
+		[-6.27263778, -0.00063952, 0.00039190, 0.00064279, -0.00000112, 0.00000000],
+		[-6.27263810, -0.00063939, 0.00039182, 0.00064265, -0.00000112, 0.00000000],
+		[-6.27263842, -0.00063926, 0.00039174, 0.00064252, -0.00000112, 0.00000000],
+		[-6.27263873, -0.00063913, 0.00039166, 0.00064239, -0.00000112, 0.00000000],
+		[-6.27263905, -0.00063900, 0.00039158, 0.00064226, -0.00000112, 0.00000000],
+		[-6.27263936, -0.00063886, 0.00039150, 0.00064212, -0.00000112, 0.00000000],
+		[-6.27263968, -0.00063873, 0.00039142, 0.00064199, -0.00000112, 0.00000000],
+		[-6.27263999, -0.00063860, 0.00039134, 0.00064186, -0.00000112, 0.00000000],
+		[-6.27264031, -0.00063847, 0.00039126, 0.00064173, -0.00000112, 0.00000000],
+		[-6.27264063, -0.00063834, 0.00039117, 0.00064159, -0.00000112, 0.00000000],
+		[-6.27264094, -0.00063821, 0.00039109, 0.00064146, -0.00000112, 0.00000000],
+		[-6.27264126, -0.00063807, 0.00039101, 0.00064133, -0.00000112, 0.00000000],
+		[-6.27264157, -0.00063794, 0.00039093, 0.00064120, -0.00000112, 0.00000000],
+		[-6.27264188, -0.00063781, 0.00039085, 0.00064106, -0.00000112, 0.00000000],
+		[-6.27264220, -0.00063768, 0.00039077, 0.00064093, -0.00000112, 0.00000000],
+		[-6.27264251, -0.00063755, 0.00039069, 0.00064080, -0.00000113, 0.00000000],
+		[-6.27264283, -0.00063742, 0.00039061, 0.00064067, -0.00000113, 0.00000000],
+		[-6.27264314, -0.00063729, 0.00039053, 0.00064054, -0.00000113, 0.00000000],
+		[-6.27264346, -0.00063716, 0.00039045, 0.00064040, -0.00000113, 0.00000000],
+		[-6.27264377, -0.00063702, 0.00039037, 0.00064027, -0.00000113, 0.00000000],
+		[-6.27264408, -0.00063689, 0.00039029, 0.00064014, -0.00000113, 0.00000000],
+		[-6.27264440, -0.00063676, 0.00039021, 0.00064001, -0.00000113, 0.00000000],
+		[-6.27264471, -0.00063663, 0.00039013, 0.00063988, -0.00000113, 0.00000000],
+		[-6.27264502, -0.00063650, 0.00039005, 0.00063975, -0.00000113, 0.00000000],
+		[-6.27264534, -0.00063637, 0.00038997, 0.00063961, -0.00000113, 0.00000000],
+		[-6.27264565, -0.00063624, 0.00038989, 0.00063948, -0.00000113, 0.00000000],
+		[-6.27264596, -0.00063611, 0.00038981, 0.00063935, -0.00000113, 0.00000000],
+		[-6.27264628, -0.00063598, 0.00038973, 0.00063922, -0.00000113, 0.00000000],
+		[-6.27264659, -0.00063585, 0.00038965, 0.00063909, -0.00000113, 0.00000000],
+		[-6.27264690, -0.00063572, 0.00038957, 0.00063896, -0.00000113, 0.00000000],
+		[-6.27264721, -0.00063559, 0.00038949, 0.00063883, -0.00000113, 0.00000000],
+		[-6.27264753, -0.00063545, 0.00038941, 0.00063870, -0.00000113, 0.00000000],
+		[-6.27264784, -0.00063532, 0.00038933, 0.00063856, -0.00000113, 0.00000000],
+		[-6.27264815, -0.00063519, 0.00038925, 0.00063843, -0.00000113, 0.00000000],
+		[-6.27264846, -0.00063506, 0.00038917, 0.00063830, -0.00000113, 0.00000000],
+		[-6.27264877, -0.00063493, 0.00038909, 0.00063817, -0.00000113, 0.00000000],
+		[-6.27264909, -0.00063480, 0.00038901, 0.00063804, -0.00000113, 0.00000000],
+		[-6.27264940, -0.00063467, 0.00038893, 0.00063791, -0.00000113, 0.00000000],
+		[-6.27264971, -0.00063454, 0.00038885, 0.00063778, -0.00000113, 0.00000000],
+		[-6.27265002, -0.00063441, 0.00038877, 0.00063765, -0.00000113, 0.00000000],
+		[-6.27265033, -0.00063428, 0.00038869, 0.00063752, -0.00000113, 0.00000000],
+		[-6.27265064, -0.00063415, 0.00038861, 0.00063739, -0.00000113, 0.00000000],
+		[-6.27265095, -0.00063402, 0.00038853, 0.00063726, -0.00000113, 0.00000000],
+		[-6.27265126, -0.00063389, 0.00038845, 0.00063713, -0.00000113, 0.00000000],
+		[-6.27265157, -0.00063376, 0.00038837, 0.00063700, -0.00000113, 0.00000000],
+		[-6.27265189, -0.00063363, 0.00038829, 0.00063686, -0.00000113, 0.00000000],
+		[-6.27265220, -0.00063350, 0.00038821, 0.00063673, -0.00000113, 0.00000000],
+		[-6.27265251, -0.00063337, 0.00038813, 0.00063660, -0.00000113, 0.00000000],
+		[-6.27265282, -0.00063324, 0.00038805, 0.00063647, -0.00000113, 0.00000000],
+		[-6.27265313, -0.00063312, 0.00038797, 0.00063634, -0.00000113, 0.00000000],
+		[-6.27265344, -0.00063299, 0.00038789, 0.00063621, -0.00000113, 0.00000000],
+		[-6.27265375, -0.00063286, 0.00038781, 0.00063608, -0.00000113, 0.00000000],
+		[-6.27265406, -0.00063273, 0.00038773, 0.00063595, -0.00000113, 0.00000000],
+		[-6.27265436, -0.00063260, 0.00038765, 0.00063582, -0.00000113, 0.00000000],
+		[-6.27265467, -0.00063247, 0.00038758, 0.00063569, -0.00000113, 0.00000000],
+		[-6.27265498, -0.00063234, 0.00038750, 0.00063556, -0.00000113, 0.00000000],
+		[-6.27265529, -0.00063221, 0.00038742, 0.00063543, -0.00000113, 0.00000000],
+		[-6.27265560, -0.00063208, 0.00038734, 0.00063530, -0.00000113, 0.00000000],
+		[-6.27265591, -0.00063195, 0.00038726, 0.00063517, -0.00000113, 0.00000000],
+		[-6.27265622, -0.00063182, 0.00038718, 0.00063504, -0.00000113, 0.00000000],
+		[-6.27265653, -0.00063169, 0.00038710, 0.00063492, -0.00000113, 0.00000000],
+		[-6.27265684, -0.00063157, 0.00038702, 0.00063479, -0.00000113, 0.00000000],
+		[-6.27265714, -0.00063144, 0.00038694, 0.00063466, -0.00000113, 0.00000000],
+		[-6.27265745, -0.00063131, 0.00038686, 0.00063453, -0.00000113, 0.00000000],
+		[-6.27265776, -0.00063118, 0.00038678, 0.00063440, -0.00000113, 0.00000000],
+		[-6.27265807, -0.00063105, 0.00038671, 0.00063427, -0.00000113, 0.00000000],
+		[-6.27265838, -0.00063092, 0.00038663, 0.00063414, -0.00000113, 0.00000000],
+		[-6.27265868, -0.00063079, 0.00038655, 0.00063401, -0.00000113, 0.00000000],
+		[-6.27265899, -0.00063066, 0.00038647, 0.00063388, -0.00000113, 0.00000000],
+		[-6.27265930, -0.00063054, 0.00038639, 0.00063375, -0.00000113, 0.00000000],
+		[-6.27265961, -0.00063041, 0.00038631, 0.00063362, -0.00000113, 0.00000000],
+		[-6.27265991, -0.00063028, 0.00038623, 0.00063349, -0.00000113, 0.00000000],
+		[-6.27266022, -0.00063015, 0.00038615, 0.00063336, -0.00000113, 0.00000000],
+		[-6.27266053, -0.00063002, 0.00038608, 0.00063323, -0.00000113, 0.00000000],
+		[-6.27266083, -0.00062989, 0.00038600, 0.00063311, -0.00000113, 0.00000000],
+		[-6.27266114, -0.00062977, 0.00038592, 0.00063298, -0.00000113, 0.00000000],
+		[-6.27266145, -0.00062964, 0.00038584, 0.00063285, -0.00000113, 0.00000000],
+		[-6.27266175, -0.00062951, 0.00038576, 0.00063272, -0.00000113, 0.00000000],
+		[-6.27266206, -0.00062938, 0.00038568, 0.00063259, -0.00000113, 0.00000000],
+		[-6.27266237, -0.00062925, 0.00038560, 0.00063246, -0.00000113, 0.00000000],
+		[-6.27266267, -0.00062913, 0.00038553, 0.00063233, -0.00000113, 0.00000000],
+		[-6.27266298, -0.00062900, 0.00038545, 0.00063221, -0.00000113, 0.00000000],
+		[-6.27266329, -0.00062887, 0.00038537, 0.00063208, -0.00000113, 0.00000000],
+		[-6.27266359, -0.00062874, 0.00038529, 0.00063195, -0.00000113, 0.00000000],
+		[-6.27266390, -0.00062862, 0.00038521, 0.00063182, -0.00000113, 0.00000000],
+		[-6.27266420, -0.00062849, 0.00038513, 0.00063169, -0.00000113, 0.00000000],
+		[-6.27266451, -0.00062836, 0.00038506, 0.00063156, -0.00000113, 0.00000000],
+		[-6.27266481, -0.00062823, 0.00038498, 0.00063144, -0.00000113, 0.00000000],
+		[-6.27266512, -0.00062811, 0.00038490, 0.00063131, -0.00000113, 0.00000000],
+		[-6.27266542, -0.00062798, 0.00038482, 0.00063118, -0.00000113, 0.00000000],
+		[-6.27266573, -0.00062785, 0.00038474, 0.00063105, -0.00000113, 0.00000000],
+		[-6.27266603, -0.00062772, 0.00038467, 0.00063092, -0.00000113, 0.00000000],
+		[-6.27266634, -0.00062760, 0.00038459, 0.00063080, -0.00000113, 0.00000000],
+		[-6.27266664, -0.00062747, 0.00038451, 0.00063067, -0.00000113, 0.00000000],
+		[-6.27266695, -0.00062734, 0.00038443, 0.00063054, -0.00000113, 0.00000000],
+		[-6.27266725, -0.00062721, 0.00038435, 0.00063041, -0.00000113, 0.00000000],
+		[-6.27266755, -0.00062709, 0.00038428, 0.00063028, -0.00000113, 0.00000000],
+		[-6.27266786, -0.00062696, 0.00038420, 0.00063016, -0.00000113, 0.00000000],
+		[-6.27266816, -0.00062683, 0.00038412, 0.00063003, -0.00000113, 0.00000000],
+		[-6.27266847, -0.00062671, 0.00038404, 0.00062990, -0.00000113, 0.00000000],
+		[-6.27266877, -0.00062658, 0.00038396, 0.00062977, -0.00000113, 0.00000000],
+		[-6.27266907, -0.00062645, 0.00038389, 0.00062965, -0.00000113, 0.00000000],
+		[-6.27266938, -0.00062633, 0.00038381, 0.00062952, -0.00000113, 0.00000000],
+		[-6.27266968, -0.00062620, 0.00038373, 0.00062939, -0.00000113, 0.00000000],
+		[-6.27266998, -0.00062607, 0.00038365, 0.00062926, -0.00000113, 0.00000000],
+		[-6.27267028, -0.00062595, 0.00038358, 0.00062914, -0.00000113, 0.00000000],
+		[-6.27267059, -0.00062582, 0.00038350, 0.00062901, -0.00000113, 0.00000000],
+		[-6.27267089, -0.00062569, 0.00038342, 0.00062888, -0.00000113, 0.00000000],
+		[-6.27267119, -0.00062557, 0.00038334, 0.00062876, -0.00000113, 0.00000000],
+		[-6.27267150, -0.00062544, 0.00038327, 0.00062863, -0.00000113, 0.00000000],
+		[-6.27267180, -0.00062531, 0.00038319, 0.00062850, -0.00000113, 0.00000000],
+		[-6.27267210, -0.00062519, 0.00038311, 0.00062837, -0.00000113, 0.00000000],
+		[-6.27267240, -0.00062506, 0.00038303, 0.00062825, -0.00000113, 0.00000000],
+		[-6.27267270, -0.00062494, 0.00038296, 0.00062812, -0.00000113, 0.00000000],
+		[-6.27267301, -0.00062481, 0.00038288, 0.00062799, -0.00000113, 0.00000000],
+		[-6.27267331, -0.00062468, 0.00038280, 0.00062787, -0.00000113, 0.00000000],
+		[-6.27267361, -0.00062456, 0.00038272, 0.00062774, -0.00000113, 0.00000000],
+		[-6.27267391, -0.00062443, 0.00038265, 0.00062761, -0.00000113, 0.00000000],
+		[-6.27267421, -0.00062431, 0.00038257, 0.00062749, -0.00000113, 0.00000000],
+		[-6.27267451, -0.00062418, 0.00038249, 0.00062736, -0.00000113, 0.00000000],
+		[-6.27267481, -0.00062405, 0.00038241, 0.00062723, -0.00000113, 0.00000000],
+		[-6.27267512, -0.00062393, 0.00038234, 0.00062711, -0.00000113, 0.00000000],
+		[-6.27267542, -0.00062380, 0.00038226, 0.00062698, -0.00000113, 0.00000000],
+		[-6.27267572, -0.00062368, 0.00038218, 0.00062685, -0.00000113, 0.00000000],
+		[-6.27267602, -0.00062355, 0.00038211, 0.00062673, -0.00000113, 0.00000000],
+		[-6.27267632, -0.00062342, 0.00038203, 0.00062660, -0.00000113, 0.00000000],
+		[-6.27267662, -0.00062330, 0.00038195, 0.00062648, -0.00000113, 0.00000000],
+		[-6.27267692, -0.00062317, 0.00038188, 0.00062635, -0.00000113, 0.00000000],
+		[-6.27267722, -0.00062305, 0.00038180, 0.00062622, -0.00000113, 0.00000000],
+		[-6.27267752, -0.00062292, 0.00038172, 0.00062610, -0.00000113, 0.00000000],
+		[-6.27267782, -0.00062280, 0.00038164, 0.00062597, -0.00000113, 0.00000000],
+		[-6.27267812, -0.00062267, 0.00038157, 0.00062585, -0.00000113, 0.00000000],
+		[-6.27267842, -0.00062255, 0.00038149, 0.00062572, -0.00000113, 0.00000000],
+		[-6.27267872, -0.00062242, 0.00038141, 0.00062559, -0.00000113, 0.00000000],
+		[-6.27267902, -0.00062230, 0.00038134, 0.00062547, -0.00000113, 0.00000000],
+		[-6.27267932, -0.00062217, 0.00038126, 0.00062534, -0.00000113, 0.00000000],
+		[-6.27267962, -0.00062205, 0.00038118, 0.00062522, -0.00000113, 0.00000000],
+		[-6.27267992, -0.00062192, 0.00038111, 0.00062509, -0.00000113, 0.00000000],
+		[-6.27268021, -0.00062180, 0.00038103, 0.00062497, -0.00000113, 0.00000000],
+		[-6.27268051, -0.00062167, 0.00038095, 0.00062484, -0.00000113, 0.00000000],
+		[-6.27268081, -0.00062155, 0.00038088, 0.00062471, -0.00000113, 0.00000000],
+		[-6.27268111, -0.00062142, 0.00038080, 0.00062459, -0.00000113, 0.00000000],
+		[-6.27268141, -0.00062130, 0.00038072, 0.00062446, -0.00000113, 0.00000000],
+		[-6.27268171, -0.00062117, 0.00038065, 0.00062434, -0.00000113, 0.00000000],
+		[-6.27268201, -0.00062105, 0.00038057, 0.00062421, -0.00000113, 0.00000000],
+		[-6.27268230, -0.00062092, 0.00038050, 0.00062409, -0.00000113, 0.00000000],
+		[-6.27268260, -0.00062080, 0.00038042, 0.00062396, -0.00000113, 0.00000000],
+		[-6.27268290, -0.00062067, 0.00038034, 0.00062384, -0.00000113, 0.00000000],
+		[-6.27268320, -0.00062055, 0.00038027, 0.00062371, -0.00000113, 0.00000000],
+		[-6.27268350, -0.00062043, 0.00038019, 0.00062359, -0.00000113, 0.00000000],
+		[-6.27268379, -0.00062030, 0.00038011, 0.00062346, -0.00000113, 0.00000000],
+		[-6.27268409, -0.00062018, 0.00038004, 0.00062334, -0.00000113, 0.00000000],
+		[-6.27268439, -0.00062005, 0.00037996, 0.00062321, -0.00000113, 0.00000000],
+		[-6.27268468, -0.00061993, 0.00037989, 0.00062309, -0.00000113, 0.00000000],
+		[-6.27268498, -0.00061980, 0.00037981, 0.00062296, -0.00000113, 0.00000000],
+		[-6.27268528, -0.00061968, 0.00037973, 0.00062284, -0.00000113, 0.00000000],
+		[-6.27268558, -0.00061956, 0.00037966, 0.00062271, -0.00000113, 0.00000000],
+		[-6.27268587, -0.00061943, 0.00037958, 0.00062259, -0.00000113, 0.00000000],
+		[-6.27268617, -0.00061931, 0.00037951, 0.00062246, -0.00000113, 0.00000000],
+		[-6.27268647, -0.00061919, 0.00037943, 0.00062234, -0.00000113, 0.00000000],
+		[-6.27268676, -0.00061906, 0.00037935, 0.00062222, -0.00000113, 0.00000000],
+		[-6.27268706, -0.00061894, 0.00037928, 0.00062209, -0.00000113, 0.00000000],
+		[-6.27268735, -0.00061881, 0.00037920, 0.00062197, -0.00000113, 0.00000000],
+		[-6.27268765, -0.00061869, 0.00037913, 0.00062184, -0.00000113, 0.00000000],
+		[-6.27268795, -0.00061857, 0.00037905, 0.00062172, -0.00000113, 0.00000000],
+		[-6.27268824, -0.00061844, 0.00037897, 0.00062159, -0.00000113, 0.00000000],
+		[-6.27268854, -0.00061832, 0.00037890, 0.00062147, -0.00000113, 0.00000000],
+		[-6.27268883, -0.00061820, 0.00037882, 0.00062135, -0.00000113, 0.00000000],
+		[-6.27268913, -0.00061807, 0.00037875, 0.00062122, -0.00000113, 0.00000000],
+		[-6.27268942, -0.00061795, 0.00037867, 0.00062110, -0.00000113, 0.00000000],
+		[-6.27268972, -0.00061783, 0.00037860, 0.00062097, -0.00000113, 0.00000000],
+		[-6.27269001, -0.00061770, 0.00037852, 0.00062085, -0.00000113, 0.00000000],
+		[-6.27269031, -0.00061758, 0.00037844, 0.00062073, -0.00000113, 0.00000000],
+		[-6.27269060, -0.00061746, 0.00037837, 0.00062060, -0.00000113, 0.00000000],
+		[-6.27269090, -0.00061733, 0.00037829, 0.00062048, -0.00000113, 0.00000000],
+		[-6.27269119, -0.00061721, 0.00037822, 0.00062035, -0.00000113, 0.00000000],
+		[-6.27269149, -0.00061709, 0.00037814, 0.00062023, -0.00000113, 0.00000000],
+		[-6.27269178, -0.00061696, 0.00037807, 0.00062011, -0.00000113, 0.00000000],
+		[-6.27269208, -0.00061684, 0.00037799, 0.00061998, -0.00000113, 0.00000000],
+		[-6.27269237, -0.00061672, 0.00037792, 0.00061986, -0.00000113, 0.00000000],
+		[-6.27269266, -0.00061660, 0.00037784, 0.00061974, -0.00000113, 0.00000000],
+		[-6.27269296, -0.00061647, 0.00037777, 0.00061961, -0.00000113, 0.00000000],
+		[-6.27269325, -0.00061635, 0.00037769, 0.00061949, -0.00000113, 0.00000000],
+		[-6.27269354, -0.00061623, 0.00037762, 0.00061937, -0.00000113, 0.00000000],
+		[-6.27269384, -0.00061610, 0.00037754, 0.00061924, -0.00000113, 0.00000000],
+		[-6.27269413, -0.00061598, 0.00037746, 0.00061912, -0.00000113, 0.00000000],
+		[-6.27269442, -0.00061586, 0.00037739, 0.00061900, -0.00000113, 0.00000000],
+		[-6.27269472, -0.00061574, 0.00037731, 0.00061887, -0.00000113, 0.00000000],
+		[-6.27269501, -0.00061561, 0.00037724, 0.00061875, -0.00000113, 0.00000000],
+		[-6.27269530, -0.00061549, 0.00037716, 0.00061863, -0.00000113, 0.00000000],
+		[-6.27269560, -0.00061537, 0.00037709, 0.00061850, -0.00000113, 0.00000000],
+		[-6.27269589, -0.00061525, 0.00037701, 0.00061838, -0.00000113, 0.00000000],
+		[-6.27269618, -0.00061512, 0.00037694, 0.00061826, -0.00000113, 0.00000000],
+		[-6.27269647, -0.00061500, 0.00037686, 0.00061814, -0.00000113, 0.00000000],
+		[-6.27269677, -0.00061488, 0.00037679, 0.00061801, -0.00000113, 0.00000000],
+		[-6.27269706, -0.00061476, 0.00037671, 0.00061789, -0.00000113, 0.00000000],
+		[-6.27269735, -0.00061464, 0.00037664, 0.00061777, -0.00000113, 0.00000000],
+		[-6.27269764, -0.00061451, 0.00037656, 0.00061764, -0.00000113, 0.00000000],
+		[-6.27269793, -0.00061439, 0.00037649, 0.00061752, -0.00000113, 0.00000000],
+		[-6.27269823, -0.00061427, 0.00037642, 0.00061740, -0.00000113, 0.00000000],
+		[-6.27269852, -0.00061415, 0.00037634, 0.00061728, -0.00000113, 0.00000000],
+		[-6.27269881, -0.00061403, 0.00037627, 0.00061715, -0.00000113, 0.00000000],
+		[-6.27269910, -0.00061390, 0.00037619, 0.00061703, -0.00000113, 0.00000000],
+		[-6.27269939, -0.00061378, 0.00037612, 0.00061691, -0.00000113, 0.00000000],
+		[-6.27269968, -0.00061366, 0.00037604, 0.00061679, -0.00000113, 0.00000000],
+		[-6.27269997, -0.00061354, 0.00037597, 0.00061667, -0.00000113, 0.00000000],
+		[-6.27270027, -0.00061342, 0.00037589, 0.00061654, -0.00000113, 0.00000000],
+		[-6.27270056, -0.00061330, 0.00037582, 0.00061642, -0.00000113, 0.00000000],
+		[-6.27270085, -0.00061318, 0.00037574, 0.00061630, -0.00000113, 0.00000000],
+		[-6.27270114, -0.00061305, 0.00037567, 0.00061618, -0.00000113, 0.00000000],
+		[-6.27270143, -0.00061293, 0.00037559, 0.00061605, -0.00000113, 0.00000000],
+		[-6.27270172, -0.00061281, 0.00037552, 0.00061593, -0.00000113, 0.00000000],
+		[-6.27270201, -0.00061269, 0.00037545, 0.00061581, -0.00000113, 0.00000000],
+		[-6.27270230, -0.00061257, 0.00037537, 0.00061569, -0.00000113, 0.00000000],
+		[-6.27270259, -0.00061245, 0.00037530, 0.00061557, -0.00000113, 0.00000000],
+		[-6.27270288, -0.00061233, 0.00037522, 0.00061545, -0.00000113, 0.00000000],
+		[-6.27270317, -0.00061221, 0.00037515, 0.00061532, -0.00000113, 0.00000000],
+		[-6.27270346, -0.00061208, 0.00037507, 0.00061520, -0.00000113, 0.00000000],
+		[-6.27270375, -0.00061196, 0.00037500, 0.00061508, -0.00000113, 0.00000000],
+		[-6.27270404, -0.00061184, 0.00037493, 0.00061496, -0.00000113, 0.00000000],
+		[-6.27270433, -0.00061172, 0.00037485, 0.00061484, -0.00000113, 0.00000000],
+		[-6.27270462, -0.00061160, 0.00037478, 0.00061472, -0.00000113, 0.00000000],
+		[-6.27270490, -0.00061148, 0.00037470, 0.00061459, -0.00000113, 0.00000000],
+		[-6.27270519, -0.00061136, 0.00037463, 0.00061447, -0.00000113, 0.00000000],
+		[-6.27270548, -0.00061124, 0.00037456, 0.00061435, -0.00000113, 0.00000000],
+		[-6.27270577, -0.00061112, 0.00037448, 0.00061423, -0.00000113, 0.00000000],
+		[-6.27270606, -0.00061100, 0.00037441, 0.00061411, -0.00000113, 0.00000000],
+		[-6.27270635, -0.00061088, 0.00037433, 0.00061399, -0.00000113, 0.00000000],
+		[-6.27270664, -0.00061076, 0.00037426, 0.00061387, -0.00000113, 0.00000000],
+		[-6.27270692, -0.00061064, 0.00037419, 0.00061375, -0.00000113, 0.00000000],
+		[-6.27270721, -0.00061051, 0.00037411, 0.00061362, -0.00000113, 0.00000000],
+		[-6.27270750, -0.00061039, 0.00037404, 0.00061350, -0.00000113, 0.00000000],
+		[-6.27270779, -0.00061027, 0.00037396, 0.00061338, -0.00000113, 0.00000000],
+		[-6.27270808, -0.00061015, 0.00037389, 0.00061326, -0.00000113, 0.00000000],
+		[-6.27270836, -0.00061003, 0.00037382, 0.00061314, -0.00000113, 0.00000000],
+		[-6.27270865, -0.00060991, 0.00037374, 0.00061302, -0.00000113, 0.00000000],
+		[-6.27270894, -0.00060979, 0.00037367, 0.00061290, -0.00000113, 0.00000000],
+		[-6.27270923, -0.00060967, 0.00037360, 0.00061278, -0.00000113, 0.00000000],
+		[-6.27270951, -0.00060955, 0.00037352, 0.00061266, -0.00000113, 0.00000000],
+		[-6.27270980, -0.00060943, 0.00037345, 0.00061254, -0.00000113, 0.00000000],
+		[-6.27271009, -0.00060931, 0.00037338, 0.00061242, -0.00000113, 0.00000000],
+		[-6.27271038, -0.00060919, 0.00037330, 0.00061230, -0.00000113, 0.00000000],
+		[-6.27271066, -0.00060907, 0.00037323, 0.00061218, -0.00000113, 0.00000000],
+		[-6.27271095, -0.00060895, 0.00037315, 0.00061205, -0.00000113, 0.00000000],
+		[-6.27271124, -0.00060883, 0.00037308, 0.00061193, -0.00000113, 0.00000000],
+		[-6.27271152, -0.00060871, 0.00037301, 0.00061181, -0.00000113, 0.00000000],
+		[-6.27271181, -0.00060859, 0.00037293, 0.00061169, -0.00000113, 0.00000000],
+		[-6.27271209, -0.00060847, 0.00037286, 0.00061157, -0.00000113, 0.00000000],
+		[-6.27271238, -0.00060836, 0.00037279, 0.00061145, -0.00000113, 0.00000000],
+		[-6.27271267, -0.00060824, 0.00037271, 0.00061133, -0.00000113, 0.00000000],
+		[-6.27271295, -0.00060812, 0.00037264, 0.00061121, -0.00000113, 0.00000000],
+		[-6.27271324, -0.00060800, 0.00037257, 0.00061109, -0.00000113, 0.00000000],
+		[-6.27271352, -0.00060788, 0.00037249, 0.00061097, -0.00000113, 0.00000000],
+		[-6.27271381, -0.00060776, 0.00037242, 0.00061085, -0.00000113, 0.00000000],
+		[-6.27271410, -0.00060764, 0.00037235, 0.00061073, -0.00000113, 0.00000000],
+		[-6.27271438, -0.00060752, 0.00037228, 0.00061061, -0.00000113, 0.00000000],
+		[-6.27271467, -0.00060740, 0.00037220, 0.00061049, -0.00000113, 0.00000000],
+		[-6.27271495, -0.00060728, 0.00037213, 0.00061037, -0.00000113, 0.00000000],
+		[-6.27271524, -0.00060716, 0.00037206, 0.00061025, -0.00000113, 0.00000000],
+		[-6.27271552, -0.00060704, 0.00037198, 0.00061013, -0.00000113, 0.00000000],
+		[-6.27271581, -0.00060692, 0.00037191, 0.00061001, -0.00000113, 0.00000000],
+		[-6.27271609, -0.00060680, 0.00037184, 0.00060989, -0.00000113, 0.00000000],
+		[-6.27271637, -0.00060669, 0.00037176, 0.00060978, -0.00000113, 0.00000000],
+		[-6.27271666, -0.00060657, 0.00037169, 0.00060966, -0.00000113, 0.00000000],
+		[-6.27271694, -0.00060645, 0.00037162, 0.00060954, -0.00000113, 0.00000000],
+		[-6.27271723, -0.00060633, 0.00037155, 0.00060942, -0.00000113, 0.00000000],
+		[-6.27271751, -0.00060621, 0.00037147, 0.00060930, -0.00000113, 0.00000000],
+		[-6.27271780, -0.00060609, 0.00037140, 0.00060918, -0.00000113, 0.00000000],
+		[-6.27271808, -0.00060597, 0.00037133, 0.00060906, -0.00000113, 0.00000000],
+		[-6.27271836, -0.00060585, 0.00037125, 0.00060894, -0.00000113, 0.00000000],
+		[-6.27271865, -0.00060574, 0.00037118, 0.00060882, -0.00000113, 0.00000000],
+		[-6.27271893, -0.00060562, 0.00037111, 0.00060870, -0.00000113, 0.00000000],
+		[-6.27271921, -0.00060550, 0.00037104, 0.00060858, -0.00000113, 0.00000000],
+		[-6.27271950, -0.00060538, 0.00037096, 0.00060846, -0.00000113, 0.00000000],
+		[-6.27271978, -0.00060526, 0.00037089, 0.00060834, -0.00000113, 0.00000000],
+		[-6.27272006, -0.00060514, 0.00037082, 0.00060823, -0.00000113, 0.00000000],
+		[-6.27272035, -0.00060503, 0.00037075, 0.00060811, -0.00000113, 0.00000000],
+		[-6.27272063, -0.00060491, 0.00037067, 0.00060799, -0.00000113, 0.00000000],
+		[-6.27272091, -0.00060479, 0.00037060, 0.00060787, -0.00000113, 0.00000000],
+		[-6.27272120, -0.00060467, 0.00037053, 0.00060775, -0.00000113, 0.00000000],
+		[-6.27272148, -0.00060455, 0.00037046, 0.00060763, -0.00000113, 0.00000000],
+		[-6.27272176, -0.00060444, 0.00037038, 0.00060751, -0.00000113, 0.00000000],
+		[-6.27272204, -0.00060432, 0.00037031, 0.00060739, -0.00000113, 0.00000000],
+		[-6.27272232, -0.00060420, 0.00037024, 0.00060728, -0.00000113, 0.00000000],
+		[-6.27272261, -0.00060408, 0.00037017, 0.00060716, -0.00000113, 0.00000000],
+		[-6.27272289, -0.00060396, 0.00037009, 0.00060704, -0.00000113, 0.00000000],
+		[-6.27272317, -0.00060385, 0.00037002, 0.00060692, -0.00000113, 0.00000000],
+		[-6.27272345, -0.00060373, 0.00036995, 0.00060680, -0.00000113, 0.00000000],
+		[-6.27272373, -0.00060361, 0.00036988, 0.00060668, -0.00000113, 0.00000000],
+		[-6.27272402, -0.00060349, 0.00036981, 0.00060657, -0.00000113, 0.00000000],
+		[-6.27272430, -0.00060337, 0.00036973, 0.00060645, -0.00000113, 0.00000000],
+		[-6.27272458, -0.00060326, 0.00036966, 0.00060633, -0.00000113, 0.00000000],
+		[-6.27272486, -0.00060314, 0.00036959, 0.00060621, -0.00000113, 0.00000000],
+		[-6.27272514, -0.00060302, 0.00036952, 0.00060609, -0.00000113, 0.00000000],
+		[-6.27272542, -0.00060290, 0.00036945, 0.00060597, -0.00000113, 0.00000000],
+		[-6.27272570, -0.00060279, 0.00036937, 0.00060586, -0.00000113, 0.00000000],
+		[-6.27272598, -0.00060267, 0.00036930, 0.00060574, -0.00000113, 0.00000000],
+		[-6.27272626, -0.00060255, 0.00036923, 0.00060562, -0.00000113, 0.00000000],
+		[-6.27272654, -0.00060244, 0.00036916, 0.00060550, -0.00000113, 0.00000000],
+		[-6.27272683, -0.00060232, 0.00036909, 0.00060538, -0.00000113, 0.00000000],
+		[-6.27272711, -0.00060220, 0.00036901, 0.00060527, -0.00000113, 0.00000000],
+		[-6.27272739, -0.00060208, 0.00036894, 0.00060515, -0.00000113, 0.00000000],
+		[-6.27272767, -0.00060197, 0.00036887, 0.00060503, -0.00000113, 0.00000000],
+		[-6.27272795, -0.00060185, 0.00036880, 0.00060491, -0.00000113, 0.00000000],
+		[-6.27272823, -0.00060173, 0.00036873, 0.00060480, -0.00000113, 0.00000000],
+		[-6.27272851, -0.00060162, 0.00036865, 0.00060468, -0.00000113, 0.00000000],
+		[-6.27272879, -0.00060150, 0.00036858, 0.00060456, -0.00000113, 0.00000000],
+		[-6.27272907, -0.00060138, 0.00036851, 0.00060444, -0.00000113, 0.00000000],
+		[-6.27272934, -0.00060127, 0.00036844, 0.00060433, -0.00000113, 0.00000000],
+		[-6.27272962, -0.00060115, 0.00036837, 0.00060421, -0.00000113, 0.00000000],
+		[-6.27272990, -0.00060103, 0.00036830, 0.00060409, -0.00000113, 0.00000000],
+		[-6.27273018, -0.00060092, 0.00036823, 0.00060397, -0.00000113, 0.00000000],
+		[-6.27273046, -0.00060080, 0.00036815, 0.00060386, -0.00000113, 0.00000000],
+		[-6.27273074, -0.00060068, 0.00036808, 0.00060374, -0.00000113, 0.00000000],
+		[-6.27273102, -0.00060057, 0.00036801, 0.00060362, -0.00000113, 0.00000000],
+		[-6.27273130, -0.00060045, 0.00036794, 0.00060351, -0.00000113, 0.00000000],
+		[-6.27273158, -0.00060033, 0.00036787, 0.00060339, -0.00000113, 0.00000000],
+		[-6.27273186, -0.00060022, 0.00036780, 0.00060327, -0.00000113, 0.00000000],
+		[-6.27273213, -0.00060010, 0.00036773, 0.00060315, -0.00000113, 0.00000000],
+		[-6.27273241, -0.00059998, 0.00036765, 0.00060304, -0.00000113, 0.00000000],
+		[-6.27273269, -0.00059987, 0.00036758, 0.00060292, -0.00000113, 0.00000000],
+		[-6.27273297, -0.00059975, 0.00036751, 0.00060280, -0.00000113, 0.00000000],
+		[-6.27273325, -0.00059963, 0.00036744, 0.00060269, -0.00000113, 0.00000000],
+		[-6.27273352, -0.00059952, 0.00036737, 0.00060257, -0.00000113, 0.00000000],
+		[-6.27273380, -0.00059940, 0.00036730, 0.00060245, -0.00000113, 0.00000000],
+		[-6.27273408, -0.00059929, 0.00036723, 0.00060234, -0.00000113, 0.00000000],
+		[-6.27273436, -0.00059917, 0.00036716, 0.00060222, -0.00000113, 0.00000000],
+		[-6.27273463, -0.00059905, 0.00036708, 0.00060210, -0.00000113, 0.00000000],
+		[-6.27273491, -0.00059894, 0.00036701, 0.00060199, -0.00000113, 0.00000000],
+		[-6.27273519, -0.00059882, 0.00036694, 0.00060187, -0.00000113, 0.00000000],
+		[-6.27273547, -0.00059871, 0.00036687, 0.00060175, -0.00000113, 0.00000000],
+		[-6.27273574, -0.00059859, 0.00036680, 0.00060164, -0.00000113, 0.00000000],
+		[-6.27273602, -0.00059848, 0.00036673, 0.00060152, -0.00000113, 0.00000000],
+		[-6.27273630, -0.00059836, 0.00036666, 0.00060141, -0.00000113, 0.00000000],
+		[-6.27273657, -0.00059824, 0.00036659, 0.00060129, -0.00000113, 0.00000000],
+		[-6.27273685, -0.00059813, 0.00036652, 0.00060117, -0.00000113, 0.00000000],
+		[-6.27273713, -0.00059801, 0.00036645, 0.00060106, -0.00000113, 0.00000000],
+		[-6.27273740, -0.00059790, 0.00036637, 0.00060094, -0.00000113, 0.00000000],
+		[-6.27273768, -0.00059778, 0.00036630, 0.00060082, -0.00000113, 0.00000000],
+		[-6.27273796, -0.00059767, 0.00036623, 0.00060071, -0.00000113, 0.00000000],
+		[-6.27273823, -0.00059755, 0.00036616, 0.00060059, -0.00000113, 0.00000000],
+		[-6.27273851, -0.00059744, 0.00036609, 0.00060048, -0.00000113, 0.00000000],
+		[-6.27273878, -0.00059732, 0.00036602, 0.00060036, -0.00000113, 0.00000000],
+		[-6.27273906, -0.00059721, 0.00036595, 0.00060025, -0.00000113, 0.00000000],
+		[-6.27273933, -0.00059709, 0.00036588, 0.00060013, -0.00000113, 0.00000000],
+		[-6.27273961, -0.00059698, 0.00036581, 0.00060001, -0.00000113, 0.00000000],
+		[-6.27273989, -0.00059686, 0.00036574, 0.00059990, -0.00000113, 0.00000000],
+		[-6.27274016, -0.00059674, 0.00036567, 0.00059978, -0.00000113, 0.00000000],
+		[-6.27274044, -0.00059663, 0.00036560, 0.00059967, -0.00000113, 0.00000000],
+		[-6.27274071, -0.00059651, 0.00036553, 0.00059955, -0.00000113, 0.00000000],
+		[-6.27274099, -0.00059640, 0.00036546, 0.00059944, -0.00000113, 0.00000000],
+		[-6.27274126, -0.00059629, 0.00036539, 0.00059932, -0.00000113, 0.00000000],
+		[-6.27274154, -0.00059617, 0.00036532, 0.00059920, -0.00000113, 0.00000000],
+		[-6.27274181, -0.00059606, 0.00036525, 0.00059909, -0.00000113, 0.00000000],
+		[-6.27274208, -0.00059594, 0.00036517, 0.00059897, -0.00000113, 0.00000000],
+		[-6.27274236, -0.00059583, 0.00036510, 0.00059886, -0.00000113, 0.00000000],
+		[-6.27274263, -0.00059571, 0.00036503, 0.00059874, -0.00000113, 0.00000000],
+		[-6.27274291, -0.00059560, 0.00036496, 0.00059863, -0.00000113, 0.00000000],
+		[-6.27274318, -0.00059548, 0.00036489, 0.00059851, -0.00000113, 0.00000000],
+		[-6.27274346, -0.00059537, 0.00036482, 0.00059840, -0.00000113, 0.00000000],
+		[-6.27274373, -0.00059525, 0.00036475, 0.00059828, -0.00000113, 0.00000000],
+		[-6.27274400, -0.00059514, 0.00036468, 0.00059817, -0.00000113, 0.00000000],
+		[-6.27274428, -0.00059502, 0.00036461, 0.00059805, -0.00000113, 0.00000000],
+		[-6.27274455, -0.00059491, 0.00036454, 0.00059794, -0.00000113, 0.00000000],
+		[-6.27274482, -0.00059480, 0.00036447, 0.00059782, -0.00000113, 0.00000000],
+		[-6.27274510, -0.00059468, 0.00036440, 0.00059771, -0.00000113, 0.00000000],
+		[-6.27274537, -0.00059457, 0.00036433, 0.00059759, -0.00000113, 0.00000000],
+		[-6.27274564, -0.00059445, 0.00036426, 0.00059748, -0.00000113, 0.00000000],
+		[-6.27274592, -0.00059434, 0.00036419, 0.00059736, -0.00000113, 0.00000000],
+		[-6.27274619, -0.00059422, 0.00036412, 0.00059725, -0.00000113, 0.00000000],
+		[-6.27274646, -0.00059411, 0.00036405, 0.00059713, -0.00000113, 0.00000000],
+		[-6.27274674, -0.00059400, 0.00036398, 0.00059702, -0.00000113, 0.00000000],
+		[-6.27274701, -0.00059388, 0.00036391, 0.00059690, -0.00000113, 0.00000000],
+		[-6.27274728, -0.00059377, 0.00036384, 0.00059679, -0.00000113, 0.00000000],
+		[-6.27274755, -0.00059365, 0.00036377, 0.00059668, -0.00000113, 0.00000000],
+		[-6.27274783, -0.00059354, 0.00036370, 0.00059656, -0.00000113, 0.00000000],
+		[-6.27274810, -0.00059343, 0.00036363, 0.00059645, -0.00000113, 0.00000000],
+		[-6.27274837, -0.00059331, 0.00036356, 0.00059633, -0.00000113, 0.00000000],
+		[-6.27274864, -0.00059320, 0.00036349, 0.00059622, -0.00000113, 0.00000000],
+		[-6.27274891, -0.00059309, 0.00036342, 0.00059610, -0.00000113, 0.00000000],
+		[-6.27274919, -0.00059297, 0.00036335, 0.00059599, -0.00000113, 0.00000000],
+		[-6.27274946, -0.00059286, 0.00036329, 0.00059588, -0.00000113, 0.00000000],
+		[-6.27274973, -0.00059275, 0.00036322, 0.00059576, -0.00000113, 0.00000000],
+		[-6.27275000, -0.00059263, 0.00036315, 0.00059565, -0.00000113, 0.00000000],
+		[-6.27275027, -0.00059252, 0.00036308, 0.00059553, -0.00000113, 0.00000000],
+		[-6.27275054, -0.00059241, 0.00036301, 0.00059542, -0.00000113, 0.00000000],
+		[-6.27275081, -0.00059229, 0.00036294, 0.00059531, -0.00000113, 0.00000000],
+		[-6.27275109, -0.00059218, 0.00036287, 0.00059519, -0.00000113, 0.00000000],
+		[-6.27275136, -0.00059207, 0.00036280, 0.00059508, -0.00000113, 0.00000000],
+		[-6.27275163, -0.00059195, 0.00036273, 0.00059496, -0.00000113, 0.00000000],
+		[-6.27275190, -0.00059184, 0.00036266, 0.00059485, -0.00000113, 0.00000000],
+		[-6.27275217, -0.00059173, 0.00036259, 0.00059474, -0.00000113, 0.00000000],
+		[-6.27275244, -0.00059161, 0.00036252, 0.00059462, -0.00000113, 0.00000000],
+		[-6.27275271, -0.00059150, 0.00036245, 0.00059451, -0.00000113, 0.00000000],
+		[-6.27275298, -0.00059139, 0.00036238, 0.00059440, -0.00000113, 0.00000000],
+		[-6.27275325, -0.00059127, 0.00036231, 0.00059428, -0.00000113, 0.00000000],
+		[-6.27275352, -0.00059116, 0.00036224, 0.00059417, -0.00000113, 0.00000000],
+		[-6.27275379, -0.00059105, 0.00036217, 0.00059406, -0.00000113, 0.00000000],
+		[-6.27275406, -0.00059094, 0.00036211, 0.00059394, -0.00000113, 0.00000000],
+		[-6.27275433, -0.00059082, 0.00036204, 0.00059383, -0.00000113, 0.00000000],
+		[-6.27275460, -0.00059071, 0.00036197, 0.00059372, -0.00000113, 0.00000000],
+		[-6.27275487, -0.00059060, 0.00036190, 0.00059360, -0.00000113, 0.00000000],
+		[-6.27275514, -0.00059048, 0.00036183, 0.00059349, -0.00000113, 0.00000000],
+		[-6.27275541, -0.00059037, 0.00036176, 0.00059338, -0.00000113, 0.00000000],
+		[-6.27275568, -0.00059026, 0.00036169, 0.00059326, -0.00000113, 0.00000000],
+		[-6.27275595, -0.00059015, 0.00036162, 0.00059315, -0.00000113, 0.00000000],
+		[-6.27275622, -0.00059003, 0.00036155, 0.00059304, -0.00000113, 0.00000000],
+		[-6.27275649, -0.00058992, 0.00036148, 0.00059292, -0.00000113, 0.00000000],
+		[-6.27275675, -0.00058981, 0.00036141, 0.00059281, -0.00000113, 0.00000000],
+		[-6.27275702, -0.00058970, 0.00036135, 0.00059270, -0.00000113, 0.00000000],
+		[-6.27275729, -0.00058958, 0.00036128, 0.00059258, -0.00000113, 0.00000000],
+		[-6.27275756, -0.00058947, 0.00036121, 0.00059247, -0.00000113, 0.00000000],
+		[-6.27275783, -0.00058936, 0.00036114, 0.00059236, -0.00000113, 0.00000000],
+		[-6.27275810, -0.00058925, 0.00036107, 0.00059225, -0.00000113, 0.00000000],
+		[-6.27275837, -0.00058914, 0.00036100, 0.00059213, -0.00000113, 0.00000000],
+		[-6.27275863, -0.00058902, 0.00036093, 0.00059202, -0.00000113, 0.00000000],
+		[-6.27275890, -0.00058891, 0.00036086, 0.00059191, -0.00000113, 0.00000000],
+		[-6.27275917, -0.00058880, 0.00036080, 0.00059180, -0.00000113, 0.00000000],
+		[-6.27275944, -0.00058869, 0.00036073, 0.00059168, -0.00000113, 0.00000000],
+		[-6.27275971, -0.00058858, 0.00036066, 0.00059157, -0.00000113, 0.00000000],
+		[-6.27275997, -0.00058846, 0.00036059, 0.00059146, -0.00000113, 0.00000000],
+		[-6.27276024, -0.00058835, 0.00036052, 0.00059135, -0.00000113, 0.00000000],
+		[-6.27276051, -0.00058824, 0.00036045, 0.00059123, -0.00000113, 0.00000000],
+		[-6.27276078, -0.00058813, 0.00036038, 0.00059112, -0.00000113, 0.00000000],
+		[-6.27276104, -0.00058802, 0.00036032, 0.00059101, -0.00000113, 0.00000000],
+		[-6.27276131, -0.00058790, 0.00036025, 0.00059090, -0.00000113, 0.00000000],
+		[-6.27276158, -0.00058779, 0.00036018, 0.00059078, -0.00000113, 0.00000000],
+		[-6.27276184, -0.00058768, 0.00036011, 0.00059067, -0.00000113, 0.00000000],
+		[-6.27276211, -0.00058757, 0.00036004, 0.00059056, -0.00000113, 0.00000000],
+		[-6.27276238, -0.00058746, 0.00035997, 0.00059045, -0.00000113, 0.00000000],
+		[-6.27276265, -0.00058735, 0.00035991, 0.00059034, -0.00000113, 0.00000000],
+		[-6.27276291, -0.00058724, 0.00035984, 0.00059022, -0.00000113, 0.00000000],
+		[-6.27276318, -0.00058712, 0.00035977, 0.00059011, -0.00000113, 0.00000000],
+		[-6.27276344, -0.00058701, 0.00035970, 0.00059000, -0.00000113, 0.00000000],
+		[-6.27276371, -0.00058690, 0.00035963, 0.00058989, -0.00000113, 0.00000000],
+		[-6.27276398, -0.00058679, 0.00035956, 0.00058978, -0.00000113, 0.00000000],
+		[-6.27276424, -0.00058668, 0.00035950, 0.00058966, -0.00000113, 0.00000000],
+		[-6.27276451, -0.00058657, 0.00035943, 0.00058955, -0.00000113, 0.00000000],
+		[-6.27276478, -0.00058646, 0.00035936, 0.00058944, -0.00000113, 0.00000000],
+		[-6.27276504, -0.00058635, 0.00035929, 0.00058933, -0.00000113, 0.00000000],
+		[-6.27276531, -0.00058623, 0.00035922, 0.00058922, -0.00000113, 0.00000000],
+		[-6.27276557, -0.00058612, 0.00035916, 0.00058911, -0.00000113, 0.00000000],
+		[-6.27276584, -0.00058601, 0.00035909, 0.00058899, -0.00000113, 0.00000000],
+		[-6.27276610, -0.00058590, 0.00035902, 0.00058888, -0.00000113, 0.00000000],
+		[-6.27276637, -0.00058579, 0.00035895, 0.00058877, -0.00000113, 0.00000000],
+		[-6.27276663, -0.00058568, 0.00035888, 0.00058866, -0.00000113, 0.00000000],
+		[-6.27276690, -0.00058557, 0.00035882, 0.00058855, -0.00000113, 0.00000000],
+		[-6.27276716, -0.00058546, 0.00035875, 0.00058844, -0.00000113, 0.00000000],
+		[-6.27276743, -0.00058535, 0.00035868, 0.00058833, -0.00000113, 0.00000000],
+		[-6.27276769, -0.00058524, 0.00035861, 0.00058821, -0.00000113, 0.00000000],
+		[-6.27276796, -0.00058513, 0.00035854, 0.00058810, -0.00000113, 0.00000000],
+		[-6.27276822, -0.00058502, 0.00035848, 0.00058799, -0.00000113, 0.00000000],
+		[-6.27276849, -0.00058491, 0.00035841, 0.00058788, -0.00000113, 0.00000000],
+		[-6.27276875, -0.00058480, 0.00035834, 0.00058777, -0.00000113, 0.00000000],
+		[-6.27276902, -0.00058468, 0.00035827, 0.00058766, -0.00000113, 0.00000000],
+		[-6.27276928, -0.00058457, 0.00035820, 0.00058755, -0.00000113, 0.00000000],
+		[-6.27276954, -0.00058446, 0.00035814, 0.00058744, -0.00000113, 0.00000000],
+		[-6.27276981, -0.00058435, 0.00035807, 0.00058733, -0.00000113, 0.00000000],
+		[-6.27277007, -0.00058424, 0.00035800, 0.00058721, -0.00000113, 0.00000000],
+		[-6.27277034, -0.00058413, 0.00035793, 0.00058710, -0.00000113, 0.00000000],
+		[-6.27277060, -0.00058402, 0.00035787, 0.00058699, -0.00000113, 0.00000000],
+		[-6.27277086, -0.00058391, 0.00035780, 0.00058688, -0.00000113, 0.00000000],
+		[-6.27277113, -0.00058380, 0.00035773, 0.00058677, -0.00000113, 0.00000000],
+		[-6.27277139, -0.00058369, 0.00035766, 0.00058666, -0.00000113, 0.00000000],
+		[-6.27277165, -0.00058358, 0.00035760, 0.00058655, -0.00000113, 0.00000000],
+		[-6.27277192, -0.00058347, 0.00035753, 0.00058644, -0.00000113, 0.00000000],
+		[-6.27277218, -0.00058336, 0.00035746, 0.00058633, -0.00000113, 0.00000000],
+		[-6.27277244, -0.00058325, 0.00035739, 0.00058622, -0.00000113, 0.00000000],
+		[-6.27277270, -0.00058314, 0.00035733, 0.00058611, -0.00000113, 0.00000000],
+		[-6.27277297, -0.00058303, 0.00035726, 0.00058600, -0.00000113, 0.00000000],
+		[-6.27277323, -0.00058292, 0.00035719, 0.00058589, -0.00000113, 0.00000000],
+		[-6.27277349, -0.00058281, 0.00035712, 0.00058578, -0.00000113, 0.00000000],
+		[-6.27277376, -0.00058270, 0.00035706, 0.00058567, -0.00000113, 0.00000000],
+		[-6.27277402, -0.00058259, 0.00035699, 0.00058556, -0.00000113, 0.00000000],
+		[-6.27277428, -0.00058248, 0.00035692, 0.00058545, -0.00000113, 0.00000000],
+		[-6.27277454, -0.00058237, 0.00035686, 0.00058534, -0.00000113, 0.00000000],
+		[-6.27277480, -0.00058227, 0.00035679, 0.00058523, -0.00000113, 0.00000000],
+		[-6.27277507, -0.00058216, 0.00035672, 0.00058512, -0.00000113, 0.00000000],
+		[-6.27277533, -0.00058205, 0.00035665, 0.00058501, -0.00000113, 0.00000000],
+		[-6.27277559, -0.00058194, 0.00035659, 0.00058490, -0.00000113, 0.00000000],
+		[-6.27277585, -0.00058183, 0.00035652, 0.00058479, -0.00000113, 0.00000000],
+		[-6.27277611, -0.00058172, 0.00035645, 0.00058468, -0.00000113, 0.00000000],
+		[-6.27277637, -0.00058161, 0.00035639, 0.00058457, -0.00000113, 0.00000000],
+		[-6.27277664, -0.00058150, 0.00035632, 0.00058446, -0.00000113, 0.00000000],
+		[-6.27277690, -0.00058139, 0.00035625, 0.00058435, -0.00000113, 0.00000000],
+		[-6.27277716, -0.00058128, 0.00035619, 0.00058424, -0.00000113, 0.00000000],
+		[-6.27277742, -0.00058117, 0.00035612, 0.00058413, -0.00000113, 0.00000000],
+		[-6.27277768, -0.00058106, 0.00035605, 0.00058402, -0.00000113, 0.00000000],
+		[-6.27277794, -0.00058095, 0.00035598, 0.00058391, -0.00000113, 0.00000000],
+		[-6.27277820, -0.00058084, 0.00035592, 0.00058380, -0.00000113, 0.00000000],
+		[-6.27277846, -0.00058074, 0.00035585, 0.00058369, -0.00000113, 0.00000000],
+		[-6.27277872, -0.00058063, 0.00035578, 0.00058358, -0.00000113, 0.00000000],
+		[-6.27277898, -0.00058052, 0.00035572, 0.00058347, -0.00000113, 0.00000000],
+		[-6.27277924, -0.00058041, 0.00035565, 0.00058336, -0.00000113, 0.00000000],
+		[-6.27277950, -0.00058030, 0.00035558, 0.00058325, -0.00000113, 0.00000000],
+		[-6.27277977, -0.00058019, 0.00035552, 0.00058314, -0.00000113, 0.00000000],
+		[-6.27278003, -0.00058008, 0.00035545, 0.00058303, -0.00000113, 0.00000000],
+		[-6.27278029, -0.00057997, 0.00035538, 0.00058292, -0.00000113, 0.00000000],
+		[-6.27278055, -0.00057987, 0.00035532, 0.00058281, -0.00000113, 0.00000000],
+		[-6.27278080, -0.00057976, 0.00035525, 0.00058271, -0.00000113, 0.00000000],
+		[-6.27278106, -0.00057965, 0.00035518, 0.00058260, -0.00000113, 0.00000000],
+		[-6.27278132, -0.00057954, 0.00035512, 0.00058249, -0.00000113, 0.00000000],
+		[-6.27278158, -0.00057943, 0.00035505, 0.00058238, -0.00000113, 0.00000000],
+		[-6.27278184, -0.00057932, 0.00035498, 0.00058227, -0.00000113, 0.00000000],
+		[-6.27278210, -0.00057921, 0.00035492, 0.00058216, -0.00000113, 0.00000000],
+		[-6.27278236, -0.00057911, 0.00035485, 0.00058205, -0.00000113, 0.00000000],
+		[-6.27278262, -0.00057900, 0.00035479, 0.00058194, -0.00000113, 0.00000000],
+		[-6.27278288, -0.00057889, 0.00035472, 0.00058183, -0.00000113, 0.00000000],
+		[-6.27278314, -0.00057878, 0.00035465, 0.00058172, -0.00000113, 0.00000000],
+		[-6.27278340, -0.00057867, 0.00035459, 0.00058162, -0.00000113, 0.00000000],
+		[-6.27278366, -0.00057857, 0.00035452, 0.00058151, -0.00000113, 0.00000000],
+		[-6.27278392, -0.00057846, 0.00035445, 0.00058140, -0.00000113, 0.00000000],
+		[-6.27278417, -0.00057835, 0.00035439, 0.00058129, -0.00000113, 0.00000000],
+		[-6.27278443, -0.00057824, 0.00035432, 0.00058118, -0.00000113, 0.00000000],
+		[-6.27278469, -0.00057813, 0.00035425, 0.00058107, -0.00000113, 0.00000000],
+		[-6.27278495, -0.00057802, 0.00035419, 0.00058096, -0.00000113, 0.00000000],
+		[-6.27278521, -0.00057792, 0.00035412, 0.00058086, -0.00000113, 0.00000000],
+		[-6.27278547, -0.00057781, 0.00035406, 0.00058075, -0.00000113, 0.00000000],
+		[-6.27278572, -0.00057770, 0.00035399, 0.00058064, -0.00000113, 0.00000000],
+		[-6.27278598, -0.00057759, 0.00035392, 0.00058053, -0.00000113, 0.00000000],
+		[-6.27278624, -0.00057749, 0.00035386, 0.00058042, -0.00000113, 0.00000000],
+		[-6.27278650, -0.00057738, 0.00035379, 0.00058031, -0.00000113, 0.00000000],
+		[-6.27278675, -0.00057727, 0.00035373, 0.00058021, -0.00000113, 0.00000000],
+		[-6.27278701, -0.00057716, 0.00035366, 0.00058010, -0.00000113, 0.00000000],
+		[-6.27278727, -0.00057706, 0.00035359, 0.00057999, -0.00000113, 0.00000000],
+		[-6.27278753, -0.00057695, 0.00035353, 0.00057988, -0.00000113, 0.00000000],
+		[-6.27278778, -0.00057684, 0.00035346, 0.00057977, -0.00000113, 0.00000000],
+		[-6.27278804, -0.00057673, 0.00035340, 0.00057966, -0.00000113, 0.00000000],
+		[-6.27278830, -0.00057663, 0.00035333, 0.00057956, -0.00000113, 0.00000000],
+		[-6.27278855, -0.00057652, 0.00035326, 0.00057945, -0.00000113, 0.00000000],
+		[-6.27278881, -0.00057641, 0.00035320, 0.00057934, -0.00000113, 0.00000000],
+		[-6.27278907, -0.00057630, 0.00035313, 0.00057923, -0.00000113, 0.00000000],
+		[-6.27278933, -0.00057620, 0.00035307, 0.00057913, -0.00000113, 0.00000000],
+		[-6.27278958, -0.00057609, 0.00035300, 0.00057902, -0.00000113, 0.00000000],
+		[-6.27278984, -0.00057598, 0.00035294, 0.00057891, -0.00000113, 0.00000000],
+		[-6.27279009, -0.00057587, 0.00035287, 0.00057880, -0.00000113, 0.00000000],
+		[-6.27279035, -0.00057577, 0.00035280, 0.00057869, -0.00000113, 0.00000000],
+		[-6.27279061, -0.00057566, 0.00035274, 0.00057859, -0.00000113, 0.00000000],
+		[-6.27279086, -0.00057555, 0.00035267, 0.00057848, -0.00000113, 0.00000000],
+		[-6.27279112, -0.00057545, 0.00035261, 0.00057837, -0.00000113, 0.00000000],
+		[-6.27279137, -0.00057534, 0.00035254, 0.00057826, -0.00000113, 0.00000000],
+		[-6.27279163, -0.00057523, 0.00035248, 0.00057816, -0.00000113, 0.00000000],
+		[-6.27279189, -0.00057513, 0.00035241, 0.00057805, -0.00000113, 0.00000000],
+		[-6.27279214, -0.00057502, 0.00035235, 0.00057794, -0.00000113, 0.00000000],
+		[-6.27279240, -0.00057491, 0.00035228, 0.00057783, -0.00000113, 0.00000000],
+		[-6.27279265, -0.00057480, 0.00035221, 0.00057773, -0.00000113, 0.00000000],
+		[-6.27279291, -0.00057470, 0.00035215, 0.00057762, -0.00000113, 0.00000000],
+		[-6.27279316, -0.00057459, 0.00035208, 0.00057751, -0.00000113, 0.00000000],
+		[-6.27279342, -0.00057448, 0.00035202, 0.00057741, -0.00000113, 0.00000000],
+		[-6.27279367, -0.00057438, 0.00035195, 0.00057730, -0.00000113, 0.00000000],
+		[-6.27279393, -0.00057427, 0.00035189, 0.00057719, -0.00000113, 0.00000000],
+		[-6.27279418, -0.00057417, 0.00035182, 0.00057708, -0.00000113, 0.00000000],
+		[-6.27279444, -0.00057406, 0.00035176, 0.00057698, -0.00000113, 0.00000000],
+		[-6.27279469, -0.00057395, 0.00035169, 0.00057687, -0.00000113, 0.00000000],
+		[-6.27279495, -0.00057385, 0.00035163, 0.00057676, -0.00000113, 0.00000000],
+		[-6.27279520, -0.00057374, 0.00035156, 0.00057666, -0.00000113, 0.00000000],
+		[-6.27279546, -0.00057363, 0.00035150, 0.00057655, -0.00000113, 0.00000000],
+		[-6.27279571, -0.00057353, 0.00035143, 0.00057644, -0.00000113, 0.00000000],
+		[-6.27279596, -0.00057342, 0.00035137, 0.00057634, -0.00000113, 0.00000000],
+		[-6.27279622, -0.00057331, 0.00035130, 0.00057623, -0.00000113, 0.00000000],
+		[-6.27279647, -0.00057321, 0.00035124, 0.00057612, -0.00000113, 0.00000000],
+		[-6.27279673, -0.00057310, 0.00035117, 0.00057602, -0.00000113, 0.00000000],
+		[-6.27279698, -0.00057300, 0.00035111, 0.00057591, -0.00000113, 0.00000000],
+		[-6.27279723, -0.00057289, 0.00035104, 0.00057580, -0.00000113, 0.00000000],
+		[-6.27279749, -0.00057278, 0.00035098, 0.00057570, -0.00000113, 0.00000000],
+		[-6.27279774, -0.00057268, 0.00035091, 0.00057559, -0.00000113, 0.00000000],
+		[-6.27279799, -0.00057257, 0.00035085, 0.00057548, -0.00000113, 0.00000000],
+		[-6.27279825, -0.00057247, 0.00035078, 0.00057538, -0.00000113, 0.00000000],
+		[-6.27279850, -0.00057236, 0.00035072, 0.00057527, -0.00000113, 0.00000000],
+		[-6.27279875, -0.00057225, 0.00035065, 0.00057516, -0.00000113, 0.00000000],
+		[-6.27279901, -0.00057215, 0.00035059, 0.00057506, -0.00000113, 0.00000000],
+		[-6.27279926, -0.00057204, 0.00035052, 0.00057495, -0.00000113, 0.00000000],
+		[-6.27279951, -0.00057194, 0.00035046, 0.00057484, -0.00000113, 0.00000000],
+		[-6.27279977, -0.00057183, 0.00035039, 0.00057474, -0.00000113, 0.00000000],
+		[-6.27280002, -0.00057173, 0.00035033, 0.00057463, -0.00000113, 0.00000000],
+		[-6.27280027, -0.00057162, 0.00035026, 0.00057453, -0.00000113, 0.00000000],
+		[-6.27280052, -0.00057152, 0.00035020, 0.00057442, -0.00000113, 0.00000000],
+		[-6.27280078, -0.00057141, 0.00035013, 0.00057431, -0.00000113, 0.00000000],
+		[-6.27280103, -0.00057130, 0.00035007, 0.00057421, -0.00000113, 0.00000000],
+		[-6.27280128, -0.00057120, 0.00035000, 0.00057410, -0.00000113, 0.00000000],
+		[-6.27280153, -0.00057109, 0.00034994, 0.00057400, -0.00000113, 0.00000000],
+		[-6.27280178, -0.00057099, 0.00034987, 0.00057389, -0.00000113, 0.00000000],
+		[-6.27280204, -0.00057088, 0.00034981, 0.00057378, -0.00000113, 0.00000000],
+		[-6.27280229, -0.00057078, 0.00034974, 0.00057368, -0.00000113, 0.00000000],
+		[-6.27280254, -0.00057067, 0.00034968, 0.00057357, -0.00000113, 0.00000000],
+		[-6.27280279, -0.00057057, 0.00034962, 0.00057347, -0.00000113, 0.00000000],
+		[-6.27280304, -0.00057046, 0.00034955, 0.00057336, -0.00000113, 0.00000000],
+		[-6.27280329, -0.00057036, 0.00034949, 0.00057326, -0.00000113, 0.00000000],
+		[-6.27280355, -0.00057025, 0.00034942, 0.00057315, -0.00000113, 0.00000000],
+		[-6.27280380, -0.00057015, 0.00034936, 0.00057304, -0.00000113, 0.00000000],
+		[-6.27280405, -0.00057004, 0.00034929, 0.00057294, -0.00000113, 0.00000000],
+		[-6.27280430, -0.00056994, 0.00034923, 0.00057283, -0.00000113, 0.00000000],
+		[-6.27280455, -0.00056983, 0.00034916, 0.00057273, -0.00000113, 0.00000000],
+		[-6.27280480, -0.00056973, 0.00034910, 0.00057262, -0.00000113, 0.00000000],
+		[-6.27280505, -0.00056962, 0.00034904, 0.00057252, -0.00000113, 0.00000000],
+		[-6.27280530, -0.00056952, 0.00034897, 0.00057241, -0.00000113, 0.00000000],
+		[-6.27280555, -0.00056941, 0.00034891, 0.00057231, -0.00000113, 0.00000000],
+		[-6.27280580, -0.00056931, 0.00034884, 0.00057220, -0.00000113, 0.00000000],
+		[-6.27280606, -0.00056920, 0.00034878, 0.00057210, -0.00000113, 0.00000000],
+		[-6.27280631, -0.00056910, 0.00034872, 0.00057199, -0.00000113, 0.00000000],
+		[-6.27280656, -0.00056899, 0.00034865, 0.00057189, -0.00000113, 0.00000000],
+		[-6.27280681, -0.00056889, 0.00034859, 0.00057178, -0.00000113, 0.00000000],
+		[-6.27280706, -0.00056878, 0.00034852, 0.00057168, -0.00000113, 0.00000000],
+		[-6.27280731, -0.00056868, 0.00034846, 0.00057157, -0.00000113, 0.00000000],
+		[-6.27280756, -0.00056858, 0.00034839, 0.00057147, -0.00000113, 0.00000000],
+		[-6.27280781, -0.00056847, 0.00034833, 0.00057136, -0.00000113, 0.00000000],
+		[-6.27280806, -0.00056837, 0.00034827, 0.00057126, -0.00000113, 0.00000000],
+		[-6.27280830, -0.00056826, 0.00034820, 0.00057115, -0.00000113, 0.00000000],
+		[-6.27280855, -0.00056816, 0.00034814, 0.00057105, -0.00000113, 0.00000000],
+		[-6.27280880, -0.00056805, 0.00034807, 0.00057094, -0.00000113, 0.00000000],
+		[-6.27280905, -0.00056795, 0.00034801, 0.00057084, -0.00000113, 0.00000000],
+		[-6.27280930, -0.00056785, 0.00034795, 0.00057073, -0.00000113, 0.00000000],
+		[-6.27280955, -0.00056774, 0.00034788, 0.00057063, -0.00000113, 0.00000000],
+		[-6.27280980, -0.00056764, 0.00034782, 0.00057052, -0.00000113, 0.00000000],
+		[-6.27281005, -0.00056753, 0.00034776, 0.00057042, -0.00000113, 0.00000000],
+		[-6.27281030, -0.00056743, 0.00034769, 0.00057031, -0.00000113, 0.00000000],
+		[-6.27281055, -0.00056733, 0.00034763, 0.00057021, -0.00000113, 0.00000000],
+		[-6.27281080, -0.00056722, 0.00034756, 0.00057010, -0.00000113, 0.00000000],
+		[-6.27281104, -0.00056712, 0.00034750, 0.00057000, -0.00000113, 0.00000000],
+		[-6.27281129, -0.00056701, 0.00034744, 0.00056990, -0.00000113, 0.00000000],
+		[-6.27281154, -0.00056691, 0.00034737, 0.00056979, -0.00000113, 0.00000000],
+		[-6.27281179, -0.00056681, 0.00034731, 0.00056969, -0.00000113, 0.00000000],
+		[-6.27281204, -0.00056670, 0.00034725, 0.00056958, -0.00000113, 0.00000000],
+		[-6.27281229, -0.00056660, 0.00034718, 0.00056948, -0.00000113, 0.00000000],
+		[-6.27281253, -0.00056649, 0.00034712, 0.00056937, -0.00000113, 0.00000000],
+		[-6.27281278, -0.00056639, 0.00034706, 0.00056927, -0.00000113, 0.00000000],
+		[-6.27281303, -0.00056629, 0.00034699, 0.00056917, -0.00000113, 0.00000000],
+		[-6.27281328, -0.00056618, 0.00034693, 0.00056906, -0.00000113, 0.00000000],
+		[-6.27281353, -0.00056608, 0.00034686, 0.00056896, -0.00000113, 0.00000000],
+		[-6.27281377, -0.00056598, 0.00034680, 0.00056885, -0.00000113, 0.00000000],
+		[-6.27281402, -0.00056587, 0.00034674, 0.00056875, -0.00000113, 0.00000000],
+		[-6.27281427, -0.00056577, 0.00034667, 0.00056865, -0.00000113, 0.00000000],
+		[-6.27281452, -0.00056567, 0.00034661, 0.00056854, -0.00000113, 0.00000000],
+		[-6.27281476, -0.00056556, 0.00034655, 0.00056844, -0.00000113, 0.00000000],
+		[-6.27281501, -0.00056546, 0.00034648, 0.00056833, -0.00000113, 0.00000000],
+		[-6.27281526, -0.00056536, 0.00034642, 0.00056823, -0.00000113, 0.00000000],
+		[-6.27281550, -0.00056525, 0.00034636, 0.00056813, -0.00000113, 0.00000000],
+		[-6.27281575, -0.00056515, 0.00034629, 0.00056802, -0.00000113, 0.00000000],
+		[-6.27281600, -0.00056505, 0.00034623, 0.00056792, -0.00000113, 0.00000000],
+		[-6.27281624, -0.00056494, 0.00034617, 0.00056781, -0.00000113, 0.00000000],
+		[-6.27281649, -0.00056484, 0.00034610, 0.00056771, -0.00000113, 0.00000000],
+		[-6.27281674, -0.00056474, 0.00034604, 0.00056761, -0.00000113, 0.00000000],
+		[-6.27281698, -0.00056463, 0.00034598, 0.00056750, -0.00000113, 0.00000000],
+		[-6.27281723, -0.00056453, 0.00034592, 0.00056740, -0.00000113, 0.00000000],
+		[-6.27281748, -0.00056443, 0.00034585, 0.00056730, -0.00000113, 0.00000000],
+		[-6.27281772, -0.00056433, 0.00034579, 0.00056719, -0.00000113, 0.00000000],
+		[-6.27281797, -0.00056422, 0.00034573, 0.00056709, -0.00000113, 0.00000000],
+		[-6.27281822, -0.00056412, 0.00034566, 0.00056699, -0.00000113, 0.00000000],
+		[-6.27281846, -0.00056402, 0.00034560, 0.00056688, -0.00000113, 0.00000000],
+		[-6.27281871, -0.00056391, 0.00034554, 0.00056678, -0.00000113, 0.00000000],
+		[-6.27281895, -0.00056381, 0.00034547, 0.00056668, -0.00000113, 0.00000000],
+		[-6.27281920, -0.00056371, 0.00034541, 0.00056657, -0.00000113, 0.00000000],
+		[-6.27281944, -0.00056361, 0.00034535, 0.00056647, -0.00000113, 0.00000000],
+		[-6.27281969, -0.00056350, 0.00034528, 0.00056637, -0.00000113, 0.00000000],
+		[-6.27281993, -0.00056340, 0.00034522, 0.00056626, -0.00000113, 0.00000000],
+		[-6.27282018, -0.00056330, 0.00034516, 0.00056616, -0.00000113, 0.00000000],
+		[-6.27282043, -0.00056320, 0.00034510, 0.00056606, -0.00000113, 0.00000000],
+		[-6.27282067, -0.00056309, 0.00034503, 0.00056596, -0.00000113, 0.00000000],
+		[-6.27282092, -0.00056299, 0.00034497, 0.00056585, -0.00000113, 0.00000000],
+		[-6.27282116, -0.00056289, 0.00034491, 0.00056575, -0.00000113, 0.00000000],
+		[-6.27282141, -0.00056279, 0.00034485, 0.00056565, -0.00000113, 0.00000000],
+		[-6.27282165, -0.00056268, 0.00034478, 0.00056554, -0.00000113, 0.00000000],
+		[-6.27282189, -0.00056258, 0.00034472, 0.00056544, -0.00000113, 0.00000000],
+		[-6.27282214, -0.00056248, 0.00034466, 0.00056534, -0.00000113, 0.00000000],
+		[-6.27282238, -0.00056238, 0.00034459, 0.00056524, -0.00000113, 0.00000000],
+		[-6.27282263, -0.00056228, 0.00034453, 0.00056513, -0.00000113, 0.00000000],
+		[-6.27282287, -0.00056217, 0.00034447, 0.00056503, -0.00000113, 0.00000000],
+		[-6.27282312, -0.00056207, 0.00034441, 0.00056493, -0.00000113, 0.00000000],
+		[-6.27282336, -0.00056197, 0.00034434, 0.00056483, -0.00000113, 0.00000000],
+		[-6.27282360, -0.00056187, 0.00034428, 0.00056472, -0.00000113, 0.00000000],
+		[-6.27282385, -0.00056177, 0.00034422, 0.00056462, -0.00000113, 0.00000000],
+		[-6.27282409, -0.00056166, 0.00034416, 0.00056452, -0.00000113, 0.00000000],
+		[-6.27282434, -0.00056156, 0.00034409, 0.00056442, -0.00000113, 0.00000000],
+		[-6.27282458, -0.00056146, 0.00034403, 0.00056431, -0.00000113, 0.00000000],
+		[-6.27282482, -0.00056136, 0.00034397, 0.00056421, -0.00000113, 0.00000000],
+		[-6.27282507, -0.00056126, 0.00034391, 0.00056411, -0.00000113, 0.00000000],
+		[-6.27282531, -0.00056115, 0.00034384, 0.00056401, -0.00000113, 0.00000000],
+		[-6.27282555, -0.00056105, 0.00034378, 0.00056390, -0.00000113, 0.00000000],
+		[-6.27282580, -0.00056095, 0.00034372, 0.00056380, -0.00000113, 0.00000000],
+		[-6.27282604, -0.00056085, 0.00034366, 0.00056370, -0.00000113, 0.00000000],
+		[-6.27282628, -0.00056075, 0.00034360, 0.00056360, -0.00000113, 0.00000000],
+		[-6.27282653, -0.00056065, 0.00034353, 0.00056349, -0.00000113, 0.00000000],
+		[-6.27282677, -0.00056055, 0.00034347, 0.00056339, -0.00000113, 0.00000000],
+		[-6.27282701, -0.00056044, 0.00034341, 0.00056329, -0.00000113, 0.00000000],
+		[-6.27282725, -0.00056034, 0.00034335, 0.00056319, -0.00000113, 0.00000000],
+		[-6.27282750, -0.00056024, 0.00034328, 0.00056309, -0.00000113, 0.00000000],
+		[-6.27282774, -0.00056014, 0.00034322, 0.00056299, -0.00000113, 0.00000000],
+		[-6.27282798, -0.00056004, 0.00034316, 0.00056288, -0.00000113, 0.00000000],
+		[-6.27282822, -0.00055994, 0.00034310, 0.00056278, -0.00000113, 0.00000000],
+		[-6.27282847, -0.00055984, 0.00034304, 0.00056268, -0.00000113, 0.00000000],
+		[-6.27282871, -0.00055973, 0.00034297, 0.00056258, -0.00000113, 0.00000000],
+		[-6.27282895, -0.00055963, 0.00034291, 0.00056248, -0.00000113, 0.00000000],
+		[-6.27282919, -0.00055953, 0.00034285, 0.00056237, -0.00000113, 0.00000000],
+		[-6.27282944, -0.00055943, 0.00034279, 0.00056227, -0.00000113, 0.00000000],
+		[-6.27282968, -0.00055933, 0.00034273, 0.00056217, -0.00000113, 0.00000000],
+		[-6.27282992, -0.00055923, 0.00034266, 0.00056207, -0.00000113, 0.00000000],
+		[-6.27283016, -0.00055913, 0.00034260, 0.00056197, -0.00000113, 0.00000000],
+		[-6.27283040, -0.00055903, 0.00034254, 0.00056187, -0.00000113, 0.00000000],
+		[-6.27283064, -0.00055893, 0.00034248, 0.00056177, -0.00000113, 0.00000000],
+		[-6.27283089, -0.00055882, 0.00034242, 0.00056166, -0.00000113, 0.00000000],
+		[-6.27283113, -0.00055872, 0.00034235, 0.00056156, -0.00000113, 0.00000000],
+		[-6.27283137, -0.00055862, 0.00034229, 0.00056146, -0.00000113, 0.00000000],
+		[-6.27283161, -0.00055852, 0.00034223, 0.00056136, -0.00000113, 0.00000000],
+		[-6.27283185, -0.00055842, 0.00034217, 0.00056126, -0.00000113, 0.00000000],
+		[-6.27283209, -0.00055832, 0.00034211, 0.00056116, -0.00000113, 0.00000000],
+		[-6.27283233, -0.00055822, 0.00034204, 0.00056106, -0.00000113, 0.00000000],
+		[-6.27283257, -0.00055812, 0.00034198, 0.00056095, -0.00000113, 0.00000000],
+		[-6.27283281, -0.00055802, 0.00034192, 0.00056085, -0.00000113, 0.00000000],
+		[-6.27283305, -0.00055792, 0.00034186, 0.00056075, -0.00000113, 0.00000000],
+		[-6.27283329, -0.00055782, 0.00034180, 0.00056065, -0.00000113, 0.00000000],
+		[-6.27283353, -0.00055772, 0.00034174, 0.00056055, -0.00000113, 0.00000000],
+		[-6.27283378, -0.00055762, 0.00034168, 0.00056045, -0.00000113, 0.00000000],
+		[-6.27283402, -0.00055752, 0.00034161, 0.00056035, -0.00000113, 0.00000000],
+		[-6.27283426, -0.00055742, 0.00034155, 0.00056025, -0.00000113, 0.00000000],
+		[-6.27283450, -0.00055732, 0.00034149, 0.00056015, -0.00000113, 0.00000000],
+		[-6.27283474, -0.00055722, 0.00034143, 0.00056005, -0.00000113, 0.00000000],
+		[-6.27283498, -0.00055712, 0.00034137, 0.00055994, -0.00000113, 0.00000000],
+		[-6.27283522, -0.00055701, 0.00034131, 0.00055984, -0.00000113, 0.00000000],
+		[-6.27283546, -0.00055691, 0.00034124, 0.00055974, -0.00000113, 0.00000000],
+		[-6.27283570, -0.00055681, 0.00034118, 0.00055964, -0.00000113, 0.00000000],
+		[-6.27283593, -0.00055671, 0.00034112, 0.00055954, -0.00000113, 0.00000000],
+		[-6.27283617, -0.00055661, 0.00034106, 0.00055944, -0.00000113, 0.00000000],
+		[-6.27283641, -0.00055651, 0.00034100, 0.00055934, -0.00000113, 0.00000000],
+		[-6.27283665, -0.00055641, 0.00034094, 0.00055924, -0.00000113, 0.00000000],
+		[-6.27283689, -0.00055631, 0.00034088, 0.00055914, -0.00000113, 0.00000000],
+		[-6.27283713, -0.00055621, 0.00034081, 0.00055904, -0.00000113, 0.00000000],
+		[-6.27283737, -0.00055611, 0.00034075, 0.00055894, -0.00000113, 0.00000000],
+		[-6.27283761, -0.00055601, 0.00034069, 0.00055884, -0.00000113, 0.00000000],
+		[-6.27283785, -0.00055591, 0.00034063, 0.00055874, -0.00000113, 0.00000000],
+		[-6.27283809, -0.00055581, 0.00034057, 0.00055864, -0.00000113, 0.00000000],
+		[-6.27283833, -0.00055571, 0.00034051, 0.00055854, -0.00000113, 0.00000000],
+		[-6.27283856, -0.00055562, 0.00034045, 0.00055844, -0.00000113, 0.00000000],
+		[-6.27283880, -0.00055552, 0.00034039, 0.00055834, -0.00000113, 0.00000000],
+		[-6.27283904, -0.00055542, 0.00034033, 0.00055824, -0.00000113, 0.00000000],
+		[-6.27283928, -0.00055532, 0.00034026, 0.00055814, -0.00000113, 0.00000000],
+		[-6.27283952, -0.00055522, 0.00034020, 0.00055804, -0.00000113, 0.00000000],
+		[-6.27283976, -0.00055512, 0.00034014, 0.00055794, -0.00000113, 0.00000000],
+		[-6.27283999, -0.00055502, 0.00034008, 0.00055784, -0.00000113, 0.00000000],
+		[-6.27284023, -0.00055492, 0.00034002, 0.00055774, -0.00000113, 0.00000000],
+		[-6.27284047, -0.00055482, 0.00033996, 0.00055764, -0.00000113, 0.00000000],
+		[-6.27284071, -0.00055472, 0.00033990, 0.00055754, -0.00000113, 0.00000000],
+		[-6.27284095, -0.00055462, 0.00033984, 0.00055744, -0.00000113, 0.00000000],
+		[-6.27284118, -0.00055452, 0.00033978, 0.00055734, -0.00000113, 0.00000000],
+		[-6.27284142, -0.00055442, 0.00033972, 0.00055724, -0.00000113, 0.00000000],
+		[-6.27284166, -0.00055432, 0.00033965, 0.00055714, -0.00000113, 0.00000000],
+		[-6.27284190, -0.00055422, 0.00033959, 0.00055704, -0.00000113, 0.00000000],
+		[-6.27284213, -0.00055412, 0.00033953, 0.00055694, -0.00000113, 0.00000000],
+		[-6.27284237, -0.00055402, 0.00033947, 0.00055684, -0.00000113, 0.00000000],
+		[-6.27284261, -0.00055393, 0.00033941, 0.00055674, -0.00000113, 0.00000000],
+		[-6.27284285, -0.00055383, 0.00033935, 0.00055664, -0.00000113, 0.00000000],
+		[-6.27284308, -0.00055373, 0.00033929, 0.00055654, -0.00000113, 0.00000000],
+		[-6.27284332, -0.00055363, 0.00033923, 0.00055644, -0.00000113, 0.00000000],
+		[-6.27284356, -0.00055353, 0.00033917, 0.00055634, -0.00000113, 0.00000000],
+		[-6.27284379, -0.00055343, 0.00033911, 0.00055624, -0.00000113, 0.00000000],
+		[-6.27284403, -0.00055333, 0.00033905, 0.00055614, -0.00000113, 0.00000000],
+		[-6.27284427, -0.00055323, 0.00033899, 0.00055604, -0.00000113, 0.00000000],
+		[-6.27284450, -0.00055313, 0.00033893, 0.00055594, -0.00000113, 0.00000000],
+		[-6.27284474, -0.00055303, 0.00033887, 0.00055584, -0.00000113, 0.00000000],
+		[-6.27284498, -0.00055294, 0.00033880, 0.00055574, -0.00000113, 0.00000000],
+		[-6.27284521, -0.00055284, 0.00033874, 0.00055564, -0.00000113, 0.00000000],
+		[-6.27284545, -0.00055274, 0.00033868, 0.00055555, -0.00000113, 0.00000000],
+		[-6.27284568, -0.00055264, 0.00033862, 0.00055545, -0.00000113, 0.00000000],
+		[-6.27284592, -0.00055254, 0.00033856, 0.00055535, -0.00000113, 0.00000000],
+		[-6.27284616, -0.00055244, 0.00033850, 0.00055525, -0.00000113, 0.00000000],
+		[-6.27284639, -0.00055234, 0.00033844, 0.00055515, -0.00000113, 0.00000000],
+		[-6.27284663, -0.00055225, 0.00033838, 0.00055505, -0.00000113, 0.00000000],
+		[-6.27284686, -0.00055215, 0.00033832, 0.00055495, -0.00000113, 0.00000000],
+		[-6.27284710, -0.00055205, 0.00033826, 0.00055485, -0.00000113, 0.00000000],
+		[-6.27284733, -0.00055195, 0.00033820, 0.00055475, -0.00000113, 0.00000000],
+		[-6.27284757, -0.00055185, 0.00033814, 0.00055465, -0.00000113, 0.00000000],
+		[-6.27284781, -0.00055175, 0.00033808, 0.00055455, -0.00000113, 0.00000000],
+		[-6.27284804, -0.00055165, 0.00033802, 0.00055446, -0.00000113, 0.00000000],
+		[-6.27284828, -0.00055156, 0.00033796, 0.00055436, -0.00000113, 0.00000000],
+		[-6.27284851, -0.00055146, 0.00033790, 0.00055426, -0.00000113, 0.00000000],
+		[-6.27284875, -0.00055136, 0.00033784, 0.00055416, -0.00000113, 0.00000000],
+		[-6.27284898, -0.00055126, 0.00033778, 0.00055406, -0.00000113, 0.00000000],
+		[-6.27284922, -0.00055116, 0.00033772, 0.00055396, -0.00000113, 0.00000000],
+		[-6.27284945, -0.00055107, 0.00033766, 0.00055386, -0.00000113, 0.00000000],
+		[-6.27284968, -0.00055097, 0.00033760, 0.00055377, -0.00000113, 0.00000000],
+		[-6.27284992, -0.00055087, 0.00033754, 0.00055367, -0.00000113, 0.00000000],
+		[-6.27285015, -0.00055077, 0.00033748, 0.00055357, -0.00000113, 0.00000000],
+		[-6.27285039, -0.00055067, 0.00033742, 0.00055347, -0.00000113, 0.00000000],
+		[-6.27285062, -0.00055058, 0.00033736, 0.00055337, -0.00000113, 0.00000000],
+		[-6.27285086, -0.00055048, 0.00033730, 0.00055327, -0.00000113, 0.00000000],
+		[-6.27285109, -0.00055038, 0.00033724, 0.00055317, -0.00000113, 0.00000000],
+		[-6.27285133, -0.00055028, 0.00033718, 0.00055308, -0.00000113, 0.00000000],
+		[-6.27285156, -0.00055018, 0.00033712, 0.00055298, -0.00000113, 0.00000000],
+		[-6.27285179, -0.00055009, 0.00033706, 0.00055288, -0.00000113, 0.00000000],
+		[-6.27285203, -0.00054999, 0.00033700, 0.00055278, -0.00000113, 0.00000000],
+		[-6.27285226, -0.00054989, 0.00033694, 0.00055268, -0.00000113, 0.00000000],
+		[-6.27285249, -0.00054979, 0.00033688, 0.00055258, -0.00000113, 0.00000000],
+		[-6.27285273, -0.00054970, 0.00033682, 0.00055249, -0.00000113, 0.00000000],
+		[-6.27285296, -0.00054960, 0.00033676, 0.00055239, -0.00000113, 0.00000000],
+		[-6.27285319, -0.00054950, 0.00033670, 0.00055229, -0.00000113, 0.00000000],
+		[-6.27285343, -0.00054940, 0.00033664, 0.00055219, -0.00000113, 0.00000000],
+		[-6.27285366, -0.00054931, 0.00033658, 0.00055209, -0.00000113, 0.00000000],
+		[-6.27285389, -0.00054921, 0.00033652, 0.00055200, -0.00000113, 0.00000000],
+		[-6.27285413, -0.00054911, 0.00033646, 0.00055190, -0.00000113, 0.00000000],
+		[-6.27285436, -0.00054901, 0.00033640, 0.00055180, -0.00000113, 0.00000000],
+		[-6.27285459, -0.00054892, 0.00033634, 0.00055170, -0.00000113, 0.00000000],
+		[-6.27285483, -0.00054882, 0.00033628, 0.00055160, -0.00000113, 0.00000000],
+		[-6.27285506, -0.00054872, 0.00033622, 0.00055151, -0.00000113, 0.00000000],
+		[-6.27285529, -0.00054862, 0.00033616, 0.00055141, -0.00000113, 0.00000000],
+		[-6.27285552, -0.00054853, 0.00033610, 0.00055131, -0.00000113, 0.00000000],
+		[-6.27285576, -0.00054843, 0.00033604, 0.00055121, -0.00000113, 0.00000000],
+		[-6.27285599, -0.00054833, 0.00033598, 0.00055112, -0.00000113, 0.00000000],
+		[-6.27285622, -0.00054824, 0.00033592, 0.00055102, -0.00000113, 0.00000000],
+		[-6.27285645, -0.00054814, 0.00033586, 0.00055092, -0.00000113, 0.00000000],
+		[-6.27285669, -0.00054804, 0.00033580, 0.00055082, -0.00000113, 0.00000000],
+		[-6.27285692, -0.00054794, 0.00033574, 0.00055073, -0.00000113, 0.00000000],
+		[-6.27285715, -0.00054785, 0.00033568, 0.00055063, -0.00000113, 0.00000000],
+		[-6.27285738, -0.00054775, 0.00033563, 0.00055053, -0.00000113, 0.00000000],
+		[-6.27285761, -0.00054765, 0.00033557, 0.00055043, -0.00000113, 0.00000000],
+		[-6.27285785, -0.00054756, 0.00033551, 0.00055034, -0.00000113, 0.00000000],
+		[-6.27285808, -0.00054746, 0.00033545, 0.00055024, -0.00000113, 0.00000000],
+		[-6.27285831, -0.00054736, 0.00033539, 0.00055014, -0.00000113, 0.00000000],
+		[-6.27285854, -0.00054727, 0.00033533, 0.00055004, -0.00000113, 0.00000000],
+		[-6.27285877, -0.00054717, 0.00033527, 0.00054995, -0.00000113, 0.00000000],
+		[-6.27285900, -0.00054707, 0.00033521, 0.00054985, -0.00000113, 0.00000000],
+		[-6.27285923, -0.00054698, 0.00033515, 0.00054975, -0.00000113, 0.00000000],
+		[-6.27285947, -0.00054688, 0.00033509, 0.00054966, -0.00000113, 0.00000000],
+		[-6.27285970, -0.00054678, 0.00033503, 0.00054956, -0.00000113, 0.00000000],
+		[-6.27285993, -0.00054669, 0.00033497, 0.00054946, -0.00000113, 0.00000000],
+		[-6.27286016, -0.00054659, 0.00033491, 0.00054936, -0.00000113, 0.00000000],
+		[-6.27286039, -0.00054649, 0.00033485, 0.00054927, -0.00000113, 0.00000000],
+		[-6.27286062, -0.00054640, 0.00033480, 0.00054917, -0.00000113, 0.00000000],
+		[-6.27286085, -0.00054630, 0.00033474, 0.00054907, -0.00000113, 0.00000000],
+		[-6.27286108, -0.00054620, 0.00033468, 0.00054898, -0.00000113, 0.00000000],
+		[-6.27286131, -0.00054611, 0.00033462, 0.00054888, -0.00000113, 0.00000000],
+		[-6.27286154, -0.00054601, 0.00033456, 0.00054878, -0.00000113, 0.00000000],
+		[-6.27286177, -0.00054591, 0.00033450, 0.00054869, -0.00000113, 0.00000000],
+		[-6.27286200, -0.00054582, 0.00033444, 0.00054859, -0.00000113, 0.00000000],
+		[-6.27286223, -0.00054572, 0.00033438, 0.00054849, -0.00000113, 0.00000000],
+		[-6.27286246, -0.00054563, 0.00033432, 0.00054840, -0.00000113, 0.00000000],
+		[-6.27286269, -0.00054553, 0.00033426, 0.00054830, -0.00000113, 0.00000000],
+		[-6.27286292, -0.00054543, 0.00033420, 0.00054820, -0.00000113, 0.00000000],
+		[-6.27286315, -0.00054534, 0.00033415, 0.00054811, -0.00000113, 0.00000000],
+		[-6.27286338, -0.00054524, 0.00033409, 0.00054801, -0.00000113, 0.00000000],
+		[-6.27286361, -0.00054515, 0.00033403, 0.00054791, -0.00000113, 0.00000000],
+		[-6.27286384, -0.00054505, 0.00033397, 0.00054782, -0.00000113, 0.00000000],
+		[-6.27286407, -0.00054495, 0.00033391, 0.00054772, -0.00000113, 0.00000000],
+		[-6.27286430, -0.00054486, 0.00033385, 0.00054762, -0.00000113, 0.00000000],
+		[-6.27286453, -0.00054476, 0.00033379, 0.00054753, -0.00000113, 0.00000000],
+		[-6.27286476, -0.00054467, 0.00033373, 0.00054743, -0.00000113, 0.00000000],
+		[-6.27286499, -0.00054457, 0.00033368, 0.00054733, -0.00000113, 0.00000000],
+		[-6.27286522, -0.00054447, 0.00033362, 0.00054724, -0.00000113, 0.00000000],
+		[-6.27286545, -0.00054438, 0.00033356, 0.00054714, -0.00000113, 0.00000000],
+		[-6.27286568, -0.00054428, 0.00033350, 0.00054705, -0.00000113, 0.00000000],
+		[-6.27286591, -0.00054419, 0.00033344, 0.00054695, -0.00000113, 0.00000000],
+		[-6.27286614, -0.00054409, 0.00033338, 0.00054685, -0.00000113, 0.00000000],
+		[-6.27286636, -0.00054400, 0.00033332, 0.00054676, -0.00000113, 0.00000000],
+		[-6.27286659, -0.00054390, 0.00033326, 0.00054666, -0.00000113, 0.00000000],
+		[-6.27286682, -0.00054380, 0.00033321, 0.00054657, -0.00000113, 0.00000000],
+		[-6.27286705, -0.00054371, 0.00033315, 0.00054647, -0.00000113, 0.00000000],
+		[-6.27286728, -0.00054361, 0.00033309, 0.00054637, -0.00000113, 0.00000000],
+		[-6.27286751, -0.00054352, 0.00033303, 0.00054628, -0.00000113, 0.00000000],
+		[-6.27286774, -0.00054342, 0.00033297, 0.00054618, -0.00000113, 0.00000000],
+		[-6.27286796, -0.00054333, 0.00033291, 0.00054609, -0.00000113, 0.00000000],
+		[-6.27286819, -0.00054323, 0.00033286, 0.00054599, -0.00000113, 0.00000000],
+		[-6.27286842, -0.00054314, 0.00033280, 0.00054589, -0.00000113, 0.00000000],
+		[-6.27286865, -0.00054304, 0.00033274, 0.00054580, -0.00000113, 0.00000000],
+		[-6.27286888, -0.00054295, 0.00033268, 0.00054570, -0.00000113, 0.00000000],
+		[-6.27286910, -0.00054285, 0.00033262, 0.00054561, -0.00000113, 0.00000000],
+		[-6.27286933, -0.00054276, 0.00033256, 0.00054551, -0.00000113, 0.00000000],
+		[-6.27286956, -0.00054266, 0.00033250, 0.00054542, -0.00000113, 0.00000000],
+		[-6.27286979, -0.00054257, 0.00033245, 0.00054532, -0.00000113, 0.00000000],
+		[-6.27287001, -0.00054247, 0.00033239, 0.00054522, -0.00000113, 0.00000000],
+		[-6.27287024, -0.00054238, 0.00033233, 0.00054513, -0.00000113, 0.00000000],
+		[-6.27287047, -0.00054228, 0.00033227, 0.00054503, -0.00000113, 0.00000000],
+		[-6.27287070, -0.00054219, 0.00033221, 0.00054494, -0.00000113, 0.00000000],
+		[-6.27287092, -0.00054209, 0.00033216, 0.00054484, -0.00000113, 0.00000000],
+		[-6.27287115, -0.00054200, 0.00033210, 0.00054475, -0.00000113, 0.00000000],
+		[-6.27287138, -0.00054190, 0.00033204, 0.00054465, -0.00000113, 0.00000000],
+		[-6.27287160, -0.00054181, 0.00033198, 0.00054456, -0.00000113, 0.00000000],
+		[-6.27287183, -0.00054171, 0.00033192, 0.00054446, -0.00000113, 0.00000000],
+		[-6.27287206, -0.00054162, 0.00033186, 0.00054437, -0.00000113, 0.00000000],
+		[-6.27287228, -0.00054152, 0.00033181, 0.00054427, -0.00000113, 0.00000000],
+		[-6.27287251, -0.00054143, 0.00033175, 0.00054417, -0.00000113, 0.00000000],
+		[-6.27287274, -0.00054133, 0.00033169, 0.00054408, -0.00000113, 0.00000000],
+		[-6.27287296, -0.00054124, 0.00033163, 0.00054398, -0.00000113, 0.00000000],
+		[-6.27287319, -0.00054114, 0.00033157, 0.00054389, -0.00000113, 0.00000000],
+		[-6.27287342, -0.00054105, 0.00033152, 0.00054379, -0.00000113, 0.00000000],
+		[-6.27287364, -0.00054095, 0.00033146, 0.00054370, -0.00000113, 0.00000000],
+		[-6.27287387, -0.00054086, 0.00033140, 0.00054360, -0.00000113, 0.00000000],
+		[-6.27287409, -0.00054076, 0.00033134, 0.00054351, -0.00000113, 0.00000000],
+		[-6.27287432, -0.00054067, 0.00033128, 0.00054341, -0.00000113, 0.00000000],
+		[-6.27287455, -0.00054058, 0.00033123, 0.00054332, -0.00000113, 0.00000000],
+		[-6.27287477, -0.00054048, 0.00033117, 0.00054322, -0.00000113, 0.00000000],
+		[-6.27287500, -0.00054039, 0.00033111, 0.00054313, -0.00000113, 0.00000000],
+		[-6.27287522, -0.00054029, 0.00033105, 0.00054304, -0.00000113, 0.00000000],
+		[-6.27287545, -0.00054020, 0.00033100, 0.00054294, -0.00000113, 0.00000000],
+		[-6.27287568, -0.00054010, 0.00033094, 0.00054285, -0.00000113, 0.00000000],
+		[-6.27287590, -0.00054001, 0.00033088, 0.00054275, -0.00000113, 0.00000000],
+		[-6.27287613, -0.00053992, 0.00033082, 0.00054266, -0.00000113, 0.00000000],
+		[-6.27287635, -0.00053982, 0.00033076, 0.00054256, -0.00000113, 0.00000000],
+		[-6.27287658, -0.00053973, 0.00033071, 0.00054247, -0.00000113, 0.00000000],
+		[-6.27287680, -0.00053963, 0.00033065, 0.00054237, -0.00000113, 0.00000000],
+		[-6.27287703, -0.00053954, 0.00033059, 0.00054228, -0.00000113, 0.00000000],
+		[-6.27287725, -0.00053945, 0.00033053, 0.00054218, -0.00000113, 0.00000000],
+		[-6.27287748, -0.00053935, 0.00033048, 0.00054209, -0.00000113, 0.00000000],
+		[-6.27287770, -0.00053926, 0.00033042, 0.00054199, -0.00000113, 0.00000000],
+		[-6.27287793, -0.00053916, 0.00033036, 0.00054190, -0.00000113, 0.00000000],
+		[-6.27287815, -0.00053907, 0.00033030, 0.00054181, -0.00000113, 0.00000000],
+		[-6.27287838, -0.00053898, 0.00033025, 0.00054171, -0.00000113, 0.00000000],
+		[-6.27287860, -0.00053888, 0.00033019, 0.00054162, -0.00000113, 0.00000000],
+		[-6.27287882, -0.00053879, 0.00033013, 0.00054152, -0.00000113, 0.00000000],
+		[-6.27287905, -0.00053869, 0.00033007, 0.00054143, -0.00000113, 0.00000000],
+		[-6.27287927, -0.00053860, 0.00033002, 0.00054133, -0.00000113, 0.00000000],
+		[-6.27287950, -0.00053851, 0.00032996, 0.00054124, -0.00000113, 0.00000000],
+		[-6.27287972, -0.00053841, 0.00032990, 0.00054115, -0.00000113, 0.00000000],
+		[-6.27287994, -0.00053832, 0.00032984, 0.00054105, -0.00000113, 0.00000000],
+		[-6.27288017, -0.00053823, 0.00032979, 0.00054096, -0.00000113, 0.00000000],
+		[-6.27288039, -0.00053813, 0.00032973, 0.00054086, -0.00000113, 0.00000000],
+		[-6.27288062, -0.00053804, 0.00032967, 0.00054077, -0.00000113, 0.00000000],
+		[-6.27288084, -0.00053795, 0.00032961, 0.00054068, -0.00000113, 0.00000000],
+		[-6.27288106, -0.00053785, 0.00032956, 0.00054058, -0.00000113, 0.00000000],
+		[-6.27288129, -0.00053776, 0.00032950, 0.00054049, -0.00000113, 0.00000000],
+		[-6.27288151, -0.00053767, 0.00032944, 0.00054039, -0.00000113, 0.00000000],
+		[-6.27288173, -0.00053757, 0.00032938, 0.00054030, -0.00000113, 0.00000000],
+		[-6.27288196, -0.00053748, 0.00032933, 0.00054021, -0.00000113, 0.00000000],
+		[-6.27288218, -0.00053739, 0.00032927, 0.00054011, -0.00000113, 0.00000000],
+		[-6.27288240, -0.00053729, 0.00032921, 0.00054002, -0.00000113, 0.00000000],
+		[-6.27288263, -0.00053720, 0.00032916, 0.00053992, -0.00000113, 0.00000000],
+		[-6.27288285, -0.00053711, 0.00032910, 0.00053983, -0.00000113, 0.00000000],
+		[-6.27288307, -0.00053701, 0.00032904, 0.00053974, -0.00000113, 0.00000000],
+		[-6.27288330, -0.00053692, 0.00032898, 0.00053964, -0.00000113, 0.00000000],
+		[-6.27288352, -0.00053683, 0.00032893, 0.00053955, -0.00000113, 0.00000000],
+		[-6.27288374, -0.00053673, 0.00032887, 0.00053946, -0.00000113, 0.00000000],
+		[-6.27288396, -0.00053664, 0.00032881, 0.00053936, -0.00000113, 0.00000000],
+		[-6.27288419, -0.00053655, 0.00032876, 0.00053927, -0.00000113, 0.00000000],
+		[-6.27288441, -0.00053645, 0.00032870, 0.00053918, -0.00000113, 0.00000000],
+		[-6.27288463, -0.00053636, 0.00032864, 0.00053908, -0.00000113, 0.00000000],
+		[-6.27288485, -0.00053627, 0.00032859, 0.00053899, -0.00000113, 0.00000000],
+		[-6.27288508, -0.00053618, 0.00032853, 0.00053890, -0.00000113, 0.00000000],
+		[-6.27288530, -0.00053608, 0.00032847, 0.00053880, -0.00000113, 0.00000000],
+		[-6.27288552, -0.00053599, 0.00032841, 0.00053871, -0.00000113, 0.00000000],
+		[-6.27288574, -0.00053590, 0.00032836, 0.00053862, -0.00000113, 0.00000000],
+		[-6.27288596, -0.00053580, 0.00032830, 0.00053852, -0.00000113, 0.00000000],
+		[-6.27288619, -0.00053571, 0.00032824, 0.00053843, -0.00000113, 0.00000000],
+		[-6.27288641, -0.00053562, 0.00032819, 0.00053834, -0.00000113, 0.00000000],
+		[-6.27288663, -0.00053553, 0.00032813, 0.00053824, -0.00000113, 0.00000000],
+		[-6.27288685, -0.00053543, 0.00032807, 0.00053815, -0.00000113, 0.00000000],
+		[-6.27288707, -0.00053534, 0.00032802, 0.00053806, -0.00000113, 0.00000000],
+		[-6.27288729, -0.00053525, 0.00032796, 0.00053796, -0.00000113, 0.00000000],
+		[-6.27288752, -0.00053516, 0.00032790, 0.00053787, -0.00000113, 0.00000000],
+		[-6.27288774, -0.00053506, 0.00032785, 0.00053778, -0.00000113, 0.00000000],
+		[-6.27288796, -0.00053497, 0.00032779, 0.00053769, -0.00000113, 0.00000000],
+		[-6.27288818, -0.00053488, 0.00032773, 0.00053759, -0.00000113, 0.00000000],
+		[-6.27288840, -0.00053479, 0.00032768, 0.00053750, -0.00000113, 0.00000000],
+		[-6.27288862, -0.00053469, 0.00032762, 0.00053741, -0.00000113, 0.00000000],
+		[-6.27288884, -0.00053460, 0.00032756, 0.00053731, -0.00000113, 0.00000000],
+		[-6.27288906, -0.00053451, 0.00032751, 0.00053722, -0.00000113, 0.00000000],
+		[-6.27288928, -0.00053442, 0.00032745, 0.00053713, -0.00000113, 0.00000000],
+		[-6.27288950, -0.00053432, 0.00032739, 0.00053704, -0.00000113, 0.00000000],
+		[-6.27288973, -0.00053423, 0.00032734, 0.00053694, -0.00000113, 0.00000000],
+		[-6.27288995, -0.00053414, 0.00032728, 0.00053685, -0.00000113, 0.00000000],
+		[-6.27289017, -0.00053405, 0.00032722, 0.00053676, -0.00000113, 0.00000000],
+		[-6.27289039, -0.00053396, 0.00032717, 0.00053666, -0.00000113, 0.00000000],
+		[-6.27289061, -0.00053386, 0.00032711, 0.00053657, -0.00000113, 0.00000000],
+		[-6.27289083, -0.00053377, 0.00032705, 0.00053648, -0.00000113, 0.00000000],
+		[-6.27289105, -0.00053368, 0.00032700, 0.00053639, -0.00000113, 0.00000000],
+		[-6.27289127, -0.00053359, 0.00032694, 0.00053629, -0.00000113, 0.00000000],
+		[-6.27289149, -0.00053350, 0.00032689, 0.00053620, -0.00000113, 0.00000000],
+		[-6.27289171, -0.00053340, 0.00032683, 0.00053611, -0.00000113, 0.00000000],
+		[-6.27289193, -0.00053331, 0.00032677, 0.00053602, -0.00000113, 0.00000000],
+		[-6.27289215, -0.00053322, 0.00032672, 0.00053593, -0.00000113, 0.00000000],
+		[-6.27289237, -0.00053313, 0.00032666, 0.00053583, -0.00000113, 0.00000000],
+		[-6.27289259, -0.00053304, 0.00032660, 0.00053574, -0.00000113, 0.00000000],
+		[-6.27289281, -0.00053294, 0.00032655, 0.00053565, -0.00000113, 0.00000000],
+		[-6.27289303, -0.00053285, 0.00032649, 0.00053556, -0.00000113, 0.00000000],
+		[-6.27289325, -0.00053276, 0.00032643, 0.00053546, -0.00000113, 0.00000000],
+		[-6.27289346, -0.00053267, 0.00032638, 0.00053537, -0.00000113, 0.00000000],
+		[-6.27289368, -0.00053258, 0.00032632, 0.00053528, -0.00000113, 0.00000000],
+		[-6.27289390, -0.00053249, 0.00032627, 0.00053519, -0.00000113, 0.00000000],
+		[-6.27289412, -0.00053239, 0.00032621, 0.00053510, -0.00000113, 0.00000000],
+		[-6.27289434, -0.00053230, 0.00032615, 0.00053500, -0.00000113, 0.00000000],
+		[-6.27289456, -0.00053221, 0.00032610, 0.00053491, -0.00000113, 0.00000000],
+		[-6.27289478, -0.00053212, 0.00032604, 0.00053482, -0.00000113, 0.00000000],
+		[-6.27289500, -0.00053203, 0.00032599, 0.00053473, -0.00000113, 0.00000000],
+		[-6.27289522, -0.00053194, 0.00032593, 0.00053464, -0.00000113, 0.00000000],
+		[-6.27289544, -0.00053185, 0.00032587, 0.00053454, -0.00000113, 0.00000000],
+		[-6.27289565, -0.00053175, 0.00032582, 0.00053445, -0.00000113, 0.00000000],
+		[-6.27289587, -0.00053166, 0.00032576, 0.00053436, -0.00000113, 0.00000000],
+		[-6.27289609, -0.00053157, 0.00032571, 0.00053427, -0.00000113, 0.00000000],
+		[-6.27289631, -0.00053148, 0.00032565, 0.00053418, -0.00000113, 0.00000000],
+		[-6.27289653, -0.00053139, 0.00032559, 0.00053408, -0.00000113, 0.00000000],
+		[-6.27289675, -0.00053130, 0.00032554, 0.00053399, -0.00000113, 0.00000000],
+		[-6.27289696, -0.00053121, 0.00032548, 0.00053390, -0.00000113, 0.00000000],
+		[-6.27289718, -0.00053112, 0.00032543, 0.00053381, -0.00000113, 0.00000000],
+		[-6.27289740, -0.00053102, 0.00032537, 0.00053372, -0.00000113, 0.00000000],
+		[-6.27289762, -0.00053093, 0.00032531, 0.00053363, -0.00000113, 0.00000000],
+		[-6.27289784, -0.00053084, 0.00032526, 0.00053354, -0.00000113, 0.00000000],
+		[-6.27289805, -0.00053075, 0.00032520, 0.00053344, -0.00000113, 0.00000000],
+		[-6.27289827, -0.00053066, 0.00032515, 0.00053335, -0.00000113, 0.00000000],
+		[-6.27289849, -0.00053057, 0.00032509, 0.00053326, -0.00000113, 0.00000000],
+		[-6.27289871, -0.00053048, 0.00032504, 0.00053317, -0.00000113, 0.00000000],
+		[-6.27289892, -0.00053039, 0.00032498, 0.00053308, -0.00000113, 0.00000000],
+		[-6.27289914, -0.00053030, 0.00032492, 0.00053299, -0.00000113, 0.00000000],
+		[-6.27289936, -0.00053021, 0.00032487, 0.00053290, -0.00000113, 0.00000000],
+		[-6.27289958, -0.00053012, 0.00032481, 0.00053280, -0.00000113, 0.00000000],
+		[-6.27289979, -0.00053002, 0.00032476, 0.00053271, -0.00000113, 0.00000000],
+		[-6.27290001, -0.00052993, 0.00032470, 0.00053262, -0.00000113, 0.00000000],
+		[-6.27290023, -0.00052984, 0.00032465, 0.00053253, -0.00000113, 0.00000000],
+		[-6.27290044, -0.00052975, 0.00032459, 0.00053244, -0.00000113, 0.00000000],
+		[-6.27290066, -0.00052966, 0.00032453, 0.00053235, -0.00000113, 0.00000000],
+		[-6.27290088, -0.00052957, 0.00032448, 0.00053226, -0.00000113, 0.00000000],
+		[-6.27290109, -0.00052948, 0.00032442, 0.00053217, -0.00000113, 0.00000000],
+		[-6.27290131, -0.00052939, 0.00032437, 0.00053208, -0.00000113, 0.00000000],
+		[-6.27290153, -0.00052930, 0.00032431, 0.00053198, -0.00000113, 0.00000000],
+		[-6.27290174, -0.00052921, 0.00032426, 0.00053189, -0.00000113, 0.00000000],
+		[-6.27290196, -0.00052912, 0.00032420, 0.00053180, -0.00000113, 0.00000000],
+		[-6.27290218, -0.00052903, 0.00032415, 0.00053171, -0.00000113, 0.00000000],
+		[-6.27290239, -0.00052894, 0.00032409, 0.00053162, -0.00000113, 0.00000000],
+		[-6.27290261, -0.00052885, 0.00032404, 0.00053153, -0.00000113, 0.00000000],
+		[-6.27290283, -0.00052876, 0.00032398, 0.00053144, -0.00000113, 0.00000000],
+		[-6.27290304, -0.00052867, 0.00032392, 0.00053135, -0.00000113, 0.00000000],
+		[-6.27290326, -0.00052858, 0.00032387, 0.00053126, -0.00000113, 0.00000000],
+		[-6.27290347, -0.00052849, 0.00032381, 0.00053117, -0.00000113, 0.00000000],
+		[-6.27290369, -0.00052840, 0.00032376, 0.00053108, -0.00000113, 0.00000000],
+		[-6.27290391, -0.00052831, 0.00032370, 0.00053099, -0.00000113, 0.00000000],
+		[-6.27290412, -0.00052822, 0.00032365, 0.00053089, -0.00000113, 0.00000000],
+		[-6.27290434, -0.00052813, 0.00032359, 0.00053080, -0.00000113, 0.00000000],
+		[-6.27290455, -0.00052804, 0.00032354, 0.00053071, -0.00000113, 0.00000000],
+		[-6.27290477, -0.00052795, 0.00032348, 0.00053062, -0.00000113, 0.00000000],
+		[-6.27290498, -0.00052786, 0.00032343, 0.00053053, -0.00000113, 0.00000000],
+		[-6.27290520, -0.00052777, 0.00032337, 0.00053044, -0.00000113, 0.00000000],
+		[-6.27290541, -0.00052768, 0.00032332, 0.00053035, -0.00000113, 0.00000000],
+		[-6.27290563, -0.00052759, 0.00032326, 0.00053026, -0.00000113, 0.00000000],
+		[-6.27290584, -0.00052750, 0.00032321, 0.00053017, -0.00000113, 0.00000000],
+		[-6.27290606, -0.00052741, 0.00032315, 0.00053008, -0.00000113, 0.00000000],
+		[-6.27290627, -0.00052732, 0.00032310, 0.00052999, -0.00000113, 0.00000000],
+		[-6.27290649, -0.00052723, 0.00032304, 0.00052990, -0.00000113, 0.00000000],
+		[-6.27290670, -0.00052714, 0.00032299, 0.00052981, -0.00000113, 0.00000000],
+		[-6.27290692, -0.00052705, 0.00032293, 0.00052972, -0.00000113, 0.00000000],
+		[-6.27290713, -0.00052696, 0.00032288, 0.00052963, -0.00000113, 0.00000000],
+		[-6.27290735, -0.00052687, 0.00032282, 0.00052954, -0.00000113, 0.00000000],
+		[-6.27290756, -0.00052678, 0.00032277, 0.00052945, -0.00000113, 0.00000000],
+		[-6.27290778, -0.00052669, 0.00032271, 0.00052936, -0.00000113, 0.00000000],
+		[-6.27290799, -0.00052660, 0.00032266, 0.00052927, -0.00000113, 0.00000000],
+		[-6.27290821, -0.00052651, 0.00032260, 0.00052918, -0.00000113, 0.00000000],
+		[-6.27290842, -0.00052642, 0.00032255, 0.00052909, -0.00000113, 0.00000000],
+		[-6.27290863, -0.00052633, 0.00032249, 0.00052900, -0.00000113, 0.00000000],
+		[-6.27290885, -0.00052624, 0.00032244, 0.00052891, -0.00000113, 0.00000000],
+		[-6.27290906, -0.00052615, 0.00032238, 0.00052882, -0.00000113, 0.00000000],
+		[-6.27290928, -0.00052606, 0.00032233, 0.00052873, -0.00000113, 0.00000000],
+		[-6.27290949, -0.00052597, 0.00032227, 0.00052864, -0.00000113, 0.00000000],
+		[-6.27290970, -0.00052588, 0.00032222, 0.00052855, -0.00000113, 0.00000000],
+		[-6.27290992, -0.00052579, 0.00032216, 0.00052846, -0.00000113, 0.00000000],
+		[-6.27291013, -0.00052570, 0.00032211, 0.00052837, -0.00000113, 0.00000000],
+		[-6.27291034, -0.00052561, 0.00032205, 0.00052828, -0.00000113, 0.00000000],
+		[-6.27291056, -0.00052553, 0.00032200, 0.00052819, -0.00000113, 0.00000000],
+		[-6.27291077, -0.00052544, 0.00032194, 0.00052810, -0.00000113, 0.00000000],
+		[-6.27291098, -0.00052535, 0.00032189, 0.00052801, -0.00000113, 0.00000000],
+		[-6.27291120, -0.00052526, 0.00032183, 0.00052792, -0.00000113, 0.00000000],
+		[-6.27291141, -0.00052517, 0.00032178, 0.00052783, -0.00000113, 0.00000000],
+		[-6.27291162, -0.00052508, 0.00032173, 0.00052774, -0.00000113, 0.00000000],
+		[-6.27291184, -0.00052499, 0.00032167, 0.00052765, -0.00000113, 0.00000000],
+		[-6.27291205, -0.00052490, 0.00032162, 0.00052756, -0.00000113, 0.00000000],
+		[-6.27291226, -0.00052481, 0.00032156, 0.00052747, -0.00000113, 0.00000000],
+		[-6.27291248, -0.00052472, 0.00032151, 0.00052738, -0.00000113, 0.00000000],
+		[-6.27291269, -0.00052463, 0.00032145, 0.00052730, -0.00000113, 0.00000000],
+		[-6.27291290, -0.00052455, 0.00032140, 0.00052721, -0.00000113, 0.00000000],
+		[-6.27291311, -0.00052446, 0.00032134, 0.00052712, -0.00000113, 0.00000000],
+		[-6.27291333, -0.00052437, 0.00032129, 0.00052703, -0.00000113, 0.00000000],
+		[-6.27291354, -0.00052428, 0.00032123, 0.00052694, -0.00000113, 0.00000000],
+		[-6.27291375, -0.00052419, 0.00032118, 0.00052685, -0.00000113, 0.00000000],
+		[-6.27291396, -0.00052410, 0.00032113, 0.00052676, -0.00000113, 0.00000000],
+		[-6.27291418, -0.00052401, 0.00032107, 0.00052667, -0.00000113, 0.00000000],
+		[-6.27291439, -0.00052392, 0.00032102, 0.00052658, -0.00000113, 0.00000000],
+		[-6.27291460, -0.00052384, 0.00032096, 0.00052649, -0.00000113, 0.00000000],
+		[-6.27291481, -0.00052375, 0.00032091, 0.00052640, -0.00000113, 0.00000000],
+		[-6.27291503, -0.00052366, 0.00032085, 0.00052631, -0.00000113, 0.00000000],
+		[-6.27291524, -0.00052357, 0.00032080, 0.00052622, -0.00000113, 0.00000000],
+		[-6.27291545, -0.00052348, 0.00032075, 0.00052614, -0.00000113, 0.00000000],
+		[-6.27291566, -0.00052339, 0.00032069, 0.00052605, -0.00000113, 0.00000000],
+		[-6.27291587, -0.00052330, 0.00032064, 0.00052596, -0.00000113, 0.00000000],
+		[-6.27291608, -0.00052322, 0.00032058, 0.00052587, -0.00000113, 0.00000000],
+		[-6.27291630, -0.00052313, 0.00032053, 0.00052578, -0.00000113, 0.00000000],
+		[-6.27291651, -0.00052304, 0.00032047, 0.00052569, -0.00000113, 0.00000000],
+		[-6.27291672, -0.00052295, 0.00032042, 0.00052560, -0.00000113, 0.00000000],
+		[-6.27291693, -0.00052286, 0.00032037, 0.00052551, -0.00000113, 0.00000000],
+		[-6.27291714, -0.00052277, 0.00032031, 0.00052542, -0.00000113, 0.00000000],
+		[-6.27291735, -0.00052269, 0.00032026, 0.00052534, -0.00000113, 0.00000000],
+		[-6.27291756, -0.00052260, 0.00032020, 0.00052525, -0.00000113, 0.00000000],
+		[-6.27291777, -0.00052251, 0.00032015, 0.00052516, -0.00000113, 0.00000000],
+		[-6.27291799, -0.00052242, 0.00032010, 0.00052507, -0.00000113, 0.00000000],
+		[-6.27291820, -0.00052233, 0.00032004, 0.00052498, -0.00000113, 0.00000000],
+		[-6.27291841, -0.00052225, 0.00031999, 0.00052489, -0.00000113, 0.00000000],
+		[-6.27291862, -0.00052216, 0.00031993, 0.00052480, -0.00000113, 0.00000000],
+		[-6.27291883, -0.00052207, 0.00031988, 0.00052472, -0.00000113, 0.00000000],
+		[-6.27291904, -0.00052198, 0.00031983, 0.00052463, -0.00000113, 0.00000000],
+		[-6.27291925, -0.00052189, 0.00031977, 0.00052454, -0.00000113, 0.00000000],
+		[-6.27291946, -0.00052180, 0.00031972, 0.00052445, -0.00000113, 0.00000000],
+		[-6.27291967, -0.00052172, 0.00031966, 0.00052436, -0.00000113, 0.00000000],
+		[-6.27291988, -0.00052163, 0.00031961, 0.00052427, -0.00000113, 0.00000000],
+		[-6.27292009, -0.00052154, 0.00031956, 0.00052419, -0.00000113, 0.00000000],
+		[-6.27292030, -0.00052145, 0.00031950, 0.00052410, -0.00000113, 0.00000000],
+		[-6.27292051, -0.00052137, 0.00031945, 0.00052401, -0.00000113, 0.00000000],
+		[-6.27292072, -0.00052128, 0.00031939, 0.00052392, -0.00000113, 0.00000000],
+		[-6.27292093, -0.00052119, 0.00031934, 0.00052383, -0.00000113, 0.00000000],
+		[-6.27292114, -0.00052110, 0.00031929, 0.00052374, -0.00000113, 0.00000000],
+		[-6.27292135, -0.00052101, 0.00031923, 0.00052366, -0.00000113, 0.00000000],
+		[-6.27292156, -0.00052093, 0.00031918, 0.00052357, -0.00000113, 0.00000000],
+		[-6.27292177, -0.00052084, 0.00031913, 0.00052348, -0.00000113, 0.00000000],
+		[-6.27292198, -0.00052075, 0.00031907, 0.00052339, -0.00000113, 0.00000000],
+		[-6.27292219, -0.00052066, 0.00031902, 0.00052330, -0.00000113, 0.00000000],
+		[-6.27292240, -0.00052058, 0.00031896, 0.00052322, -0.00000113, 0.00000000],
+		[-6.27292261, -0.00052049, 0.00031891, 0.00052313, -0.00000113, 0.00000000],
+		[-6.27292282, -0.00052040, 0.00031886, 0.00052304, -0.00000113, 0.00000000],
+		[-6.27292303, -0.00052031, 0.00031880, 0.00052295, -0.00000113, 0.00000000],
+		[-6.27292324, -0.00052023, 0.00031875, 0.00052286, -0.00000113, 0.00000000],
+		[-6.27292345, -0.00052014, 0.00031870, 0.00052278, -0.00000113, 0.00000000],
+		[-6.27292366, -0.00052005, 0.00031864, 0.00052269, -0.00000113, 0.00000000],
+		[-6.27292386, -0.00051996, 0.00031859, 0.00052260, -0.00000113, 0.00000000],
+		[-6.27292407, -0.00051988, 0.00031854, 0.00052251, -0.00000113, 0.00000000],
+		[-6.27292428, -0.00051979, 0.00031848, 0.00052242, -0.00000113, 0.00000000],
+		[-6.27292449, -0.00051970, 0.00031843, 0.00052234, -0.00000113, 0.00000000],
+		[-6.27292470, -0.00051962, 0.00031837, 0.00052225, -0.00000113, 0.00000000],
+		[-6.27292491, -0.00051953, 0.00031832, 0.00052216, -0.00000113, 0.00000000],
+		[-6.27292512, -0.00051944, 0.00031827, 0.00052207, -0.00000113, 0.00000000],
+		[-6.27292533, -0.00051935, 0.00031821, 0.00052199, -0.00000113, 0.00000000],
+		[-6.27292553, -0.00051927, 0.00031816, 0.00052190, -0.00000113, 0.00000000],
+		[-6.27292574, -0.00051918, 0.00031811, 0.00052181, -0.00000113, 0.00000000],
+		[-6.27292595, -0.00051909, 0.00031805, 0.00052172, -0.00000113, 0.00000000],
+		[-6.27292616, -0.00051901, 0.00031800, 0.00052164, -0.00000113, 0.00000000],
+		[-6.27292637, -0.00051892, 0.00031795, 0.00052155, -0.00000113, 0.00000000],
+		[-6.27292658, -0.00051883, 0.00031789, 0.00052146, -0.00000113, 0.00000000],
+		[-6.27292678, -0.00051874, 0.00031784, 0.00052137, -0.00000113, 0.00000000],
+		[-6.27292699, -0.00051866, 0.00031779, 0.00052129, -0.00000113, 0.00000000],
+		[-6.27292720, -0.00051857, 0.00031773, 0.00052120, -0.00000113, 0.00000000],
+		[-6.27292741, -0.00051848, 0.00031768, 0.00052111, -0.00000113, 0.00000000],
+		[-6.27292762, -0.00051840, 0.00031763, 0.00052102, -0.00000113, 0.00000000],
+		[-6.27292782, -0.00051831, 0.00031757, 0.00052094, -0.00000113, 0.00000000],
+		[-6.27292803, -0.00051822, 0.00031752, 0.00052085, -0.00000113, 0.00000000],
+		[-6.27292824, -0.00051814, 0.00031747, 0.00052076, -0.00000113, 0.00000000],
+		[-6.27292845, -0.00051805, 0.00031742, 0.00052068, -0.00000113, 0.00000000],
+		[-6.27292865, -0.00051796, 0.00031736, 0.00052059, -0.00000113, 0.00000000],
+		[-6.27292886, -0.00051788, 0.00031731, 0.00052050, -0.00000113, 0.00000000],
+		[-6.27292907, -0.00051779, 0.00031726, 0.00052041, -0.00000113, 0.00000000],
+		[-6.27292927, -0.00051770, 0.00031720, 0.00052033, -0.00000113, 0.00000000],
+		[-6.27292948, -0.00051762, 0.00031715, 0.00052024, -0.00000113, 0.00000000],
+		[-6.27292969, -0.00051753, 0.00031710, 0.00052015, -0.00000113, 0.00000000],
+		[-6.27292990, -0.00051744, 0.00031704, 0.00052007, -0.00000113, 0.00000000],
+		[-6.27293010, -0.00051736, 0.00031699, 0.00051998, -0.00000113, 0.00000000],
+		[-6.27293031, -0.00051727, 0.00031694, 0.00051989, -0.00000113, 0.00000000],
+		[-6.27293052, -0.00051718, 0.00031688, 0.00051981, -0.00000113, 0.00000000],
+		[-6.27293072, -0.00051710, 0.00031683, 0.00051972, -0.00000113, 0.00000000],
+		[-6.27293093, -0.00051701, 0.00031678, 0.00051963, -0.00000113, 0.00000000],
+		[-6.27293114, -0.00051693, 0.00031673, 0.00051955, -0.00000113, 0.00000000],
+		[-6.27293134, -0.00051684, 0.00031667, 0.00051946, -0.00000113, 0.00000000],
+		[-6.27293155, -0.00051675, 0.00031662, 0.00051937, -0.00000113, 0.00000000],
+		[-6.27293176, -0.00051667, 0.00031657, 0.00051929, -0.00000113, 0.00000000],
+		[-6.27293196, -0.00051658, 0.00031651, 0.00051920, -0.00000113, 0.00000000],
+		[-6.27293217, -0.00051649, 0.00031646, 0.00051911, -0.00000113, 0.00000000],
+		[-6.27293237, -0.00051641, 0.00031641, 0.00051903, -0.00000113, 0.00000000],
+		[-6.27293258, -0.00051632, 0.00031636, 0.00051894, -0.00000113, 0.00000000],
+		[-6.27293279, -0.00051624, 0.00031630, 0.00051885, -0.00000113, 0.00000000],
+		[-6.27293299, -0.00051615, 0.00031625, 0.00051877, -0.00000113, 0.00000000],
+		[-6.27293320, -0.00051606, 0.00031620, 0.00051868, -0.00000113, 0.00000000],
+		[-6.27293340, -0.00051598, 0.00031614, 0.00051859, -0.00000113, 0.00000000],
+		[-6.27293361, -0.00051589, 0.00031609, 0.00051851, -0.00000113, 0.00000000],
+		[-6.27293382, -0.00051581, 0.00031604, 0.00051842, -0.00000113, 0.00000000],
+		[-6.27293402, -0.00051572, 0.00031599, 0.00051833, -0.00000113, 0.00000000],
+		[-6.27293423, -0.00051563, 0.00031593, 0.00051825, -0.00000113, 0.00000000],
+		[-6.27293443, -0.00051555, 0.00031588, 0.00051816, -0.00000113, 0.00000000],
+		[-6.27293464, -0.00051546, 0.00031583, 0.00051807, -0.00000113, 0.00000000],
+		[-6.27293484, -0.00051538, 0.00031578, 0.00051799, -0.00000113, 0.00000000],
+		[-6.27293505, -0.00051529, 0.00031572, 0.00051790, -0.00000113, 0.00000000],
+		[-6.27293525, -0.00051520, 0.00031567, 0.00051782, -0.00000113, 0.00000000],
+		[-6.27293546, -0.00051512, 0.00031562, 0.00051773, -0.00000113, 0.00000000],
+		[-6.27293566, -0.00051503, 0.00031557, 0.00051764, -0.00000113, 0.00000000],
+		[-6.27293587, -0.00051495, 0.00031551, 0.00051756, -0.00000113, 0.00000000],
+		[-6.27293607, -0.00051486, 0.00031546, 0.00051747, -0.00000113, 0.00000000],
+		[-6.27293628, -0.00051478, 0.00031541, 0.00051739, -0.00000113, 0.00000000],
+		[-6.27293648, -0.00051469, 0.00031536, 0.00051730, -0.00000113, 0.00000000],
+		[-6.27293669, -0.00051461, 0.00031530, 0.00051721, -0.00000113, 0.00000000],
+		[-6.27293689, -0.00051452, 0.00031525, 0.00051713, -0.00000113, 0.00000000],
+		[-6.27293710, -0.00051443, 0.00031520, 0.00051704, -0.00000113, 0.00000000],
+		[-6.27293730, -0.00051435, 0.00031515, 0.00051696, -0.00000113, 0.00000000],
+		[-6.27293751, -0.00051426, 0.00031509, 0.00051687, -0.00000113, 0.00000000],
+		[-6.27293771, -0.00051418, 0.00031504, 0.00051678, -0.00000113, 0.00000000],
+		[-6.27293792, -0.00051409, 0.00031499, 0.00051670, -0.00000113, 0.00000000],
+		[-6.27293812, -0.00051401, 0.00031494, 0.00051661, -0.00000113, 0.00000000],
+		[-6.27293832, -0.00051392, 0.00031488, 0.00051653, -0.00000113, 0.00000000],
+		[-6.27293853, -0.00051384, 0.00031483, 0.00051644, -0.00000113, 0.00000000],
+		[-6.27293873, -0.00051375, 0.00031478, 0.00051635, -0.00000113, 0.00000000],
+		[-6.27293894, -0.00051367, 0.00031473, 0.00051627, -0.00000113, 0.00000000],
+		[-6.27293914, -0.00051358, 0.00031467, 0.00051618, -0.00000113, 0.00000000],
+		[-6.27293934, -0.00051350, 0.00031462, 0.00051610, -0.00000113, 0.00000000],
+		[-6.27293955, -0.00051341, 0.00031457, 0.00051601, -0.00000113, 0.00000000],
+		[-6.27293975, -0.00051333, 0.00031452, 0.00051593, -0.00000113, 0.00000000],
+		[-6.27293995, -0.00051324, 0.00031447, 0.00051584, -0.00000113, 0.00000000],
+		[-6.27294016, -0.00051315, 0.00031441, 0.00051576, -0.00000113, 0.00000000],
+		[-6.27294036, -0.00051307, 0.00031436, 0.00051567, -0.00000113, 0.00000000],
+		[-6.27294057, -0.00051298, 0.00031431, 0.00051558, -0.00000113, 0.00000000],
+		[-6.27294077, -0.00051290, 0.00031426, 0.00051550, -0.00000113, 0.00000000],
+		[-6.27294097, -0.00051281, 0.00031421, 0.00051541, -0.00000113, 0.00000000],
+		[-6.27294118, -0.00051273, 0.00031415, 0.00051533, -0.00000113, 0.00000000],
+		[-6.27294138, -0.00051265, 0.00031410, 0.00051524, -0.00000113, 0.00000000],
+		[-6.27294158, -0.00051256, 0.00031405, 0.00051516, -0.00000113, 0.00000000],
+		[-6.27294178, -0.00051248, 0.00031400, 0.00051507, -0.00000113, 0.00000000],
+		[-6.27294199, -0.00051239, 0.00031395, 0.00051499, -0.00000113, 0.00000000],
+		[-6.27294219, -0.00051231, 0.00031389, 0.00051490, -0.00000113, 0.00000000],
+		[-6.27294239, -0.00051222, 0.00031384, 0.00051482, -0.00000113, 0.00000000],
+		[-6.27294260, -0.00051214, 0.00031379, 0.00051473, -0.00000113, 0.00000000],
+		[-6.27294280, -0.00051205, 0.00031374, 0.00051465, -0.00000113, 0.00000000],
+		[-6.27294300, -0.00051197, 0.00031369, 0.00051456, -0.00000113, 0.00000000],
+		[-6.27294320, -0.00051188, 0.00031363, 0.00051448, -0.00000113, 0.00000000],
+		[-6.27294341, -0.00051180, 0.00031358, 0.00051439, -0.00000113, 0.00000000],
+		[-6.27294361, -0.00051171, 0.00031353, 0.00051431, -0.00000113, 0.00000000],
+		[-6.27294381, -0.00051163, 0.00031348, 0.00051422, -0.00000113, 0.00000000],
+		[-6.27294401, -0.00051154, 0.00031343, 0.00051414, -0.00000113, 0.00000000],
+		[-6.27294422, -0.00051146, 0.00031337, 0.00051405, -0.00000113, 0.00000000],
+		[-6.27294442, -0.00051137, 0.00031332, 0.00051397, -0.00000113, 0.00000000],
+		[-6.27294462, -0.00051129, 0.00031327, 0.00051388, -0.00000113, 0.00000000],
+		[-6.27294482, -0.00051121, 0.00031322, 0.00051380, -0.00000113, 0.00000000],
+		[-6.27294502, -0.00051112, 0.00031317, 0.00051371, -0.00000113, 0.00000000],
+		[-6.27294523, -0.00051104, 0.00031312, 0.00051363, -0.00000113, 0.00000000],
+		[-6.27294543, -0.00051095, 0.00031306, 0.00051354, -0.00000113, 0.00000000],
+		[-6.27294563, -0.00051087, 0.00031301, 0.00051346, -0.00000113, 0.00000000],
+		[-6.27294583, -0.00051078, 0.00031296, 0.00051337, -0.00000113, 0.00000000],
+		[-6.27294603, -0.00051070, 0.00031291, 0.00051329, -0.00000113, 0.00000000],
+		[-6.27294623, -0.00051062, 0.00031286, 0.00051320, -0.00000113, 0.00000000],
+		[-6.27294644, -0.00051053, 0.00031281, 0.00051312, -0.00000113, 0.00000000],
+		[-6.27294664, -0.00051045, 0.00031275, 0.00051303, -0.00000113, 0.00000000],
+		[-6.27294684, -0.00051036, 0.00031270, 0.00051295, -0.00000113, 0.00000000],
+		[-6.27294704, -0.00051028, 0.00031265, 0.00051286, -0.00000113, 0.00000000],
+		[-6.27294724, -0.00051019, 0.00031260, 0.00051278, -0.00000113, 0.00000000],
+		[-6.27294744, -0.00051011, 0.00031255, 0.00051270, -0.00000113, 0.00000000],
+		[-6.27294764, -0.00051003, 0.00031250, 0.00051261, -0.00000113, 0.00000000],
+		[-6.27294784, -0.00050994, 0.00031244, 0.00051253, -0.00000113, 0.00000000],
+		[-6.27294805, -0.00050986, 0.00031239, 0.00051244, -0.00000113, 0.00000000],
+		[-6.27294825, -0.00050977, 0.00031234, 0.00051236, -0.00000113, 0.00000000],
+		[-6.27294845, -0.00050969, 0.00031229, 0.00051227, -0.00000113, 0.00000000],
+		[-6.27294865, -0.00050961, 0.00031224, 0.00051219, -0.00000113, 0.00000000],
+		[-6.27294885, -0.00050952, 0.00031219, 0.00051210, -0.00000113, 0.00000000],
+		[-6.27294905, -0.00050944, 0.00031214, 0.00051202, -0.00000113, 0.00000000],
+		[-6.27294925, -0.00050936, 0.00031208, 0.00051194, -0.00000113, 0.00000000],
+		[-6.27294945, -0.00050927, 0.00031203, 0.00051185, -0.00000113, 0.00000000],
+		[-6.27294965, -0.00050919, 0.00031198, 0.00051177, -0.00000113, 0.00000000],
+		[-6.27294985, -0.00050910, 0.00031193, 0.00051168, -0.00000113, 0.00000000],
+		[-6.27295005, -0.00050902, 0.00031188, 0.00051160, -0.00000113, 0.00000000],
+		[-6.27295025, -0.00050894, 0.00031183, 0.00051152, -0.00000113, 0.00000000],
+		[-6.27295045, -0.00050885, 0.00031178, 0.00051143, -0.00000113, 0.00000000],
+		[-6.27295065, -0.00050877, 0.00031173, 0.00051135, -0.00000113, 0.00000000],
+		[-6.27295085, -0.00050869, 0.00031167, 0.00051126, -0.00000113, 0.00000000],
+		[-6.27295105, -0.00050860, 0.00031162, 0.00051118, -0.00000113, 0.00000000],
+		[-6.27295125, -0.00050852, 0.00031157, 0.00051109, -0.00000113, 0.00000000],
+		[-6.27295145, -0.00050844, 0.00031152, 0.00051101, -0.00000113, 0.00000000],
+		[-6.27295165, -0.00050835, 0.00031147, 0.00051093, -0.00000113, 0.00000000],
+		[-6.27295185, -0.00050827, 0.00031142, 0.00051084, -0.00000113, 0.00000000],
+		[-6.27295205, -0.00050818, 0.00031137, 0.00051076, -0.00000113, 0.00000000],
+		[-6.27295225, -0.00050810, 0.00031132, 0.00051068, -0.00000113, 0.00000000],
+		[-6.27295245, -0.00050802, 0.00031126, 0.00051059, -0.00000113, 0.00000000],
+		[-6.27295265, -0.00050793, 0.00031121, 0.00051051, -0.00000113, 0.00000000],
+		[-6.27295285, -0.00050785, 0.00031116, 0.00051042, -0.00000113, 0.00000000],
+		[-6.27295305, -0.00050777, 0.00031111, 0.00051034, -0.00000113, 0.00000000],
+		[-6.27295325, -0.00050768, 0.00031106, 0.00051026, -0.00000113, 0.00000000],
+		[-6.27295345, -0.00050760, 0.00031101, 0.00051017, -0.00000113, 0.00000000],
+		[-6.27295365, -0.00050752, 0.00031096, 0.00051009, -0.00000113, 0.00000000],
+		[-6.27295385, -0.00050743, 0.00031091, 0.00051001, -0.00000113, 0.00000000],
+		[-6.27295404, -0.00050735, 0.00031086, 0.00050992, -0.00000113, 0.00000000],
+		[-6.27295424, -0.00050727, 0.00031081, 0.00050984, -0.00000113, 0.00000000],
+		[-6.27295444, -0.00050719, 0.00031075, 0.00050975, -0.00000113, 0.00000000],
+		[-6.27295464, -0.00050710, 0.00031070, 0.00050967, -0.00000113, 0.00000000],
+		[-6.27295484, -0.00050702, 0.00031065, 0.00050959, -0.00000113, 0.00000000],
+		[-6.27295504, -0.00050694, 0.00031060, 0.00050950, -0.00000113, 0.00000000],
+		[-6.27295524, -0.00050685, 0.00031055, 0.00050942, -0.00000113, 0.00000000],
+		[-6.27295544, -0.00050677, 0.00031050, 0.00050934, -0.00000113, 0.00000000],
+		[-6.27295563, -0.00050669, 0.00031045, 0.00050925, -0.00000113, 0.00000000],
+		[-6.27295583, -0.00050660, 0.00031040, 0.00050917, -0.00000113, 0.00000000],
+		[-6.27295603, -0.00050652, 0.00031035, 0.00050909, -0.00000113, 0.00000000],
+		[-6.27295623, -0.00050644, 0.00031030, 0.00050900, -0.00000113, 0.00000000],
+		[-6.27295643, -0.00050636, 0.00031025, 0.00050892, -0.00000113, 0.00000000],
+		[-6.27295663, -0.00050627, 0.00031019, 0.00050884, -0.00000113, 0.00000000],
+		[-6.27295682, -0.00050619, 0.00031014, 0.00050875, -0.00000113, 0.00000000],
+		[-6.27295702, -0.00050611, 0.00031009, 0.00050867, -0.00000113, 0.00000000],
+		[-6.27295722, -0.00050602, 0.00031004, 0.00050859, -0.00000113, 0.00000000],
+		[-6.27295742, -0.00050594, 0.00030999, 0.00050851, -0.00000113, 0.00000000],
+		[-6.27295762, -0.00050586, 0.00030994, 0.00050842, -0.00000113, 0.00000000],
+		[-6.27295781, -0.00050578, 0.00030989, 0.00050834, -0.00000113, 0.00000000],
+		[-6.27295801, -0.00050569, 0.00030984, 0.00050826, -0.00000113, 0.00000000],
+		[-6.27295821, -0.00050561, 0.00030979, 0.00050817, -0.00000113, 0.00000000],
+		[-6.27295841, -0.00050553, 0.00030974, 0.00050809, -0.00000113, 0.00000000],
+		[-6.27295860, -0.00050545, 0.00030969, 0.00050801, -0.00000113, 0.00000000],
+		[-6.27295880, -0.00050536, 0.00030964, 0.00050792, -0.00000113, 0.00000000],
+		[-6.27295900, -0.00050528, 0.00030959, 0.00050784, -0.00000113, 0.00000000],
+		[-6.27295920, -0.00050520, 0.00030954, 0.00050776, -0.00000113, 0.00000000],
+		[-6.27295939, -0.00050512, 0.00030949, 0.00050768, -0.00000113, 0.00000000],
+		[-6.27295959, -0.00050503, 0.00030944, 0.00050759, -0.00000113, 0.00000000],
+		[-6.27295979, -0.00050495, 0.00030938, 0.00050751, -0.00000113, 0.00000000],
+		[-6.27295998, -0.00050487, 0.00030933, 0.00050743, -0.00000113, 0.00000000],
+		[-6.27296018, -0.00050479, 0.00030928, 0.00050734, -0.00000113, 0.00000000],
+		[-6.27296038, -0.00050470, 0.00030923, 0.00050726, -0.00000113, 0.00000000],
+		[-6.27296058, -0.00050462, 0.00030918, 0.00050718, -0.00000113, 0.00000000],
+		[-6.27296077, -0.00050454, 0.00030913, 0.00050710, -0.00000113, 0.00000000],
+		[-6.27296097, -0.00050446, 0.00030908, 0.00050701, -0.00000113, 0.00000000],
+		[-6.27296117, -0.00050438, 0.00030903, 0.00050693, -0.00000113, 0.00000000],
+		[-6.27296136, -0.00050429, 0.00030898, 0.00050685, -0.00000113, 0.00000000],
+		[-6.27296156, -0.00050421, 0.00030893, 0.00050677, -0.00000113, 0.00000000],
+		[-6.27296176, -0.00050413, 0.00030888, 0.00050668, -0.00000113, 0.00000000],
+		[-6.27296195, -0.00050405, 0.00030883, 0.00050660, -0.00000113, 0.00000000],
+		[-6.27296215, -0.00050397, 0.00030878, 0.00050652, -0.00000113, 0.00000000],
+		[-6.27296234, -0.00050388, 0.00030873, 0.00050644, -0.00000113, 0.00000000],
+		[-6.27296254, -0.00050380, 0.00030868, 0.00050635, -0.00000113, 0.00000000],
+		[-6.27296274, -0.00050372, 0.00030863, 0.00050627, -0.00000113, 0.00000000],
+		[-6.27296293, -0.00050364, 0.00030858, 0.00050619, -0.00000113, 0.00000000],
+		[-6.27296313, -0.00050356, 0.00030853, 0.00050611, -0.00000113, 0.00000000],
+		[-6.27296332, -0.00050347, 0.00030848, 0.00050602, -0.00000113, 0.00000000],
+		[-6.27296352, -0.00050339, 0.00030843, 0.00050594, -0.00000113, 0.00000000],
+		[-6.27296372, -0.00050331, 0.00030838, 0.00050586, -0.00000113, 0.00000000],
+		[-6.27296391, -0.00050323, 0.00030833, 0.00050578, -0.00000113, 0.00000000],
+		[-6.27296411, -0.00050315, 0.00030828, 0.00050569, -0.00000113, 0.00000000],
+		[-6.27296430, -0.00050306, 0.00030823, 0.00050561, -0.00000113, 0.00000000],
+		[-6.27296450, -0.00050298, 0.00030818, 0.00050553, -0.00000113, 0.00000000],
+		[-6.27296469, -0.00050290, 0.00030813, 0.00050545, -0.00000113, 0.00000000],
+		[-6.27296489, -0.00050282, 0.00030808, 0.00050537, -0.00000113, 0.00000000],
+		[-6.27296509, -0.00050274, 0.00030803, 0.00050528, -0.00000113, 0.00000000],
+		[-6.27296528, -0.00050266, 0.00030798, 0.00050520, -0.00000113, 0.00000000],
+		[-6.27296548, -0.00050257, 0.00030793, 0.00050512, -0.00000113, 0.00000000],
+		[-6.27296567, -0.00050249, 0.00030788, 0.00050504, -0.00000113, 0.00000000],
+		[-6.27296587, -0.00050241, 0.00030783, 0.00050496, -0.00000113, 0.00000000],
+		[-6.27296606, -0.00050233, 0.00030778, 0.00050487, -0.00000113, 0.00000000],
+		[-6.27296626, -0.00050225, 0.00030773, 0.00050479, -0.00000113, 0.00000000],
+		[-6.27296645, -0.00050217, 0.00030768, 0.00050471, -0.00000113, 0.00000000],
+		[-6.27296665, -0.00050209, 0.00030763, 0.00050463, -0.00000113, 0.00000000],
+		[-6.27296684, -0.00050200, 0.00030758, 0.00050455, -0.00000113, 0.00000000],
+		[-6.27296704, -0.00050192, 0.00030753, 0.00050446, -0.00000113, 0.00000000],
+		[-6.27296723, -0.00050184, 0.00030748, 0.00050438, -0.00000113, 0.00000000],
+		[-6.27296743, -0.00050176, 0.00030743, 0.00050430, -0.00000113, 0.00000000],
+		[-6.27296762, -0.00050168, 0.00030738, 0.00050422, -0.00000113, 0.00000000],
+		[-6.27296781, -0.00050160, 0.00030733, 0.00050414, -0.00000113, 0.00000000],
+		[-6.27296801, -0.00050152, 0.00030728, 0.00050406, -0.00000113, 0.00000000],
+		[-6.27296820, -0.00050143, 0.00030723, 0.00050397, -0.00000113, 0.00000000],
+		[-6.27296840, -0.00050135, 0.00030718, 0.00050389, -0.00000113, 0.00000000],
+		[-6.27296859, -0.00050127, 0.00030713, 0.00050381, -0.00000113, 0.00000000],
+		[-6.27296879, -0.00050119, 0.00030708, 0.00050373, -0.00000113, 0.00000000],
+		[-6.27296898, -0.00050111, 0.00030703, 0.00050365, -0.00000113, 0.00000000],
+		[-6.27296917, -0.00050103, 0.00030698, 0.00050357, -0.00000113, 0.00000000],
+		[-6.27296937, -0.00050095, 0.00030693, 0.00050348, -0.00000113, 0.00000000],
+		[-6.27296956, -0.00050087, 0.00030688, 0.00050340, -0.00000113, 0.00000000],
+		[-6.27296976, -0.00050079, 0.00030683, 0.00050332, -0.00000113, 0.00000000],
+		[-6.27296995, -0.00050070, 0.00030678, 0.00050324, -0.00000113, 0.00000000],
+		[-6.27297014, -0.00050062, 0.00030673, 0.00050316, -0.00000113, 0.00000000],
+		[-6.27297034, -0.00050054, 0.00030668, 0.00050308, -0.00000113, 0.00000000],
+		[-6.27297053, -0.00050046, 0.00030663, 0.00050300, -0.00000113, 0.00000000],
+		[-6.27297073, -0.00050038, 0.00030658, 0.00050291, -0.00000113, 0.00000000],
+		[-6.27297092, -0.00050030, 0.00030653, 0.00050283, -0.00000113, 0.00000000],
+		[-6.27297111, -0.00050022, 0.00030648, 0.00050275, -0.00000113, 0.00000000],
+		[-6.27297131, -0.00050014, 0.00030643, 0.00050267, -0.00000113, 0.00000000],
+		[-6.27297150, -0.00050006, 0.00030638, 0.00050259, -0.00000113, 0.00000000],
+		[-6.27297169, -0.00049998, 0.00030633, 0.00050251, -0.00000113, 0.00000000],
+		[-6.27297189, -0.00049990, 0.00030629, 0.00050243, -0.00000113, 0.00000000],
+		[-6.27297208, -0.00049982, 0.00030624, 0.00050235, -0.00000113, 0.00000000],
+		[-6.27297227, -0.00049973, 0.00030619, 0.00050227, -0.00000113, 0.00000000],
+		[-6.27297246, -0.00049965, 0.00030614, 0.00050218, -0.00000113, 0.00000000],
+		[-6.27297266, -0.00049957, 0.00030609, 0.00050210, -0.00000113, 0.00000000],
+		[-6.27297285, -0.00049949, 0.00030604, 0.00050202, -0.00000113, 0.00000000],
+		[-6.27297304, -0.00049941, 0.00030599, 0.00050194, -0.00000113, 0.00000000],
+		[-6.27297324, -0.00049933, 0.00030594, 0.00050186, -0.00000113, 0.00000000],
+		[-6.27297343, -0.00049925, 0.00030589, 0.00050178, -0.00000113, 0.00000000],
+		[-6.27297362, -0.00049917, 0.00030584, 0.00050170, -0.00000113, 0.00000000],
+		[-6.27297381, -0.00049909, 0.00030579, 0.00050162, -0.00000113, 0.00000000],
+		[-6.27297401, -0.00049901, 0.00030574, 0.00050154, -0.00000113, 0.00000000],
+		[-6.27297420, -0.00049893, 0.00030569, 0.00050146, -0.00000113, 0.00000000],
+		[-6.27297439, -0.00049885, 0.00030564, 0.00050137, -0.00000113, 0.00000000],
+		[-6.27297458, -0.00049877, 0.00030559, 0.00050129, -0.00000113, 0.00000000],
+		[-6.27297478, -0.00049869, 0.00030554, 0.00050121, -0.00000113, 0.00000000],
+		[-6.27297497, -0.00049861, 0.00030550, 0.00050113, -0.00000113, 0.00000000],
+		[-6.27297516, -0.00049853, 0.00030545, 0.00050105, -0.00000113, 0.00000000],
+		[-6.27297535, -0.00049845, 0.00030540, 0.00050097, -0.00000113, 0.00000000],
+		[-6.27297554, -0.00049837, 0.00030535, 0.00050089, -0.00000113, 0.00000000],
+		[-6.27297574, -0.00049829, 0.00030530, 0.00050081, -0.00000113, 0.00000000],
+		[-6.27297593, -0.00049821, 0.00030525, 0.00050073, -0.00000113, 0.00000000],
+		[-6.27297612, -0.00049813, 0.00030520, 0.00050065, -0.00000113, 0.00000000],
+		[-6.27297631, -0.00049805, 0.00030515, 0.00050057, -0.00000113, 0.00000000],
+		[-6.27297650, -0.00049797, 0.00030510, 0.00050049, -0.00000113, 0.00000000],
+		[-6.27297670, -0.00049789, 0.00030505, 0.00050041, -0.00000113, 0.00000000],
+		[-6.27297689, -0.00049781, 0.00030500, 0.00050033, -0.00000113, 0.00000000],
+		[-6.27297708, -0.00049773, 0.00030495, 0.00050025, -0.00000113, 0.00000000],
+		[-6.27297727, -0.00049765, 0.00030491, 0.00050017, -0.00000113, 0.00000000],
+		[-6.27297746, -0.00049757, 0.00030486, 0.00050009, -0.00000113, 0.00000000],
+		[-6.27297765, -0.00049749, 0.00030481, 0.00050000, -0.00000113, 0.00000000],
+		[-6.27297784, -0.00049741, 0.00030476, 0.00049992, -0.00000113, 0.00000000],
+		[-6.27297804, -0.00049733, 0.00030471, 0.00049984, -0.00000113, 0.00000000],
+		[-6.27297823, -0.00049725, 0.00030466, 0.00049976, -0.00000113, 0.00000000],
+		[-6.27297842, -0.00049717, 0.00030461, 0.00049968, -0.00000113, 0.00000000],
+		[-6.27297861, -0.00049709, 0.00030456, 0.00049960, -0.00000113, 0.00000000],
+		[-6.27297880, -0.00049701, 0.00030451, 0.00049952, -0.00000113, 0.00000000],
+		[-6.27297899, -0.00049693, 0.00030446, 0.00049944, -0.00000113, 0.00000000],
+		[-6.27297918, -0.00049685, 0.00030442, 0.00049936, -0.00000113, 0.00000000],
+		[-6.27297937, -0.00049677, 0.00030437, 0.00049928, -0.00000113, 0.00000000],
+		[-6.27297956, -0.00049669, 0.00030432, 0.00049920, -0.00000113, 0.00000000],
+		[-6.27297975, -0.00049661, 0.00030427, 0.00049912, -0.00000113, 0.00000000],
+		[-6.27297994, -0.00049653, 0.00030422, 0.00049904, -0.00000113, 0.00000000],
+		[-6.27298013, -0.00049645, 0.00030417, 0.00049896, -0.00000113, 0.00000000],
+		[-6.27298033, -0.00049637, 0.00030412, 0.00049888, -0.00000114, 0.00000000],
+		[-6.27298052, -0.00049629, 0.00030407, 0.00049880, -0.00000114, 0.00000000],
+		[-6.27298071, -0.00049621, 0.00030403, 0.00049872, -0.00000114, 0.00000000],
+		[-6.27298090, -0.00049613, 0.00030398, 0.00049864, -0.00000114, 0.00000000],
+		[-6.27298109, -0.00049605, 0.00030393, 0.00049856, -0.00000114, 0.00000000],
+		[-6.27298128, -0.00049597, 0.00030388, 0.00049848, -0.00000114, 0.00000000],
+		[-6.27298147, -0.00049589, 0.00030383, 0.00049840, -0.00000114, 0.00000000],
+		[-6.27298166, -0.00049581, 0.00030378, 0.00049832, -0.00000114, 0.00000000],
+		[-6.27298185, -0.00049573, 0.00030373, 0.00049824, -0.00000114, 0.00000000],
+		[-6.27298204, -0.00049565, 0.00030368, 0.00049816, -0.00000114, 0.00000000],
+		[-6.27298223, -0.00049557, 0.00030364, 0.00049808, -0.00000114, 0.00000000],
+		[-6.27298242, -0.00049550, 0.00030359, 0.00049800, -0.00000114, 0.00000000],
+		[-6.27298261, -0.00049542, 0.00030354, 0.00049792, -0.00000114, 0.00000000],
+		[-6.27298280, -0.00049534, 0.00030349, 0.00049784, -0.00000114, 0.00000000],
+		[-6.27298299, -0.00049526, 0.00030344, 0.00049776, -0.00000114, 0.00000000],
+		[-6.27298318, -0.00049518, 0.00030339, 0.00049769, -0.00000114, 0.00000000],
+		[-6.27298336, -0.00049510, 0.00030334, 0.00049761, -0.00000114, 0.00000000],
+		[-6.27298355, -0.00049502, 0.00030330, 0.00049753, -0.00000114, 0.00000000],
+		[-6.27298374, -0.00049494, 0.00030325, 0.00049745, -0.00000114, 0.00000000],
+		[-6.27298393, -0.00049486, 0.00030320, 0.00049737, -0.00000114, 0.00000000],
+		[-6.27298412, -0.00049478, 0.00030315, 0.00049729, -0.00000114, 0.00000000],
+		[-6.27298431, -0.00049470, 0.00030310, 0.00049721, -0.00000114, 0.00000000],
+		[-6.27298450, -0.00049462, 0.00030305, 0.00049713, -0.00000114, 0.00000000],
+		[-6.27298469, -0.00049455, 0.00030300, 0.00049705, -0.00000114, 0.00000000],
+		[-6.27298488, -0.00049447, 0.00030296, 0.00049697, -0.00000114, 0.00000000],
+		[-6.27298507, -0.00049439, 0.00030291, 0.00049689, -0.00000114, 0.00000000],
+		[-6.27298526, -0.00049431, 0.00030286, 0.00049681, -0.00000114, 0.00000000],
+		[-6.27298545, -0.00049423, 0.00030281, 0.00049673, -0.00000114, 0.00000000],
+		[-6.27298563, -0.00049415, 0.00030276, 0.00049665, -0.00000114, 0.00000000],
+		[-6.27298582, -0.00049407, 0.00030271, 0.00049657, -0.00000114, 0.00000000],
+		[-6.27298601, -0.00049399, 0.00030267, 0.00049649, -0.00000114, 0.00000000],
+		[-6.27298620, -0.00049391, 0.00030262, 0.00049641, -0.00000114, 0.00000000],
+		[-6.27298639, -0.00049384, 0.00030257, 0.00049634, -0.00000114, 0.00000000],
+		[-6.27298658, -0.00049376, 0.00030252, 0.00049626, -0.00000114, 0.00000000],
+		[-6.27298677, -0.00049368, 0.00030247, 0.00049618, -0.00000114, 0.00000000],
+		[-6.27298695, -0.00049360, 0.00030242, 0.00049610, -0.00000114, 0.00000000],
+		[-6.27298714, -0.00049352, 0.00030238, 0.00049602, -0.00000114, 0.00000000],
+		[-6.27298733, -0.00049344, 0.00030233, 0.00049594, -0.00000114, 0.00000000],
+		[-6.27298752, -0.00049336, 0.00030228, 0.00049586, -0.00000114, 0.00000000],
+		[-6.27298771, -0.00049328, 0.00030223, 0.00049578, -0.00000114, 0.00000000],
+		[-6.27298790, -0.00049321, 0.00030218, 0.00049570, -0.00000114, 0.00000000],
+		[-6.27298808, -0.00049313, 0.00030214, 0.00049562, -0.00000114, 0.00000000],
+		[-6.27298827, -0.00049305, 0.00030209, 0.00049554, -0.00000114, 0.00000000],
+		[-6.27298846, -0.00049297, 0.00030204, 0.00049547, -0.00000114, 0.00000000],
+		[-6.27298865, -0.00049289, 0.00030199, 0.00049539, -0.00000114, 0.00000000],
+		[-6.27298883, -0.00049281, 0.00030194, 0.00049531, -0.00000114, 0.00000000],
+		[-6.27298902, -0.00049273, 0.00030189, 0.00049523, -0.00000114, 0.00000000],
+		[-6.27298921, -0.00049266, 0.00030185, 0.00049515, -0.00000114, 0.00000000],
+		[-6.27298940, -0.00049258, 0.00030180, 0.00049507, -0.00000114, 0.00000000],
+		[-6.27298959, -0.00049250, 0.00030175, 0.00049499, -0.00000114, 0.00000000],
+		[-6.27298977, -0.00049242, 0.00030170, 0.00049491, -0.00000114, 0.00000000],
+		[-6.27298996, -0.00049234, 0.00030165, 0.00049484, -0.00000114, 0.00000000],
+		[-6.27299015, -0.00049226, 0.00030161, 0.00049476, -0.00000114, 0.00000000],
+		[-6.27299033, -0.00049219, 0.00030156, 0.00049468, -0.00000114, 0.00000000],
+		[-6.27299052, -0.00049211, 0.00030151, 0.00049460, -0.00000114, 0.00000000],
+		[-6.27299071, -0.00049203, 0.00030146, 0.00049452, -0.00000114, 0.00000000],
+		[-6.27299090, -0.00049195, 0.00030141, 0.00049444, -0.00000114, 0.00000000],
+		[-6.27299108, -0.00049187, 0.00030137, 0.00049436, -0.00000114, 0.00000000],
+		[-6.27299127, -0.00049180, 0.00030132, 0.00049428, -0.00000114, 0.00000000],
+		[-6.27299146, -0.00049172, 0.00030127, 0.00049421, -0.00000114, 0.00000000],
+		[-6.27299164, -0.00049164, 0.00030122, 0.00049413, -0.00000114, 0.00000000],
+		[-6.27299183, -0.00049156, 0.00030118, 0.00049405, -0.00000114, 0.00000000],
+		[-6.27299202, -0.00049148, 0.00030113, 0.00049397, -0.00000114, 0.00000000],
+		[-6.27299220, -0.00049140, 0.00030108, 0.00049389, -0.00000114, 0.00000000],
+		[-6.27299239, -0.00049133, 0.00030103, 0.00049381, -0.00000114, 0.00000000],
+		[-6.27299258, -0.00049125, 0.00030098, 0.00049374, -0.00000114, 0.00000000],
+		[-6.27299276, -0.00049117, 0.00030094, 0.00049366, -0.00000114, 0.00000000],
+		[-6.27299295, -0.00049109, 0.00030089, 0.00049358, -0.00000114, 0.00000000],
+		[-6.27299314, -0.00049102, 0.00030084, 0.00049350, -0.00000114, 0.00000000],
+		[-6.27299332, -0.00049094, 0.00030079, 0.00049342, -0.00000114, 0.00000000],
+		[-6.27299351, -0.00049086, 0.00030075, 0.00049334, -0.00000114, 0.00000000],
+		[-6.27299370, -0.00049078, 0.00030070, 0.00049327, -0.00000114, 0.00000000],
+		[-6.27299388, -0.00049070, 0.00030065, 0.00049319, -0.00000114, 0.00000000],
+		[-6.27299407, -0.00049063, 0.00030060, 0.00049311, -0.00000114, 0.00000000],
+		[-6.27299425, -0.00049055, 0.00030055, 0.00049303, -0.00000114, 0.00000000],
+		[-6.27299444, -0.00049047, 0.00030051, 0.00049295, -0.00000114, 0.00000000],
+		[-6.27299463, -0.00049039, 0.00030046, 0.00049288, -0.00000114, 0.00000000],
+		[-6.27299481, -0.00049032, 0.00030041, 0.00049280, -0.00000114, 0.00000000],
+		[-6.27299500, -0.00049024, 0.00030036, 0.00049272, -0.00000114, 0.00000000],
+		[-6.27299518, -0.00049016, 0.00030032, 0.00049264, -0.00000114, 0.00000000],
+		[-6.27299537, -0.00049008, 0.00030027, 0.00049256, -0.00000114, 0.00000000],
+		[-6.27299556, -0.00049000, 0.00030022, 0.00049249, -0.00000114, 0.00000000],
+		[-6.27299574, -0.00048993, 0.00030017, 0.00049241, -0.00000114, 0.00000000],
+		[-6.27299593, -0.00048985, 0.00030013, 0.00049233, -0.00000114, 0.00000000],
+		[-6.27299611, -0.00048977, 0.00030008, 0.00049225, -0.00000114, 0.00000000],
+		[-6.27299630, -0.00048969, 0.00030003, 0.00049217, -0.00000114, 0.00000000],
+		[-6.27299648, -0.00048962, 0.00029998, 0.00049210, -0.00000114, 0.00000000],
+		[-6.27299667, -0.00048954, 0.00029994, 0.00049202, -0.00000114, 0.00000000],
+		[-6.27299685, -0.00048946, 0.00029989, 0.00049194, -0.00000114, 0.00000000],
+		[-6.27299704, -0.00048938, 0.00029984, 0.00049186, -0.00000114, 0.00000000],
+		[-6.27299722, -0.00048931, 0.00029979, 0.00049178, -0.00000114, 0.00000000],
+		[-6.27299741, -0.00048923, 0.00029975, 0.00049171, -0.00000114, 0.00000000],
+		[-6.27299759, -0.00048915, 0.00029970, 0.00049163, -0.00000114, 0.00000000],
+		[-6.27299778, -0.00048908, 0.00029965, 0.00049155, -0.00000114, 0.00000000],
+		[-6.27299796, -0.00048900, 0.00029960, 0.00049147, -0.00000114, 0.00000000],
+		[-6.27299815, -0.00048892, 0.00029956, 0.00049140, -0.00000114, 0.00000000],
+		[-6.27299833, -0.00048884, 0.00029951, 0.00049132, -0.00000114, 0.00000000],
+		[-6.27299852, -0.00048877, 0.00029946, 0.00049124, -0.00000114, 0.00000000],
+		[-6.27299870, -0.00048869, 0.00029941, 0.00049116, -0.00000114, 0.00000000],
+		[-6.27299889, -0.00048861, 0.00029937, 0.00049109, -0.00000114, 0.00000000],
+		[-6.27299907, -0.00048854, 0.00029932, 0.00049101, -0.00000114, 0.00000000],
+		[-6.27299926, -0.00048846, 0.00029927, 0.00049093, -0.00000114, 0.00000000],
+		[-6.27299944, -0.00048838, 0.00029923, 0.00049085, -0.00000114, 0.00000000],
+		[-6.27299962, -0.00048830, 0.00029918, 0.00049078, -0.00000114, 0.00000000],
+		[-6.27299981, -0.00048823, 0.00029913, 0.00049070, -0.00000114, 0.00000000],
+		[-6.27299999, -0.00048815, 0.00029908, 0.00049062, -0.00000114, 0.00000000],
+		[-6.27300018, -0.00048807, 0.00029904, 0.00049054, -0.00000114, 0.00000000],
+		[-6.27300036, -0.00048800, 0.00029899, 0.00049047, -0.00000114, 0.00000000],
+		[-6.27300055, -0.00048792, 0.00029894, 0.00049039, -0.00000114, 0.00000000],
+		[-6.27300073, -0.00048784, 0.00029890, 0.00049031, -0.00000114, 0.00000000],
+		[-6.27300091, -0.00048777, 0.00029885, 0.00049023, -0.00000114, 0.00000000],
+		[-6.27300110, -0.00048769, 0.00029880, 0.00049016, -0.00000114, 0.00000000],
+		[-6.27300128, -0.00048761, 0.00029875, 0.00049008, -0.00000114, 0.00000000],
+		[-6.27300146, -0.00048754, 0.00029871, 0.00049000, -0.00000114, 0.00000000],
+		[-6.27300165, -0.00048746, 0.00029866, 0.00048993, -0.00000114, 0.00000000],
+		[-6.27300183, -0.00048738, 0.00029861, 0.00048985, -0.00000114, 0.00000000],
+		[-6.27300202, -0.00048730, 0.00029857, 0.00048977, -0.00000114, 0.00000000],
+		[-6.27300220, -0.00048723, 0.00029852, 0.00048969, -0.00000114, 0.00000000],
+		[-6.27300238, -0.00048715, 0.00029847, 0.00048962, -0.00000114, 0.00000000],
+		[-6.27300257, -0.00048707, 0.00029842, 0.00048954, -0.00000114, 0.00000000],
+		[-6.27300275, -0.00048700, 0.00029838, 0.00048946, -0.00000114, 0.00000000],
+		[-6.27300293, -0.00048692, 0.00029833, 0.00048939, -0.00000114, 0.00000000],
+		[-6.27300312, -0.00048685, 0.00029828, 0.00048931, -0.00000114, 0.00000000],
+		[-6.27300330, -0.00048677, 0.00029824, 0.00048923, -0.00000114, 0.00000000],
+		[-6.27300348, -0.00048669, 0.00029819, 0.00048916, -0.00000114, 0.00000000],
+		[-6.27300367, -0.00048662, 0.00029814, 0.00048908, -0.00000114, 0.00000000],
+		[-6.27300385, -0.00048654, 0.00029810, 0.00048900, -0.00000114, 0.00000000],
+		[-6.27300403, -0.00048646, 0.00029805, 0.00048892, -0.00000114, 0.00000000],
+		[-6.27300421, -0.00048639, 0.00029800, 0.00048885, -0.00000114, 0.00000000],
+		[-6.27300440, -0.00048631, 0.00029796, 0.00048877, -0.00000114, 0.00000000],
+		[-6.27300458, -0.00048623, 0.00029791, 0.00048869, -0.00000114, 0.00000000],
+		[-6.27300476, -0.00048616, 0.00029786, 0.00048862, -0.00000114, 0.00000000],
+		[-6.27300495, -0.00048608, 0.00029782, 0.00048854, -0.00000114, 0.00000000],
+		[-6.27300513, -0.00048600, 0.00029777, 0.00048846, -0.00000114, 0.00000000],
+		[-6.27300531, -0.00048593, 0.00029772, 0.00048839, -0.00000114, 0.00000000],
+		[-6.27300549, -0.00048585, 0.00029768, 0.00048831, -0.00000114, 0.00000000],
+		[-6.27300568, -0.00048578, 0.00029763, 0.00048823, -0.00000114, 0.00000000],
+		[-6.27300586, -0.00048570, 0.00029758, 0.00048816, -0.00000114, 0.00000000],
+		[-6.27300604, -0.00048562, 0.00029753, 0.00048808, -0.00000114, 0.00000000],
+		[-6.27300622, -0.00048555, 0.00029749, 0.00048800, -0.00000114, 0.00000000],
+		[-6.27300640, -0.00048547, 0.00029744, 0.00048793, -0.00000114, 0.00000000],
+		[-6.27300659, -0.00048539, 0.00029739, 0.00048785, -0.00000114, 0.00000000],
+		[-6.27300677, -0.00048532, 0.00029735, 0.00048777, -0.00000114, 0.00000000],
+		[-6.27300695, -0.00048524, 0.00029730, 0.00048770, -0.00000114, 0.00000000],
+		[-6.27300713, -0.00048517, 0.00029725, 0.00048762, -0.00000114, 0.00000000],
+		[-6.27300732, -0.00048509, 0.00029721, 0.00048755, -0.00000114, 0.00000000],
+		[-6.27300750, -0.00048501, 0.00029716, 0.00048747, -0.00000114, 0.00000000],
+		[-6.27300768, -0.00048494, 0.00029712, 0.00048739, -0.00000114, 0.00000000],
+		[-6.27300786, -0.00048486, 0.00029707, 0.00048732, -0.00000114, 0.00000000],
+		[-6.27300804, -0.00048479, 0.00029702, 0.00048724, -0.00000114, 0.00000000],
+		[-6.27300822, -0.00048471, 0.00029698, 0.00048716, -0.00000114, 0.00000000],
+		[-6.27300841, -0.00048463, 0.00029693, 0.00048709, -0.00000114, 0.00000000],
+		[-6.27300859, -0.00048456, 0.00029688, 0.00048701, -0.00000114, 0.00000000],
+		[-6.27300877, -0.00048448, 0.00029684, 0.00048693, -0.00000114, 0.00000000],
+		[-6.27300895, -0.00048441, 0.00029679, 0.00048686, -0.00000114, 0.00000000],
+		[-6.27300913, -0.00048433, 0.00029674, 0.00048678, -0.00000114, 0.00000000],
+		[-6.27300931, -0.00048426, 0.00029670, 0.00048671, -0.00000114, 0.00000000],
+		[-6.27300949, -0.00048418, 0.00029665, 0.00048663, -0.00000114, 0.00000000],
+		[-6.27300968, -0.00048410, 0.00029660, 0.00048655, -0.00000114, 0.00000000],
+		[-6.27300986, -0.00048403, 0.00029656, 0.00048648, -0.00000114, 0.00000000],
+		[-6.27301004, -0.00048395, 0.00029651, 0.00048640, -0.00000114, 0.00000000],
+		[-6.27301022, -0.00048388, 0.00029646, 0.00048633, -0.00000114, 0.00000000],
+		[-6.27301040, -0.00048380, 0.00029642, 0.00048625, -0.00000114, 0.00000000],
+		[-6.27301058, -0.00048373, 0.00029637, 0.00048617, -0.00000114, 0.00000000],
+		[-6.27301076, -0.00048365, 0.00029633, 0.00048610, -0.00000114, 0.00000000],
+		[-6.27301094, -0.00048357, 0.00029628, 0.00048602, -0.00000114, 0.00000000],
+		[-6.27301112, -0.00048350, 0.00029623, 0.00048595, -0.00000114, 0.00000000],
+		[-6.27301130, -0.00048342, 0.00029619, 0.00048587, -0.00000114, 0.00000000],
+		[-6.27301148, -0.00048335, 0.00029614, 0.00048579, -0.00000114, 0.00000000],
+		[-6.27301166, -0.00048327, 0.00029609, 0.00048572, -0.00000114, 0.00000000],
+		[-6.27301185, -0.00048320, 0.00029605, 0.00048564, -0.00000114, 0.00000000],
+		[-6.27301203, -0.00048312, 0.00029600, 0.00048557, -0.00000114, 0.00000000],
+		[-6.27301221, -0.00048305, 0.00029596, 0.00048549, -0.00000114, 0.00000000],
+		[-6.27301239, -0.00048297, 0.00029591, 0.00048542, -0.00000114, 0.00000000],
+		[-6.27301257, -0.00048290, 0.00029586, 0.00048534, -0.00000114, 0.00000000],
+		[-6.27301275, -0.00048282, 0.00029582, 0.00048526, -0.00000114, 0.00000000],
+		[-6.27301293, -0.00048275, 0.00029577, 0.00048519, -0.00000114, 0.00000000],
+		[-6.27301311, -0.00048267, 0.00029572, 0.00048511, -0.00000114, 0.00000000],
+		[-6.27301329, -0.00048259, 0.00029568, 0.00048504, -0.00000114, 0.00000000],
+		[-6.27301347, -0.00048252, 0.00029563, 0.00048496, -0.00000114, 0.00000000],
+		[-6.27301365, -0.00048244, 0.00029559, 0.00048489, -0.00000114, 0.00000000],
+		[-6.27301383, -0.00048237, 0.00029554, 0.00048481, -0.00000114, 0.00000000],
+		[-6.27301401, -0.00048229, 0.00029549, 0.00048473, -0.00000114, 0.00000000],
+		[-6.27301419, -0.00048222, 0.00029545, 0.00048466, -0.00000114, 0.00000000],
+		[-6.27301437, -0.00048214, 0.00029540, 0.00048458, -0.00000114, 0.00000000],
+		[-6.27301455, -0.00048207, 0.00029536, 0.00048451, -0.00000114, 0.00000000],
+		[-6.27301473, -0.00048199, 0.00029531, 0.00048443, -0.00000114, 0.00000000],
+		[-6.27301491, -0.00048192, 0.00029526, 0.00048436, -0.00000114, 0.00000000],
+		[-6.27301509, -0.00048184, 0.00029522, 0.00048428, -0.00000114, 0.00000000],
+		[-6.27301526, -0.00048177, 0.00029517, 0.00048421, -0.00000114, 0.00000000],
+		[-6.27301544, -0.00048169, 0.00029513, 0.00048413, -0.00000114, 0.00000000],
+		[-6.27301562, -0.00048162, 0.00029508, 0.00048406, -0.00000114, 0.00000000],
+		[-6.27301580, -0.00048154, 0.00029503, 0.00048398, -0.00000114, 0.00000000],
+		[-6.27301598, -0.00048147, 0.00029499, 0.00048390, -0.00000114, 0.00000000],
+		[-6.27301616, -0.00048139, 0.00029494, 0.00048383, -0.00000114, 0.00000000],
+		[-6.27301634, -0.00048132, 0.00029490, 0.00048375, -0.00000114, 0.00000000],
+		[-6.27301652, -0.00048124, 0.00029485, 0.00048368, -0.00000114, 0.00000000],
+		[-6.27301670, -0.00048117, 0.00029480, 0.00048360, -0.00000114, 0.00000000],
+		[-6.27301688, -0.00048109, 0.00029476, 0.00048353, -0.00000114, 0.00000000],
+		[-6.27301706, -0.00048102, 0.00029471, 0.00048345, -0.00000114, 0.00000000],
+		[-6.27301724, -0.00048095, 0.00029467, 0.00048338, -0.00000114, 0.00000000],
+		[-6.27301741, -0.00048087, 0.00029462, 0.00048330, -0.00000114, 0.00000000],
+		[-6.27301759, -0.00048080, 0.00029458, 0.00048323, -0.00000114, 0.00000000],
+		[-6.27301777, -0.00048072, 0.00029453, 0.00048315, -0.00000114, 0.00000000],
+		[-6.27301795, -0.00048065, 0.00029448, 0.00048308, -0.00000114, 0.00000000],
+		[-6.27301813, -0.00048057, 0.00029444, 0.00048300, -0.00000114, 0.00000000],
+		[-6.27301831, -0.00048050, 0.00029439, 0.00048293, -0.00000114, 0.00000000],
+		[-6.27301849, -0.00048042, 0.00029435, 0.00048285, -0.00000114, 0.00000000],
+		[-6.27301866, -0.00048035, 0.00029430, 0.00048278, -0.00000114, 0.00000000],
+		[-6.27301884, -0.00048027, 0.00029426, 0.00048270, -0.00000114, 0.00000000],
+		[-6.27301902, -0.00048020, 0.00029421, 0.00048263, -0.00000114, 0.00000000],
+		[-6.27301920, -0.00048012, 0.00029416, 0.00048255, -0.00000114, 0.00000000],
+		[-6.27301938, -0.00048005, 0.00029412, 0.00048248, -0.00000114, 0.00000000],
+		[-6.27301956, -0.00047998, 0.00029407, 0.00048240, -0.00000114, 0.00000000],
+		[-6.27301973, -0.00047990, 0.00029403, 0.00048233, -0.00000114, 0.00000000],
+		[-6.27301991, -0.00047983, 0.00029398, 0.00048225, -0.00000114, 0.00000000],
+		[-6.27302009, -0.00047975, 0.00029394, 0.00048218, -0.00000114, 0.00000000],
+		[-6.27302027, -0.00047968, 0.00029389, 0.00048211, -0.00000114, 0.00000000],
+		[-6.27302044, -0.00047960, 0.00029384, 0.00048203, -0.00000114, 0.00000000],
+		[-6.27302062, -0.00047953, 0.00029380, 0.00048196, -0.00000114, 0.00000000],
+		[-6.27302080, -0.00047946, 0.00029375, 0.00048188, -0.00000114, 0.00000000],
+		[-6.27302098, -0.00047938, 0.00029371, 0.00048181, -0.00000114, 0.00000000],
+		[-6.27302116, -0.00047931, 0.00029366, 0.00048173, -0.00000114, 0.00000000],
+		[-6.27302133, -0.00047923, 0.00029362, 0.00048166, -0.00000114, 0.00000000],
+		[-6.27302151, -0.00047916, 0.00029357, 0.00048158, -0.00000114, 0.00000000],
+		[-6.27302169, -0.00047908, 0.00029353, 0.00048151, -0.00000114, 0.00000000],
+		[-6.27302187, -0.00047901, 0.00029348, 0.00048143, -0.00000114, 0.00000000],
+		[-6.27302204, -0.00047894, 0.00029344, 0.00048136, -0.00000114, 0.00000000],
+		[-6.27302222, -0.00047886, 0.00029339, 0.00048128, -0.00000114, 0.00000000],
+		[-6.27302240, -0.00047879, 0.00029334, 0.00048121, -0.00000114, 0.00000000],
+		[-6.27302257, -0.00047871, 0.00029330, 0.00048114, -0.00000114, 0.00000000],
+		[-6.27302275, -0.00047864, 0.00029325, 0.00048106, -0.00000114, 0.00000000],
+		[-6.27302293, -0.00047857, 0.00029321, 0.00048099, -0.00000114, 0.00000000],
+		[-6.27302311, -0.00047849, 0.00029316, 0.00048091, -0.00000114, 0.00000000],
+		[-6.27302328, -0.00047842, 0.00029312, 0.00048084, -0.00000114, 0.00000000],
+		[-6.27302346, -0.00047834, 0.00029307, 0.00048076, -0.00000114, 0.00000000],
+		[-6.27302364, -0.00047827, 0.00029303, 0.00048069, -0.00000114, 0.00000000],
+		[-6.27302381, -0.00047820, 0.00029298, 0.00048062, -0.00000114, 0.00000000],
+		[-6.27302399, -0.00047812, 0.00029294, 0.00048054, -0.00000114, 0.00000000],
+		[-6.27302417, -0.00047805, 0.00029289, 0.00048047, -0.00000114, 0.00000000],
+		[-6.27302434, -0.00047797, 0.00029285, 0.00048039, -0.00000114, 0.00000000],
+		[-6.27302452, -0.00047790, 0.00029280, 0.00048032, -0.00000114, 0.00000000],
+		[-6.27302470, -0.00047783, 0.00029276, 0.00048024, -0.00000114, 0.00000000],
+		[-6.27302487, -0.00047775, 0.00029271, 0.00048017, -0.00000114, 0.00000000],
+		[-6.27302505, -0.00047768, 0.00029267, 0.00048010, -0.00000114, 0.00000000],
+		[-6.27302523, -0.00047761, 0.00029262, 0.00048002, -0.00000114, 0.00000000],
+		[-6.27302540, -0.00047753, 0.00029257, 0.00047995, -0.00000114, 0.00000000],
+		[-6.27302558, -0.00047746, 0.00029253, 0.00047987, -0.00000114, 0.00000000],
+		[-6.27302575, -0.00047739, 0.00029248, 0.00047980, -0.00000114, 0.00000000],
+		[-6.27302593, -0.00047731, 0.00029244, 0.00047973, -0.00000114, 0.00000000],
+		[-6.27302611, -0.00047724, 0.00029239, 0.00047965, -0.00000114, 0.00000000],
+		[-6.27302628, -0.00047716, 0.00029235, 0.00047958, -0.00000114, 0.00000000],
+		[-6.27302646, -0.00047709, 0.00029230, 0.00047950, -0.00000114, 0.00000000],
+		[-6.27302664, -0.00047702, 0.00029226, 0.00047943, -0.00000114, 0.00000000],
+		[-6.27302681, -0.00047694, 0.00029221, 0.00047936, -0.00000114, 0.00000000],
+		[-6.27302699, -0.00047687, 0.00029217, 0.00047928, -0.00000114, 0.00000000],
+		[-6.27302716, -0.00047680, 0.00029212, 0.00047921, -0.00000114, 0.00000000],
+		[-6.27302734, -0.00047672, 0.00029208, 0.00047913, -0.00000114, 0.00000000],
+		[-6.27302751, -0.00047665, 0.00029203, 0.00047906, -0.00000114, 0.00000000],
+		[-6.27302769, -0.00047658, 0.00029199, 0.00047899, -0.00000114, 0.00000000],
+		[-6.27302787, -0.00047650, 0.00029194, 0.00047891, -0.00000114, 0.00000000],
+		[-6.27302804, -0.00047643, 0.00029190, 0.00047884, -0.00000114, 0.00000000],
+		[-6.27302822, -0.00047636, 0.00029185, 0.00047877, -0.00000114, 0.00000000],
+		[-6.27302839, -0.00047628, 0.00029181, 0.00047869, -0.00000114, 0.00000000],
+		[-6.27302857, -0.00047621, 0.00029176, 0.00047862, -0.00000114, 0.00000000],
+		[-6.27302874, -0.00047614, 0.00029172, 0.00047855, -0.00000114, 0.00000000],
+		[-6.27302892, -0.00047606, 0.00029167, 0.00047847, -0.00000114, 0.00000000],
+		[-6.27302909, -0.00047599, 0.00029163, 0.00047840, -0.00000114, 0.00000000],
+		[-6.27302927, -0.00047592, 0.00029158, 0.00047832, -0.00000114, 0.00000000],
+		[-6.27302944, -0.00047584, 0.00029154, 0.00047825, -0.00000114, 0.00000000],
+		[-6.27302962, -0.00047577, 0.00029150, 0.00047818, -0.00000114, 0.00000000],
+		[-6.27302979, -0.00047570, 0.00029145, 0.00047810, -0.00000114, 0.00000000],
+		[-6.27302997, -0.00047562, 0.00029141, 0.00047803, -0.00000114, 0.00000000],
+		[-6.27303014, -0.00047555, 0.00029136, 0.00047796, -0.00000114, 0.00000000],
+		[-6.27303032, -0.00047548, 0.00029132, 0.00047788, -0.00000114, 0.00000000],
+		[-6.27303049, -0.00047541, 0.00029127, 0.00047781, -0.00000114, 0.00000000],
+		[-6.27303067, -0.00047533, 0.00029123, 0.00047774, -0.00000114, 0.00000000],
+		[-6.27303084, -0.00047526, 0.00029118, 0.00047766, -0.00000114, 0.00000000],
+		[-6.27303102, -0.00047519, 0.00029114, 0.00047759, -0.00000114, 0.00000000],
+		[-6.27303119, -0.00047511, 0.00029109, 0.00047752, -0.00000114, 0.00000000],
+		[-6.27303137, -0.00047504, 0.00029105, 0.00047744, -0.00000114, 0.00000000],
+		[-6.27303154, -0.00047497, 0.00029100, 0.00047737, -0.00000114, 0.00000000],
+		[-6.27303171, -0.00047490, 0.00029096, 0.00047730, -0.00000114, 0.00000000],
+		[-6.27303189, -0.00047482, 0.00029091, 0.00047722, -0.00000114, 0.00000000],
+		[-6.27303206, -0.00047475, 0.00029087, 0.00047715, -0.00000114, 0.00000000],
+		[-6.27303224, -0.00047468, 0.00029082, 0.00047708, -0.00000114, 0.00000000],
+		[-6.27303241, -0.00047460, 0.00029078, 0.00047700, -0.00000114, 0.00000000],
+		[-6.27303259, -0.00047453, 0.00029073, 0.00047693, -0.00000114, 0.00000000],
+		[-6.27303276, -0.00047446, 0.00029069, 0.00047686, -0.00000114, 0.00000000],
+		[-6.27303293, -0.00047439, 0.00029065, 0.00047678, -0.00000114, 0.00000000],
+		[-6.27303311, -0.00047431, 0.00029060, 0.00047671, -0.00000114, 0.00000000],
+		[-6.27303328, -0.00047424, 0.00029056, 0.00047664, -0.00000114, 0.00000000],
+		[-6.27303345, -0.00047417, 0.00029051, 0.00047657, -0.00000114, 0.00000000],
+		[-6.27303363, -0.00047410, 0.00029047, 0.00047649, -0.00000114, 0.00000000],
+		[-6.27303380, -0.00047402, 0.00029042, 0.00047642, -0.00000114, 0.00000000],
+		[-6.27303398, -0.00047395, 0.00029038, 0.00047635, -0.00000114, 0.00000000],
+		[-6.27303415, -0.00047388, 0.00029033, 0.00047627, -0.00000114, 0.00000000],
+		[-6.27303432, -0.00047380, 0.00029029, 0.00047620, -0.00000114, 0.00000000],
+		[-6.27303450, -0.00047373, 0.00029025, 0.00047613, -0.00000114, 0.00000000],
+		[-6.27303467, -0.00047366, 0.00029020, 0.00047606, -0.00000114, 0.00000000],
+		[-6.27303484, -0.00047359, 0.00029016, 0.00047598, -0.00000114, 0.00000000],
+		[-6.27303502, -0.00047351, 0.00029011, 0.00047591, -0.00000114, 0.00000000],
+		[-6.27303519, -0.00047344, 0.00029007, 0.00047584, -0.00000114, 0.00000000],
+		[-6.27303536, -0.00047337, 0.00029002, 0.00047576, -0.00000114, 0.00000000],
+		[-6.27303554, -0.00047330, 0.00028998, 0.00047569, -0.00000114, 0.00000000],
+		[-6.27303571, -0.00047323, 0.00028993, 0.00047562, -0.00000114, 0.00000000],
+		[-6.27303588, -0.00047315, 0.00028989, 0.00047555, -0.00000114, 0.00000000],
+		[-6.27303606, -0.00047308, 0.00028985, 0.00047547, -0.00000114, 0.00000000],
+		[-6.27303623, -0.00047301, 0.00028980, 0.00047540, -0.00000114, 0.00000000],
+		[-6.27303640, -0.00047294, 0.00028976, 0.00047533, -0.00000114, 0.00000000],
+		[-6.27303658, -0.00047286, 0.00028971, 0.00047526, -0.00000114, 0.00000000],
+		[-6.27303675, -0.00047279, 0.00028967, 0.00047518, -0.00000114, 0.00000000],
+		[-6.27303692, -0.00047272, 0.00028962, 0.00047511, -0.00000114, 0.00000000],
+		[-6.27303709, -0.00047265, 0.00028958, 0.00047504, -0.00000114, 0.00000000],
+		[-6.27303727, -0.00047258, 0.00028954, 0.00047497, -0.00000114, 0.00000000],
+		[-6.27303744, -0.00047250, 0.00028949, 0.00047489, -0.00000114, 0.00000000],
+		[-6.27303761, -0.00047243, 0.00028945, 0.00047482, -0.00000114, 0.00000000],
+		[-6.27303778, -0.00047236, 0.00028940, 0.00047475, -0.00000114, 0.00000000],
+		[-6.27303796, -0.00047229, 0.00028936, 0.00047468, -0.00000114, 0.00000000],
+		[-6.27303813, -0.00047221, 0.00028931, 0.00047460, -0.00000114, 0.00000000],
+		[-6.27303830, -0.00047214, 0.00028927, 0.00047453, -0.00000114, 0.00000000],
+		[-6.27303847, -0.00047207, 0.00028923, 0.00047446, -0.00000114, 0.00000000],
+		[-6.27303865, -0.00047200, 0.00028918, 0.00047439, -0.00000114, 0.00000000],
+		[-6.27303882, -0.00047193, 0.00028914, 0.00047431, -0.00000114, 0.00000000],
+		[-6.27303899, -0.00047185, 0.00028909, 0.00047424, -0.00000114, 0.00000000],
+		[-6.27303916, -0.00047178, 0.00028905, 0.00047417, -0.00000114, 0.00000000],
+		[-6.27303933, -0.00047171, 0.00028901, 0.00047410, -0.00000114, 0.00000000],
+		[-6.27303951, -0.00047164, 0.00028896, 0.00047402, -0.00000114, 0.00000000],
+		[-6.27303968, -0.00047157, 0.00028892, 0.00047395, -0.00000114, 0.00000000],
+		[-6.27303985, -0.00047150, 0.00028887, 0.00047388, -0.00000114, 0.00000000],
+		[-6.27304002, -0.00047142, 0.00028883, 0.00047381, -0.00000114, 0.00000000],
+		[-6.27304019, -0.00047135, 0.00028879, 0.00047374, -0.00000114, 0.00000000],
+		[-6.27304037, -0.00047128, 0.00028874, 0.00047366, -0.00000114, 0.00000000],
+		[-6.27304054, -0.00047121, 0.00028870, 0.00047359, -0.00000114, 0.00000000],
+		[-6.27304071, -0.00047114, 0.00028865, 0.00047352, -0.00000114, 0.00000000],
+		[-6.27304088, -0.00047106, 0.00028861, 0.00047345, -0.00000114, 0.00000000],
+		[-6.27304105, -0.00047099, 0.00028857, 0.00047337, -0.00000114, 0.00000000],
+		[-6.27304122, -0.00047092, 0.00028852, 0.00047330, -0.00000114, 0.00000000],
+		[-6.27304139, -0.00047085, 0.00028848, 0.00047323, -0.00000114, 0.00000000],
+		[-6.27304157, -0.00047078, 0.00028843, 0.00047316, -0.00000114, 0.00000000],
+		[-6.27304174, -0.00047071, 0.00028839, 0.00047309, -0.00000114, 0.00000000],
+		[-6.27304191, -0.00047064, 0.00028835, 0.00047302, -0.00000114, 0.00000000],
+		[-6.27304208, -0.00047056, 0.00028830, 0.00047294, -0.00000114, 0.00000000],
+		[-6.27304225, -0.00047049, 0.00028826, 0.00047287, -0.00000114, 0.00000000],
+		[-6.27304242, -0.00047042, 0.00028822, 0.00047280, -0.00000114, 0.00000000],
+		[-6.27304259, -0.00047035, 0.00028817, 0.00047273, -0.00000114, 0.00000000],
+		[-6.27304276, -0.00047028, 0.00028813, 0.00047266, -0.00000114, 0.00000000],
+		[-6.27304294, -0.00047021, 0.00028808, 0.00047258, -0.00000114, 0.00000000],
+		[-6.27304311, -0.00047013, 0.00028804, 0.00047251, -0.00000114, 0.00000000],
+		[-6.27304328, -0.00047006, 0.00028800, 0.00047244, -0.00000114, 0.00000000],
+		[-6.27304345, -0.00046999, 0.00028795, 0.00047237, -0.00000114, 0.00000000],
+		[-6.27304362, -0.00046992, 0.00028791, 0.00047230, -0.00000114, 0.00000000],
+		[-6.27304379, -0.00046985, 0.00028787, 0.00047223, -0.00000114, 0.00000000],
+		[-6.27304396, -0.00046978, 0.00028782, 0.00047215, -0.00000114, 0.00000000],
+		[-6.27304413, -0.00046971, 0.00028778, 0.00047208, -0.00000114, 0.00000000],
+		[-6.27304430, -0.00046964, 0.00028773, 0.00047201, -0.00000114, 0.00000000],
+		[-6.27304447, -0.00046956, 0.00028769, 0.00047194, -0.00000114, 0.00000000],
+		[-6.27304464, -0.00046949, 0.00028765, 0.00047187, -0.00000114, 0.00000000],
+		[-6.27304481, -0.00046942, 0.00028760, 0.00047180, -0.00000114, 0.00000000],
+		[-6.27304498, -0.00046935, 0.00028756, 0.00047172, -0.00000114, 0.00000000],
+		[-6.27304515, -0.00046928, 0.00028752, 0.00047165, -0.00000114, 0.00000000],
+		[-6.27304532, -0.00046921, 0.00028747, 0.00047158, -0.00000114, 0.00000000],
+		[-6.27304549, -0.00046914, 0.00028743, 0.00047151, -0.00000114, 0.00000000],
+		[-6.27304566, -0.00046907, 0.00028738, 0.00047144, -0.00000114, 0.00000000],
+		[-6.27304583, -0.00046900, 0.00028734, 0.00047137, -0.00000114, 0.00000000],
+		[-6.27304600, -0.00046892, 0.00028730, 0.00047130, -0.00000114, 0.00000000],
+		[-6.27304617, -0.00046885, 0.00028725, 0.00047122, -0.00000114, 0.00000000],
+		[-6.27304634, -0.00046878, 0.00028721, 0.00047115, -0.00000114, 0.00000000],
+		[-6.27304651, -0.00046871, 0.00028717, 0.00047108, -0.00000114, 0.00000000],
+		[-6.27304668, -0.00046864, 0.00028712, 0.00047101, -0.00000114, 0.00000000],
+		[-6.27304685, -0.00046857, 0.00028708, 0.00047094, -0.00000114, 0.00000000],
+		[-6.27304702, -0.00046850, 0.00028704, 0.00047087, -0.00000114, 0.00000000],
+		[-6.27304719, -0.00046843, 0.00028699, 0.00047080, -0.00000114, 0.00000000],
+		[-6.27304736, -0.00046836, 0.00028695, 0.00047072, -0.00000114, 0.00000000],
+		[-6.27304753, -0.00046829, 0.00028691, 0.00047065, -0.00000114, 0.00000000],
+		[-6.27304770, -0.00046821, 0.00028686, 0.00047058, -0.00000114, 0.00000000],
+		[-6.27304787, -0.00046814, 0.00028682, 0.00047051, -0.00000114, 0.00000000],
+		[-6.27304804, -0.00046807, 0.00028678, 0.00047044, -0.00000114, 0.00000000],
+		[-6.27304821, -0.00046800, 0.00028673, 0.00047037, -0.00000114, 0.00000000],
+		[-6.27304838, -0.00046793, 0.00028669, 0.00047030, -0.00000114, 0.00000000],
+		[-6.27304855, -0.00046786, 0.00028665, 0.00047023, -0.00000114, 0.00000000],
+		[-6.27304872, -0.00046779, 0.00028660, 0.00047016, -0.00000114, 0.00000000],
+		[-6.27304889, -0.00046772, 0.00028656, 0.00047008, -0.00000114, 0.00000000],
+		[-6.27304906, -0.00046765, 0.00028652, 0.00047001, -0.00000114, 0.00000000],
+		[-6.27304922, -0.00046758, 0.00028647, 0.00046994, -0.00000114, 0.00000000],
+		[-6.27304939, -0.00046751, 0.00028643, 0.00046987, -0.00000114, 0.00000000],
+		[-6.27304956, -0.00046744, 0.00028639, 0.00046980, -0.00000114, 0.00000000],
+		[-6.27304973, -0.00046737, 0.00028634, 0.00046973, -0.00000114, 0.00000000],
+		[-6.27304990, -0.00046730, 0.00028630, 0.00046966, -0.00000114, 0.00000000],
+		[-6.27305007, -0.00046723, 0.00028626, 0.00046959, -0.00000114, 0.00000000],
+		[-6.27305024, -0.00046715, 0.00028621, 0.00046952, -0.00000114, 0.00000000],
+		[-6.27305041, -0.00046708, 0.00028617, 0.00046945, -0.00000114, 0.00000000],
+		[-6.27305057, -0.00046701, 0.00028613, 0.00046938, -0.00000114, 0.00000000],
+		[-6.27305074, -0.00046694, 0.00028608, 0.00046930, -0.00000114, 0.00000000],
+		[-6.27305091, -0.00046687, 0.00028604, 0.00046923, -0.00000114, 0.00000000],
+		[-6.27305108, -0.00046680, 0.00028600, 0.00046916, -0.00000114, 0.00000000],
+		[-6.27305125, -0.00046673, 0.00028595, 0.00046909, -0.00000114, 0.00000000],
+		[-6.27305142, -0.00046666, 0.00028591, 0.00046902, -0.00000114, 0.00000000],
+		[-6.27305159, -0.00046659, 0.00028587, 0.00046895, -0.00000114, 0.00000000],
+		[-6.27305175, -0.00046652, 0.00028582, 0.00046888, -0.00000114, 0.00000000],
+		[-6.27305192, -0.00046645, 0.00028578, 0.00046881, -0.00000114, 0.00000000],
+		[-6.27305209, -0.00046638, 0.00028574, 0.00046874, -0.00000114, 0.00000000],
+		[-6.27305226, -0.00046631, 0.00028570, 0.00046867, -0.00000114, 0.00000000],
+		[-6.27305243, -0.00046624, 0.00028565, 0.00046860, -0.00000114, 0.00000000],
+		[-6.27305259, -0.00046617, 0.00028561, 0.00046853, -0.00000114, 0.00000000],
+		[-6.27305276, -0.00046610, 0.00028557, 0.00046846, -0.00000114, 0.00000000],
+		[-6.27305293, -0.00046603, 0.00028552, 0.00046839, -0.00000114, 0.00000000],
+		[-6.27305310, -0.00046596, 0.00028548, 0.00046832, -0.00000114, 0.00000000],
+		[-6.27305327, -0.00046589, 0.00028544, 0.00046824, -0.00000114, 0.00000000],
+		[-6.27305343, -0.00046582, 0.00028539, 0.00046817, -0.00000114, 0.00000000],
+		[-6.27305360, -0.00046575, 0.00028535, 0.00046810, -0.00000114, 0.00000000],
+		[-6.27305377, -0.00046568, 0.00028531, 0.00046803, -0.00000114, 0.00000000],
+		[-6.27305394, -0.00046561, 0.00028527, 0.00046796, -0.00000114, 0.00000000],
+		[-6.27305410, -0.00046554, 0.00028522, 0.00046789, -0.00000114, 0.00000000],
+		[-6.27305427, -0.00046547, 0.00028518, 0.00046782, -0.00000114, 0.00000000],
+		[-6.27305444, -0.00046540, 0.00028514, 0.00046775, -0.00000114, 0.00000000],
+		[-6.27305461, -0.00046533, 0.00028509, 0.00046768, -0.00000114, 0.00000000],
+		[-6.27305477, -0.00046526, 0.00028505, 0.00046761, -0.00000114, 0.00000000],
+		[-6.27305494, -0.00046519, 0.00028501, 0.00046754, -0.00000114, 0.00000000],
+		[-6.27305511, -0.00046512, 0.00028497, 0.00046747, -0.00000114, 0.00000000],
+		[-6.27305528, -0.00046505, 0.00028492, 0.00046740, -0.00000114, 0.00000000],
+		[-6.27305544, -0.00046498, 0.00028488, 0.00046733, -0.00000114, 0.00000000],
+		[-6.27305561, -0.00046491, 0.00028484, 0.00046726, -0.00000114, 0.00000000],
+		[-6.27305578, -0.00046484, 0.00028479, 0.00046719, -0.00000114, 0.00000000],
+		[-6.27305594, -0.00046477, 0.00028475, 0.00046712, -0.00000114, 0.00000000],
+		[-6.27305611, -0.00046470, 0.00028471, 0.00046705, -0.00000114, 0.00000000],
+		[-6.27305628, -0.00046463, 0.00028467, 0.00046698, -0.00000114, 0.00000000],
+		[-6.27305645, -0.00046456, 0.00028462, 0.00046691, -0.00000114, 0.00000000],
+		[-6.27305661, -0.00046449, 0.00028458, 0.00046684, -0.00000114, 0.00000000],
+		[-6.27305678, -0.00046442, 0.00028454, 0.00046677, -0.00000114, 0.00000000],
+		[-6.27305695, -0.00046435, 0.00028449, 0.00046670, -0.00000114, 0.00000000],
+		[-6.27305711, -0.00046428, 0.00028445, 0.00046663, -0.00000114, 0.00000000],
+		[-6.27305728, -0.00046421, 0.00028441, 0.00046656, -0.00000114, 0.00000000],
+		[-6.27305745, -0.00046414, 0.00028437, 0.00046649, -0.00000114, 0.00000000],
+		[-6.27305761, -0.00046407, 0.00028432, 0.00046642, -0.00000114, 0.00000000],
+		[-6.27305778, -0.00046400, 0.00028428, 0.00046635, -0.00000114, 0.00000000],
+		[-6.27305795, -0.00046393, 0.00028424, 0.00046628, -0.00000114, 0.00000000],
+		[-6.27305811, -0.00046386, 0.00028420, 0.00046621, -0.00000114, 0.00000000],
+		[-6.27305828, -0.00046380, 0.00028415, 0.00046614, -0.00000114, 0.00000000],
+		[-6.27305844, -0.00046373, 0.00028411, 0.00046607, -0.00000114, 0.00000000],
+		[-6.27305861, -0.00046366, 0.00028407, 0.00046600, -0.00000114, 0.00000000],
+		[-6.27305878, -0.00046359, 0.00028403, 0.00046593, -0.00000114, 0.00000000],
+		[-6.27305894, -0.00046352, 0.00028398, 0.00046586, -0.00000114, 0.00000000],
+		[-6.27305911, -0.00046345, 0.00028394, 0.00046579, -0.00000114, 0.00000000],
+		[-6.27305927, -0.00046338, 0.00028390, 0.00046572, -0.00000114, 0.00000000],
+		[-6.27305944, -0.00046331, 0.00028386, 0.00046565, -0.00000114, 0.00000000],
+		[-6.27305961, -0.00046324, 0.00028381, 0.00046558, -0.00000114, 0.00000000],
+		[-6.27305977, -0.00046317, 0.00028377, 0.00046551, -0.00000114, 0.00000000],
+		[-6.27305994, -0.00046310, 0.00028373, 0.00046544, -0.00000114, 0.00000000],
+		[-6.27306010, -0.00046303, 0.00028369, 0.00046537, -0.00000114, 0.00000000],
+		[-6.27306027, -0.00046296, 0.00028364, 0.00046530, -0.00000114, 0.00000000],
+		[-6.27306044, -0.00046289, 0.00028360, 0.00046523, -0.00000114, 0.00000000],
+		[-6.27306060, -0.00046282, 0.00028356, 0.00046516, -0.00000114, 0.00000000],
+		[-6.27306077, -0.00046276, 0.00028352, 0.00046509, -0.00000114, 0.00000000],
+		[-6.27306093, -0.00046269, 0.00028347, 0.00046502, -0.00000114, 0.00000000],
+		[-6.27306110, -0.00046262, 0.00028343, 0.00046496, -0.00000114, 0.00000000],
+		[-6.27306126, -0.00046255, 0.00028339, 0.00046489, -0.00000114, 0.00000000],
+		[-6.27306143, -0.00046248, 0.00028335, 0.00046482, -0.00000114, 0.00000000],
+		[-6.27306159, -0.00046241, 0.00028330, 0.00046475, -0.00000114, 0.00000000],
+		[-6.27306176, -0.00046234, 0.00028326, 0.00046468, -0.00000114, 0.00000000],
+		[-6.27306192, -0.00046227, 0.00028322, 0.00046461, -0.00000114, 0.00000000],
+		[-6.27306209, -0.00046220, 0.00028318, 0.00046454, -0.00000114, 0.00000000],
+		[-6.27306225, -0.00046213, 0.00028314, 0.00046447, -0.00000114, 0.00000000],
+		[-6.27306242, -0.00046206, 0.00028309, 0.00046440, -0.00000114, 0.00000000],
+		[-6.27306259, -0.00046200, 0.00028305, 0.00046433, -0.00000114, 0.00000000],
+		[-6.27306275, -0.00046193, 0.00028301, 0.00046426, -0.00000114, 0.00000000],
+		[-6.27306292, -0.00046186, 0.00028297, 0.00046419, -0.00000114, 0.00000000],
+		[-6.27306308, -0.00046179, 0.00028292, 0.00046412, -0.00000114, 0.00000000],
+		[-6.27306324, -0.00046172, 0.00028288, 0.00046405, -0.00000114, 0.00000000],
+		[-6.27306341, -0.00046165, 0.00028284, 0.00046398, -0.00000114, 0.00000000],
+		[-6.27306357, -0.00046158, 0.00028280, 0.00046392, -0.00000114, 0.00000000],
+		[-6.27306374, -0.00046151, 0.00028275, 0.00046385, -0.00000114, 0.00000000],
+		[-6.27306390, -0.00046144, 0.00028271, 0.00046378, -0.00000114, 0.00000000],
+		[-6.27306407, -0.00046138, 0.00028267, 0.00046371, -0.00000114, 0.00000000],
+		[-6.27306423, -0.00046131, 0.00028263, 0.00046364, -0.00000114, 0.00000000],
+		[-6.27306440, -0.00046124, 0.00028259, 0.00046357, -0.00000114, 0.00000000],
+		[-6.27306456, -0.00046117, 0.00028254, 0.00046350, -0.00000114, 0.00000000],
+		[-6.27306473, -0.00046110, 0.00028250, 0.00046343, -0.00000114, 0.00000000],
+		[-6.27306489, -0.00046103, 0.00028246, 0.00046336, -0.00000114, 0.00000000],
+		[-6.27306505, -0.00046096, 0.00028242, 0.00046329, -0.00000114, 0.00000000],
+		[-6.27306522, -0.00046090, 0.00028238, 0.00046322, -0.00000114, 0.00000000],
+		[-6.27306538, -0.00046083, 0.00028233, 0.00046316, -0.00000114, 0.00000000],
+		[-6.27306555, -0.00046076, 0.00028229, 0.00046309, -0.00000114, 0.00000000],
+		[-6.27306571, -0.00046069, 0.00028225, 0.00046302, -0.00000114, 0.00000000],
+		[-6.27306588, -0.00046062, 0.00028221, 0.00046295, -0.00000114, 0.00000000],
+		[-6.27306604, -0.00046055, 0.00028217, 0.00046288, -0.00000114, 0.00000000],
+		[-6.27306620, -0.00046048, 0.00028212, 0.00046281, -0.00000114, 0.00000000],
+		[-6.27306637, -0.00046042, 0.00028208, 0.00046274, -0.00000114, 0.00000000],
+		[-6.27306653, -0.00046035, 0.00028204, 0.00046267, -0.00000114, 0.00000000],
+		[-6.27306670, -0.00046028, 0.00028200, 0.00046260, -0.00000114, 0.00000000],
+		[-6.27306686, -0.00046021, 0.00028196, 0.00046254, -0.00000114, 0.00000000],
+		[-6.27306702, -0.00046014, 0.00028191, 0.00046247, -0.00000114, 0.00000000],
+		[-6.27306719, -0.00046007, 0.00028187, 0.00046240, -0.00000114, 0.00000000],
+		[-6.27306735, -0.00046000, 0.00028183, 0.00046233, -0.00000114, 0.00000000],
+		[-6.27306751, -0.00045994, 0.00028179, 0.00046226, -0.00000114, 0.00000000],
+		[-6.27306768, -0.00045987, 0.00028175, 0.00046219, -0.00000114, 0.00000000],
+		[-6.27306784, -0.00045980, 0.00028170, 0.00046212, -0.00000114, 0.00000000],
+		[-6.27306800, -0.00045973, 0.00028166, 0.00046205, -0.00000114, 0.00000000],
+		[-6.27306817, -0.00045966, 0.00028162, 0.00046199, -0.00000114, 0.00000000],
+		[-6.27306833, -0.00045959, 0.00028158, 0.00046192, -0.00000114, 0.00000000],
+		[-6.27306849, -0.00045953, 0.00028154, 0.00046185, -0.00000114, 0.00000000],
+		[-6.27306866, -0.00045946, 0.00028150, 0.00046178, -0.00000114, 0.00000000],
+		[-6.27306882, -0.00045939, 0.00028145, 0.00046171, -0.00000114, 0.00000000],
+		[-6.27306898, -0.00045932, 0.00028141, 0.00046164, -0.00000114, 0.00000000],
+		[-6.27306915, -0.00045925, 0.00028137, 0.00046158, -0.00000114, 0.00000000],
+		[-6.27306931, -0.00045919, 0.00028133, 0.00046151, -0.00000114, 0.00000000],
+		[-6.27306947, -0.00045912, 0.00028129, 0.00046144, -0.00000114, 0.00000000],
+		[-6.27306964, -0.00045905, 0.00028124, 0.00046137, -0.00000114, 0.00000000],
+		[-6.27306980, -0.00045898, 0.00028120, 0.00046130, -0.00000114, 0.00000000],
+		[-6.27306996, -0.00045891, 0.00028116, 0.00046123, -0.00000114, 0.00000000],
+		[-6.27307012, -0.00045885, 0.00028112, 0.00046116, -0.00000114, 0.00000000],
+		[-6.27307029, -0.00045878, 0.00028108, 0.00046110, -0.00000114, 0.00000000],
+		[-6.27307045, -0.00045871, 0.00028104, 0.00046103, -0.00000114, 0.00000000],
+		[-6.27307061, -0.00045864, 0.00028099, 0.00046096, -0.00000114, 0.00000000],
+		[-6.27307078, -0.00045857, 0.00028095, 0.00046089, -0.00000114, 0.00000000],
+		[-6.27307094, -0.00045851, 0.00028091, 0.00046082, -0.00000114, 0.00000000],
+		[-6.27307110, -0.00045844, 0.00028087, 0.00046075, -0.00000114, 0.00000000],
+		[-6.27307126, -0.00045837, 0.00028083, 0.00046069, -0.00000114, 0.00000000],
+		[-6.27307142, -0.00045830, 0.00028079, 0.00046062, -0.00000114, 0.00000000],
+		[-6.27307159, -0.00045823, 0.00028074, 0.00046055, -0.00000114, 0.00000000],
+		[-6.27307175, -0.00045817, 0.00028070, 0.00046048, -0.00000114, 0.00000000],
+		[-6.27307191, -0.00045810, 0.00028066, 0.00046041, -0.00000114, 0.00000000],
+		[-6.27307207, -0.00045803, 0.00028062, 0.00046035, -0.00000114, 0.00000000],
+		[-6.27307224, -0.00045796, 0.00028058, 0.00046028, -0.00000114, 0.00000000],
+		[-6.27307240, -0.00045790, 0.00028054, 0.00046021, -0.00000114, 0.00000000],
+		[-6.27307256, -0.00045783, 0.00028050, 0.00046014, -0.00000114, 0.00000000],
+		[-6.27307272, -0.00045776, 0.00028045, 0.00046007, -0.00000114, 0.00000000],
+		[-6.27307288, -0.00045769, 0.00028041, 0.00046001, -0.00000114, 0.00000000],
+		[-6.27307305, -0.00045762, 0.00028037, 0.00045994, -0.00000114, 0.00000000],
+		[-6.27307321, -0.00045756, 0.00028033, 0.00045987, -0.00000114, 0.00000000],
+		[-6.27307337, -0.00045749, 0.00028029, 0.00045980, -0.00000114, 0.00000000],
+		[-6.27307353, -0.00045742, 0.00028025, 0.00045973, -0.00000114, 0.00000000],
+		[-6.27307369, -0.00045735, 0.00028021, 0.00045967, -0.00000114, 0.00000000],
+		[-6.27307386, -0.00045729, 0.00028016, 0.00045960, -0.00000114, 0.00000000],
+		[-6.27307402, -0.00045722, 0.00028012, 0.00045953, -0.00000114, 0.00000000],
+		[-6.27307418, -0.00045715, 0.00028008, 0.00045946, -0.00000114, 0.00000000],
+		[-6.27307434, -0.00045708, 0.00028004, 0.00045939, -0.00000114, 0.00000000],
+		[-6.27307450, -0.00045702, 0.00028000, 0.00045933, -0.00000114, 0.00000000],
+		[-6.27307466, -0.00045695, 0.00027996, 0.00045926, -0.00000114, 0.00000000],
+		[-6.27307482, -0.00045688, 0.00027992, 0.00045919, -0.00000114, 0.00000000],
+		[-6.27307499, -0.00045681, 0.00027987, 0.00045912, -0.00000114, 0.00000000],
+		[-6.27307515, -0.00045675, 0.00027983, 0.00045905, -0.00000114, 0.00000000],
+		[-6.27307531, -0.00045668, 0.00027979, 0.00045899, -0.00000114, 0.00000000],
+		[-6.27307547, -0.00045661, 0.00027975, 0.00045892, -0.00000114, 0.00000000],
+		[-6.27307563, -0.00045654, 0.00027971, 0.00045885, -0.00000114, 0.00000000],
+		[-6.27307579, -0.00045648, 0.00027967, 0.00045878, -0.00000114, 0.00000000],
+		[-6.27307595, -0.00045641, 0.00027963, 0.00045872, -0.00000114, 0.00000000],
+		[-6.27307611, -0.00045634, 0.00027959, 0.00045865, -0.00000114, 0.00000000],
+		[-6.27307628, -0.00045628, 0.00027954, 0.00045858, -0.00000114, 0.00000000],
+		[-6.27307644, -0.00045621, 0.00027950, 0.00045851, -0.00000114, 0.00000000],
+		[-6.27307660, -0.00045614, 0.00027946, 0.00045845, -0.00000114, 0.00000000],
+		[-6.27307676, -0.00045607, 0.00027942, 0.00045838, -0.00000114, 0.00000000],
+		[-6.27307692, -0.00045601, 0.00027938, 0.00045831, -0.00000114, 0.00000000],
+		[-6.27307708, -0.00045594, 0.00027934, 0.00045824, -0.00000114, 0.00000000],
+		[-6.27307724, -0.00045587, 0.00027930, 0.00045818, -0.00000114, 0.00000000],
+		[-6.27307740, -0.00045581, 0.00027926, 0.00045811, -0.00000114, 0.00000000],
+		[-6.27307756, -0.00045574, 0.00027921, 0.00045804, -0.00000114, 0.00000000],
+		[-6.27307772, -0.00045567, 0.00027917, 0.00045797, -0.00000114, 0.00000000],
+		[-6.27307788, -0.00045560, 0.00027913, 0.00045791, -0.00000114, 0.00000000],
+		[-6.27307804, -0.00045554, 0.00027909, 0.00045784, -0.00000114, 0.00000000],
+		[-6.27307820, -0.00045547, 0.00027905, 0.00045777, -0.00000114, 0.00000000],
+		[-6.27307836, -0.00045540, 0.00027901, 0.00045770, -0.00000114, 0.00000000],
+		[-6.27307852, -0.00045534, 0.00027897, 0.00045764, -0.00000114, 0.00000000],
+		[-6.27307868, -0.00045527, 0.00027893, 0.00045757, -0.00000114, 0.00000000],
+		[-6.27307884, -0.00045520, 0.00027889, 0.00045750, -0.00000114, 0.00000000],
+		[-6.27307900, -0.00045514, 0.00027884, 0.00045743, -0.00000114, 0.00000000],
+		[-6.27307916, -0.00045507, 0.00027880, 0.00045737, -0.00000114, 0.00000000],
+		[-6.27307932, -0.00045500, 0.00027876, 0.00045730, -0.00000114, 0.00000000],
+		[-6.27307949, -0.00045493, 0.00027872, 0.00045723, -0.00000114, 0.00000000],
+		[-6.27307964, -0.00045487, 0.00027868, 0.00045717, -0.00000114, 0.00000000],
+		[-6.27307980, -0.00045480, 0.00027864, 0.00045710, -0.00000114, 0.00000000],
+		[-6.27307996, -0.00045473, 0.00027860, 0.00045703, -0.00000114, 0.00000000],
+		[-6.27308012, -0.00045467, 0.00027856, 0.00045696, -0.00000114, 0.00000000],
+		[-6.27308028, -0.00045460, 0.00027852, 0.00045690, -0.00000114, 0.00000000],
+		[-6.27308044, -0.00045453, 0.00027848, 0.00045683, -0.00000114, 0.00000000],
+		[-6.27308060, -0.00045447, 0.00027844, 0.00045676, -0.00000114, 0.00000000],
+		[-6.27308076, -0.00045440, 0.00027839, 0.00045670, -0.00000114, 0.00000000],
+		[-6.27308092, -0.00045433, 0.00027835, 0.00045663, -0.00000114, 0.00000000],
+		[-6.27308108, -0.00045427, 0.00027831, 0.00045656, -0.00000114, 0.00000000],
+		[-6.27308124, -0.00045420, 0.00027827, 0.00045650, -0.00000114, 0.00000000],
+		[-6.27308140, -0.00045413, 0.00027823, 0.00045643, -0.00000114, 0.00000000],
+		[-6.27308156, -0.00045407, 0.00027819, 0.00045636, -0.00000114, 0.00000000],
+		[-6.27308172, -0.00045400, 0.00027815, 0.00045629, -0.00000114, 0.00000000],
+		[-6.27308188, -0.00045393, 0.00027811, 0.00045623, -0.00000114, 0.00000000],
+		[-6.27308204, -0.00045387, 0.00027807, 0.00045616, -0.00000114, 0.00000000],
+		[-6.27308220, -0.00045380, 0.00027803, 0.00045609, -0.00000114, 0.00000000],
+		[-6.27308236, -0.00045373, 0.00027799, 0.00045603, -0.00000114, 0.00000000],
+		[-6.27308252, -0.00045367, 0.00027795, 0.00045596, -0.00000114, 0.00000000],
+		[-6.27308268, -0.00045360, 0.00027790, 0.00045589, -0.00000114, 0.00000000],
+		[-6.27308284, -0.00045353, 0.00027786, 0.00045583, -0.00000114, 0.00000000],
+		[-6.27308299, -0.00045347, 0.00027782, 0.00045576, -0.00000114, 0.00000000],
+		[-6.27308315, -0.00045340, 0.00027778, 0.00045569, -0.00000114, 0.00000000],
+		[-6.27308331, -0.00045334, 0.00027774, 0.00045563, -0.00000114, 0.00000000],
+		[-6.27308347, -0.00045327, 0.00027770, 0.00045556, -0.00000114, 0.00000000],
+		[-6.27308363, -0.00045320, 0.00027766, 0.00045549, -0.00000114, 0.00000000],
+		[-6.27308379, -0.00045314, 0.00027762, 0.00045543, -0.00000114, 0.00000000],
+		[-6.27308395, -0.00045307, 0.00027758, 0.00045536, -0.00000114, 0.00000000],
+		[-6.27308411, -0.00045300, 0.00027754, 0.00045529, -0.00000114, 0.00000000],
+		[-6.27308426, -0.00045294, 0.00027750, 0.00045523, -0.00000114, 0.00000000],
+		[-6.27308442, -0.00045287, 0.00027746, 0.00045516, -0.00000114, 0.00000000],
+		[-6.27308458, -0.00045281, 0.00027742, 0.00045509, -0.00000114, 0.00000000],
+		[-6.27308474, -0.00045274, 0.00027738, 0.00045503, -0.00000114, 0.00000000],
+		[-6.27308490, -0.00045267, 0.00027734, 0.00045496, -0.00000114, 0.00000000],
+		[-6.27308506, -0.00045261, 0.00027729, 0.00045489, -0.00000114, 0.00000000],
+		[-6.27308522, -0.00045254, 0.00027725, 0.00045483, -0.00000114, 0.00000000],
+		[-6.27308537, -0.00045247, 0.00027721, 0.00045476, -0.00000114, 0.00000000],
+		[-6.27308553, -0.00045241, 0.00027717, 0.00045469, -0.00000114, 0.00000000],
+		[-6.27308569, -0.00045234, 0.00027713, 0.00045463, -0.00000114, 0.00000000],
+		[-6.27308585, -0.00045228, 0.00027709, 0.00045456, -0.00000114, 0.00000000],
+		[-6.27308601, -0.00045221, 0.00027705, 0.00045449, -0.00000114, 0.00000000],
+		[-6.27308616, -0.00045214, 0.00027701, 0.00045443, -0.00000114, 0.00000000],
+		[-6.27308632, -0.00045208, 0.00027697, 0.00045436, -0.00000114, 0.00000000],
+		[-6.27308648, -0.00045201, 0.00027693, 0.00045430, -0.00000114, 0.00000000],
+		[-6.27308664, -0.00045195, 0.00027689, 0.00045423, -0.00000114, 0.00000000],
+		[-6.27308680, -0.00045188, 0.00027685, 0.00045416, -0.00000114, 0.00000000],
+		[-6.27308695, -0.00045181, 0.00027681, 0.00045410, -0.00000114, 0.00000000],
+		[-6.27308711, -0.00045175, 0.00027677, 0.00045403, -0.00000114, 0.00000000],
+		[-6.27308727, -0.00045168, 0.00027673, 0.00045396, -0.00000114, 0.00000000],
+		[-6.27308743, -0.00045162, 0.00027669, 0.00045390, -0.00000114, 0.00000000],
+		[-6.27308759, -0.00045155, 0.00027665, 0.00045383, -0.00000114, 0.00000000],
+		[-6.27308774, -0.00045148, 0.00027661, 0.00045376, -0.00000114, 0.00000000],
+		[-6.27308790, -0.00045142, 0.00027657, 0.00045370, -0.00000114, 0.00000000],
+		[-6.27308806, -0.00045135, 0.00027653, 0.00045363, -0.00000114, 0.00000000],
+		[-6.27308822, -0.00045129, 0.00027649, 0.00045357, -0.00000114, 0.00000000],
+		[-6.27308837, -0.00045122, 0.00027645, 0.00045350, -0.00000114, 0.00000000],
+		[-6.27308853, -0.00045116, 0.00027641, 0.00045343, -0.00000114, 0.00000000],
+		[-6.27308869, -0.00045109, 0.00027636, 0.00045337, -0.00000114, 0.00000000],
+		[-6.27308884, -0.00045102, 0.00027632, 0.00045330, -0.00000114, 0.00000000],
+		[-6.27308900, -0.00045096, 0.00027628, 0.00045324, -0.00000114, 0.00000000],
+		[-6.27308916, -0.00045089, 0.00027624, 0.00045317, -0.00000114, 0.00000000],
+		[-6.27308932, -0.00045083, 0.00027620, 0.00045310, -0.00000114, 0.00000000],
+		[-6.27308947, -0.00045076, 0.00027616, 0.00045304, -0.00000114, 0.00000000],
+		[-6.27308963, -0.00045070, 0.00027612, 0.00045297, -0.00000114, 0.00000000],
+		[-6.27308979, -0.00045063, 0.00027608, 0.00045291, -0.00000114, 0.00000000],
+		[-6.27308994, -0.00045056, 0.00027604, 0.00045284, -0.00000114, 0.00000000],
+		[-6.27309010, -0.00045050, 0.00027600, 0.00045277, -0.00000114, 0.00000000],
+		[-6.27309026, -0.00045043, 0.00027596, 0.00045271, -0.00000114, 0.00000000],
+		[-6.27309042, -0.00045037, 0.00027592, 0.00045264, -0.00000114, 0.00000000],
+		[-6.27309057, -0.00045030, 0.00027588, 0.00045258, -0.00000114, 0.00000000],
+		[-6.27309073, -0.00045024, 0.00027584, 0.00045251, -0.00000114, 0.00000000],
+		[-6.27309089, -0.00045017, 0.00027580, 0.00045245, -0.00000114, 0.00000000],
+		[-6.27309104, -0.00045011, 0.00027576, 0.00045238, -0.00000114, 0.00000000],
+		[-6.27309120, -0.00045004, 0.00027572, 0.00045231, -0.00000114, 0.00000000],
+		[-6.27309136, -0.00044997, 0.00027568, 0.00045225, -0.00000114, 0.00000000],
+		[-6.27309151, -0.00044991, 0.00027564, 0.00045218, -0.00000114, 0.00000000],
+		[-6.27309167, -0.00044984, 0.00027560, 0.00045212, -0.00000114, 0.00000000],
+		[-6.27309183, -0.00044978, 0.00027556, 0.00045205, -0.00000114, 0.00000000],
+		[-6.27309198, -0.00044971, 0.00027552, 0.00045198, -0.00000114, 0.00000000],
+		[-6.27309214, -0.00044965, 0.00027548, 0.00045192, -0.00000114, 0.00000000],
+		[-6.27309229, -0.00044958, 0.00027544, 0.00045185, -0.00000114, 0.00000000],
+		[-6.27309245, -0.00044952, 0.00027540, 0.00045179, -0.00000114, 0.00000000],
+		[-6.27309261, -0.00044945, 0.00027536, 0.00045172, -0.00000114, 0.00000000],
+		[-6.27309276, -0.00044939, 0.00027532, 0.00045166, -0.00000114, 0.00000000],
+		[-6.27309292, -0.00044932, 0.00027528, 0.00045159, -0.00000114, 0.00000000],
+		[-6.27309307, -0.00044926, 0.00027524, 0.00045153, -0.00000114, 0.00000000],
+		[-6.27309323, -0.00044919, 0.00027520, 0.00045146, -0.00000114, 0.00000000],
+		[-6.27309339, -0.00044913, 0.00027516, 0.00045139, -0.00000114, 0.00000000],
+		[-6.27309354, -0.00044906, 0.00027512, 0.00045133, -0.00000114, 0.00000000],
+		[-6.27309370, -0.00044900, 0.00027508, 0.00045126, -0.00000114, 0.00000000],
+		[-6.27309385, -0.00044893, 0.00027504, 0.00045120, -0.00000114, 0.00000000],
+		[-6.27309401, -0.00044887, 0.00027500, 0.00045113, -0.00000114, 0.00000000],
+		[-6.27309417, -0.00044880, 0.00027496, 0.00045107, -0.00000114, 0.00000000],
+		[-6.27309432, -0.00044874, 0.00027492, 0.00045100, -0.00000114, 0.00000000],
+		[-6.27309448, -0.00044867, 0.00027488, 0.00045094, -0.00000114, 0.00000000],
+		[-6.27309463, -0.00044861, 0.00027484, 0.00045087, -0.00000114, 0.00000000],
+		[-6.27309479, -0.00044854, 0.00027480, 0.00045081, -0.00000114, 0.00000000],
+		[-6.27309494, -0.00044848, 0.00027476, 0.00045074, -0.00000114, 0.00000000],
+		[-6.27309510, -0.00044841, 0.00027472, 0.00045068, -0.00000114, 0.00000000],
+		[-6.27309526, -0.00044835, 0.00027468, 0.00045061, -0.00000114, 0.00000000],
+		[-6.27309541, -0.00044828, 0.00027464, 0.00045054, -0.00000114, 0.00000000],
+		[-6.27309557, -0.00044822, 0.00027460, 0.00045048, -0.00000114, 0.00000000],
+		[-6.27309572, -0.00044815, 0.00027456, 0.00045041, -0.00000114, 0.00000000],
+		[-6.27309588, -0.00044809, 0.00027452, 0.00045035, -0.00000114, 0.00000000],
+		[-6.27309603, -0.00044802, 0.00027448, 0.00045028, -0.00000114, 0.00000000],
+		[-6.27309619, -0.00044796, 0.00027444, 0.00045022, -0.00000114, 0.00000000],
+		[-6.27309634, -0.00044789, 0.00027440, 0.00045015, -0.00000114, 0.00000000],
+		[-6.27309650, -0.00044783, 0.00027436, 0.00045009, -0.00000114, 0.00000000],
+		[-6.27309665, -0.00044776, 0.00027432, 0.00045002, -0.00000114, 0.00000000],
+		[-6.27309681, -0.00044770, 0.00027429, 0.00044996, -0.00000114, 0.00000000],
+		[-6.27309696, -0.00044763, 0.00027425, 0.00044989, -0.00000114, 0.00000000],
+		[-6.27309712, -0.00044757, 0.00027421, 0.00044983, -0.00000114, 0.00000000],
+		[-6.27309727, -0.00044750, 0.00027417, 0.00044976, -0.00000114, 0.00000000],
+		[-6.27309743, -0.00044744, 0.00027413, 0.00044970, -0.00000114, 0.00000000],
+		[-6.27309758, -0.00044737, 0.00027409, 0.00044963, -0.00000114, 0.00000000],
+		[-6.27309774, -0.00044731, 0.00027405, 0.00044957, -0.00000114, 0.00000000],
+		[-6.27309789, -0.00044724, 0.00027401, 0.00044950, -0.00000114, 0.00000000],
+		[-6.27309805, -0.00044718, 0.00027397, 0.00044944, -0.00000114, 0.00000000],
+		[-6.27309820, -0.00044712, 0.00027393, 0.00044937, -0.00000114, 0.00000000],
+		[-6.27309835, -0.00044705, 0.00027389, 0.00044931, -0.00000114, 0.00000000],
+		[-6.27309851, -0.00044699, 0.00027385, 0.00044924, -0.00000114, 0.00000000],
+		[-6.27309866, -0.00044692, 0.00027381, 0.00044918, -0.00000114, 0.00000000],
+		[-6.27309882, -0.00044686, 0.00027377, 0.00044911, -0.00000114, 0.00000000],
+		[-6.27309897, -0.00044679, 0.00027373, 0.00044905, -0.00000114, 0.00000000],
+		[-6.27309913, -0.00044673, 0.00027369, 0.00044898, -0.00000114, 0.00000000],
+		[-6.27309928, -0.00044666, 0.00027365, 0.00044892, -0.00000114, 0.00000000],
+		[-6.27309944, -0.00044660, 0.00027361, 0.00044885, -0.00000114, 0.00000000],
+		[-6.27309959, -0.00044653, 0.00027357, 0.00044879, -0.00000114, 0.00000000],
+		[-6.27309974, -0.00044647, 0.00027353, 0.00044873, -0.00000114, 0.00000000],
+		[-6.27309990, -0.00044641, 0.00027349, 0.00044866, -0.00000114, 0.00000000],
+		[-6.27310005, -0.00044634, 0.00027345, 0.00044860, -0.00000114, 0.00000000],
+		[-6.27310021, -0.00044628, 0.00027341, 0.00044853, -0.00000114, 0.00000000],
+		[-6.27310036, -0.00044621, 0.00027338, 0.00044847, -0.00000114, 0.00000000],
+		[-6.27310051, -0.00044615, 0.00027334, 0.00044840, -0.00000114, 0.00000000],
+		[-6.27310067, -0.00044608, 0.00027330, 0.00044834, -0.00000114, 0.00000000],
+		[-6.27310082, -0.00044602, 0.00027326, 0.00044827, -0.00000114, 0.00000000],
+		[-6.27310097, -0.00044596, 0.00027322, 0.00044821, -0.00000114, 0.00000000],
+		[-6.27310113, -0.00044589, 0.00027318, 0.00044814, -0.00000114, 0.00000000],
+		[-6.27310128, -0.00044583, 0.00027314, 0.00044808, -0.00000114, 0.00000000],
+		[-6.27310144, -0.00044576, 0.00027310, 0.00044801, -0.00000114, 0.00000000],
+		[-6.27310159, -0.00044570, 0.00027306, 0.00044795, -0.00000114, 0.00000000],
+		[-6.27310174, -0.00044563, 0.00027302, 0.00044789, -0.00000114, 0.00000000],
+		[-6.27310190, -0.00044557, 0.00027298, 0.00044782, -0.00000114, 0.00000000],
+		[-6.27310205, -0.00044551, 0.00027294, 0.00044776, -0.00000114, 0.00000000],
+		[-6.27310220, -0.00044544, 0.00027290, 0.00044769, -0.00000114, 0.00000000],
+		[-6.27310236, -0.00044538, 0.00027286, 0.00044763, -0.00000114, 0.00000000],
+		[-6.27310251, -0.00044531, 0.00027282, 0.00044756, -0.00000114, 0.00000000],
+		[-6.27310266, -0.00044525, 0.00027279, 0.00044750, -0.00000114, 0.00000000],
+		[-6.27310282, -0.00044519, 0.00027275, 0.00044743, -0.00000114, 0.00000000],
+		[-6.27310297, -0.00044512, 0.00027271, 0.00044737, -0.00000114, 0.00000000],
+		[-6.27310312, -0.00044506, 0.00027267, 0.00044731, -0.00000114, 0.00000000],
+		[-6.27310328, -0.00044499, 0.00027263, 0.00044724, -0.00000114, 0.00000000],
+		[-6.27310343, -0.00044493, 0.00027259, 0.00044718, -0.00000114, 0.00000000],
+		[-6.27310358, -0.00044487, 0.00027255, 0.00044711, -0.00000114, 0.00000000],
+		[-6.27310374, -0.00044480, 0.00027251, 0.00044705, -0.00000114, 0.00000000],
+		[-6.27310389, -0.00044474, 0.00027247, 0.00044698, -0.00000114, 0.00000000],
+		[-6.27310404, -0.00044467, 0.00027243, 0.00044692, -0.00000114, 0.00000000],
+		[-6.27310419, -0.00044461, 0.00027239, 0.00044686, -0.00000114, 0.00000000],
+		[-6.27310435, -0.00044455, 0.00027235, 0.00044679, -0.00000114, 0.00000000],
+		[-6.27310450, -0.00044448, 0.00027231, 0.00044673, -0.00000114, 0.00000000],
+		[-6.27310465, -0.00044442, 0.00027228, 0.00044666, -0.00000114, 0.00000000],
+		[-6.27310481, -0.00044436, 0.00027224, 0.00044660, -0.00000114, 0.00000000],
+		[-6.27310496, -0.00044429, 0.00027220, 0.00044654, -0.00000114, 0.00000000],
+		[-6.27310511, -0.00044423, 0.00027216, 0.00044647, -0.00000114, 0.00000000],
+		[-6.27310526, -0.00044416, 0.00027212, 0.00044641, -0.00000114, 0.00000000],
+		[-6.27310542, -0.00044410, 0.00027208, 0.00044634, -0.00000114, 0.00000000],
+		[-6.27310557, -0.00044404, 0.00027204, 0.00044628, -0.00000114, 0.00000000],
+		[-6.27310572, -0.00044397, 0.00027200, 0.00044621, -0.00000114, 0.00000000],
+		[-6.27310587, -0.00044391, 0.00027196, 0.00044615, -0.00000114, 0.00000000],
+		[-6.27310603, -0.00044385, 0.00027192, 0.00044609, -0.00000114, 0.00000000],
+		[-6.27310618, -0.00044378, 0.00027189, 0.00044602, -0.00000114, 0.00000000],
+		[-6.27310633, -0.00044372, 0.00027185, 0.00044596, -0.00000114, 0.00000000],
+		[-6.27310648, -0.00044365, 0.00027181, 0.00044590, -0.00000114, 0.00000000],
+		[-6.27310663, -0.00044359, 0.00027177, 0.00044583, -0.00000114, 0.00000000],
+		[-6.27310679, -0.00044353, 0.00027173, 0.00044577, -0.00000114, 0.00000000],
+		[-6.27310694, -0.00044346, 0.00027169, 0.00044570, -0.00000114, 0.00000000],
+		[-6.27310709, -0.00044340, 0.00027165, 0.00044564, -0.00000114, 0.00000000],
+		[-6.27310724, -0.00044334, 0.00027161, 0.00044558, -0.00000114, 0.00000000],
+		[-6.27310739, -0.00044327, 0.00027157, 0.00044551, -0.00000114, 0.00000000],
+		[-6.27310755, -0.00044321, 0.00027153, 0.00044545, -0.00000114, 0.00000000],
+		[-6.27310770, -0.00044315, 0.00027150, 0.00044538, -0.00000114, 0.00000000],
+		[-6.27310785, -0.00044308, 0.00027146, 0.00044532, -0.00000114, 0.00000000],
+		[-6.27310800, -0.00044302, 0.00027142, 0.00044526, -0.00000114, 0.00000000],
+		[-6.27310815, -0.00044296, 0.00027138, 0.00044519, -0.00000114, 0.00000000],
+		[-6.27310831, -0.00044289, 0.00027134, 0.00044513, -0.00000114, 0.00000000],
+		[-6.27310846, -0.00044283, 0.00027130, 0.00044507, -0.00000114, 0.00000000],
+		[-6.27310861, -0.00044277, 0.00027126, 0.00044500, -0.00000114, 0.00000000],
+		[-6.27310876, -0.00044270, 0.00027122, 0.00044494, -0.00000114, 0.00000000],
+		[-6.27310891, -0.00044264, 0.00027119, 0.00044487, -0.00000114, 0.00000000],
+		[-6.27310906, -0.00044258, 0.00027115, 0.00044481, -0.00000114, 0.00000000],
+		[-6.27310921, -0.00044251, 0.00027111, 0.00044475, -0.00000114, 0.00000000],
+		[-6.27310937, -0.00044245, 0.00027107, 0.00044468, -0.00000114, 0.00000000],
+		[-6.27310952, -0.00044239, 0.00027103, 0.00044462, -0.00000114, 0.00000000],
+		[-6.27310967, -0.00044232, 0.00027099, 0.00044456, -0.00000114, 0.00000000],
+		[-6.27310982, -0.00044226, 0.00027095, 0.00044449, -0.00000114, 0.00000000],
+		[-6.27310997, -0.00044220, 0.00027091, 0.00044443, -0.00000114, 0.00000000],
+		[-6.27311012, -0.00044213, 0.00027088, 0.00044437, -0.00000114, 0.00000000],
+		[-6.27311027, -0.00044207, 0.00027084, 0.00044430, -0.00000114, 0.00000000],
+		[-6.27311042, -0.00044201, 0.00027080, 0.00044424, -0.00000114, 0.00000000],
+		[-6.27311058, -0.00044194, 0.00027076, 0.00044418, -0.00000114, 0.00000000],
+		[-6.27311073, -0.00044188, 0.00027072, 0.00044411, -0.00000114, 0.00000000],
+		[-6.27311088, -0.00044182, 0.00027068, 0.00044405, -0.00000114, 0.00000000],
+		[-6.27311103, -0.00044176, 0.00027064, 0.00044399, -0.00000114, 0.00000000],
+		[-6.27311118, -0.00044169, 0.00027060, 0.00044392, -0.00000114, 0.00000000],
+		[-6.27311133, -0.00044163, 0.00027057, 0.00044386, -0.00000114, 0.00000000],
+		[-6.27311148, -0.00044157, 0.00027053, 0.00044380, -0.00000114, 0.00000000],
+		[-6.27311163, -0.00044150, 0.00027049, 0.00044373, -0.00000114, 0.00000000],
+		[-6.27311178, -0.00044144, 0.00027045, 0.00044367, -0.00000114, 0.00000000],
+		[-6.27311193, -0.00044138, 0.00027041, 0.00044361, -0.00000114, 0.00000000],
+		[-6.27311208, -0.00044131, 0.00027037, 0.00044354, -0.00000114, 0.00000000],
+		[-6.27311223, -0.00044125, 0.00027033, 0.00044348, -0.00000114, 0.00000000],
+		[-6.27311238, -0.00044119, 0.00027030, 0.00044342, -0.00000114, 0.00000000],
+		[-6.27311253, -0.00044113, 0.00027026, 0.00044335, -0.00000114, 0.00000000],
+		[-6.27311269, -0.00044106, 0.00027022, 0.00044329, -0.00000114, 0.00000000],
+		[-6.27311284, -0.00044100, 0.00027018, 0.00044323, -0.00000114, 0.00000000],
+		[-6.27311299, -0.00044094, 0.00027014, 0.00044316, -0.00000114, 0.00000000],
+		[-6.27311314, -0.00044087, 0.00027010, 0.00044310, -0.00000114, 0.00000000],
+		[-6.27311329, -0.00044081, 0.00027006, 0.00044304, -0.00000114, 0.00000000],
+		[-6.27311344, -0.00044075, 0.00027003, 0.00044297, -0.00000114, 0.00000000],
+		[-6.27311359, -0.00044069, 0.00026999, 0.00044291, -0.00000114, 0.00000000],
+		[-6.27311374, -0.00044062, 0.00026995, 0.00044285, -0.00000114, 0.00000000],
+		[-6.27311389, -0.00044056, 0.00026991, 0.00044279, -0.00000114, 0.00000000],
+		[-6.27311404, -0.00044050, 0.00026987, 0.00044272, -0.00000114, 0.00000000],
+		[-6.27311419, -0.00044044, 0.00026983, 0.00044266, -0.00000114, 0.00000000],
+		[-6.27311434, -0.00044037, 0.00026980, 0.00044260, -0.00000114, 0.00000000],
+		[-6.27311449, -0.00044031, 0.00026976, 0.00044253, -0.00000114, 0.00000000],
+		[-6.27311464, -0.00044025, 0.00026972, 0.00044247, -0.00000114, 0.00000000],
+		[-6.27311479, -0.00044018, 0.00026968, 0.00044241, -0.00000114, 0.00000000],
+		[-6.27311494, -0.00044012, 0.00026964, 0.00044234, -0.00000114, 0.00000000],
+		[-6.27311509, -0.00044006, 0.00026960, 0.00044228, -0.00000114, 0.00000000],
+		[-6.27311524, -0.00044000, 0.00026957, 0.00044222, -0.00000114, 0.00000000],
+		[-6.27311539, -0.00043993, 0.00026953, 0.00044216, -0.00000114, 0.00000000],
+		[-6.27311554, -0.00043987, 0.00026949, 0.00044209, -0.00000114, 0.00000000],
+		[-6.27311569, -0.00043981, 0.00026945, 0.00044203, -0.00000114, 0.00000000],
+		[-6.27311583, -0.00043975, 0.00026941, 0.00044197, -0.00000114, 0.00000000],
+		[-6.27311598, -0.00043968, 0.00026937, 0.00044190, -0.00000114, 0.00000000],
+		[-6.27311613, -0.00043962, 0.00026934, 0.00044184, -0.00000114, 0.00000000],
+		[-6.27311628, -0.00043956, 0.00026930, 0.00044178, -0.00000114, 0.00000000],
+		[-6.27311643, -0.00043950, 0.00026926, 0.00044172, -0.00000114, 0.00000000],
+		[-6.27311658, -0.00043944, 0.00026922, 0.00044165, -0.00000114, 0.00000000],
+		[-6.27311673, -0.00043937, 0.00026918, 0.00044159, -0.00000114, 0.00000000],
+		[-6.27311688, -0.00043931, 0.00026914, 0.00044153, -0.00000114, 0.00000000],
+		[-6.27311703, -0.00043925, 0.00026911, 0.00044147, -0.00000114, 0.00000000],
+		[-6.27311718, -0.00043919, 0.00026907, 0.00044140, -0.00000114, 0.00000000],
+		[-6.27311733, -0.00043912, 0.00026903, 0.00044134, -0.00000114, 0.00000000],
+		[-6.27311748, -0.00043906, 0.00026899, 0.00044128, -0.00000114, 0.00000000],
+		[-6.27311763, -0.00043900, 0.00026895, 0.00044122, -0.00000114, 0.00000000],
+		[-6.27311777, -0.00043894, 0.00026892, 0.00044115, -0.00000114, 0.00000000],
+		[-6.27311792, -0.00043887, 0.00026888, 0.00044109, -0.00000114, 0.00000000],
+		[-6.27311807, -0.00043881, 0.00026884, 0.00044103, -0.00000114, 0.00000000],
+		[-6.27311822, -0.00043875, 0.00026880, 0.00044096, -0.00000114, 0.00000000],
+		[-6.27311837, -0.00043869, 0.00026876, 0.00044090, -0.00000114, 0.00000000],
+		[-6.27311852, -0.00043863, 0.00026872, 0.00044084, -0.00000114, 0.00000000],
+		[-6.27311867, -0.00043856, 0.00026869, 0.00044078, -0.00000114, 0.00000000],
+		[-6.27311882, -0.00043850, 0.00026865, 0.00044072, -0.00000114, 0.00000000],
+		[-6.27311897, -0.00043844, 0.00026861, 0.00044065, -0.00000114, 0.00000000],
+		[-6.27311911, -0.00043838, 0.00026857, 0.00044059, -0.00000114, 0.00000000],
+		[-6.27311926, -0.00043832, 0.00026853, 0.00044053, -0.00000114, 0.00000000],
+		[-6.27311941, -0.00043825, 0.00026850, 0.00044047, -0.00000114, 0.00000000],
+		[-6.27311956, -0.00043819, 0.00026846, 0.00044040, -0.00000114, 0.00000000],
+		[-6.27311971, -0.00043813, 0.00026842, 0.00044034, -0.00000114, 0.00000000],
+		[-6.27311986, -0.00043807, 0.00026838, 0.00044028, -0.00000114, 0.00000000],
+		[-6.27312000, -0.00043800, 0.00026834, 0.00044022, -0.00000114, 0.00000000],
+		[-6.27312015, -0.00043794, 0.00026831, 0.00044015, -0.00000114, 0.00000000],
+		[-6.27312030, -0.00043788, 0.00026827, 0.00044009, -0.00000114, 0.00000000],
+		[-6.27312045, -0.00043782, 0.00026823, 0.00044003, -0.00000114, 0.00000000],
+		[-6.27312060, -0.00043776, 0.00026819, 0.00043997, -0.00000114, 0.00000000],
+		[-6.27312075, -0.00043770, 0.00026815, 0.00043990, -0.00000114, 0.00000000],
+		[-6.27312089, -0.00043763, 0.00026812, 0.00043984, -0.00000114, 0.00000000],
+		[-6.27312104, -0.00043757, 0.00026808, 0.00043978, -0.00000114, 0.00000000],
+		[-6.27312119, -0.00043751, 0.00026804, 0.00043972, -0.00000114, 0.00000000],
+		[-6.27312134, -0.00043745, 0.00026800, 0.00043966, -0.00000114, 0.00000000],
+		[-6.27312149, -0.00043739, 0.00026796, 0.00043959, -0.00000114, 0.00000000],
+		[-6.27312163, -0.00043732, 0.00026793, 0.00043953, -0.00000114, 0.00000000],
+		[-6.27312178, -0.00043726, 0.00026789, 0.00043947, -0.00000114, 0.00000000],
+		[-6.27312193, -0.00043720, 0.00026785, 0.00043941, -0.00000114, 0.00000000],
+		[-6.27312208, -0.00043714, 0.00026781, 0.00043935, -0.00000114, 0.00000000],
+		[-6.27312223, -0.00043708, 0.00026778, 0.00043928, -0.00000114, 0.00000000],
+		[-6.27312237, -0.00043702, 0.00026774, 0.00043922, -0.00000114, 0.00000000],
+		[-6.27312252, -0.00043695, 0.00026770, 0.00043916, -0.00000114, 0.00000000],
+		[-6.27312267, -0.00043689, 0.00026766, 0.00043910, -0.00000114, 0.00000000],
+		[-6.27312282, -0.00043683, 0.00026762, 0.00043904, -0.00000114, 0.00000000],
+		[-6.27312296, -0.00043677, 0.00026759, 0.00043897, -0.00000114, 0.00000000],
+		[-6.27312311, -0.00043671, 0.00026755, 0.00043891, -0.00000114, 0.00000000],
+		[-6.27312326, -0.00043665, 0.00026751, 0.00043885, -0.00000114, 0.00000000],
+		[-6.27312341, -0.00043658, 0.00026747, 0.00043879, -0.00000114, 0.00000000],
+		[-6.27312355, -0.00043652, 0.00026744, 0.00043873, -0.00000114, 0.00000000],
+		[-6.27312370, -0.00043646, 0.00026740, 0.00043866, -0.00000114, 0.00000000],
+		[-6.27312385, -0.00043640, 0.00026736, 0.00043860, -0.00000114, 0.00000000],
+		[-6.27312399, -0.00043634, 0.00026732, 0.00043854, -0.00000114, 0.00000000],
+		[-6.27312414, -0.00043628, 0.00026728, 0.00043848, -0.00000114, 0.00000000],
+		[-6.27312429, -0.00043622, 0.00026725, 0.00043842, -0.00000114, 0.00000000],
+		[-6.27312444, -0.00043615, 0.00026721, 0.00043836, -0.00000114, 0.00000000],
+		[-6.27312458, -0.00043609, 0.00026717, 0.00043829, -0.00000114, 0.00000000],
+		[-6.27312473, -0.00043603, 0.00026713, 0.00043823, -0.00000114, 0.00000000],
+		[-6.27312488, -0.00043597, 0.00026710, 0.00043817, -0.00000114, 0.00000000],
+		[-6.27312502, -0.00043591, 0.00026706, 0.00043811, -0.00000114, 0.00000000],
+		[-6.27312517, -0.00043585, 0.00026702, 0.00043805, -0.00000114, 0.00000000],
+		[-6.27312532, -0.00043579, 0.00026698, 0.00043798, -0.00000114, 0.00000000],
+		[-6.27312546, -0.00043572, 0.00026695, 0.00043792, -0.00000114, 0.00000000],
+		[-6.27312561, -0.00043566, 0.00026691, 0.00043786, -0.00000114, 0.00000000],
+		[-6.27312576, -0.00043560, 0.00026687, 0.00043780, -0.00000114, 0.00000000],
+		[-6.27312590, -0.00043554, 0.00026683, 0.00043774, -0.00000114, 0.00000000],
+		[-6.27312605, -0.00043548, 0.00026680, 0.00043768, -0.00000114, 0.00000000],
+		[-6.27312620, -0.00043542, 0.00026676, 0.00043762, -0.00000114, 0.00000000],
+		[-6.27312634, -0.00043536, 0.00026672, 0.00043755, -0.00000114, 0.00000000],
+		[-6.27312649, -0.00043529, 0.00026668, 0.00043749, -0.00000114, 0.00000000],
+		[-6.27312664, -0.00043523, 0.00026665, 0.00043743, -0.00000114, 0.00000000],
+		[-6.27312678, -0.00043517, 0.00026661, 0.00043737, -0.00000114, 0.00000000],
+		[-6.27312693, -0.00043511, 0.00026657, 0.00043731, -0.00000114, 0.00000000],
+		[-6.27312708, -0.00043505, 0.00026653, 0.00043725, -0.00000114, 0.00000000],
+		[-6.27312722, -0.00043499, 0.00026650, 0.00043718, -0.00000114, 0.00000000],
+		[-6.27312737, -0.00043493, 0.00026646, 0.00043712, -0.00000114, 0.00000000],
+		[-6.27312752, -0.00043487, 0.00026642, 0.00043706, -0.00000114, 0.00000000],
+		[-6.27312766, -0.00043481, 0.00026638, 0.00043700, -0.00000114, 0.00000000],
+		[-6.27312781, -0.00043474, 0.00026635, 0.00043694, -0.00000114, 0.00000000],
+		[-6.27312795, -0.00043468, 0.00026631, 0.00043688, -0.00000114, 0.00000000],
+		[-6.27312810, -0.00043462, 0.00026627, 0.00043682, -0.00000114, 0.00000000],
+		[-6.27312825, -0.00043456, 0.00026623, 0.00043676, -0.00000114, 0.00000000],
+		[-6.27312839, -0.00043450, 0.00026620, 0.00043669, -0.00000114, 0.00000000],
+		[-6.27312854, -0.00043444, 0.00026616, 0.00043663, -0.00000114, 0.00000000],
+		[-6.27312868, -0.00043438, 0.00026612, 0.00043657, -0.00000114, 0.00000000],
+		[-6.27312883, -0.00043432, 0.00026608, 0.00043651, -0.00000114, 0.00000000],
+		[-6.27312898, -0.00043426, 0.00026605, 0.00043645, -0.00000114, 0.00000000],
+		[-6.27312912, -0.00043420, 0.00026601, 0.00043639, -0.00000114, 0.00000000],
+		[-6.27312927, -0.00043413, 0.00026597, 0.00043633, -0.00000114, 0.00000000],
+		[-6.27312941, -0.00043407, 0.00026593, 0.00043626, -0.00000114, 0.00000000],
+		[-6.27312956, -0.00043401, 0.00026590, 0.00043620, -0.00000114, 0.00000000],
+		[-6.27312970, -0.00043395, 0.00026586, 0.00043614, -0.00000114, 0.00000000],
+		[-6.27312985, -0.00043389, 0.00026582, 0.00043608, -0.00000114, 0.00000000],
+		[-6.27313000, -0.00043383, 0.00026579, 0.00043602, -0.00000114, 0.00000000],
+		[-6.27313014, -0.00043377, 0.00026575, 0.00043596, -0.00000114, 0.00000000],
+		[-6.27313029, -0.00043371, 0.00026571, 0.00043590, -0.00000114, 0.00000000],
+		[-6.27313043, -0.00043365, 0.00026567, 0.00043584, -0.00000114, 0.00000000],
+		[-6.27313058, -0.00043359, 0.00026564, 0.00043578, -0.00000114, 0.00000000],
+		[-6.27313072, -0.00043353, 0.00026560, 0.00043572, -0.00000114, 0.00000000],
+		[-6.27313087, -0.00043347, 0.00026556, 0.00043565, -0.00000114, 0.00000000],
+		[-6.27313101, -0.00043341, 0.00026552, 0.00043559, -0.00000114, 0.00000000],
+		[-6.27313116, -0.00043335, 0.00026549, 0.00043553, -0.00000114, 0.00000000],
+		[-6.27313130, -0.00043328, 0.00026545, 0.00043547, -0.00000114, 0.00000000],
+		[-6.27313145, -0.00043322, 0.00026541, 0.00043541, -0.00000114, 0.00000000],
+		[-6.27313159, -0.00043316, 0.00026538, 0.00043535, -0.00000114, 0.00000000],
+		[-6.27313174, -0.00043310, 0.00026534, 0.00043529, -0.00000114, 0.00000000],
+		[-6.27313188, -0.00043304, 0.00026530, 0.00043523, -0.00000114, 0.00000000],
+		[-6.27313203, -0.00043298, 0.00026526, 0.00043517, -0.00000114, 0.00000000],
+		[-6.27313217, -0.00043292, 0.00026523, 0.00043511, -0.00000114, 0.00000000],
+		[-6.27313232, -0.00043286, 0.00026519, 0.00043504, -0.00000114, 0.00000000],
+		[-6.27313246, -0.00043280, 0.00026515, 0.00043498, -0.00000114, 0.00000000],
+		[-6.27313261, -0.00043274, 0.00026512, 0.00043492, -0.00000114, 0.00000000],
+		[-6.27313275, -0.00043268, 0.00026508, 0.00043486, -0.00000114, 0.00000000],
+		[-6.27313290, -0.00043262, 0.00026504, 0.00043480, -0.00000114, 0.00000000],
+		[-6.27313304, -0.00043256, 0.00026501, 0.00043474, -0.00000114, 0.00000000],
+		[-6.27313319, -0.00043250, 0.00026497, 0.00043468, -0.00000114, 0.00000000],
+		[-6.27313333, -0.00043244, 0.00026493, 0.00043462, -0.00000114, 0.00000000],
+		[-6.27313348, -0.00043238, 0.00026489, 0.00043456, -0.00000114, 0.00000000],
+		[-6.27313362, -0.00043232, 0.00026486, 0.00043450, -0.00000114, 0.00000000],
+		[-6.27313377, -0.00043226, 0.00026482, 0.00043444, -0.00000114, 0.00000000],
+		[-6.27313391, -0.00043220, 0.00026478, 0.00043438, -0.00000114, 0.00000000],
+		[-6.27313405, -0.00043214, 0.00026475, 0.00043432, -0.00000114, 0.00000000],
+		[-6.27313420, -0.00043207, 0.00026471, 0.00043426, -0.00000114, 0.00000000],
+		[-6.27313434, -0.00043201, 0.00026467, 0.00043419, -0.00000114, 0.00000000],
+		[-6.27313449, -0.00043195, 0.00026464, 0.00043413, -0.00000114, 0.00000000],
+		[-6.27313463, -0.00043189, 0.00026460, 0.00043407, -0.00000114, 0.00000000],
+		[-6.27313478, -0.00043183, 0.00026456, 0.00043401, -0.00000114, 0.00000000],
+		[-6.27313492, -0.00043177, 0.00026452, 0.00043395, -0.00000114, 0.00000000],
+		[-6.27313506, -0.00043171, 0.00026449, 0.00043389, -0.00000114, 0.00000000],
+		[-6.27313521, -0.00043165, 0.00026445, 0.00043383, -0.00000114, 0.00000000],
+		[-6.27313535, -0.00043159, 0.00026441, 0.00043377, -0.00000114, 0.00000000],
+		[-6.27313550, -0.00043153, 0.00026438, 0.00043371, -0.00000114, 0.00000000],
+		[-6.27313564, -0.00043147, 0.00026434, 0.00043365, -0.00000114, 0.00000000],
+		[-6.27313578, -0.00043141, 0.00026430, 0.00043359, -0.00000114, 0.00000000],
+		[-6.27313593, -0.00043135, 0.00026427, 0.00043353, -0.00000114, 0.00000000],
+		[-6.27313607, -0.00043129, 0.00026423, 0.00043347, -0.00000114, 0.00000000],
+		[-6.27313622, -0.00043123, 0.00026419, 0.00043341, -0.00000114, 0.00000000],
+		[-6.27313636, -0.00043117, 0.00026416, 0.00043335, -0.00000114, 0.00000000],
+		[-6.27313650, -0.00043111, 0.00026412, 0.00043329, -0.00000114, 0.00000000],
+		[-6.27313665, -0.00043105, 0.00026408, 0.00043323, -0.00000114, 0.00000000],
+		[-6.27313679, -0.00043099, 0.00026405, 0.00043317, -0.00000114, 0.00000000],
+		[-6.27313693, -0.00043093, 0.00026401, 0.00043311, -0.00000114, 0.00000000],
+		[-6.27313708, -0.00043087, 0.00026397, 0.00043305, -0.00000114, 0.00000000],
+		[-6.27313722, -0.00043081, 0.00026394, 0.00043299, -0.00000114, 0.00000000],
+		[-6.27313737, -0.00043075, 0.00026390, 0.00043293, -0.00000114, 0.00000000],
+		[-6.27313751, -0.00043069, 0.00026386, 0.00043287, -0.00000114, 0.00000000],
+		[-6.27313765, -0.00043063, 0.00026382, 0.00043281, -0.00000114, 0.00000000],
+		[-6.27313780, -0.00043057, 0.00026379, 0.00043275, -0.00000114, 0.00000000],
+		[-6.27313794, -0.00043051, 0.00026375, 0.00043268, -0.00000114, 0.00000000],
+		[-6.27313808, -0.00043045, 0.00026371, 0.00043262, -0.00000114, 0.00000000],
+		[-6.27313823, -0.00043039, 0.00026368, 0.00043256, -0.00000114, 0.00000000],
+		[-6.27313837, -0.00043033, 0.00026364, 0.00043250, -0.00000114, 0.00000000],
+		[-6.27313851, -0.00043027, 0.00026360, 0.00043244, -0.00000114, 0.00000000],
+		[-6.27313865, -0.00043021, 0.00026357, 0.00043238, -0.00000114, 0.00000000],
+		[-6.27313880, -0.00043015, 0.00026353, 0.00043232, -0.00000114, 0.00000000],
+		[-6.27313894, -0.00043009, 0.00026349, 0.00043226, -0.00000114, 0.00000000],
+		[-6.27313908, -0.00043003, 0.00026346, 0.00043220, -0.00000114, 0.00000000],
+		[-6.27313923, -0.00042997, 0.00026342, 0.00043214, -0.00000114, 0.00000000],
+		[-6.27313937, -0.00042991, 0.00026338, 0.00043208, -0.00000114, 0.00000000],
+		[-6.27313951, -0.00042985, 0.00026335, 0.00043202, -0.00000114, 0.00000000],
+		[-6.27313966, -0.00042980, 0.00026331, 0.00043196, -0.00000114, 0.00000000],
+		[-6.27313980, -0.00042974, 0.00026328, 0.00043190, -0.00000114, 0.00000000],
+		[-6.27313994, -0.00042968, 0.00026324, 0.00043184, -0.00000114, 0.00000000],
+		[-6.27314008, -0.00042962, 0.00026320, 0.00043178, -0.00000114, 0.00000000],
+		[-6.27314023, -0.00042956, 0.00026317, 0.00043172, -0.00000114, 0.00000000],
+		[-6.27314037, -0.00042950, 0.00026313, 0.00043166, -0.00000114, 0.00000000],
+		[-6.27314051, -0.00042944, 0.00026309, 0.00043160, -0.00000114, 0.00000000],
+		[-6.27314065, -0.00042938, 0.00026306, 0.00043154, -0.00000114, 0.00000000],
+		[-6.27314080, -0.00042932, 0.00026302, 0.00043148, -0.00000114, 0.00000000],
+		[-6.27314094, -0.00042926, 0.00026298, 0.00043142, -0.00000114, 0.00000000],
+		[-6.27314108, -0.00042920, 0.00026295, 0.00043136, -0.00000114, 0.00000000],
+		[-6.27314122, -0.00042914, 0.00026291, 0.00043131, -0.00000114, 0.00000000],
+		[-6.27314137, -0.00042908, 0.00026287, 0.00043125, -0.00000114, 0.00000000],
+		[-6.27314151, -0.00042902, 0.00026284, 0.00043119, -0.00000114, 0.00000000],
+		[-6.27314165, -0.00042896, 0.00026280, 0.00043113, -0.00000114, 0.00000000],
+		[-6.27314179, -0.00042890, 0.00026276, 0.00043107, -0.00000114, 0.00000000],
+		[-6.27314194, -0.00042884, 0.00026273, 0.00043101, -0.00000114, 0.00000000],
+		[-6.27314208, -0.00042878, 0.00026269, 0.00043095, -0.00000114, 0.00000000],
+		[-6.27314222, -0.00042872, 0.00026265, 0.00043089, -0.00000114, 0.00000000],
+		[-6.27314236, -0.00042866, 0.00026262, 0.00043083, -0.00000114, 0.00000000],
+		[-6.27314250, -0.00042861, 0.00026258, 0.00043077, -0.00000114, 0.00000000],
+		[-6.27314265, -0.00042855, 0.00026255, 0.00043071, -0.00000114, 0.00000000],
+		[-6.27314279, -0.00042849, 0.00026251, 0.00043065, -0.00000114, 0.00000000],
+		[-6.27314293, -0.00042843, 0.00026247, 0.00043059, -0.00000114, 0.00000000],
+		[-6.27314307, -0.00042837, 0.00026244, 0.00043053, -0.00000114, 0.00000000],
+		[-6.27314321, -0.00042831, 0.00026240, 0.00043047, -0.00000114, 0.00000000],
+		[-6.27314336, -0.00042825, 0.00026236, 0.00043041, -0.00000114, 0.00000000],
+		[-6.27314350, -0.00042819, 0.00026233, 0.00043035, -0.00000114, 0.00000000],
+		[-6.27314364, -0.00042813, 0.00026229, 0.00043029, -0.00000114, 0.00000000],
+		[-6.27314378, -0.00042807, 0.00026226, 0.00043023, -0.00000114, 0.00000000],
+		[-6.27314392, -0.00042801, 0.00026222, 0.00043017, -0.00000114, 0.00000000],
+		[-6.27314406, -0.00042795, 0.00026218, 0.00043011, -0.00000114, 0.00000000],
+		[-6.27314421, -0.00042789, 0.00026215, 0.00043005, -0.00000114, 0.00000000],
+		[-6.27314435, -0.00042783, 0.00026211, 0.00042999, -0.00000114, 0.00000000],
+		[-6.27314449, -0.00042778, 0.00026207, 0.00042993, -0.00000114, 0.00000000],
+		[-6.27314463, -0.00042772, 0.00026204, 0.00042987, -0.00000114, 0.00000000],
+		[-6.27314477, -0.00042766, 0.00026200, 0.00042982, -0.00000114, 0.00000000],
+		[-6.27314491, -0.00042760, 0.00026197, 0.00042976, -0.00000114, 0.00000000],
+		[-6.27314505, -0.00042754, 0.00026193, 0.00042970, -0.00000114, 0.00000000],
+		[-6.27314520, -0.00042748, 0.00026189, 0.00042964, -0.00000114, 0.00000000],
+		[-6.27314534, -0.00042742, 0.00026186, 0.00042958, -0.00000114, 0.00000000],
+		[-6.27314548, -0.00042736, 0.00026182, 0.00042952, -0.00000114, 0.00000000],
+		[-6.27314562, -0.00042730, 0.00026178, 0.00042946, -0.00000114, 0.00000000],
+		[-6.27314576, -0.00042724, 0.00026175, 0.00042940, -0.00000114, 0.00000000],
+		[-6.27314590, -0.00042719, 0.00026171, 0.00042934, -0.00000114, 0.00000000],
+		[-6.27314604, -0.00042713, 0.00026168, 0.00042928, -0.00000114, 0.00000000],
+		[-6.27314618, -0.00042707, 0.00026164, 0.00042922, -0.00000114, 0.00000000],
+		[-6.27314633, -0.00042701, 0.00026160, 0.00042916, -0.00000114, 0.00000000],
+		[-6.27314647, -0.00042695, 0.00026157, 0.00042910, -0.00000114, 0.00000000],
+		[-6.27314661, -0.00042689, 0.00026153, 0.00042904, -0.00000114, 0.00000000],
+		[-6.27314675, -0.00042683, 0.00026150, 0.00042899, -0.00000114, 0.00000000],
+		[-6.27314689, -0.00042677, 0.00026146, 0.00042893, -0.00000114, 0.00000000],
+		[-6.27314703, -0.00042671, 0.00026142, 0.00042887, -0.00000114, 0.00000000],
+		[-6.27314717, -0.00042666, 0.00026139, 0.00042881, -0.00000114, 0.00000000],
+		[-6.27314731, -0.00042660, 0.00026135, 0.00042875, -0.00000114, 0.00000000],
+		[-6.27314745, -0.00042654, 0.00026132, 0.00042869, -0.00000114, 0.00000000],
+		[-6.27314759, -0.00042648, 0.00026128, 0.00042863, -0.00000114, 0.00000000],
+		[-6.27314773, -0.00042642, 0.00026124, 0.00042857, -0.00000114, 0.00000000],
+		[-6.27314787, -0.00042636, 0.00026121, 0.00042851, -0.00000114, 0.00000000],
+		[-6.27314801, -0.00042630, 0.00026117, 0.00042845, -0.00000114, 0.00000000],
+		[-6.27314815, -0.00042624, 0.00026114, 0.00042839, -0.00000114, 0.00000000],
+		[-6.27314830, -0.00042619, 0.00026110, 0.00042834, -0.00000114, 0.00000000],
+		[-6.27314844, -0.00042613, 0.00026106, 0.00042828, -0.00000114, 0.00000000],
+		[-6.27314858, -0.00042607, 0.00026103, 0.00042822, -0.00000114, 0.00000000],
+		[-6.27314872, -0.00042601, 0.00026099, 0.00042816, -0.00000114, 0.00000000],
+		[-6.27314886, -0.00042595, 0.00026096, 0.00042810, -0.00000114, 0.00000000],
+		[-6.27314900, -0.00042589, 0.00026092, 0.00042804, -0.00000114, 0.00000000],
+		[-6.27314914, -0.00042583, 0.00026088, 0.00042798, -0.00000114, 0.00000000],
+		[-6.27314928, -0.00042578, 0.00026085, 0.00042792, -0.00000114, 0.00000000],
+		[-6.27314942, -0.00042572, 0.00026081, 0.00042786, -0.00000114, 0.00000000],
+		[-6.27314956, -0.00042566, 0.00026078, 0.00042781, -0.00000114, 0.00000000],
+		[-6.27314970, -0.00042560, 0.00026074, 0.00042775, -0.00000114, 0.00000000],
+		[-6.27314984, -0.00042554, 0.00026070, 0.00042769, -0.00000114, 0.00000000],
+		[-6.27314998, -0.00042548, 0.00026067, 0.00042763, -0.00000114, 0.00000000],
+		[-6.27315012, -0.00042542, 0.00026063, 0.00042757, -0.00000114, 0.00000000],
+		[-6.27315026, -0.00042537, 0.00026060, 0.00042751, -0.00000114, 0.00000000],
+		[-6.27315040, -0.00042531, 0.00026056, 0.00042745, -0.00000114, 0.00000000],
+		[-6.27315054, -0.00042525, 0.00026052, 0.00042739, -0.00000114, 0.00000000],
+		[-6.27315068, -0.00042519, 0.00026049, 0.00042734, -0.00000114, 0.00000000],
+		[-6.27315082, -0.00042513, 0.00026045, 0.00042728, -0.00000114, 0.00000000],
+		[-6.27315096, -0.00042507, 0.00026042, 0.00042722, -0.00000114, 0.00000000],
+		[-6.27315110, -0.00042502, 0.00026038, 0.00042716, -0.00000114, 0.00000000],
+		[-6.27315124, -0.00042496, 0.00026035, 0.00042710, -0.00000114, 0.00000000],
+		[-6.27315138, -0.00042490, 0.00026031, 0.00042704, -0.00000114, 0.00000000],
+		[-6.27315152, -0.00042484, 0.00026027, 0.00042698, -0.00000114, 0.00000000],
+		[-6.27315165, -0.00042478, 0.00026024, 0.00042692, -0.00000114, 0.00000000],
+		[-6.27315179, -0.00042472, 0.00026020, 0.00042687, -0.00000114, 0.00000000],
+		[-6.27315193, -0.00042467, 0.00026017, 0.00042681, -0.00000114, 0.00000000],
+		[-6.27315207, -0.00042461, 0.00026013, 0.00042675, -0.00000114, 0.00000000],
+		[-6.27315221, -0.00042455, 0.00026010, 0.00042669, -0.00000114, 0.00000000],
+		[-6.27315235, -0.00042449, 0.00026006, 0.00042663, -0.00000114, 0.00000000],
+		[-6.27315249, -0.00042443, 0.00026002, 0.00042657, -0.00000114, 0.00000000],
+		[-6.27315263, -0.00042437, 0.00025999, 0.00042652, -0.00000114, 0.00000000],
+		[-6.27315277, -0.00042432, 0.00025995, 0.00042646, -0.00000114, 0.00000000],
+		[-6.27315291, -0.00042426, 0.00025992, 0.00042640, -0.00000114, 0.00000000],
+		[-6.27315305, -0.00042420, 0.00025988, 0.00042634, -0.00000114, 0.00000000],
+		[-6.27315319, -0.00042414, 0.00025985, 0.00042628, -0.00000114, 0.00000000],
+		[-6.27315333, -0.00042408, 0.00025981, 0.00042622, -0.00000114, 0.00000000],
+		[-6.27315347, -0.00042403, 0.00025978, 0.00042616, -0.00000114, 0.00000000],
+		[-6.27315360, -0.00042397, 0.00025974, 0.00042611, -0.00000114, 0.00000000],
+		[-6.27315374, -0.00042391, 0.00025970, 0.00042605, -0.00000114, 0.00000000],
+		[-6.27315388, -0.00042385, 0.00025967, 0.00042599, -0.00000114, 0.00000000],
+		[-6.27315402, -0.00042379, 0.00025963, 0.00042593, -0.00000114, 0.00000000],
+		[-6.27315416, -0.00042374, 0.00025960, 0.00042587, -0.00000114, 0.00000000],
+		[-6.27315430, -0.00042368, 0.00025956, 0.00042581, -0.00000114, 0.00000000],
+		[-6.27315444, -0.00042362, 0.00025953, 0.00042576, -0.00000114, 0.00000000],
+		[-6.27315458, -0.00042356, 0.00025949, 0.00042570, -0.00000114, 0.00000000],
+		[-6.27315472, -0.00042350, 0.00025946, 0.00042564, -0.00000114, 0.00000000],
+		[-6.27315485, -0.00042345, 0.00025942, 0.00042558, -0.00000114, 0.00000000],
+		[-6.27315499, -0.00042339, 0.00025938, 0.00042552, -0.00000114, 0.00000000],
+		[-6.27315513, -0.00042333, 0.00025935, 0.00042547, -0.00000114, 0.00000000],
+		[-6.27315527, -0.00042327, 0.00025931, 0.00042541, -0.00000114, 0.00000000],
+		[-6.27315541, -0.00042321, 0.00025928, 0.00042535, -0.00000114, 0.00000000],
+		[-6.27315555, -0.00042316, 0.00025924, 0.00042529, -0.00000114, 0.00000000],
+		[-6.27315569, -0.00042310, 0.00025921, 0.00042523, -0.00000114, 0.00000000],
+		[-6.27315582, -0.00042304, 0.00025917, 0.00042517, -0.00000114, 0.00000000],
+		[-6.27315596, -0.00042298, 0.00025914, 0.00042512, -0.00000114, 0.00000000],
+		[-6.27315610, -0.00042292, 0.00025910, 0.00042506, -0.00000114, 0.00000000],
+		[-6.27315624, -0.00042287, 0.00025907, 0.00042500, -0.00000114, 0.00000000],
+		[-6.27315638, -0.00042281, 0.00025903, 0.00042494, -0.00000114, 0.00000000],
+		[-6.27315652, -0.00042275, 0.00025899, 0.00042488, -0.00000114, 0.00000000],
+		[-6.27315665, -0.00042269, 0.00025896, 0.00042483, -0.00000114, 0.00000000],
+		[-6.27315679, -0.00042264, 0.00025892, 0.00042477, -0.00000114, 0.00000000],
+		[-6.27315693, -0.00042258, 0.00025889, 0.00042471, -0.00000114, 0.00000000],
+		[-6.27315707, -0.00042252, 0.00025885, 0.00042465, -0.00000114, 0.00000000],
+		[-6.27315721, -0.00042246, 0.00025882, 0.00042459, -0.00000114, 0.00000000],
+		[-6.27315734, -0.00042241, 0.00025878, 0.00042454, -0.00000114, 0.00000000],
+		[-6.27315748, -0.00042235, 0.00025875, 0.00042448, -0.00000114, 0.00000000],
+		[-6.27315762, -0.00042229, 0.00025871, 0.00042442, -0.00000114, 0.00000000],
+		[-6.27315776, -0.00042223, 0.00025868, 0.00042436, -0.00000114, 0.00000000],
+		[-6.27315790, -0.00042218, 0.00025864, 0.00042430, -0.00000114, 0.00000000],
+		[-6.27315803, -0.00042212, 0.00025861, 0.00042425, -0.00000114, 0.00000000],
+		[-6.27315817, -0.00042206, 0.00025857, 0.00042419, -0.00000114, 0.00000000],
+		[-6.27315831, -0.00042200, 0.00025854, 0.00042413, -0.00000114, 0.00000000],
+		[-6.27315845, -0.00042194, 0.00025850, 0.00042407, -0.00000114, 0.00000000],
+		[-6.27315858, -0.00042189, 0.00025846, 0.00042402, -0.00000114, 0.00000000],
+		[-6.27315872, -0.00042183, 0.00025843, 0.00042396, -0.00000114, 0.00000000],
+		[-6.27315886, -0.00042177, 0.00025839, 0.00042390, -0.00000114, 0.00000000],
+		[-6.27315900, -0.00042171, 0.00025836, 0.00042384, -0.00000114, 0.00000000],
+		[-6.27315913, -0.00042166, 0.00025832, 0.00042378, -0.00000114, 0.00000000],
+		[-6.27315927, -0.00042160, 0.00025829, 0.00042373, -0.00000114, 0.00000000],
+		[-6.27315941, -0.00042154, 0.00025825, 0.00042367, -0.00000114, 0.00000000],
+		[-6.27315955, -0.00042149, 0.00025822, 0.00042361, -0.00000114, 0.00000000],
+		[-6.27315968, -0.00042143, 0.00025818, 0.00042355, -0.00000114, 0.00000000],
+		[-6.27315982, -0.00042137, 0.00025815, 0.00042350, -0.00000114, 0.00000000],
+		[-6.27315996, -0.00042131, 0.00025811, 0.00042344, -0.00000114, 0.00000000],
+		[-6.27316010, -0.00042126, 0.00025808, 0.00042338, -0.00000114, 0.00000000],
+		[-6.27316023, -0.00042120, 0.00025804, 0.00042332, -0.00000114, 0.00000000],
+		[-6.27316037, -0.00042114, 0.00025801, 0.00042327, -0.00000114, 0.00000000],
+		[-6.27316051, -0.00042108, 0.00025797, 0.00042321, -0.00000114, 0.00000000],
+		[-6.27316064, -0.00042103, 0.00025794, 0.00042315, -0.00000114, 0.00000000],
+		[-6.27316078, -0.00042097, 0.00025790, 0.00042309, -0.00000114, 0.00000000],
+		[-6.27316092, -0.00042091, 0.00025787, 0.00042304, -0.00000114, 0.00000000],
+		[-6.27316105, -0.00042085, 0.00025783, 0.00042298, -0.00000114, 0.00000000],
+		[-6.27316119, -0.00042080, 0.00025780, 0.00042292, -0.00000114, 0.00000000],
+		[-6.27316133, -0.00042074, 0.00025776, 0.00042286, -0.00000114, 0.00000000],
+		[-6.27316147, -0.00042068, 0.00025773, 0.00042281, -0.00000114, 0.00000000],
+		[-6.27316160, -0.00042063, 0.00025769, 0.00042275, -0.00000114, 0.00000000],
+		[-6.27316174, -0.00042057, 0.00025766, 0.00042269, -0.00000114, 0.00000000],
+		[-6.27316188, -0.00042051, 0.00025762, 0.00042263, -0.00000114, 0.00000000],
+		[-6.27316201, -0.00042045, 0.00025759, 0.00042258, -0.00000114, 0.00000000],
+		[-6.27316215, -0.00042040, 0.00025755, 0.00042252, -0.00000114, 0.00000000],
+		[-6.27316229, -0.00042034, 0.00025752, 0.00042246, -0.00000114, 0.00000000],
+		[-6.27316242, -0.00042028, 0.00025748, 0.00042240, -0.00000114, 0.00000000],
+		[-6.27316256, -0.00042023, 0.00025745, 0.00042235, -0.00000114, 0.00000000],
+		[-6.27316270, -0.00042017, 0.00025741, 0.00042229, -0.00000114, 0.00000000],
+		[-6.27316283, -0.00042011, 0.00025738, 0.00042223, -0.00000114, 0.00000000],
+		[-6.27316297, -0.00042006, 0.00025734, 0.00042217, -0.00000114, 0.00000000],
+		[-6.27316311, -0.00042000, 0.00025731, 0.00042212, -0.00000114, 0.00000000],
+		[-6.27316324, -0.00041994, 0.00025727, 0.00042206, -0.00000114, 0.00000000],
+		[-6.27316338, -0.00041988, 0.00025724, 0.00042200, -0.00000114, 0.00000000],
+		[-6.27316351, -0.00041983, 0.00025720, 0.00042194, -0.00000114, 0.00000000],
+		[-6.27316365, -0.00041977, 0.00025717, 0.00042189, -0.00000114, 0.00000000],
+		[-6.27316379, -0.00041971, 0.00025713, 0.00042183, -0.00000114, 0.00000000],
+		[-6.27316392, -0.00041966, 0.00025710, 0.00042177, -0.00000114, 0.00000000],
+		[-6.27316406, -0.00041960, 0.00025706, 0.00042172, -0.00000114, 0.00000000],
+		[-6.27316420, -0.00041954, 0.00025703, 0.00042166, -0.00000114, 0.00000000],
+		[-6.27316433, -0.00041949, 0.00025699, 0.00042160, -0.00000114, 0.00000000],
+		[-6.27316447, -0.00041943, 0.00025696, 0.00042154, -0.00000114, 0.00000000],
+		[-6.27316460, -0.00041937, 0.00025692, 0.00042149, -0.00000114, 0.00000000],
+		[-6.27316474, -0.00041932, 0.00025689, 0.00042143, -0.00000114, 0.00000000],
+		[-6.27316488, -0.00041926, 0.00025685, 0.00042137, -0.00000114, 0.00000000],
+		[-6.27316501, -0.00041920, 0.00025682, 0.00042132, -0.00000114, 0.00000000],
+		[-6.27316515, -0.00041915, 0.00025678, 0.00042126, -0.00000114, 0.00000000],
+		[-6.27316528, -0.00041909, 0.00025675, 0.00042120, -0.00000114, 0.00000000],
+		[-6.27316542, -0.00041903, 0.00025671, 0.00042115, -0.00000114, 0.00000000],
+		[-6.27316555, -0.00041898, 0.00025668, 0.00042109, -0.00000114, 0.00000000],
+		[-6.27316569, -0.00041892, 0.00025664, 0.00042103, -0.00000114, 0.00000000],
+		[-6.27316583, -0.00041886, 0.00025661, 0.00042097, -0.00000114, 0.00000000],
+		[-6.27316596, -0.00041881, 0.00025658, 0.00042092, -0.00000114, 0.00000000],
+		[-6.27316610, -0.00041875, 0.00025654, 0.00042086, -0.00000114, 0.00000000],
+		[-6.27316623, -0.00041869, 0.00025651, 0.00042080, -0.00000114, 0.00000000],
+		[-6.27316637, -0.00041864, 0.00025647, 0.00042075, -0.00000114, 0.00000000],
+		[-6.27316650, -0.00041858, 0.00025644, 0.00042069, -0.00000114, 0.00000000],
+		[-6.27316664, -0.00041852, 0.00025640, 0.00042063, -0.00000114, 0.00000000],
+		[-6.27316677, -0.00041847, 0.00025637, 0.00042058, -0.00000114, 0.00000000],
+		[-6.27316691, -0.00041841, 0.00025633, 0.00042052, -0.00000114, 0.00000000],
+		[-6.27316705, -0.00041835, 0.00025630, 0.00042046, -0.00000114, 0.00000000],
+		[-6.27316718, -0.00041830, 0.00025626, 0.00042041, -0.00000114, 0.00000000],
+		[-6.27316732, -0.00041824, 0.00025623, 0.00042035, -0.00000114, 0.00000000],
+		[-6.27316745, -0.00041818, 0.00025619, 0.00042029, -0.00000114, 0.00000000],
+		[-6.27316759, -0.00041813, 0.00025616, 0.00042023, -0.00000114, 0.00000000],
+		[-6.27316772, -0.00041807, 0.00025612, 0.00042018, -0.00000114, 0.00000000],
+		[-6.27316786, -0.00041801, 0.00025609, 0.00042012, -0.00000114, 0.00000000],
+		[-6.27316799, -0.00041796, 0.00025606, 0.00042006, -0.00000114, 0.00000000],
+		[-6.27316813, -0.00041790, 0.00025602, 0.00042001, -0.00000114, 0.00000000],
+		[-6.27316826, -0.00041784, 0.00025599, 0.00041995, -0.00000114, 0.00000000],
+		[-6.27316840, -0.00041779, 0.00025595, 0.00041989, -0.00000114, 0.00000000],
+		[-6.27316853, -0.00041773, 0.00025592, 0.00041984, -0.00000114, 0.00000000],
+		[-6.27316867, -0.00041768, 0.00025588, 0.00041978, -0.00000114, 0.00000000],
+		[-6.27316880, -0.00041762, 0.00025585, 0.00041972, -0.00000114, 0.00000000],
+		[-6.27316894, -0.00041756, 0.00025581, 0.00041967, -0.00000114, 0.00000000],
+		[-6.27316907, -0.00041751, 0.00025578, 0.00041961, -0.00000114, 0.00000000],
+		[-6.27316921, -0.00041745, 0.00025574, 0.00041955, -0.00000114, 0.00000000],
+		[-6.27316934, -0.00041739, 0.00025571, 0.00041950, -0.00000114, 0.00000000],
+		[-6.27316948, -0.00041734, 0.00025568, 0.00041944, -0.00000114, 0.00000000],
+		[-6.27316961, -0.00041728, 0.00025564, 0.00041939, -0.00000114, 0.00000000],
+		[-6.27316974, -0.00041722, 0.00025561, 0.00041933, -0.00000114, 0.00000000],
+		[-6.27316988, -0.00041717, 0.00025557, 0.00041927, -0.00000114, 0.00000000],
+		[-6.27317001, -0.00041711, 0.00025554, 0.00041922, -0.00000114, 0.00000000],
+		[-6.27317015, -0.00041706, 0.00025550, 0.00041916, -0.00000114, 0.00000000],
+		[-6.27317028, -0.00041700, 0.00025547, 0.00041910, -0.00000114, 0.00000000],
+		[-6.27317042, -0.00041694, 0.00025543, 0.00041905, -0.00000114, 0.00000000],
+		[-6.27317055, -0.00041689, 0.00025540, 0.00041899, -0.00000114, 0.00000000],
+		[-6.27317069, -0.00041683, 0.00025537, 0.00041893, -0.00000114, 0.00000000],
+		[-6.27317082, -0.00041678, 0.00025533, 0.00041888, -0.00000114, 0.00000000],
+		[-6.27317095, -0.00041672, 0.00025530, 0.00041882, -0.00000114, 0.00000000],
+		[-6.27317109, -0.00041666, 0.00025526, 0.00041876, -0.00000114, 0.00000000],
+		[-6.27317122, -0.00041661, 0.00025523, 0.00041871, -0.00000114, 0.00000000],
+		[-6.27317136, -0.00041655, 0.00025519, 0.00041865, -0.00000114, 0.00000000],
+		[-6.27317149, -0.00041649, 0.00025516, 0.00041860, -0.00000114, 0.00000000],
+		[-6.27317163, -0.00041644, 0.00025512, 0.00041854, -0.00000114, 0.00000000],
+		[-6.27317176, -0.00041638, 0.00025509, 0.00041848, -0.00000114, 0.00000000],
+		[-6.27317189, -0.00041633, 0.00025506, 0.00041843, -0.00000114, 0.00000000],
+		[-6.27317203, -0.00041627, 0.00025502, 0.00041837, -0.00000114, 0.00000000],
+		[-6.27317216, -0.00041621, 0.00025499, 0.00041831, -0.00000114, 0.00000000],
+		[-6.27317230, -0.00041616, 0.00025495, 0.00041826, -0.00000114, 0.00000000],
+		[-6.27317243, -0.00041610, 0.00025492, 0.00041820, -0.00000114, 0.00000000],
+		[-6.27317256, -0.00041605, 0.00025488, 0.00041814, -0.00000114, 0.00000000],
+		[-6.27317270, -0.00041599, 0.00025485, 0.00041809, -0.00000114, 0.00000000],
+		[-6.27317283, -0.00041594, 0.00025482, 0.00041803, -0.00000114, 0.00000000],
+		[-6.27317297, -0.00041588, 0.00025478, 0.00041798, -0.00000114, 0.00000000],
+		[-6.27317310, -0.00041582, 0.00025475, 0.00041792, -0.00000115, 0.00000000],
+		[-6.27317323, -0.00041577, 0.00025471, 0.00041786, -0.00000115, 0.00000000],
+		[-6.27317337, -0.00041571, 0.00025468, 0.00041781, -0.00000115, 0.00000000],
+		[-6.27317350, -0.00041566, 0.00025465, 0.00041775, -0.00000115, 0.00000000],
+		[-6.27317363, -0.00041560, 0.00025461, 0.00041770, -0.00000115, 0.00000000],
+		[-6.27317377, -0.00041554, 0.00025458, 0.00041764, -0.00000115, 0.00000000],
+		[-6.27317390, -0.00041549, 0.00025454, 0.00041758, -0.00000115, 0.00000000],
+		[-6.27317403, -0.00041543, 0.00025451, 0.00041753, -0.00000115, 0.00000000],
+		[-6.27317417, -0.00041538, 0.00025447, 0.00041747, -0.00000115, 0.00000000],
+		[-6.27317430, -0.00041532, 0.00025444, 0.00041742, -0.00000115, 0.00000000],
+		[-6.27317443, -0.00041527, 0.00025441, 0.00041736, -0.00000115, 0.00000000],
+		[-6.27317457, -0.00041521, 0.00025437, 0.00041730, -0.00000115, 0.00000000],
+		[-6.27317470, -0.00041515, 0.00025434, 0.00041725, -0.00000115, 0.00000000],
+		[-6.27317483, -0.00041510, 0.00025430, 0.00041719, -0.00000115, 0.00000000],
+		[-6.27317497, -0.00041504, 0.00025427, 0.00041714, -0.00000115, 0.00000000],
+		[-6.27317510, -0.00041499, 0.00025424, 0.00041708, -0.00000115, 0.00000000],
+		[-6.27317523, -0.00041493, 0.00025420, 0.00041702, -0.00000115, 0.00000000],
+		[-6.27317537, -0.00041488, 0.00025417, 0.00041697, -0.00000115, 0.00000000],
+		[-6.27317550, -0.00041482, 0.00025413, 0.00041691, -0.00000115, 0.00000000],
+		[-6.27317563, -0.00041476, 0.00025410, 0.00041686, -0.00000115, 0.00000000],
+		[-6.27317577, -0.00041471, 0.00025406, 0.00041680, -0.00000115, 0.00000000],
+		[-6.27317590, -0.00041465, 0.00025403, 0.00041674, -0.00000115, 0.00000000],
+		[-6.27317603, -0.00041460, 0.00025400, 0.00041669, -0.00000115, 0.00000000],
+		[-6.27317616, -0.00041454, 0.00025396, 0.00041663, -0.00000115, 0.00000000],
+		[-6.27317630, -0.00041449, 0.00025393, 0.00041658, -0.00000115, 0.00000000],
+		[-6.27317643, -0.00041443, 0.00025389, 0.00041652, -0.00000115, 0.00000000],
+		[-6.27317656, -0.00041438, 0.00025386, 0.00041647, -0.00000115, 0.00000000],
+		[-6.27317670, -0.00041432, 0.00025383, 0.00041641, -0.00000115, 0.00000000],
+		[-6.27317683, -0.00041427, 0.00025379, 0.00041635, -0.00000115, 0.00000000],
+		[-6.27317696, -0.00041421, 0.00025376, 0.00041630, -0.00000115, 0.00000000],
+		[-6.27317709, -0.00041415, 0.00025372, 0.00041624, -0.00000115, 0.00000000],
+		[-6.27317723, -0.00041410, 0.00025369, 0.00041619, -0.00000115, 0.00000000],
+		[-6.27317736, -0.00041404, 0.00025366, 0.00041613, -0.00000115, 0.00000000],
+		[-6.27317749, -0.00041399, 0.00025362, 0.00041608, -0.00000115, 0.00000000],
+		[-6.27317762, -0.00041393, 0.00025359, 0.00041602, -0.00000115, 0.00000000],
+		[-6.27317776, -0.00041388, 0.00025355, 0.00041596, -0.00000115, 0.00000000],
+		[-6.27317789, -0.00041382, 0.00025352, 0.00041591, -0.00000115, 0.00000000],
+		[-6.27317802, -0.00041377, 0.00025349, 0.00041585, -0.00000115, 0.00000000],
+		[-6.27317815, -0.00041371, 0.00025345, 0.00041580, -0.00000115, 0.00000000],
+		[-6.27317829, -0.00041366, 0.00025342, 0.00041574, -0.00000115, 0.00000000],
+		[-6.27317842, -0.00041360, 0.00025339, 0.00041569, -0.00000115, 0.00000000],
+		[-6.27317855, -0.00041355, 0.00025335, 0.00041563, -0.00000115, 0.00000000],
+		[-6.27317868, -0.00041349, 0.00025332, 0.00041558, -0.00000115, 0.00000000],
+		[-6.27317882, -0.00041344, 0.00025328, 0.00041552, -0.00000115, 0.00000000],
+		[-6.27317895, -0.00041338, 0.00025325, 0.00041546, -0.00000115, 0.00000000],
+		[-6.27317908, -0.00041333, 0.00025322, 0.00041541, -0.00000115, 0.00000000],
+		[-6.27317921, -0.00041327, 0.00025318, 0.00041535, -0.00000115, 0.00000000],
+		[-6.27317934, -0.00041321, 0.00025315, 0.00041530, -0.00000115, 0.00000000],
+		[-6.27317948, -0.00041316, 0.00025311, 0.00041524, -0.00000115, 0.00000000],
+		[-6.27317961, -0.00041310, 0.00025308, 0.00041519, -0.00000115, 0.00000000],
+		[-6.27317974, -0.00041305, 0.00025305, 0.00041513, -0.00000115, 0.00000000],
+		[-6.27317987, -0.00041299, 0.00025301, 0.00041508, -0.00000115, 0.00000000],
+		[-6.27318000, -0.00041294, 0.00025298, 0.00041502, -0.00000115, 0.00000000],
+		[-6.27318014, -0.00041288, 0.00025295, 0.00041497, -0.00000115, 0.00000000],
+		[-6.27318027, -0.00041283, 0.00025291, 0.00041491, -0.00000115, 0.00000000],
+		[-6.27318040, -0.00041277, 0.00025288, 0.00041485, -0.00000115, 0.00000000],
+		[-6.27318053, -0.00041272, 0.00025284, 0.00041480, -0.00000115, 0.00000000],
+		[-6.27318066, -0.00041266, 0.00025281, 0.00041474, -0.00000115, 0.00000000],
+		[-6.27318079, -0.00041261, 0.00025278, 0.00041469, -0.00000115, 0.00000000],
+		[-6.27318093, -0.00041255, 0.00025274, 0.00041463, -0.00000115, 0.00000000],
+		[-6.27318106, -0.00041250, 0.00025271, 0.00041458, -0.00000115, 0.00000000],
+		[-6.27318119, -0.00041244, 0.00025268, 0.00041452, -0.00000115, 0.00000000],
+		[-6.27318132, -0.00041239, 0.00025264, 0.00041447, -0.00000115, 0.00000000],
+		[-6.27318145, -0.00041233, 0.00025261, 0.00041441, -0.00000115, 0.00000000],
+		[-6.27318158, -0.00041228, 0.00025258, 0.00041436, -0.00000115, 0.00000000],
+		[-6.27318171, -0.00041222, 0.00025254, 0.00041430, -0.00000115, 0.00000000],
+		[-6.27318185, -0.00041217, 0.00025251, 0.00041425, -0.00000115, 0.00000000],
+		[-6.27318198, -0.00041211, 0.00025247, 0.00041419, -0.00000115, 0.00000000],
+		[-6.27318211, -0.00041206, 0.00025244, 0.00041414, -0.00000115, 0.00000000],
+		[-6.27318224, -0.00041200, 0.00025241, 0.00041408, -0.00000115, 0.00000000],
+		[-6.27318237, -0.00041195, 0.00025237, 0.00041403, -0.00000115, 0.00000000],
+		[-6.27318250, -0.00041190, 0.00025234, 0.00041397, -0.00000115, 0.00000000],
+		[-6.27318263, -0.00041184, 0.00025231, 0.00041392, -0.00000115, 0.00000000],
+		[-6.27318276, -0.00041179, 0.00025227, 0.00041386, -0.00000115, 0.00000000],
+		[-6.27318290, -0.00041173, 0.00025224, 0.00041381, -0.00000115, 0.00000000],
+		[-6.27318303, -0.00041168, 0.00025221, 0.00041375, -0.00000115, 0.00000000],
+		[-6.27318316, -0.00041162, 0.00025217, 0.00041370, -0.00000115, 0.00000000],
+		[-6.27318329, -0.00041157, 0.00025214, 0.00041364, -0.00000115, 0.00000000],
+		[-6.27318342, -0.00041151, 0.00025210, 0.00041359, -0.00000115, 0.00000000],
+		[-6.27318355, -0.00041146, 0.00025207, 0.00041353, -0.00000115, 0.00000000],
+		[-6.27318368, -0.00041140, 0.00025204, 0.00041348, -0.00000115, 0.00000000],
+		[-6.27318381, -0.00041135, 0.00025200, 0.00041342, -0.00000115, 0.00000000],
+		[-6.27318394, -0.00041129, 0.00025197, 0.00041337, -0.00000115, 0.00000000],
+		[-6.27318407, -0.00041124, 0.00025194, 0.00041331, -0.00000115, 0.00000000],
+		[-6.27318420, -0.00041118, 0.00025190, 0.00041326, -0.00000115, 0.00000000],
+		[-6.27318434, -0.00041113, 0.00025187, 0.00041320, -0.00000115, 0.00000000],
+		[-6.27318447, -0.00041107, 0.00025184, 0.00041315, -0.00000115, 0.00000000],
+		[-6.27318460, -0.00041102, 0.00025180, 0.00041309, -0.00000115, 0.00000000],
+		[-6.27318473, -0.00041097, 0.00025177, 0.00041304, -0.00000115, 0.00000000],
+		[-6.27318486, -0.00041091, 0.00025174, 0.00041298, -0.00000115, 0.00000000],
+		[-6.27318499, -0.00041086, 0.00025170, 0.00041293, -0.00000115, 0.00000000],
+		[-6.27318512, -0.00041080, 0.00025167, 0.00041287, -0.00000115, 0.00000000],
+		[-6.27318525, -0.00041075, 0.00025164, 0.00041282, -0.00000115, 0.00000000],
+		[-6.27318538, -0.00041069, 0.00025160, 0.00041276, -0.00000115, 0.00000000],
+		[-6.27318551, -0.00041064, 0.00025157, 0.00041271, -0.00000115, 0.00000000],
+		[-6.27318564, -0.00041058, 0.00025154, 0.00041265, -0.00000115, 0.00000000],
+		[-6.27318577, -0.00041053, 0.00025150, 0.00041260, -0.00000115, 0.00000000],
+		[-6.27318590, -0.00041048, 0.00025147, 0.00041254, -0.00000115, 0.00000000],
+		[-6.27318603, -0.00041042, 0.00025144, 0.00041249, -0.00000115, 0.00000000],
+		[-6.27318616, -0.00041037, 0.00025140, 0.00041243, -0.00000115, 0.00000000],
+		[-6.27318629, -0.00041031, 0.00025137, 0.00041238, -0.00000115, 0.00000000],
+		[-6.27318642, -0.00041026, 0.00025134, 0.00041233, -0.00000115, 0.00000000],
+		[-6.27318655, -0.00041020, 0.00025130, 0.00041227, -0.00000115, 0.00000000],
+		[-6.27318668, -0.00041015, 0.00025127, 0.00041222, -0.00000115, 0.00000000],
+		[-6.27318681, -0.00041009, 0.00025124, 0.00041216, -0.00000115, 0.00000000],
+		[-6.27318694, -0.00041004, 0.00025120, 0.00041211, -0.00000115, 0.00000000],
+		[-6.27318707, -0.00040999, 0.00025117, 0.00041205, -0.00000115, 0.00000000],
+		[-6.27318720, -0.00040993, 0.00025114, 0.00041200, -0.00000115, 0.00000000],
+		[-6.27318733, -0.00040988, 0.00025110, 0.00041194, -0.00000115, 0.00000000],
+		[-6.27318746, -0.00040982, 0.00025107, 0.00041189, -0.00000115, 0.00000000],
+		[-6.27318759, -0.00040977, 0.00025104, 0.00041183, -0.00000115, 0.00000000],
+		[-6.27318772, -0.00040971, 0.00025100, 0.00041178, -0.00000115, 0.00000000],
+		[-6.27318785, -0.00040966, 0.00025097, 0.00041173, -0.00000115, 0.00000000],
+		[-6.27318798, -0.00040961, 0.00025094, 0.00041167, -0.00000115, 0.00000000],
+		[-6.27318811, -0.00040955, 0.00025090, 0.00041162, -0.00000115, 0.00000000],
+		[-6.27318824, -0.00040950, 0.00025087, 0.00041156, -0.00000115, 0.00000000],
+		[-6.27318837, -0.00040944, 0.00025084, 0.00041151, -0.00000115, 0.00000000],
+		[-6.27318850, -0.00040939, 0.00025080, 0.00041145, -0.00000115, 0.00000000],
+		[-6.27318863, -0.00040934, 0.00025077, 0.00041140, -0.00000115, 0.00000000],
+		[-6.27318876, -0.00040928, 0.00025074, 0.00041134, -0.00000115, 0.00000000],
+		[-6.27318889, -0.00040923, 0.00025070, 0.00041129, -0.00000115, 0.00000000],
+		[-6.27318902, -0.00040917, 0.00025067, 0.00041124, -0.00000115, 0.00000000],
+		[-6.27318915, -0.00040912, 0.00025064, 0.00041118, -0.00000115, 0.00000000],
+		[-6.27318928, -0.00040906, 0.00025060, 0.00041113, -0.00000115, 0.00000000],
+		[-6.27318941, -0.00040901, 0.00025057, 0.00041107, -0.00000115, 0.00000000],
+		[-6.27318954, -0.00040896, 0.00025054, 0.00041102, -0.00000115, 0.00000000],
+		[-6.27318967, -0.00040890, 0.00025051, 0.00041096, -0.00000115, 0.00000000],
+		[-6.27318979, -0.00040885, 0.00025047, 0.00041091, -0.00000115, 0.00000000],
+		[-6.27318992, -0.00040879, 0.00025044, 0.00041086, -0.00000115, 0.00000000],
+		[-6.27319005, -0.00040874, 0.00025041, 0.00041080, -0.00000115, 0.00000000],
+		[-6.27319018, -0.00040869, 0.00025037, 0.00041075, -0.00000115, 0.00000000],
+		[-6.27319031, -0.00040863, 0.00025034, 0.00041069, -0.00000115, 0.00000000],
+		[-6.27319044, -0.00040858, 0.00025031, 0.00041064, -0.00000115, 0.00000000],
+		[-6.27319057, -0.00040852, 0.00025027, 0.00041058, -0.00000115, 0.00000000],
+		[-6.27319070, -0.00040847, 0.00025024, 0.00041053, -0.00000115, 0.00000000],
+		[-6.27319083, -0.00040842, 0.00025021, 0.00041048, -0.00000115, 0.00000000],
+		[-6.27319096, -0.00040836, 0.00025017, 0.00041042, -0.00000115, 0.00000000],
+		[-6.27319109, -0.00040831, 0.00025014, 0.00041037, -0.00000115, 0.00000000],
+		[-6.27319121, -0.00040826, 0.00025011, 0.00041031, -0.00000115, 0.00000000],
+		[-6.27319134, -0.00040820, 0.00025008, 0.00041026, -0.00000115, 0.00000000],
+		[-6.27319147, -0.00040815, 0.00025004, 0.00041021, -0.00000115, 0.00000000],
+		[-6.27319160, -0.00040809, 0.00025001, 0.00041015, -0.00000115, 0.00000000],
+		[-6.27319173, -0.00040804, 0.00024998, 0.00041010, -0.00000115, 0.00000000],
+		[-6.27319186, -0.00040799, 0.00024994, 0.00041004, -0.00000115, 0.00000000],
+		[-6.27319199, -0.00040793, 0.00024991, 0.00040999, -0.00000115, 0.00000000],
+		[-6.27319212, -0.00040788, 0.00024988, 0.00040993, -0.00000115, 0.00000000],
+		[-6.27319224, -0.00040783, 0.00024985, 0.00040988, -0.00000115, 0.00000000],
+		[-6.27319237, -0.00040777, 0.00024981, 0.00040983, -0.00000115, 0.00000000],
+		[-6.27319250, -0.00040772, 0.00024978, 0.00040977, -0.00000115, 0.00000000],
+		[-6.27319263, -0.00040766, 0.00024975, 0.00040972, -0.00000115, 0.00000000],
+		[-6.27319276, -0.00040761, 0.00024971, 0.00040966, -0.00000115, 0.00000000],
+		[-6.27319289, -0.00040756, 0.00024968, 0.00040961, -0.00000115, 0.00000000],
+		[-6.27319302, -0.00040750, 0.00024965, 0.00040956, -0.00000115, 0.00000000],
+		[-6.27319314, -0.00040745, 0.00024961, 0.00040950, -0.00000115, 0.00000000],
+		[-6.27319327, -0.00040740, 0.00024958, 0.00040945, -0.00000115, 0.00000000],
+		[-6.27319340, -0.00040734, 0.00024955, 0.00040940, -0.00000115, 0.00000000],
+		[-6.27319353, -0.00040729, 0.00024952, 0.00040934, -0.00000115, 0.00000000],
+		[-6.27319366, -0.00040724, 0.00024948, 0.00040929, -0.00000115, 0.00000000],
+		[-6.27319379, -0.00040718, 0.00024945, 0.00040923, -0.00000115, 0.00000000],
+		[-6.27319391, -0.00040713, 0.00024942, 0.00040918, -0.00000115, 0.00000000],
+		[-6.27319404, -0.00040707, 0.00024938, 0.00040913, -0.00000115, 0.00000000],
+		[-6.27319417, -0.00040702, 0.00024935, 0.00040907, -0.00000115, 0.00000000],
+		[-6.27319430, -0.00040697, 0.00024932, 0.00040902, -0.00000115, 0.00000000],
+		[-6.27319443, -0.00040691, 0.00024929, 0.00040896, -0.00000115, 0.00000000],
+		[-6.27319455, -0.00040686, 0.00024925, 0.00040891, -0.00000115, 0.00000000],
+		[-6.27319468, -0.00040681, 0.00024922, 0.00040886, -0.00000115, 0.00000000],
+		[-6.27319481, -0.00040675, 0.00024919, 0.00040880, -0.00000115, 0.00000000],
+		[-6.27319494, -0.00040670, 0.00024916, 0.00040875, -0.00000115, 0.00000000],
+		[-6.27319507, -0.00040665, 0.00024912, 0.00040870, -0.00000115, 0.00000000],
+		[-6.27319519, -0.00040659, 0.00024909, 0.00040864, -0.00000115, 0.00000000],
+		[-6.27319532, -0.00040654, 0.00024906, 0.00040859, -0.00000115, 0.00000000],
+		[-6.27319545, -0.00040649, 0.00024902, 0.00040854, -0.00000115, 0.00000000],
+		[-6.27319558, -0.00040643, 0.00024899, 0.00040848, -0.00000115, 0.00000000],
+		[-6.27319571, -0.00040638, 0.00024896, 0.00040843, -0.00000115, 0.00000000],
+		[-6.27319583, -0.00040633, 0.00024893, 0.00040837, -0.00000115, 0.00000000],
+		[-6.27319596, -0.00040627, 0.00024889, 0.00040832, -0.00000115, 0.00000000],
+		[-6.27319609, -0.00040622, 0.00024886, 0.00040827, -0.00000115, 0.00000000],
+		[-6.27319622, -0.00040617, 0.00024883, 0.00040821, -0.00000115, 0.00000000],
+		[-6.27319634, -0.00040611, 0.00024880, 0.00040816, -0.00000115, 0.00000000],
+		[-6.27319647, -0.00040606, 0.00024876, 0.00040811, -0.00000115, 0.00000000],
+		[-6.27319660, -0.00040601, 0.00024873, 0.00040805, -0.00000115, 0.00000000],
+		[-6.27319673, -0.00040595, 0.00024870, 0.00040800, -0.00000115, 0.00000000],
+		[-6.27319685, -0.00040590, 0.00024867, 0.00040795, -0.00000115, 0.00000000],
+		[-6.27319698, -0.00040585, 0.00024863, 0.00040789, -0.00000115, 0.00000000],
+		[-6.27319711, -0.00040579, 0.00024860, 0.00040784, -0.00000115, 0.00000000],
+		[-6.27319724, -0.00040574, 0.00024857, 0.00040779, -0.00000115, 0.00000000],
+		[-6.27319736, -0.00040569, 0.00024853, 0.00040773, -0.00000115, 0.00000000],
+		[-6.27319749, -0.00040563, 0.00024850, 0.00040768, -0.00000115, 0.00000000],
+		[-6.27319762, -0.00040558, 0.00024847, 0.00040763, -0.00000115, 0.00000000],
+		[-6.27319774, -0.00040553, 0.00024844, 0.00040757, -0.00000115, 0.00000000],
+		[-6.27319787, -0.00040547, 0.00024840, 0.00040752, -0.00000115, 0.00000000],
+		[-6.27319800, -0.00040542, 0.00024837, 0.00040746, -0.00000115, 0.00000000],
+		[-6.27319813, -0.00040537, 0.00024834, 0.00040741, -0.00000115, 0.00000000],
+		[-6.27319825, -0.00040532, 0.00024831, 0.00040736, -0.00000115, 0.00000000],
+		[-6.27319838, -0.00040526, 0.00024827, 0.00040730, -0.00000115, 0.00000000],
+		[-6.27319851, -0.00040521, 0.00024824, 0.00040725, -0.00000115, 0.00000000],
+		[-6.27319863, -0.00040516, 0.00024821, 0.00040720, -0.00000115, 0.00000000],
+		[-6.27319876, -0.00040510, 0.00024818, 0.00040714, -0.00000115, 0.00000000],
+		[-6.27319889, -0.00040505, 0.00024814, 0.00040709, -0.00000115, 0.00000000],
+		[-6.27319901, -0.00040500, 0.00024811, 0.00040704, -0.00000115, 0.00000000],
+		[-6.27319914, -0.00040494, 0.00024808, 0.00040699, -0.00000115, 0.00000000],
+		[-6.27319927, -0.00040489, 0.00024805, 0.00040693, -0.00000115, 0.00000000],
+		[-6.27319939, -0.00040484, 0.00024801, 0.00040688, -0.00000115, 0.00000000],
+		[-6.27319952, -0.00040479, 0.00024798, 0.00040683, -0.00000115, 0.00000000],
+		[-6.27319965, -0.00040473, 0.00024795, 0.00040677, -0.00000115, 0.00000000],
+		[-6.27319977, -0.00040468, 0.00024792, 0.00040672, -0.00000115, 0.00000000],
+		[-6.27319990, -0.00040463, 0.00024788, 0.00040667, -0.00000115, 0.00000000],
+		[-6.27320003, -0.00040457, 0.00024785, 0.00040661, -0.00000115, 0.00000000],
+		[-6.27320015, -0.00040452, 0.00024782, 0.00040656, -0.00000115, 0.00000000],
+		[-6.27320028, -0.00040447, 0.00024779, 0.00040651, -0.00000115, 0.00000000],
+		[-6.27320041, -0.00040442, 0.00024776, 0.00040645, -0.00000115, 0.00000000],
+		[-6.27320053, -0.00040436, 0.00024772, 0.00040640, -0.00000115, 0.00000000],
+		[-6.27320066, -0.00040431, 0.00024769, 0.00040635, -0.00000115, 0.00000000],
+		[-6.27320079, -0.00040426, 0.00024766, 0.00040629, -0.00000115, 0.00000000],
+		[-6.27320091, -0.00040420, 0.00024763, 0.00040624, -0.00000115, 0.00000000],
+		[-6.27320104, -0.00040415, 0.00024759, 0.00040619, -0.00000115, 0.00000000],
+		[-6.27320117, -0.00040410, 0.00024756, 0.00040613, -0.00000115, 0.00000000],
+		[-6.27320129, -0.00040405, 0.00024753, 0.00040608, -0.00000115, 0.00000000],
+		[-6.27320142, -0.00040399, 0.00024750, 0.00040603, -0.00000115, 0.00000000],
+		[-6.27320154, -0.00040394, 0.00024746, 0.00040598, -0.00000115, 0.00000000],
+		[-6.27320167, -0.00040389, 0.00024743, 0.00040592, -0.00000115, 0.00000000],
+		[-6.27320180, -0.00040383, 0.00024740, 0.00040587, -0.00000115, 0.00000000],
+		[-6.27320192, -0.00040378, 0.00024737, 0.00040582, -0.00000115, 0.00000000],
+		[-6.27320205, -0.00040373, 0.00024733, 0.00040576, -0.00000115, 0.00000000],
+		[-6.27320217, -0.00040368, 0.00024730, 0.00040571, -0.00000115, 0.00000000],
+		[-6.27320230, -0.00040362, 0.00024727, 0.00040566, -0.00000115, 0.00000000],
+		[-6.27320243, -0.00040357, 0.00024724, 0.00040561, -0.00000115, 0.00000000],
+		[-6.27320255, -0.00040352, 0.00024721, 0.00040555, -0.00000115, 0.00000000],
+		[-6.27320268, -0.00040347, 0.00024717, 0.00040550, -0.00000115, 0.00000000],
+		[-6.27320280, -0.00040341, 0.00024714, 0.00040545, -0.00000115, 0.00000000],
+		[-6.27320293, -0.00040336, 0.00024711, 0.00040539, -0.00000115, 0.00000000],
+		[-6.27320306, -0.00040331, 0.00024708, 0.00040534, -0.00000115, 0.00000000],
+		[-6.27320318, -0.00040326, 0.00024704, 0.00040529, -0.00000115, 0.00000000],
+		[-6.27320331, -0.00040320, 0.00024701, 0.00040524, -0.00000115, 0.00000000],
+		[-6.27320343, -0.00040315, 0.00024698, 0.00040518, -0.00000115, 0.00000000],
+		[-6.27320356, -0.00040310, 0.00024695, 0.00040513, -0.00000115, 0.00000000],
+		[-6.27320368, -0.00040305, 0.00024692, 0.00040508, -0.00000115, 0.00000000],
+		[-6.27320381, -0.00040299, 0.00024688, 0.00040502, -0.00000115, 0.00000000],
+		[-6.27320394, -0.00040294, 0.00024685, 0.00040497, -0.00000115, 0.00000000],
+		[-6.27320406, -0.00040289, 0.00024682, 0.00040492, -0.00000115, 0.00000000],
+		[-6.27320419, -0.00040284, 0.00024679, 0.00040487, -0.00000115, 0.00000000],
+		[-6.27320431, -0.00040278, 0.00024676, 0.00040481, -0.00000115, 0.00000000],
+		[-6.27320444, -0.00040273, 0.00024672, 0.00040476, -0.00000115, 0.00000000],
+		[-6.27320456, -0.00040268, 0.00024669, 0.00040471, -0.00000115, 0.00000000],
+		[-6.27320469, -0.00040263, 0.00024666, 0.00040466, -0.00000115, 0.00000000],
+		[-6.27320481, -0.00040257, 0.00024663, 0.00040460, -0.00000115, 0.00000000],
+		[-6.27320494, -0.00040252, 0.00024659, 0.00040455, -0.00000115, 0.00000000],
+		[-6.27320506, -0.00040247, 0.00024656, 0.00040450, -0.00000115, 0.00000000],
+		[-6.27320519, -0.00040242, 0.00024653, 0.00040445, -0.00000115, 0.00000000],
+		[-6.27320532, -0.00040237, 0.00024650, 0.00040439, -0.00000115, 0.00000000],
+		[-6.27320544, -0.00040231, 0.00024647, 0.00040434, -0.00000115, 0.00000000],
+		[-6.27320557, -0.00040226, 0.00024643, 0.00040429, -0.00000115, 0.00000000],
+		[-6.27320569, -0.00040221, 0.00024640, 0.00040424, -0.00000115, 0.00000000],
+		[-6.27320582, -0.00040216, 0.00024637, 0.00040418, -0.00000115, 0.00000000],
+		[-6.27320594, -0.00040210, 0.00024634, 0.00040413, -0.00000115, 0.00000000],
+		[-6.27320607, -0.00040205, 0.00024631, 0.00040408, -0.00000115, 0.00000000],
+		[-6.27320619, -0.00040200, 0.00024627, 0.00040403, -0.00000115, 0.00000000],
+		[-6.27320632, -0.00040195, 0.00024624, 0.00040397, -0.00000115, 0.00000000],
+		[-6.27320644, -0.00040190, 0.00024621, 0.00040392, -0.00000115, 0.00000000],
+		[-6.27320657, -0.00040184, 0.00024618, 0.00040387, -0.00000115, 0.00000000],
+		[-6.27320669, -0.00040179, 0.00024615, 0.00040382, -0.00000115, 0.00000000],
+		[-6.27320682, -0.00040174, 0.00024611, 0.00040376, -0.00000115, 0.00000000],
+		[-6.27320694, -0.00040169, 0.00024608, 0.00040371, -0.00000115, 0.00000000],
+		[-6.27320706, -0.00040163, 0.00024605, 0.00040366, -0.00000115, 0.00000000],
+		[-6.27320719, -0.00040158, 0.00024602, 0.00040361, -0.00000115, 0.00000000],
+		[-6.27320731, -0.00040153, 0.00024599, 0.00040355, -0.00000115, 0.00000000],
+		[-6.27320744, -0.00040148, 0.00024595, 0.00040350, -0.00000115, 0.00000000],
+		[-6.27320756, -0.00040143, 0.00024592, 0.00040345, -0.00000115, 0.00000000],
+		[-6.27320769, -0.00040137, 0.00024589, 0.00040340, -0.00000115, 0.00000000],
+		[-6.27320781, -0.00040132, 0.00024586, 0.00040334, -0.00000115, 0.00000000],
+		[-6.27320794, -0.00040127, 0.00024583, 0.00040329, -0.00000115, 0.00000000],
+		[-6.27320806, -0.00040122, 0.00024580, 0.00040324, -0.00000115, 0.00000000],
+		[-6.27320819, -0.00040117, 0.00024576, 0.00040319, -0.00000115, 0.00000000],
+		[-6.27320831, -0.00040111, 0.00024573, 0.00040313, -0.00000115, 0.00000000],
+		[-6.27320843, -0.00040106, 0.00024570, 0.00040308, -0.00000115, 0.00000000],
+		[-6.27320856, -0.00040101, 0.00024567, 0.00040303, -0.00000115, 0.00000000],
+		[-6.27320868, -0.00040096, 0.00024564, 0.00040298, -0.00000115, 0.00000000],
+		[-6.27320881, -0.00040091, 0.00024560, 0.00040293, -0.00000115, 0.00000000],
+		[-6.27320893, -0.00040085, 0.00024557, 0.00040287, -0.00000115, 0.00000000],
+		[-6.27320906, -0.00040080, 0.00024554, 0.00040282, -0.00000115, 0.00000000],
+		[-6.27320918, -0.00040075, 0.00024551, 0.00040277, -0.00000115, 0.00000000],
+		[-6.27320930, -0.00040070, 0.00024548, 0.00040272, -0.00000115, 0.00000000],
+		[-6.27320943, -0.00040065, 0.00024545, 0.00040267, -0.00000115, 0.00000000],
+		[-6.27320955, -0.00040059, 0.00024541, 0.00040261, -0.00000115, 0.00000000],
+		[-6.27320968, -0.00040054, 0.00024538, 0.00040256, -0.00000115, 0.00000000],
+		[-6.27320980, -0.00040049, 0.00024535, 0.00040251, -0.00000115, 0.00000000],
+		[-6.27320993, -0.00040044, 0.00024532, 0.00040246, -0.00000115, 0.00000000],
+		[-6.27321005, -0.00040039, 0.00024529, 0.00040240, -0.00000115, 0.00000000],
+		[-6.27321017, -0.00040034, 0.00024525, 0.00040235, -0.00000115, 0.00000000],
+		[-6.27321030, -0.00040028, 0.00024522, 0.00040230, -0.00000115, 0.00000000],
+		[-6.27321042, -0.00040023, 0.00024519, 0.00040225, -0.00000115, 0.00000000],
+		[-6.27321054, -0.00040018, 0.00024516, 0.00040220, -0.00000115, 0.00000000],
+		[-6.27321067, -0.00040013, 0.00024513, 0.00040214, -0.00000115, 0.00000000],
+		[-6.27321079, -0.00040008, 0.00024510, 0.00040209, -0.00000115, 0.00000000],
+		[-6.27321092, -0.00040003, 0.00024506, 0.00040204, -0.00000115, 0.00000000],
+		[-6.27321104, -0.00039997, 0.00024503, 0.00040199, -0.00000115, 0.00000000],
+		[-6.27321116, -0.00039992, 0.00024500, 0.00040194, -0.00000115, 0.00000000],
+		[-6.27321129, -0.00039987, 0.00024497, 0.00040189, -0.00000115, 0.00000000],
+		[-6.27321141, -0.00039982, 0.00024494, 0.00040183, -0.00000115, 0.00000000],
+		[-6.27321153, -0.00039977, 0.00024491, 0.00040178, -0.00000115, 0.00000000],
+		[-6.27321166, -0.00039972, 0.00024487, 0.00040173, -0.00000115, 0.00000000],
+		[-6.27321178, -0.00039966, 0.00024484, 0.00040168, -0.00000115, 0.00000000],
+		[-6.27321191, -0.00039961, 0.00024481, 0.00040163, -0.00000115, 0.00000000],
+		[-6.27321203, -0.00039956, 0.00024478, 0.00040157, -0.00000115, 0.00000000],
+		[-6.27321215, -0.00039951, 0.00024475, 0.00040152, -0.00000115, 0.00000000],
+		[-6.27321228, -0.00039946, 0.00024472, 0.00040147, -0.00000115, 0.00000000],
+		[-6.27321240, -0.00039941, 0.00024468, 0.00040142, -0.00000115, 0.00000000],
+		[-6.27321252, -0.00039935, 0.00024465, 0.00040137, -0.00000115, 0.00000000],
+		[-6.27321265, -0.00039930, 0.00024462, 0.00040131, -0.00000115, 0.00000000],
+		[-6.27321277, -0.00039925, 0.00024459, 0.00040126, -0.00000115, 0.00000000],
+		[-6.27321289, -0.00039920, 0.00024456, 0.00040121, -0.00000115, 0.00000000],
+		[-6.27321302, -0.00039915, 0.00024453, 0.00040116, -0.00000115, 0.00000000],
+		[-6.27321314, -0.00039910, 0.00024450, 0.00040111, -0.00000115, 0.00000000],
+		[-6.27321326, -0.00039905, 0.00024446, 0.00040106, -0.00000115, 0.00000000],
+		[-6.27321338, -0.00039899, 0.00024443, 0.00040100, -0.00000115, 0.00000000],
+		[-6.27321351, -0.00039894, 0.00024440, 0.00040095, -0.00000115, 0.00000000],
+		[-6.27321363, -0.00039889, 0.00024437, 0.00040090, -0.00000115, 0.00000000],
+		[-6.27321375, -0.00039884, 0.00024434, 0.00040085, -0.00000115, 0.00000000],
+		[-6.27321388, -0.00039879, 0.00024431, 0.00040080, -0.00000115, 0.00000000],
+		[-6.27321400, -0.00039874, 0.00024427, 0.00040075, -0.00000115, 0.00000000],
+		[-6.27321412, -0.00039869, 0.00024424, 0.00040069, -0.00000115, 0.00000000],
+		[-6.27321425, -0.00039863, 0.00024421, 0.00040064, -0.00000115, 0.00000000],
+		[-6.27321437, -0.00039858, 0.00024418, 0.00040059, -0.00000115, 0.00000000],
+		[-6.27321449, -0.00039853, 0.00024415, 0.00040054, -0.00000115, 0.00000000],
+		[-6.27321461, -0.00039848, 0.00024412, 0.00040049, -0.00000115, 0.00000000],
+		[-6.27321474, -0.00039843, 0.00024409, 0.00040044, -0.00000115, 0.00000000],
+		[-6.27321486, -0.00039838, 0.00024405, 0.00040039, -0.00000115, 0.00000000],
+		[-6.27321498, -0.00039833, 0.00024402, 0.00040033, -0.00000115, 0.00000000],
+		[-6.27321511, -0.00039828, 0.00024399, 0.00040028, -0.00000115, 0.00000000],
+		[-6.27321523, -0.00039822, 0.00024396, 0.00040023, -0.00000115, 0.00000000],
+		[-6.27321535, -0.00039817, 0.00024393, 0.00040018, -0.00000115, 0.00000000],
+		[-6.27321547, -0.00039812, 0.00024390, 0.00040013, -0.00000115, 0.00000000],
+		[-6.27321560, -0.00039807, 0.00024387, 0.00040008, -0.00000115, 0.00000000],
+		[-6.27321572, -0.00039802, 0.00024383, 0.00040002, -0.00000115, 0.00000000],
+		[-6.27321584, -0.00039797, 0.00024380, 0.00039997, -0.00000115, 0.00000000],
+		[-6.27321596, -0.00039792, 0.00024377, 0.00039992, -0.00000115, 0.00000000],
+		[-6.27321609, -0.00039787, 0.00024374, 0.00039987, -0.00000115, 0.00000000],
+		[-6.27321621, -0.00039781, 0.00024371, 0.00039982, -0.00000115, 0.00000000],
+		[-6.27321633, -0.00039776, 0.00024368, 0.00039977, -0.00000115, 0.00000000],
+		[-6.27321645, -0.00039771, 0.00024365, 0.00039972, -0.00000115, 0.00000000],
+		[-6.27321658, -0.00039766, 0.00024362, 0.00039966, -0.00000115, 0.00000000],
+		[-6.27321670, -0.00039761, 0.00024358, 0.00039961, -0.00000115, 0.00000000],
+		[-6.27321682, -0.00039756, 0.00024355, 0.00039956, -0.00000115, 0.00000000],
+		[-6.27321694, -0.00039751, 0.00024352, 0.00039951, -0.00000115, 0.00000000],
+		[-6.27321706, -0.00039746, 0.00024349, 0.00039946, -0.00000115, 0.00000000],
+		[-6.27321719, -0.00039741, 0.00024346, 0.00039941, -0.00000115, 0.00000000],
+		[-6.27321731, -0.00039736, 0.00024343, 0.00039936, -0.00000115, 0.00000000],
+		[-6.27321743, -0.00039730, 0.00024340, 0.00039931, -0.00000115, 0.00000000],
+		[-6.27321755, -0.00039725, 0.00024337, 0.00039925, -0.00000115, 0.00000000],
+		[-6.27321767, -0.00039720, 0.00024333, 0.00039920, -0.00000115, 0.00000000],
+		[-6.27321780, -0.00039715, 0.00024330, 0.00039915, -0.00000115, 0.00000000],
+		[-6.27321792, -0.00039710, 0.00024327, 0.00039910, -0.00000115, 0.00000000],
+		[-6.27321804, -0.00039705, 0.00024324, 0.00039905, -0.00000115, 0.00000000],
+		[-6.27321816, -0.00039700, 0.00024321, 0.00039900, -0.00000115, 0.00000000],
+		[-6.27321828, -0.00039695, 0.00024318, 0.00039895, -0.00000115, 0.00000000],
+		[-6.27321841, -0.00039690, 0.00024315, 0.00039890, -0.00000115, 0.00000000],
+		[-6.27321853, -0.00039685, 0.00024312, 0.00039884, -0.00000115, 0.00000000],
+		[-6.27321865, -0.00039680, 0.00024308, 0.00039879, -0.00000115, 0.00000000],
+		[-6.27321877, -0.00039674, 0.00024305, 0.00039874, -0.00000115, 0.00000000],
+		[-6.27321889, -0.00039669, 0.00024302, 0.00039869, -0.00000115, 0.00000000],
+		[-6.27321901, -0.00039664, 0.00024299, 0.00039864, -0.00000115, 0.00000000],
+		[-6.27321914, -0.00039659, 0.00024296, 0.00039859, -0.00000115, 0.00000000],
+		[-6.27321926, -0.00039654, 0.00024293, 0.00039854, -0.00000115, 0.00000000],
+		[-6.27321938, -0.00039649, 0.00024290, 0.00039849, -0.00000115, 0.00000000],
+		[-6.27321950, -0.00039644, 0.00024287, 0.00039844, -0.00000115, 0.00000000],
+		[-6.27321962, -0.00039639, 0.00024284, 0.00039839, -0.00000115, 0.00000000],
+		[-6.27321974, -0.00039634, 0.00024280, 0.00039833, -0.00000115, 0.00000000],
+		[-6.27321987, -0.00039629, 0.00024277, 0.00039828, -0.00000115, 0.00000000],
+		[-6.27321999, -0.00039624, 0.00024274, 0.00039823, -0.00000115, 0.00000000],
+		[-6.27322011, -0.00039619, 0.00024271, 0.00039818, -0.00000115, 0.00000000],
+		[-6.27322023, -0.00039613, 0.00024268, 0.00039813, -0.00000115, 0.00000000],
+		[-6.27322035, -0.00039608, 0.00024265, 0.00039808, -0.00000115, 0.00000000],
+		[-6.27322047, -0.00039603, 0.00024262, 0.00039803, -0.00000115, 0.00000000],
+		[-6.27322059, -0.00039598, 0.00024259, 0.00039798, -0.00000115, 0.00000000],
+		[-6.27322071, -0.00039593, 0.00024256, 0.00039793, -0.00000115, 0.00000000],
+		[-6.27322084, -0.00039588, 0.00024252, 0.00039788, -0.00000115, 0.00000000],
+		[-6.27322096, -0.00039583, 0.00024249, 0.00039782, -0.00000115, 0.00000000],
+		[-6.27322108, -0.00039578, 0.00024246, 0.00039777, -0.00000115, 0.00000000],
+		[-6.27322120, -0.00039573, 0.00024243, 0.00039772, -0.00000115, 0.00000000],
+		[-6.27322132, -0.00039568, 0.00024240, 0.00039767, -0.00000115, 0.00000000],
+		[-6.27322144, -0.00039563, 0.00024237, 0.00039762, -0.00000115, 0.00000000],
+		[-6.27322156, -0.00039558, 0.00024234, 0.00039757, -0.00000115, 0.00000000],
+		[-6.27322168, -0.00039553, 0.00024231, 0.00039752, -0.00000115, 0.00000000],
+		[-6.27322180, -0.00039548, 0.00024228, 0.00039747, -0.00000115, 0.00000000],
+		[-6.27322193, -0.00039543, 0.00024225, 0.00039742, -0.00000115, 0.00000000],
+		[-6.27322205, -0.00039538, 0.00024221, 0.00039737, -0.00000115, 0.00000000],
+		[-6.27322217, -0.00039533, 0.00024218, 0.00039732, -0.00000115, 0.00000000],
+		[-6.27322229, -0.00039528, 0.00024215, 0.00039727, -0.00000115, 0.00000000],
+		[-6.27322241, -0.00039522, 0.00024212, 0.00039722, -0.00000115, 0.00000000],
+		[-6.27322253, -0.00039517, 0.00024209, 0.00039716, -0.00000115, 0.00000000],
+		[-6.27322265, -0.00039512, 0.00024206, 0.00039711, -0.00000115, 0.00000000],
+		[-6.27322277, -0.00039507, 0.00024203, 0.00039706, -0.00000115, 0.00000000],
+		[-6.27322289, -0.00039502, 0.00024200, 0.00039701, -0.00000115, 0.00000000],
+		[-6.27322301, -0.00039497, 0.00024197, 0.00039696, -0.00000115, 0.00000000],
+		[-6.27322313, -0.00039492, 0.00024194, 0.00039691, -0.00000115, 0.00000000],
+		[-6.27322325, -0.00039487, 0.00024191, 0.00039686, -0.00000115, 0.00000000],
+		[-6.27322337, -0.00039482, 0.00024187, 0.00039681, -0.00000115, 0.00000000],
+		[-6.27322349, -0.00039477, 0.00024184, 0.00039676, -0.00000115, 0.00000000],
+		[-6.27322362, -0.00039472, 0.00024181, 0.00039671, -0.00000115, 0.00000000],
+		[-6.27322374, -0.00039467, 0.00024178, 0.00039666, -0.00000115, 0.00000000],
+		[-6.27322386, -0.00039462, 0.00024175, 0.00039661, -0.00000115, 0.00000000],
+		[-6.27322398, -0.00039457, 0.00024172, 0.00039656, -0.00000115, 0.00000000],
+		[-6.27322410, -0.00039452, 0.00024169, 0.00039651, -0.00000115, 0.00000000],
+		[-6.27322422, -0.00039447, 0.00024166, 0.00039646, -0.00000115, 0.00000000],
+		[-6.27322434, -0.00039442, 0.00024163, 0.00039641, -0.00000115, 0.00000000],
+		[-6.27322446, -0.00039437, 0.00024160, 0.00039635, -0.00000115, 0.00000000],
+		[-6.27322458, -0.00039432, 0.00024157, 0.00039630, -0.00000115, 0.00000000],
+		[-6.27322470, -0.00039427, 0.00024154, 0.00039625, -0.00000115, 0.00000000],
+		[-6.27322482, -0.00039422, 0.00024150, 0.00039620, -0.00000115, 0.00000000],
+		[-6.27322494, -0.00039417, 0.00024147, 0.00039615, -0.00000115, 0.00000000],
+		[-6.27322506, -0.00039412, 0.00024144, 0.00039610, -0.00000115, 0.00000000],
+		[-6.27322518, -0.00039407, 0.00024141, 0.00039605, -0.00000115, 0.00000000],
+		[-6.27322530, -0.00039402, 0.00024138, 0.00039600, -0.00000115, 0.00000000],
+		[-6.27322542, -0.00039397, 0.00024135, 0.00039595, -0.00000115, 0.00000000],
+		[-6.27322554, -0.00039392, 0.00024132, 0.00039590, -0.00000115, 0.00000000],
+		[-6.27322566, -0.00039387, 0.00024129, 0.00039585, -0.00000115, 0.00000000],
+		[-6.27322578, -0.00039382, 0.00024126, 0.00039580, -0.00000115, 0.00000000],
+		[-6.27322590, -0.00039377, 0.00024123, 0.00039575, -0.00000115, 0.00000000],
+		[-6.27322602, -0.00039372, 0.00024120, 0.00039570, -0.00000115, 0.00000000],
+		[-6.27322614, -0.00039367, 0.00024117, 0.00039565, -0.00000115, 0.00000000],
+		[-6.27322626, -0.00039362, 0.00024114, 0.00039560, -0.00000115, 0.00000000],
+		[-6.27322638, -0.00039357, 0.00024111, 0.00039555, -0.00000115, 0.00000000],
+		[-6.27322650, -0.00039352, 0.00024107, 0.00039550, -0.00000115, 0.00000000],
+		[-6.27322662, -0.00039347, 0.00024104, 0.00039545, -0.00000115, 0.00000000],
+		[-6.27322674, -0.00039342, 0.00024101, 0.00039540, -0.00000115, 0.00000000],
+		[-6.27322686, -0.00039337, 0.00024098, 0.00039535, -0.00000115, 0.00000000],
+		[-6.27322698, -0.00039332, 0.00024095, 0.00039530, -0.00000115, 0.00000000],
+		[-6.27322710, -0.00039327, 0.00024092, 0.00039525, -0.00000115, 0.00000000],
+		[-6.27322722, -0.00039322, 0.00024089, 0.00039520, -0.00000115, 0.00000000],
+		[-6.27322734, -0.00039317, 0.00024086, 0.00039515, -0.00000115, 0.00000000],
+		[-6.27322746, -0.00039312, 0.00024083, 0.00039510, -0.00000115, 0.00000000],
+		[-6.27322757, -0.00039307, 0.00024080, 0.00039505, -0.00000115, 0.00000000],
+		[-6.27322769, -0.00039302, 0.00024077, 0.00039500, -0.00000115, 0.00000000],
+		[-6.27322781, -0.00039297, 0.00024074, 0.00039495, -0.00000115, 0.00000000],
+		[-6.27322793, -0.00039292, 0.00024071, 0.00039490, -0.00000115, 0.00000000],
+		[-6.27322805, -0.00039287, 0.00024068, 0.00039485, -0.00000115, 0.00000000],
+		[-6.27322817, -0.00039282, 0.00024065, 0.00039480, -0.00000115, 0.00000000],
+		[-6.27322829, -0.00039277, 0.00024062, 0.00039475, -0.00000115, 0.00000000],
+		[-6.27322841, -0.00039272, 0.00024059, 0.00039470, -0.00000115, 0.00000000],
+		[-6.27322853, -0.00039267, 0.00024055, 0.00039465, -0.00000115, 0.00000000],
+		[-6.27322865, -0.00039262, 0.00024052, 0.00039460, -0.00000115, 0.00000000],
+		[-6.27322877, -0.00039257, 0.00024049, 0.00039455, -0.00000115, 0.00000000],
+		[-6.27322889, -0.00039252, 0.00024046, 0.00039450, -0.00000115, 0.00000000],
+		[-6.27322901, -0.00039247, 0.00024043, 0.00039445, -0.00000115, 0.00000000],
+		[-6.27322913, -0.00039242, 0.00024040, 0.00039440, -0.00000115, 0.00000000],
+		[-6.27322924, -0.00039237, 0.00024037, 0.00039435, -0.00000115, 0.00000000],
+		[-6.27322936, -0.00039232, 0.00024034, 0.00039430, -0.00000115, 0.00000000],
+		[-6.27322948, -0.00039227, 0.00024031, 0.00039425, -0.00000115, 0.00000000],
+		[-6.27322960, -0.00039222, 0.00024028, 0.00039420, -0.00000115, 0.00000000],
+		[-6.27322972, -0.00039217, 0.00024025, 0.00039415, -0.00000115, 0.00000000],
+		[-6.27322984, -0.00039212, 0.00024022, 0.00039410, -0.00000115, 0.00000000],
+		[-6.27322996, -0.00039207, 0.00024019, 0.00039405, -0.00000115, 0.00000000],
+		[-6.27323008, -0.00039202, 0.00024016, 0.00039400, -0.00000115, 0.00000000],
+		[-6.27323020, -0.00039197, 0.00024013, 0.00039395, -0.00000115, 0.00000000],
+		[-6.27323032, -0.00039192, 0.00024010, 0.00039390, -0.00000115, 0.00000000],
+		[-6.27323043, -0.00039187, 0.00024007, 0.00039385, -0.00000115, 0.00000000],
+		[-6.27323055, -0.00039182, 0.00024004, 0.00039380, -0.00000115, 0.00000000],
+		[-6.27323067, -0.00039177, 0.00024001, 0.00039375, -0.00000115, 0.00000000],
+		[-6.27323079, -0.00039172, 0.00023998, 0.00039370, -0.00000115, 0.00000000],
+		[-6.27323091, -0.00039167, 0.00023995, 0.00039365, -0.00000115, 0.00000000],
+		[-6.27323103, -0.00039162, 0.00023992, 0.00039360, -0.00000115, 0.00000000],
+		[-6.27323115, -0.00039158, 0.00023989, 0.00039355, -0.00000115, 0.00000000],
+		[-6.27323126, -0.00039153, 0.00023985, 0.00039350, -0.00000115, 0.00000000],
+		[-6.27323138, -0.00039148, 0.00023982, 0.00039345, -0.00000115, 0.00000000],
+		[-6.27323150, -0.00039143, 0.00023979, 0.00039340, -0.00000115, 0.00000000],
+		[-6.27323162, -0.00039138, 0.00023976, 0.00039335, -0.00000115, 0.00000000],
+		[-6.27323174, -0.00039133, 0.00023973, 0.00039330, -0.00000115, 0.00000000],
+		[-6.27323186, -0.00039128, 0.00023970, 0.00039325, -0.00000115, 0.00000000],
+		[-6.27323198, -0.00039123, 0.00023967, 0.00039320, -0.00000115, 0.00000000],
+		[-6.27323209, -0.00039118, 0.00023964, 0.00039315, -0.00000115, 0.00000000],
+		[-6.27323221, -0.00039113, 0.00023961, 0.00039310, -0.00000115, 0.00000000],
+		[-6.27323233, -0.00039108, 0.00023958, 0.00039305, -0.00000115, 0.00000000],
+		[-6.27323245, -0.00039103, 0.00023955, 0.00039300, -0.00000115, 0.00000000],
+		[-6.27323257, -0.00039098, 0.00023952, 0.00039295, -0.00000115, 0.00000000],
+		[-6.27323268, -0.00039093, 0.00023949, 0.00039290, -0.00000115, 0.00000000],
+		[-6.27323280, -0.00039088, 0.00023946, 0.00039285, -0.00000115, 0.00000000],
+		[-6.27323292, -0.00039083, 0.00023943, 0.00039280, -0.00000115, 0.00000000],
+		[-6.27323304, -0.00039078, 0.00023940, 0.00039275, -0.00000115, 0.00000000],
+		[-6.27323316, -0.00039073, 0.00023937, 0.00039270, -0.00000115, 0.00000000],
+		[-6.27323328, -0.00039069, 0.00023934, 0.00039265, -0.00000115, 0.00000000],
+		[-6.27323339, -0.00039064, 0.00023931, 0.00039260, -0.00000115, 0.00000000],
+		[-6.27323351, -0.00039059, 0.00023928, 0.00039255, -0.00000115, 0.00000000],
+		[-6.27323363, -0.00039054, 0.00023925, 0.00039250, -0.00000115, 0.00000000],
+		[-6.27323375, -0.00039049, 0.00023922, 0.00039245, -0.00000115, 0.00000000],
+		[-6.27323387, -0.00039044, 0.00023919, 0.00039241, -0.00000115, 0.00000000],
+		[-6.27323398, -0.00039039, 0.00023916, 0.00039236, -0.00000115, 0.00000000],
+		[-6.27323410, -0.00039034, 0.00023913, 0.00039231, -0.00000115, 0.00000000],
+		[-6.27323422, -0.00039029, 0.00023910, 0.00039226, -0.00000115, 0.00000000],
+		[-6.27323434, -0.00039024, 0.00023907, 0.00039221, -0.00000115, 0.00000000],
+		[-6.27323445, -0.00039019, 0.00023904, 0.00039216, -0.00000115, 0.00000000],
+		[-6.27323457, -0.00039014, 0.00023901, 0.00039211, -0.00000115, 0.00000000],
+		[-6.27323469, -0.00039009, 0.00023898, 0.00039206, -0.00000115, 0.00000000],
+		[-6.27323481, -0.00039005, 0.00023895, 0.00039201, -0.00000115, 0.00000000],
+		[-6.27323493, -0.00039000, 0.00023892, 0.00039196, -0.00000115, 0.00000000],
+		[-6.27323504, -0.00038995, 0.00023889, 0.00039191, -0.00000115, 0.00000000],
+		[-6.27323516, -0.00038990, 0.00023886, 0.00039186, -0.00000115, 0.00000000],
+		[-6.27323528, -0.00038985, 0.00023883, 0.00039181, -0.00000115, 0.00000000],
+		[-6.27323540, -0.00038980, 0.00023880, 0.00039176, -0.00000115, 0.00000000],
+		[-6.27323551, -0.00038975, 0.00023877, 0.00039171, -0.00000115, 0.00000000],
+		[-6.27323563, -0.00038970, 0.00023874, 0.00039166, -0.00000115, 0.00000000],
+		[-6.27323575, -0.00038965, 0.00023871, 0.00039161, -0.00000115, 0.00000000],
+		[-6.27323587, -0.00038960, 0.00023868, 0.00039157, -0.00000115, 0.00000000],
+		[-6.27323598, -0.00038955, 0.00023865, 0.00039152, -0.00000115, 0.00000000],
+		[-6.27323610, -0.00038951, 0.00023862, 0.00039147, -0.00000115, 0.00000000],
+		[-6.27323622, -0.00038946, 0.00023859, 0.00039142, -0.00000115, 0.00000000],
+		[-6.27323633, -0.00038941, 0.00023856, 0.00039137, -0.00000115, 0.00000000],
+		[-6.27323645, -0.00038936, 0.00023853, 0.00039132, -0.00000115, 0.00000000],
+		[-6.27323657, -0.00038931, 0.00023850, 0.00039127, -0.00000115, 0.00000000],
+		[-6.27323669, -0.00038926, 0.00023847, 0.00039122, -0.00000115, 0.00000000],
+		[-6.27323680, -0.00038921, 0.00023844, 0.00039117, -0.00000115, 0.00000000],
+		[-6.27323692, -0.00038916, 0.00023841, 0.00039112, -0.00000115, 0.00000000],
+		[-6.27323704, -0.00038911, 0.00023838, 0.00039107, -0.00000115, 0.00000000],
+		[-6.27323715, -0.00038907, 0.00023835, 0.00039102, -0.00000115, 0.00000000],
+		[-6.27323727, -0.00038902, 0.00023832, 0.00039097, -0.00000115, 0.00000000],
+		[-6.27323739, -0.00038897, 0.00023829, 0.00039093, -0.00000115, 0.00000000],
+		[-6.27323751, -0.00038892, 0.00023826, 0.00039088, -0.00000115, 0.00000000],
+		[-6.27323762, -0.00038887, 0.00023823, 0.00039083, -0.00000115, 0.00000000],
+		[-6.27323774, -0.00038882, 0.00023820, 0.00039078, -0.00000115, 0.00000000],
+		[-6.27323786, -0.00038877, 0.00023817, 0.00039073, -0.00000115, 0.00000000],
+		[-6.27323797, -0.00038872, 0.00023814, 0.00039068, -0.00000115, 0.00000000],
+		[-6.27323809, -0.00038867, 0.00023811, 0.00039063, -0.00000115, 0.00000000],
+		[-6.27323821, -0.00038863, 0.00023808, 0.00039058, -0.00000115, 0.00000000],
+		[-6.27323832, -0.00038858, 0.00023805, 0.00039053, -0.00000115, 0.00000000],
+		[-6.27323844, -0.00038853, 0.00023802, 0.00039048, -0.00000115, 0.00000000],
+		[-6.27323856, -0.00038848, 0.00023799, 0.00039044, -0.00000115, 0.00000000],
+		[-6.27323867, -0.00038843, 0.00023796, 0.00039039, -0.00000115, 0.00000000],
+		[-6.27323879, -0.00038838, 0.00023793, 0.00039034, -0.00000115, 0.00000000],
+		[-6.27323891, -0.00038833, 0.00023790, 0.00039029, -0.00000115, 0.00000000],
+		[-6.27323902, -0.00038828, 0.00023787, 0.00039024, -0.00000115, 0.00000000],
+		[-6.27323914, -0.00038824, 0.00023784, 0.00039019, -0.00000115, 0.00000000],
+		[-6.27323926, -0.00038819, 0.00023781, 0.00039014, -0.00000115, 0.00000000],
+		[-6.27323937, -0.00038814, 0.00023778, 0.00039009, -0.00000115, 0.00000000],
+		[-6.27323949, -0.00038809, 0.00023775, 0.00039004, -0.00000115, 0.00000000],
+		[-6.27323961, -0.00038804, 0.00023772, 0.00038999, -0.00000115, 0.00000000],
+		[-6.27323972, -0.00038799, 0.00023769, 0.00038995, -0.00000115, 0.00000000],
+		[-6.27323984, -0.00038794, 0.00023766, 0.00038990, -0.00000115, 0.00000000],
+		[-6.27323996, -0.00038789, 0.00023763, 0.00038985, -0.00000115, 0.00000000],
+		[-6.27324007, -0.00038785, 0.00023760, 0.00038980, -0.00000115, 0.00000000],
+		[-6.27324019, -0.00038780, 0.00023757, 0.00038975, -0.00000115, 0.00000000],
+		[-6.27324030, -0.00038775, 0.00023754, 0.00038970, -0.00000115, 0.00000000],
+		[-6.27324042, -0.00038770, 0.00023751, 0.00038965, -0.00000115, 0.00000000],
+		[-6.27324054, -0.00038765, 0.00023748, 0.00038960, -0.00000115, 0.00000000],
+		[-6.27324065, -0.00038760, 0.00023745, 0.00038956, -0.00000115, 0.00000000],
+		[-6.27324077, -0.00038755, 0.00023742, 0.00038951, -0.00000115, 0.00000000],
+		[-6.27324089, -0.00038751, 0.00023739, 0.00038946, -0.00000115, 0.00000000],
+		[-6.27324100, -0.00038746, 0.00023736, 0.00038941, -0.00000115, 0.00000000],
+		[-6.27324112, -0.00038741, 0.00023733, 0.00038936, -0.00000115, 0.00000000],
+		[-6.27324123, -0.00038736, 0.00023730, 0.00038931, -0.00000115, 0.00000000],
+		[-6.27324135, -0.00038731, 0.00023727, 0.00038926, -0.00000115, 0.00000000],
+		[-6.27324147, -0.00038726, 0.00023724, 0.00038921, -0.00000115, 0.00000000],
+		[-6.27324158, -0.00038722, 0.00023721, 0.00038917, -0.00000115, 0.00000000],
+		[-6.27324170, -0.00038717, 0.00023718, 0.00038912, -0.00000115, 0.00000000],
+		[-6.27324181, -0.00038712, 0.00023715, 0.00038907, -0.00000115, 0.00000000],
+		[-6.27324193, -0.00038707, 0.00023712, 0.00038902, -0.00000115, 0.00000000],
+		[-6.27324205, -0.00038702, 0.00023709, 0.00038897, -0.00000115, 0.00000000],
+		[-6.27324216, -0.00038697, 0.00023706, 0.00038892, -0.00000115, 0.00000000],
+		[-6.27324228, -0.00038693, 0.00023704, 0.00038887, -0.00000115, 0.00000000],
+		[-6.27324239, -0.00038688, 0.00023701, 0.00038882, -0.00000115, 0.00000000],
+		[-6.27324251, -0.00038683, 0.00023698, 0.00038878, -0.00000115, 0.00000000],
+		[-6.27324262, -0.00038678, 0.00023695, 0.00038873, -0.00000115, 0.00000000],
+		[-6.27324274, -0.00038673, 0.00023692, 0.00038868, -0.00000115, 0.00000000],
+		[-6.27324286, -0.00038668, 0.00023689, 0.00038863, -0.00000115, 0.00000000],
+		[-6.27324297, -0.00038664, 0.00023686, 0.00038858, -0.00000115, 0.00000000],
+		[-6.27324309, -0.00038659, 0.00023683, 0.00038853, -0.00000115, 0.00000000],
+		[-6.27324320, -0.00038654, 0.00023680, 0.00038848, -0.00000115, 0.00000000],
+		[-6.27324332, -0.00038649, 0.00023677, 0.00038844, -0.00000115, 0.00000000],
+		[-6.27324343, -0.00038644, 0.00023674, 0.00038839, -0.00000115, 0.00000000],
+		[-6.27324355, -0.00038639, 0.00023671, 0.00038834, -0.00000115, 0.00000000],
+		[-6.27324366, -0.00038635, 0.00023668, 0.00038829, -0.00000115, 0.00000000],
+		[-6.27324378, -0.00038630, 0.00023665, 0.00038824, -0.00000115, 0.00000000],
+		[-6.27324390, -0.00038625, 0.00023662, 0.00038819, -0.00000115, 0.00000000],
+		[-6.27324401, -0.00038620, 0.00023659, 0.00038815, -0.00000115, 0.00000000],
+		[-6.27324413, -0.00038615, 0.00023656, 0.00038810, -0.00000115, 0.00000000],
+		[-6.27324424, -0.00038610, 0.00023653, 0.00038805, -0.00000115, 0.00000000],
+		[-6.27324436, -0.00038606, 0.00023650, 0.00038800, -0.00000115, 0.00000000],
+		[-6.27324447, -0.00038601, 0.00023647, 0.00038795, -0.00000115, 0.00000000],
+		[-6.27324459, -0.00038596, 0.00023644, 0.00038790, -0.00000115, 0.00000000],
+		[-6.27324470, -0.00038591, 0.00023641, 0.00038786, -0.00000115, 0.00000000],
+		[-6.27324482, -0.00038586, 0.00023638, 0.00038781, -0.00000115, 0.00000000],
+		[-6.27324493, -0.00038582, 0.00023636, 0.00038776, -0.00000115, 0.00000000],
+		[-6.27324505, -0.00038577, 0.00023633, 0.00038771, -0.00000115, 0.00000000],
+		[-6.27324516, -0.00038572, 0.00023630, 0.00038766, -0.00000115, 0.00000000],
+		[-6.27324528, -0.00038567, 0.00023627, 0.00038761, -0.00000115, 0.00000000],
+		[-6.27324539, -0.00038562, 0.00023624, 0.00038757, -0.00000115, 0.00000000],
+		[-6.27324551, -0.00038558, 0.00023621, 0.00038752, -0.00000115, 0.00000000],
+		[-6.27324562, -0.00038553, 0.00023618, 0.00038747, -0.00000115, 0.00000000],
+		[-6.27324574, -0.00038548, 0.00023615, 0.00038742, -0.00000115, 0.00000000],
+		[-6.27324585, -0.00038543, 0.00023612, 0.00038737, -0.00000115, 0.00000000],
+		[-6.27324597, -0.00038538, 0.00023609, 0.00038732, -0.00000115, 0.00000000],
+		[-6.27324608, -0.00038534, 0.00023606, 0.00038728, -0.00000115, 0.00000000],
+		[-6.27324620, -0.00038529, 0.00023603, 0.00038723, -0.00000115, 0.00000000],
+		[-6.27324631, -0.00038524, 0.00023600, 0.00038718, -0.00000115, 0.00000000],
+		[-6.27324643, -0.00038519, 0.00023597, 0.00038713, -0.00000115, 0.00000000],
+		[-6.27324654, -0.00038514, 0.00023594, 0.00038708, -0.00000115, 0.00000000],
+		[-6.27324666, -0.00038510, 0.00023591, 0.00038703, -0.00000115, 0.00000000],
+		[-6.27324677, -0.00038505, 0.00023588, 0.00038699, -0.00000115, 0.00000000],
+		[-6.27324689, -0.00038500, 0.00023586, 0.00038694, -0.00000115, 0.00000000],
+		[-6.27324700, -0.00038495, 0.00023583, 0.00038689, -0.00000115, 0.00000000],
+		[-6.27324711, -0.00038490, 0.00023580, 0.00038684, -0.00000115, 0.00000000],
+		[-6.27324723, -0.00038486, 0.00023577, 0.00038679, -0.00000115, 0.00000000],
+		[-6.27324734, -0.00038481, 0.00023574, 0.00038675, -0.00000115, 0.00000000],
+		[-6.27324746, -0.00038476, 0.00023571, 0.00038670, -0.00000115, 0.00000000],
+		[-6.27324757, -0.00038471, 0.00023568, 0.00038665, -0.00000115, 0.00000000],
+		[-6.27324769, -0.00038467, 0.00023565, 0.00038660, -0.00000115, 0.00000000],
+		[-6.27324780, -0.00038462, 0.00023562, 0.00038655, -0.00000115, 0.00000000],
+		[-6.27324792, -0.00038457, 0.00023559, 0.00038651, -0.00000115, 0.00000000],
+		[-6.27324803, -0.00038452, 0.00023556, 0.00038646, -0.00000115, 0.00000000],
+		[-6.27324814, -0.00038447, 0.00023553, 0.00038641, -0.00000115, 0.00000000],
+		[-6.27324826, -0.00038443, 0.00023550, 0.00038636, -0.00000115, 0.00000000],
+		[-6.27324837, -0.00038438, 0.00023547, 0.00038631, -0.00000115, 0.00000000],
+		[-6.27324849, -0.00038433, 0.00023545, 0.00038627, -0.00000115, 0.00000000],
+		[-6.27324860, -0.00038428, 0.00023542, 0.00038622, -0.00000115, 0.00000000],
+		[-6.27324872, -0.00038424, 0.00023539, 0.00038617, -0.00000115, 0.00000000],
+		[-6.27324883, -0.00038419, 0.00023536, 0.00038612, -0.00000115, 0.00000000],
+		[-6.27324894, -0.00038414, 0.00023533, 0.00038607, -0.00000115, 0.00000000],
+		[-6.27324906, -0.00038409, 0.00023530, 0.00038603, -0.00000115, 0.00000000],
+		[-6.27324917, -0.00038405, 0.00023527, 0.00038598, -0.00000115, 0.00000000],
+		[-6.27324929, -0.00038400, 0.00023524, 0.00038593, -0.00000115, 0.00000000],
+		[-6.27324940, -0.00038395, 0.00023521, 0.00038588, -0.00000115, 0.00000000],
+		[-6.27324951, -0.00038390, 0.00023518, 0.00038583, -0.00000115, 0.00000000],
+		[-6.27324963, -0.00038385, 0.00023515, 0.00038579, -0.00000115, 0.00000000],
+		[-6.27324974, -0.00038381, 0.00023512, 0.00038574, -0.00000115, 0.00000000],
+		[-6.27324986, -0.00038376, 0.00023509, 0.00038569, -0.00000115, 0.00000000],
+		[-6.27324997, -0.00038371, 0.00023507, 0.00038564, -0.00000115, 0.00000000],
+		[-6.27325008, -0.00038366, 0.00023504, 0.00038560, -0.00000115, 0.00000000],
+		[-6.27325020, -0.00038362, 0.00023501, 0.00038555, -0.00000115, 0.00000000],
+		[-6.27325031, -0.00038357, 0.00023498, 0.00038550, -0.00000115, 0.00000000],
+		[-6.27325043, -0.00038352, 0.00023495, 0.00038545, -0.00000115, 0.00000000],
+		[-6.27325054, -0.00038347, 0.00023492, 0.00038540, -0.00000115, 0.00000000],
+		[-6.27325065, -0.00038343, 0.00023489, 0.00038536, -0.00000115, 0.00000000],
+		[-6.27325077, -0.00038338, 0.00023486, 0.00038531, -0.00000115, 0.00000000],
+		[-6.27325088, -0.00038333, 0.00023483, 0.00038526, -0.00000115, 0.00000000],
+		[-6.27325099, -0.00038328, 0.00023480, 0.00038521, -0.00000115, 0.00000000],
+		[-6.27325111, -0.00038324, 0.00023477, 0.00038517, -0.00000115, 0.00000000],
+		[-6.27325122, -0.00038319, 0.00023475, 0.00038512, -0.00000115, 0.00000000],
+		[-6.27325133, -0.00038314, 0.00023472, 0.00038507, -0.00000115, 0.00000000],
+		[-6.27325145, -0.00038309, 0.00023469, 0.00038502, -0.00000115, 0.00000000],
+		[-6.27325156, -0.00038305, 0.00023466, 0.00038498, -0.00000115, 0.00000000],
+		[-6.27325168, -0.00038300, 0.00023463, 0.00038493, -0.00000115, 0.00000000],
+		[-6.27325179, -0.00038295, 0.00023460, 0.00038488, -0.00000115, 0.00000000],
+		[-6.27325190, -0.00038291, 0.00023457, 0.00038483, -0.00000115, 0.00000000],
+		[-6.27325202, -0.00038286, 0.00023454, 0.00038478, -0.00000115, 0.00000000],
+		[-6.27325213, -0.00038281, 0.00023451, 0.00038474, -0.00000115, 0.00000000],
+		[-6.27325224, -0.00038276, 0.00023448, 0.00038469, -0.00000115, 0.00000000],
+		[-6.27325236, -0.00038272, 0.00023446, 0.00038464, -0.00000115, 0.00000000],
+		[-6.27325247, -0.00038267, 0.00023443, 0.00038459, -0.00000115, 0.00000000],
+		[-6.27325258, -0.00038262, 0.00023440, 0.00038455, -0.00000115, 0.00000000],
+		[-6.27325269, -0.00038257, 0.00023437, 0.00038450, -0.00000115, 0.00000000],
+		[-6.27325281, -0.00038253, 0.00023434, 0.00038445, -0.00000115, 0.00000000],
+		[-6.27325292, -0.00038248, 0.00023431, 0.00038440, -0.00000115, 0.00000000],
+		[-6.27325303, -0.00038243, 0.00023428, 0.00038436, -0.00000115, 0.00000000],
+		[-6.27325315, -0.00038238, 0.00023425, 0.00038431, -0.00000115, 0.00000000],
+		[-6.27325326, -0.00038234, 0.00023422, 0.00038426, -0.00000115, 0.00000000],
+		[-6.27325337, -0.00038229, 0.00023419, 0.00038421, -0.00000115, 0.00000000],
+		[-6.27325349, -0.00038224, 0.00023417, 0.00038417, -0.00000115, 0.00000000],
+		[-6.27325360, -0.00038220, 0.00023414, 0.00038412, -0.00000115, 0.00000000],
+		[-6.27325371, -0.00038215, 0.00023411, 0.00038407, -0.00000115, 0.00000000],
+		[-6.27325383, -0.00038210, 0.00023408, 0.00038402, -0.00000115, 0.00000000],
+		[-6.27325394, -0.00038205, 0.00023405, 0.00038398, -0.00000115, 0.00000000],
+		[-6.27325405, -0.00038201, 0.00023402, 0.00038393, -0.00000115, 0.00000000],
+		[-6.27325416, -0.00038196, 0.00023399, 0.00038388, -0.00000115, 0.00000000],
+		[-6.27325428, -0.00038191, 0.00023396, 0.00038384, -0.00000115, 0.00000000],
+		[-6.27325439, -0.00038187, 0.00023393, 0.00038379, -0.00000115, 0.00000000],
+		[-6.27325450, -0.00038182, 0.00023391, 0.00038374, -0.00000115, 0.00000000],
+		[-6.27325462, -0.00038177, 0.00023388, 0.00038369, -0.00000115, 0.00000000],
+		[-6.27325473, -0.00038172, 0.00023385, 0.00038365, -0.00000115, 0.00000000],
+		[-6.27325484, -0.00038168, 0.00023382, 0.00038360, -0.00000115, 0.00000000],
+		[-6.27325495, -0.00038163, 0.00023379, 0.00038355, -0.00000115, 0.00000000],
+		[-6.27325507, -0.00038158, 0.00023376, 0.00038350, -0.00000115, 0.00000000],
+		[-6.27325518, -0.00038154, 0.00023373, 0.00038346, -0.00000115, 0.00000000],
+		[-6.27325529, -0.00038149, 0.00023370, 0.00038341, -0.00000115, 0.00000000],
+		[-6.27325540, -0.00038144, 0.00023367, 0.00038336, -0.00000115, 0.00000000],
+		[-6.27325552, -0.00038140, 0.00023365, 0.00038332, -0.00000115, 0.00000000],
+		[-6.27325563, -0.00038135, 0.00023362, 0.00038327, -0.00000115, 0.00000000],
+		[-6.27325574, -0.00038130, 0.00023359, 0.00038322, -0.00000115, 0.00000000],
+		[-6.27325585, -0.00038125, 0.00023356, 0.00038317, -0.00000115, 0.00000000],
+		[-6.27325597, -0.00038121, 0.00023353, 0.00038313, -0.00000115, 0.00000000],
+		[-6.27325608, -0.00038116, 0.00023350, 0.00038308, -0.00000115, 0.00000000],
+		[-6.27325619, -0.00038111, 0.00023347, 0.00038303, -0.00000115, 0.00000000],
+		[-6.27325630, -0.00038107, 0.00023344, 0.00038298, -0.00000115, 0.00000000],
+		[-6.27325642, -0.00038102, 0.00023342, 0.00038294, -0.00000115, 0.00000000],
+		[-6.27325653, -0.00038097, 0.00023339, 0.00038289, -0.00000115, 0.00000000],
+		[-6.27325664, -0.00038093, 0.00023336, 0.00038284, -0.00000115, 0.00000000],
+		[-6.27325675, -0.00038088, 0.00023333, 0.00038280, -0.00000115, 0.00000000],
+		[-6.27325686, -0.00038083, 0.00023330, 0.00038275, -0.00000115, 0.00000000],
+		[-6.27325698, -0.00038079, 0.00023327, 0.00038270, -0.00000115, 0.00000000],
+		[-6.27325709, -0.00038074, 0.00023324, 0.00038265, -0.00000115, 0.00000000],
+		[-6.27325720, -0.00038069, 0.00023321, 0.00038261, -0.00000115, 0.00000000],
+		[-6.27325731, -0.00038065, 0.00023319, 0.00038256, -0.00000115, 0.00000000],
+		[-6.27325742, -0.00038060, 0.00023316, 0.00038251, -0.00000115, 0.00000000],
+		[-6.27325754, -0.00038055, 0.00023313, 0.00038247, -0.00000115, 0.00000000],
+		[-6.27325765, -0.00038050, 0.00023310, 0.00038242, -0.00000115, 0.00000000],
+		[-6.27325776, -0.00038046, 0.00023307, 0.00038237, -0.00000115, 0.00000000],
+		[-6.27325787, -0.00038041, 0.00023304, 0.00038233, -0.00000115, 0.00000000],
+		[-6.27325798, -0.00038036, 0.00023301, 0.00038228, -0.00000115, 0.00000000],
+		[-6.27325810, -0.00038032, 0.00023299, 0.00038223, -0.00000115, 0.00000000],
+		[-6.27325821, -0.00038027, 0.00023296, 0.00038218, -0.00000115, 0.00000000],
+		[-6.27325832, -0.00038022, 0.00023293, 0.00038214, -0.00000115, 0.00000000],
+		[-6.27325843, -0.00038018, 0.00023290, 0.00038209, -0.00000115, 0.00000000],
+		[-6.27325854, -0.00038013, 0.00023287, 0.00038204, -0.00000115, 0.00000000],
+		[-6.27325866, -0.00038008, 0.00023284, 0.00038200, -0.00000115, 0.00000000],
+		[-6.27325877, -0.00038004, 0.00023281, 0.00038195, -0.00000115, 0.00000000],
+		[-6.27325888, -0.00037999, 0.00023279, 0.00038190, -0.00000115, 0.00000000],
+		[-6.27325899, -0.00037994, 0.00023276, 0.00038186, -0.00000115, 0.00000000],
+		[-6.27325910, -0.00037990, 0.00023273, 0.00038181, -0.00000115, 0.00000000],
+		[-6.27325921, -0.00037985, 0.00023270, 0.00038176, -0.00000115, 0.00000000],
+		[-6.27325932, -0.00037980, 0.00023267, 0.00038172, -0.00000115, 0.00000000],
+		[-6.27325944, -0.00037976, 0.00023264, 0.00038167, -0.00000115, 0.00000000],
+		[-6.27325955, -0.00037971, 0.00023261, 0.00038162, -0.00000115, 0.00000000],
+		[-6.27325966, -0.00037966, 0.00023259, 0.00038158, -0.00000115, 0.00000000],
+		[-6.27325977, -0.00037962, 0.00023256, 0.00038153, -0.00000115, 0.00000000],
+		[-6.27325988, -0.00037957, 0.00023253, 0.00038148, -0.00000115, 0.00000000],
+		[-6.27325999, -0.00037953, 0.00023250, 0.00038144, -0.00000115, 0.00000000],
+		[-6.27326011, -0.00037948, 0.00023247, 0.00038139, -0.00000115, 0.00000000],
+		[-6.27326022, -0.00037943, 0.00023244, 0.00038134, -0.00000115, 0.00000000],
+		[-6.27326033, -0.00037939, 0.00023241, 0.00038129, -0.00000115, 0.00000000],
+		[-6.27326044, -0.00037934, 0.00023239, 0.00038125, -0.00000115, 0.00000000],
+		[-6.27326055, -0.00037929, 0.00023236, 0.00038120, -0.00000115, 0.00000000],
+		[-6.27326066, -0.00037925, 0.00023233, 0.00038115, -0.00000115, 0.00000000],
+		[-6.27326077, -0.00037920, 0.00023230, 0.00038111, -0.00000115, 0.00000000],
+		[-6.27326088, -0.00037915, 0.00023227, 0.00038106, -0.00000115, 0.00000000],
+		[-6.27326100, -0.00037911, 0.00023224, 0.00038101, -0.00000115, 0.00000000],
+		[-6.27326111, -0.00037906, 0.00023221, 0.00038097, -0.00000115, 0.00000000],
+		[-6.27326122, -0.00037901, 0.00023219, 0.00038092, -0.00000115, 0.00000000],
+		[-6.27326133, -0.00037897, 0.00023216, 0.00038087, -0.00000115, 0.00000000],
+		[-6.27326144, -0.00037892, 0.00023213, 0.00038083, -0.00000115, 0.00000000],
+		[-6.27326155, -0.00037887, 0.00023210, 0.00038078, -0.00000115, 0.00000000],
+		[-6.27326166, -0.00037883, 0.00023207, 0.00038073, -0.00000115, 0.00000000],
+		[-6.27326177, -0.00037878, 0.00023204, 0.00038069, -0.00000115, 0.00000000],
+		[-6.27326188, -0.00037874, 0.00023202, 0.00038064, -0.00000115, 0.00000000],
+		[-6.27326199, -0.00037869, 0.00023199, 0.00038060, -0.00000115, 0.00000000],
+		[-6.27326211, -0.00037864, 0.00023196, 0.00038055, -0.00000115, 0.00000000],
+		[-6.27326222, -0.00037860, 0.00023193, 0.00038050, -0.00000115, 0.00000000],
+		[-6.27326233, -0.00037855, 0.00023190, 0.00038046, -0.00000115, 0.00000000],
+		[-6.27326244, -0.00037850, 0.00023187, 0.00038041, -0.00000115, 0.00000000],
+		[-6.27326255, -0.00037846, 0.00023185, 0.00038036, -0.00000115, 0.00000000],
+		[-6.27326266, -0.00037841, 0.00023182, 0.00038032, -0.00000115, 0.00000000],
+		[-6.27326277, -0.00037837, 0.00023179, 0.00038027, -0.00000115, 0.00000000],
+		[-6.27326288, -0.00037832, 0.00023176, 0.00038022, -0.00000115, 0.00000000],
+		[-6.27326299, -0.00037827, 0.00023173, 0.00038018, -0.00000115, 0.00000000],
+		[-6.27326310, -0.00037823, 0.00023170, 0.00038013, -0.00000115, 0.00000000],
+		[-6.27326321, -0.00037818, 0.00023168, 0.00038008, -0.00000115, 0.00000000],
+		[-6.27326332, -0.00037813, 0.00023165, 0.00038004, -0.00000115, 0.00000000],
+		[-6.27326343, -0.00037809, 0.00023162, 0.00037999, -0.00000115, 0.00000000],
+		[-6.27326354, -0.00037804, 0.00023159, 0.00037994, -0.00000115, 0.00000000],
+		[-6.27326366, -0.00037800, 0.00023156, 0.00037990, -0.00000115, 0.00000000],
+		[-6.27326377, -0.00037795, 0.00023153, 0.00037985, -0.00000115, 0.00000000],
+		[-6.27326388, -0.00037790, 0.00023151, 0.00037981, -0.00000115, 0.00000000],
+		[-6.27326399, -0.00037786, 0.00023148, 0.00037976, -0.00000115, 0.00000000],
+		[-6.27326410, -0.00037781, 0.00023145, 0.00037971, -0.00000115, 0.00000000],
+		[-6.27326421, -0.00037777, 0.00023142, 0.00037967, -0.00000115, 0.00000000],
+		[-6.27326432, -0.00037772, 0.00023139, 0.00037962, -0.00000115, 0.00000000],
+		[-6.27326443, -0.00037767, 0.00023136, 0.00037957, -0.00000115, 0.00000000],
+		[-6.27326454, -0.00037763, 0.00023134, 0.00037953, -0.00000115, 0.00000000],
+		[-6.27326465, -0.00037758, 0.00023131, 0.00037948, -0.00000115, 0.00000000],
+		[-6.27326476, -0.00037753, 0.00023128, 0.00037943, -0.00000115, 0.00000000],
+		[-6.27326487, -0.00037749, 0.00023125, 0.00037939, -0.00000115, 0.00000000],
+		[-6.27326498, -0.00037744, 0.00023122, 0.00037934, -0.00000115, 0.00000000],
+		[-6.27326509, -0.00037740, 0.00023120, 0.00037930, -0.00000115, 0.00000000],
+		[-6.27326520, -0.00037735, 0.00023117, 0.00037925, -0.00000115, 0.00000000],
+		[-6.27326531, -0.00037730, 0.00023114, 0.00037920, -0.00000115, 0.00000000],
+		[-6.27326542, -0.00037726, 0.00023111, 0.00037916, -0.00000115, 0.00000000],
+		[-6.27326553, -0.00037721, 0.00023108, 0.00037911, -0.00000115, 0.00000000],
+		[-6.27326564, -0.00037717, 0.00023105, 0.00037906, -0.00000115, 0.00000000],
+		[-6.27326575, -0.00037712, 0.00023103, 0.00037902, -0.00000115, 0.00000000],
+		[-6.27326586, -0.00037707, 0.00023100, 0.00037897, -0.00000115, 0.00000000],
+		[-6.27326597, -0.00037703, 0.00023097, 0.00037893, -0.00000115, 0.00000000],
+		[-6.27326608, -0.00037698, 0.00023094, 0.00037888, -0.00000115, 0.00000000],
+		[-6.27326619, -0.00037694, 0.00023091, 0.00037883, -0.00000115, 0.00000000],
+		[-6.27326630, -0.00037689, 0.00023089, 0.00037879, -0.00000115, 0.00000000],
+		[-6.27326641, -0.00037685, 0.00023086, 0.00037874, -0.00000115, 0.00000000],
+		[-6.27326652, -0.00037680, 0.00023083, 0.00037870, -0.00000115, 0.00000000],
+		[-6.27326663, -0.00037675, 0.00023080, 0.00037865, -0.00000115, 0.00000000],
+		[-6.27326674, -0.00037671, 0.00023077, 0.00037860, -0.00000115, 0.00000000],
+		[-6.27326685, -0.00037666, 0.00023074, 0.00037856, -0.00000115, 0.00000000],
+		[-6.27326696, -0.00037662, 0.00023072, 0.00037851, -0.00000115, 0.00000000],
+		[-6.27326707, -0.00037657, 0.00023069, 0.00037847, -0.00000115, 0.00000000],
+		[-6.27326718, -0.00037652, 0.00023066, 0.00037842, -0.00000115, 0.00000000],
+		[-6.27326729, -0.00037648, 0.00023063, 0.00037837, -0.00000115, 0.00000000],
+		[-6.27326740, -0.00037643, 0.00023060, 0.00037833, -0.00000115, 0.00000000],
+		[-6.27326751, -0.00037639, 0.00023058, 0.00037828, -0.00000115, 0.00000000],
+		[-6.27326762, -0.00037634, 0.00023055, 0.00037823, -0.00000115, 0.00000000],
+		[-6.27326773, -0.00037630, 0.00023052, 0.00037819, -0.00000115, 0.00000000],
+		[-6.27326783, -0.00037625, 0.00023049, 0.00037814, -0.00000115, 0.00000000],
+		[-6.27326794, -0.00037620, 0.00023046, 0.00037810, -0.00000115, 0.00000000],
+		[-6.27326805, -0.00037616, 0.00023044, 0.00037805, -0.00000115, 0.00000000],
+		[-6.27326816, -0.00037611, 0.00023041, 0.00037801, -0.00000115, 0.00000000],
+		[-6.27326827, -0.00037607, 0.00023038, 0.00037796, -0.00000115, 0.00000000],
+		[-6.27326838, -0.00037602, 0.00023035, 0.00037791, -0.00000115, 0.00000000],
+		[-6.27326849, -0.00037598, 0.00023032, 0.00037787, -0.00000115, 0.00000000],
+		[-6.27326860, -0.00037593, 0.00023030, 0.00037782, -0.00000115, 0.00000000],
+		[-6.27326871, -0.00037588, 0.00023027, 0.00037778, -0.00000115, 0.00000000],
+		[-6.27326882, -0.00037584, 0.00023024, 0.00037773, -0.00000115, 0.00000000],
+		[-6.27326893, -0.00037579, 0.00023021, 0.00037768, -0.00000115, 0.00000000],
+		[-6.27326904, -0.00037575, 0.00023018, 0.00037764, -0.00000115, 0.00000000],
+		[-6.27326915, -0.00037570, 0.00023016, 0.00037759, -0.00000115, 0.00000000],
+		[-6.27326926, -0.00037566, 0.00023013, 0.00037755, -0.00000115, 0.00000000],
+		[-6.27326937, -0.00037561, 0.00023010, 0.00037750, -0.00000115, 0.00000000],
+		[-6.27326947, -0.00037557, 0.00023007, 0.00037745, -0.00000115, 0.00000000],
+		[-6.27326958, -0.00037552, 0.00023004, 0.00037741, -0.00000115, 0.00000000],
+		[-6.27326969, -0.00037547, 0.00023002, 0.00037736, -0.00000115, 0.00000000],
+		[-6.27326980, -0.00037543, 0.00022999, 0.00037732, -0.00000115, 0.00000000],
+		[-6.27326991, -0.00037538, 0.00022996, 0.00037727, -0.00000115, 0.00000000],
+		[-6.27327002, -0.00037534, 0.00022993, 0.00037723, -0.00000115, 0.00000000],
+		[-6.27327013, -0.00037529, 0.00022991, 0.00037718, -0.00000115, 0.00000000],
+		[-6.27327024, -0.00037525, 0.00022988, 0.00037713, -0.00000115, 0.00000000],
+		[-6.27327035, -0.00037520, 0.00022985, 0.00037709, -0.00000115, 0.00000000],
+		[-6.27327045, -0.00037516, 0.00022982, 0.00037704, -0.00000115, 0.00000000],
+		[-6.27327056, -0.00037511, 0.00022979, 0.00037700, -0.00000115, 0.00000000],
+		[-6.27327067, -0.00037506, 0.00022977, 0.00037695, -0.00000115, 0.00000000],
+		[-6.27327078, -0.00037502, 0.00022974, 0.00037691, -0.00000115, 0.00000000],
+		[-6.27327089, -0.00037497, 0.00022971, 0.00037686, -0.00000115, 0.00000000],
+		[-6.27327100, -0.00037493, 0.00022968, 0.00037681, -0.00000115, 0.00000000],
+		[-6.27327111, -0.00037488, 0.00022965, 0.00037677, -0.00000115, 0.00000000],
+		[-6.27327122, -0.00037484, 0.00022963, 0.00037672, -0.00000115, 0.00000000],
+		[-6.27327132, -0.00037479, 0.00022960, 0.00037668, -0.00000115, 0.00000000],
+		[-6.27327143, -0.00037475, 0.00022957, 0.00037663, -0.00000115, 0.00000000],
+		[-6.27327154, -0.00037470, 0.00022954, 0.00037659, -0.00000115, 0.00000000],
+		[-6.27327165, -0.00037466, 0.00022952, 0.00037654, -0.00000115, 0.00000000],
+		[-6.27327176, -0.00037461, 0.00022949, 0.00037650, -0.00000115, 0.00000000],
+		[-6.27327187, -0.00037457, 0.00022946, 0.00037645, -0.00000115, 0.00000000],
+		[-6.27327198, -0.00037452, 0.00022943, 0.00037640, -0.00000115, 0.00000000],
+		[-6.27327208, -0.00037447, 0.00022940, 0.00037636, -0.00000115, 0.00000000],
+		[-6.27327219, -0.00037443, 0.00022938, 0.00037631, -0.00000115, 0.00000000],
+		[-6.27327230, -0.00037438, 0.00022935, 0.00037627, -0.00000115, 0.00000000],
+		[-6.27327241, -0.00037434, 0.00022932, 0.00037622, -0.00000115, 0.00000000],
+		[-6.27327252, -0.00037429, 0.00022929, 0.00037618, -0.00000115, 0.00000000],
+		[-6.27327263, -0.00037425, 0.00022927, 0.00037613, -0.00000115, 0.00000000],
+		[-6.27327273, -0.00037420, 0.00022924, 0.00037609, -0.00000115, 0.00000000],
+		[-6.27327284, -0.00037416, 0.00022921, 0.00037604, -0.00000115, 0.00000000],
+		[-6.27327295, -0.00037411, 0.00022918, 0.00037599, -0.00000115, 0.00000000],
+		[-6.27327306, -0.00037407, 0.00022915, 0.00037595, -0.00000115, 0.00000000],
+		[-6.27327317, -0.00037402, 0.00022913, 0.00037590, -0.00000115, 0.00000000],
+		[-6.27327328, -0.00037398, 0.00022910, 0.00037586, -0.00000115, 0.00000000],
+		[-6.27327338, -0.00037393, 0.00022907, 0.00037581, -0.00000115, 0.00000000],
+		[-6.27327349, -0.00037389, 0.00022904, 0.00037577, -0.00000115, 0.00000000],
+		[-6.27327360, -0.00037384, 0.00022902, 0.00037572, -0.00000115, 0.00000000],
+		[-6.27327371, -0.00037380, 0.00022899, 0.00037568, -0.00000115, 0.00000000],
+		[-6.27327382, -0.00037375, 0.00022896, 0.00037563, -0.00000115, 0.00000000],
+		[-6.27327392, -0.00037371, 0.00022893, 0.00037559, -0.00000115, 0.00000000],
+		[-6.27327403, -0.00037366, 0.00022891, 0.00037554, -0.00000115, 0.00000000],
+		[-6.27327414, -0.00037362, 0.00022888, 0.00037550, -0.00000115, 0.00000000],
+		[-6.27327425, -0.00037357, 0.00022885, 0.00037545, -0.00000115, 0.00000000],
+		[-6.27327436, -0.00037353, 0.00022882, 0.00037541, -0.00000115, 0.00000000],
+		[-6.27327446, -0.00037348, 0.00022880, 0.00037536, -0.00000115, 0.00000000],
+		[-6.27327457, -0.00037344, 0.00022877, 0.00037531, -0.00000115, 0.00000000],
+		[-6.27327468, -0.00037339, 0.00022874, 0.00037527, -0.00000115, 0.00000000],
+		[-6.27327479, -0.00037335, 0.00022871, 0.00037522, -0.00000115, 0.00000000],
+		[-6.27327490, -0.00037330, 0.00022868, 0.00037518, -0.00000115, 0.00000000],
+		[-6.27327500, -0.00037326, 0.00022866, 0.00037513, -0.00000115, 0.00000000],
+		[-6.27327511, -0.00037321, 0.00022863, 0.00037509, -0.00000115, 0.00000000],
+		[-6.27327522, -0.00037317, 0.00022860, 0.00037504, -0.00000115, 0.00000000],
+		[-6.27327533, -0.00037312, 0.00022857, 0.00037500, -0.00000115, 0.00000000],
+		[-6.27327543, -0.00037308, 0.00022855, 0.00037495, -0.00000115, 0.00000000],
+		[-6.27327554, -0.00037303, 0.00022852, 0.00037491, -0.00000115, 0.00000000],
+		[-6.27327565, -0.00037299, 0.00022849, 0.00037486, -0.00000115, 0.00000000],
+		[-6.27327576, -0.00037294, 0.00022846, 0.00037482, -0.00000115, 0.00000000],
+		[-6.27327586, -0.00037290, 0.00022844, 0.00037477, -0.00000115, 0.00000000],
+		[-6.27327597, -0.00037285, 0.00022841, 0.00037473, -0.00000115, 0.00000000],
+		[-6.27327608, -0.00037281, 0.00022838, 0.00037468, -0.00000115, 0.00000000],
+		[-6.27327619, -0.00037276, 0.00022835, 0.00037464, -0.00000115, 0.00000000],
+		[-6.27327629, -0.00037272, 0.00022833, 0.00037459, -0.00000115, 0.00000000],
+		[-6.27327640, -0.00037267, 0.00022830, 0.00037455, -0.00000115, 0.00000000],
+		[-6.27327651, -0.00037263, 0.00022827, 0.00037450, -0.00000115, 0.00000000],
+		[-6.27327662, -0.00037258, 0.00022824, 0.00037446, -0.00000115, 0.00000000],
+		[-6.27327672, -0.00037254, 0.00022822, 0.00037441, -0.00000115, 0.00000000],
+		[-6.27327683, -0.00037249, 0.00022819, 0.00037437, -0.00000115, 0.00000000],
+		[-6.27327694, -0.00037245, 0.00022816, 0.00037432, -0.00000115, 0.00000000],
+		[-6.27327705, -0.00037240, 0.00022813, 0.00037428, -0.00000115, 0.00000000],
+		[-6.27327715, -0.00037236, 0.00022811, 0.00037423, -0.00000115, 0.00000000],
+		[-6.27327726, -0.00037231, 0.00022808, 0.00037419, -0.00000115, 0.00000000],
+		[-6.27327737, -0.00037227, 0.00022805, 0.00037414, -0.00000115, 0.00000000],
+		[-6.27327747, -0.00037222, 0.00022802, 0.00037410, -0.00000115, 0.00000000],
+		[-6.27327758, -0.00037218, 0.00022800, 0.00037405, -0.00000115, 0.00000000],
+		[-6.27327769, -0.00037213, 0.00022797, 0.00037401, -0.00000115, 0.00000000],
+		[-6.27327780, -0.00037209, 0.00022794, 0.00037396, -0.00000115, 0.00000000],
+		[-6.27327790, -0.00037204, 0.00022791, 0.00037392, -0.00000115, 0.00000000],
+		[-6.27327801, -0.00037200, 0.00022789, 0.00037387, -0.00000115, 0.00000000],
+		[-6.27327812, -0.00037195, 0.00022786, 0.00037383, -0.00000115, 0.00000000],
+		[-6.27327822, -0.00037191, 0.00022783, 0.00037378, -0.00000115, 0.00000000],
+		[-6.27327833, -0.00037187, 0.00022781, 0.00037374, -0.00000115, 0.00000000],
+		[-6.27327844, -0.00037182, 0.00022778, 0.00037369, -0.00000115, 0.00000000],
+		[-6.27327855, -0.00037178, 0.00022775, 0.00037365, -0.00000115, 0.00000000],
+		[-6.27327865, -0.00037173, 0.00022772, 0.00037360, -0.00000115, 0.00000000],
+		[-6.27327876, -0.00037169, 0.00022770, 0.00037356, -0.00000115, 0.00000000],
+		[-6.27327887, -0.00037164, 0.00022767, 0.00037351, -0.00000115, 0.00000000],
+		[-6.27327897, -0.00037160, 0.00022764, 0.00037347, -0.00000115, 0.00000000],
+		[-6.27327908, -0.00037155, 0.00022761, 0.00037342, -0.00000115, 0.00000000],
+		[-6.27327919, -0.00037151, 0.00022759, 0.00037338, -0.00000115, 0.00000000],
+		[-6.27327929, -0.00037146, 0.00022756, 0.00037333, -0.00000115, 0.00000000],
+		[-6.27327940, -0.00037142, 0.00022753, 0.00037329, -0.00000115, 0.00000000],
+		[-6.27327951, -0.00037137, 0.00022750, 0.00037324, -0.00000115, 0.00000000],
+		[-6.27327961, -0.00037133, 0.00022748, 0.00037320, -0.00000115, 0.00000000],
+		[-6.27327972, -0.00037129, 0.00022745, 0.00037315, -0.00000115, 0.00000000],
+		[-6.27327983, -0.00037124, 0.00022742, 0.00037311, -0.00000115, 0.00000000],
+		[-6.27327993, -0.00037120, 0.00022740, 0.00037306, -0.00000115, 0.00000000],
+		[-6.27328004, -0.00037115, 0.00022737, 0.00037302, -0.00000115, 0.00000000],
+		[-6.27328015, -0.00037111, 0.00022734, 0.00037297, -0.00000115, 0.00000000],
+		[-6.27328025, -0.00037106, 0.00022731, 0.00037293, -0.00000115, 0.00000000],
+		[-6.27328036, -0.00037102, 0.00022729, 0.00037289, -0.00000115, 0.00000000],
+		[-6.27328047, -0.00037097, 0.00022726, 0.00037284, -0.00000115, 0.00000000],
+		[-6.27328057, -0.00037093, 0.00022723, 0.00037280, -0.00000115, 0.00000000],
+		[-6.27328068, -0.00037089, 0.00022720, 0.00037275, -0.00000115, 0.00000000],
+		[-6.27328078, -0.00037084, 0.00022718, 0.00037271, -0.00000115, 0.00000000],
+		[-6.27328089, -0.00037080, 0.00022715, 0.00037266, -0.00000115, 0.00000000],
+		[-6.27328100, -0.00037075, 0.00022712, 0.00037262, -0.00000115, 0.00000000],
+		[-6.27328110, -0.00037071, 0.00022710, 0.00037257, -0.00000115, 0.00000000],
+		[-6.27328121, -0.00037066, 0.00022707, 0.00037253, -0.00000115, 0.00000000],
+		[-6.27328132, -0.00037062, 0.00022704, 0.00037248, -0.00000115, 0.00000000],
+		[-6.27328142, -0.00037057, 0.00022701, 0.00037244, -0.00000115, 0.00000000],
+		[-6.27328153, -0.00037053, 0.00022699, 0.00037239, -0.00000115, 0.00000000],
+		[-6.27328163, -0.00037049, 0.00022696, 0.00037235, -0.00000115, 0.00000000],
+		[-6.27328174, -0.00037044, 0.00022693, 0.00037230, -0.00000115, 0.00000000],
+		[-6.27328185, -0.00037040, 0.00022691, 0.00037226, -0.00000115, 0.00000000],
+		[-6.27328195, -0.00037035, 0.00022688, 0.00037222, -0.00000115, 0.00000000],
+		[-6.27328206, -0.00037031, 0.00022685, 0.00037217, -0.00000115, 0.00000000],
+		[-6.27328217, -0.00037026, 0.00022682, 0.00037213, -0.00000115, 0.00000000],
+		[-6.27328227, -0.00037022, 0.00022680, 0.00037208, -0.00000115, 0.00000000],
+		[-6.27328238, -0.00037018, 0.00022677, 0.00037204, -0.00000115, 0.00000000],
+		[-6.27328248, -0.00037013, 0.00022674, 0.00037199, -0.00000115, 0.00000000],
+		[-6.27328259, -0.00037009, 0.00022672, 0.00037195, -0.00000115, 0.00000000],
+		[-6.27328269, -0.00037004, 0.00022669, 0.00037190, -0.00000115, 0.00000000],
+		[-6.27328280, -0.00037000, 0.00022666, 0.00037186, -0.00000115, 0.00000000],
+		[-6.27328291, -0.00036995, 0.00022663, 0.00037182, -0.00000115, 0.00000000],
+		[-6.27328301, -0.00036991, 0.00022661, 0.00037177, -0.00000115, 0.00000000],
+		[-6.27328312, -0.00036987, 0.00022658, 0.00037173, -0.00000115, 0.00000000],
+		[-6.27328322, -0.00036982, 0.00022655, 0.00037168, -0.00000115, 0.00000000],
+		[-6.27328333, -0.00036978, 0.00022653, 0.00037164, -0.00000115, 0.00000000],
+		[-6.27328344, -0.00036973, 0.00022650, 0.00037159, -0.00000115, 0.00000000],
+		[-6.27328354, -0.00036969, 0.00022647, 0.00037155, -0.00000115, 0.00000000],
+		[-6.27328365, -0.00036965, 0.00022644, 0.00037150, -0.00000115, 0.00000000],
+		[-6.27328375, -0.00036960, 0.00022642, 0.00037146, -0.00000115, 0.00000000],
+		[-6.27328386, -0.00036956, 0.00022639, 0.00037142, -0.00000115, 0.00000000],
+		[-6.27328396, -0.00036951, 0.00022636, 0.00037137, -0.00000115, 0.00000000],
+		[-6.27328407, -0.00036947, 0.00022634, 0.00037133, -0.00000115, 0.00000000],
+		[-6.27328418, -0.00036942, 0.00022631, 0.00037128, -0.00000115, 0.00000000],
+		[-6.27328428, -0.00036938, 0.00022628, 0.00037124, -0.00000115, 0.00000000],
+		[-6.27328439, -0.00036934, 0.00022626, 0.00037119, -0.00000115, 0.00000000],
+		[-6.27328449, -0.00036929, 0.00022623, 0.00037115, -0.00000115, 0.00000000],
+		[-6.27328460, -0.00036925, 0.00022620, 0.00037111, -0.00000115, 0.00000000],
+		[-6.27328470, -0.00036920, 0.00022617, 0.00037106, -0.00000115, 0.00000000],
+		[-6.27328481, -0.00036916, 0.00022615, 0.00037102, -0.00000115, 0.00000000],
+		[-6.27328491, -0.00036912, 0.00022612, 0.00037097, -0.00000115, 0.00000000],
+		[-6.27328502, -0.00036907, 0.00022609, 0.00037093, -0.00000115, 0.00000000],
+		[-6.27328512, -0.00036903, 0.00022607, 0.00037088, -0.00000115, 0.00000000],
+		[-6.27328523, -0.00036898, 0.00022604, 0.00037084, -0.00000115, 0.00000000],
+		[-6.27328533, -0.00036894, 0.00022601, 0.00037080, -0.00000115, 0.00000000],
+		[-6.27328544, -0.00036890, 0.00022599, 0.00037075, -0.00000115, 0.00000000],
+		[-6.27328555, -0.00036885, 0.00022596, 0.00037071, -0.00000115, 0.00000000],
+		[-6.27328565, -0.00036881, 0.00022593, 0.00037066, -0.00000115, 0.00000000],
+		[-6.27328576, -0.00036876, 0.00022590, 0.00037062, -0.00000115, 0.00000000],
+		[-6.27328586, -0.00036872, 0.00022588, 0.00037058, -0.00000115, 0.00000000],
+		[-6.27328597, -0.00036868, 0.00022585, 0.00037053, -0.00000115, 0.00000000],
+		[-6.27328607, -0.00036863, 0.00022582, 0.00037049, -0.00000115, 0.00000000],
+		[-6.27328618, -0.00036859, 0.00022580, 0.00037044, -0.00000115, 0.00000000],
+		[-6.27328628, -0.00036855, 0.00022577, 0.00037040, -0.00000115, 0.00000000],
+		[-6.27328639, -0.00036850, 0.00022574, 0.00037035, -0.00000115, 0.00000000],
+		[-6.27328649, -0.00036846, 0.00022572, 0.00037031, -0.00000115, 0.00000000],
+		[-6.27328660, -0.00036841, 0.00022569, 0.00037027, -0.00000115, 0.00000000],
+		[-6.27328670, -0.00036837, 0.00022566, 0.00037022, -0.00000115, 0.00000000],
+		[-6.27328681, -0.00036833, 0.00022564, 0.00037018, -0.00000115, 0.00000000],
+		[-6.27328691, -0.00036828, 0.00022561, 0.00037013, -0.00000115, 0.00000000],
+		[-6.27328702, -0.00036824, 0.00022558, 0.00037009, -0.00000115, 0.00000000],
+		[-6.27328712, -0.00036819, 0.00022556, 0.00037005, -0.00000115, 0.00000000],
+		[-6.27328723, -0.00036815, 0.00022553, 0.00037000, -0.00000115, 0.00000000],
+		[-6.27328733, -0.00036811, 0.00022550, 0.00036996, -0.00000115, 0.00000000],
+		[-6.27328744, -0.00036806, 0.00022547, 0.00036991, -0.00000115, 0.00000000],
+		[-6.27328754, -0.00036802, 0.00022545, 0.00036987, -0.00000115, 0.00000000],
+		[-6.27328764, -0.00036798, 0.00022542, 0.00036983, -0.00000115, 0.00000000],
+		[-6.27328775, -0.00036793, 0.00022539, 0.00036978, -0.00000115, 0.00000000],
+		[-6.27328785, -0.00036789, 0.00022537, 0.00036974, -0.00000115, 0.00000000],
+		[-6.27328796, -0.00036784, 0.00022534, 0.00036969, -0.00000115, 0.00000000],
+		[-6.27328806, -0.00036780, 0.00022531, 0.00036965, -0.00000115, 0.00000000],
+		[-6.27328817, -0.00036776, 0.00022529, 0.00036961, -0.00000115, 0.00000000],
+		[-6.27328827, -0.00036771, 0.00022526, 0.00036956, -0.00000115, 0.00000000],
+		[-6.27328838, -0.00036767, 0.00022523, 0.00036952, -0.00000115, 0.00000000],
+		[-6.27328848, -0.00036763, 0.00022521, 0.00036947, -0.00000115, 0.00000000],
+		[-6.27328859, -0.00036758, 0.00022518, 0.00036943, -0.00000115, 0.00000000],
+		[-6.27328869, -0.00036754, 0.00022515, 0.00036939, -0.00000115, 0.00000000],
+		[-6.27328880, -0.00036749, 0.00022513, 0.00036934, -0.00000115, 0.00000000],
+		[-6.27328890, -0.00036745, 0.00022510, 0.00036930, -0.00000115, 0.00000000],
+		[-6.27328900, -0.00036741, 0.00022507, 0.00036926, -0.00000115, 0.00000000],
+		[-6.27328911, -0.00036736, 0.00022505, 0.00036921, -0.00000115, 0.00000000],
+		[-6.27328921, -0.00036732, 0.00022502, 0.00036917, -0.00000115, 0.00000000],
+		[-6.27328932, -0.00036728, 0.00022499, 0.00036912, -0.00000115, 0.00000000],
+		[-6.27328942, -0.00036723, 0.00022497, 0.00036908, -0.00000115, 0.00000000],
+		[-6.27328953, -0.00036719, 0.00022494, 0.00036904, -0.00000115, 0.00000000],
+		[-6.27328963, -0.00036715, 0.00022491, 0.00036899, -0.00000115, 0.00000000],
+		[-6.27328973, -0.00036710, 0.00022489, 0.00036895, -0.00000115, 0.00000000],
+		[-6.27328984, -0.00036706, 0.00022486, 0.00036891, -0.00000115, 0.00000000],
+		[-6.27328994, -0.00036702, 0.00022483, 0.00036886, -0.00000115, 0.00000000],
+		[-6.27329005, -0.00036697, 0.00022481, 0.00036882, -0.00000115, 0.00000000],
+		[-6.27329015, -0.00036693, 0.00022478, 0.00036877, -0.00000115, 0.00000000],
+		[-6.27329025, -0.00036689, 0.00022475, 0.00036873, -0.00000115, 0.00000000],
+		[-6.27329036, -0.00036684, 0.00022473, 0.00036869, -0.00000115, 0.00000000],
+		[-6.27329046, -0.00036680, 0.00022470, 0.00036864, -0.00000115, 0.00000000],
+		[-6.27329057, -0.00036675, 0.00022467, 0.00036860, -0.00000115, 0.00000000],
+		[-6.27329067, -0.00036671, 0.00022465, 0.00036856, -0.00000115, 0.00000000],
+		[-6.27329078, -0.00036667, 0.00022462, 0.00036851, -0.00000115, 0.00000000],
+		[-6.27329088, -0.00036662, 0.00022459, 0.00036847, -0.00000115, 0.00000000],
+		[-6.27329098, -0.00036658, 0.00022457, 0.00036842, -0.00000115, 0.00000000],
+		[-6.27329109, -0.00036654, 0.00022454, 0.00036838, -0.00000115, 0.00000000],
+		[-6.27329119, -0.00036649, 0.00022451, 0.00036834, -0.00000115, 0.00000000],
+		[-6.27329129, -0.00036645, 0.00022449, 0.00036829, -0.00000115, 0.00000000],
+		[-6.27329140, -0.00036641, 0.00022446, 0.00036825, -0.00000115, 0.00000000],
+		[-6.27329150, -0.00036636, 0.00022443, 0.00036821, -0.00000115, 0.00000000],
+		[-6.27329161, -0.00036632, 0.00022441, 0.00036816, -0.00000115, 0.00000000],
+		[-6.27329171, -0.00036628, 0.00022438, 0.00036812, -0.00000115, 0.00000000],
+		[-6.27329181, -0.00036623, 0.00022435, 0.00036808, -0.00000115, 0.00000000],
+		[-6.27329192, -0.00036619, 0.00022433, 0.00036803, -0.00000115, 0.00000000],
+		[-6.27329202, -0.00036615, 0.00022430, 0.00036799, -0.00000115, 0.00000000],
+		[-6.27329212, -0.00036610, 0.00022427, 0.00036795, -0.00000115, 0.00000000],
+		[-6.27329223, -0.00036606, 0.00022425, 0.00036790, -0.00000115, 0.00000000],
+		[-6.27329233, -0.00036602, 0.00022422, 0.00036786, -0.00000115, 0.00000000],
+		[-6.27329244, -0.00036597, 0.00022419, 0.00036781, -0.00000115, 0.00000000],
+		[-6.27329254, -0.00036593, 0.00022417, 0.00036777, -0.00000115, 0.00000000],
+		[-6.27329264, -0.00036589, 0.00022414, 0.00036773, -0.00000115, 0.00000000],
+		[-6.27329275, -0.00036584, 0.00022412, 0.00036768, -0.00000115, 0.00000000],
+		[-6.27329285, -0.00036580, 0.00022409, 0.00036764, -0.00000115, 0.00000000],
+		[-6.27329295, -0.00036576, 0.00022406, 0.00036760, -0.00000115, 0.00000000],
+		[-6.27329306, -0.00036571, 0.00022404, 0.00036755, -0.00000115, 0.00000000],
+		[-6.27329316, -0.00036567, 0.00022401, 0.00036751, -0.00000115, 0.00000000],
+		[-6.27329326, -0.00036563, 0.00022398, 0.00036747, -0.00000115, 0.00000000],
+		[-6.27329337, -0.00036559, 0.00022396, 0.00036742, -0.00000115, 0.00000000],
+		[-6.27329347, -0.00036554, 0.00022393, 0.00036738, -0.00000115, 0.00000000],
+		[-6.27329357, -0.00036550, 0.00022390, 0.00036734, -0.00000115, 0.00000000],
+		[-6.27329368, -0.00036546, 0.00022388, 0.00036729, -0.00000115, 0.00000000],
+		[-6.27329378, -0.00036541, 0.00022385, 0.00036725, -0.00000115, 0.00000000],
+		[-6.27329388, -0.00036537, 0.00022382, 0.00036721, -0.00000115, 0.00000000],
+		[-6.27329399, -0.00036533, 0.00022380, 0.00036716, -0.00000115, 0.00000000],
+		[-6.27329409, -0.00036528, 0.00022377, 0.00036712, -0.00000115, 0.00000000],
+		[-6.27329419, -0.00036524, 0.00022374, 0.00036708, -0.00000115, 0.00000000],
+		[-6.27329430, -0.00036520, 0.00022372, 0.00036703, -0.00000115, 0.00000000],
+		[-6.27329440, -0.00036515, 0.00022369, 0.00036699, -0.00000115, 0.00000000],
+		[-6.27329450, -0.00036511, 0.00022367, 0.00036695, -0.00000115, 0.00000000],
+		[-6.27329461, -0.00036507, 0.00022364, 0.00036690, -0.00000115, 0.00000000],
+		[-6.27329471, -0.00036502, 0.00022361, 0.00036686, -0.00000115, 0.00000000],
+		[-6.27329481, -0.00036498, 0.00022359, 0.00036682, -0.00000115, 0.00000000],
+		[-6.27329491, -0.00036494, 0.00022356, 0.00036677, -0.00000115, 0.00000000],
+		[-6.27329502, -0.00036490, 0.00022353, 0.00036673, -0.00000115, 0.00000000],
+		[-6.27329512, -0.00036485, 0.00022351, 0.00036669, -0.00000115, 0.00000000],
+		[-6.27329522, -0.00036481, 0.00022348, 0.00036664, -0.00000115, 0.00000000],
+		[-6.27329533, -0.00036477, 0.00022345, 0.00036660, -0.00000115, 0.00000000],
+		[-6.27329543, -0.00036472, 0.00022343, 0.00036656, -0.00000115, 0.00000000],
+		[-6.27329553, -0.00036468, 0.00022340, 0.00036651, -0.00000115, 0.00000000],
+		[-6.27329564, -0.00036464, 0.00022338, 0.00036647, -0.00000115, 0.00000000],
+		[-6.27329574, -0.00036460, 0.00022335, 0.00036643, -0.00000115, 0.00000000],
+		[-6.27329584, -0.00036455, 0.00022332, 0.00036639, -0.00000115, 0.00000000],
+		[-6.27329594, -0.00036451, 0.00022330, 0.00036634, -0.00000115, 0.00000000],
+		[-6.27329605, -0.00036447, 0.00022327, 0.00036630, -0.00000115, 0.00000000],
+		[-6.27329615, -0.00036442, 0.00022324, 0.00036626, -0.00000115, 0.00000000],
+		[-6.27329625, -0.00036438, 0.00022322, 0.00036621, -0.00000115, 0.00000000],
+		[-6.27329635, -0.00036434, 0.00022319, 0.00036617, -0.00000115, 0.00000000],
+		[-6.27329646, -0.00036429, 0.00022317, 0.00036613, -0.00000115, 0.00000000],
+		[-6.27329656, -0.00036425, 0.00022314, 0.00036608, -0.00000115, 0.00000000],
+		[-6.27329666, -0.00036421, 0.00022311, 0.00036604, -0.00000115, 0.00000000],
+		[-6.27329677, -0.00036417, 0.00022309, 0.00036600, -0.00000115, 0.00000000],
+		[-6.27329687, -0.00036412, 0.00022306, 0.00036595, -0.00000115, 0.00000000],
+		[-6.27329697, -0.00036408, 0.00022303, 0.00036591, -0.00000115, 0.00000000],
+		[-6.27329707, -0.00036404, 0.00022301, 0.00036587, -0.00000115, 0.00000000],
+		[-6.27329718, -0.00036399, 0.00022298, 0.00036583, -0.00000115, 0.00000000],
+		[-6.27329728, -0.00036395, 0.00022296, 0.00036578, -0.00000115, 0.00000000],
+		[-6.27329738, -0.00036391, 0.00022293, 0.00036574, -0.00000115, 0.00000000],
+		[-6.27329748, -0.00036387, 0.00022290, 0.00036570, -0.00000115, 0.00000000],
+		[-6.27329758, -0.00036382, 0.00022288, 0.00036565, -0.00000115, 0.00000000],
+		[-6.27329769, -0.00036378, 0.00022285, 0.00036561, -0.00000115, 0.00000000],
+		[-6.27329779, -0.00036374, 0.00022282, 0.00036557, -0.00000115, 0.00000000],
+		[-6.27329789, -0.00036370, 0.00022280, 0.00036552, -0.00000115, 0.00000000],
+		[-6.27329799, -0.00036365, 0.00022277, 0.00036548, -0.00000115, 0.00000000],
+		[-6.27329810, -0.00036361, 0.00022275, 0.00036544, -0.00000115, 0.00000000],
+		[-6.27329820, -0.00036357, 0.00022272, 0.00036540, -0.00000115, 0.00000000],
+		[-6.27329830, -0.00036352, 0.00022269, 0.00036535, -0.00000115, 0.00000000],
+		[-6.27329840, -0.00036348, 0.00022267, 0.00036531, -0.00000115, 0.00000000],
+		[-6.27329851, -0.00036344, 0.00022264, 0.00036527, -0.00000115, 0.00000000],
+		[-6.27329861, -0.00036340, 0.00022261, 0.00036522, -0.00000115, 0.00000000],
+		[-6.27329871, -0.00036335, 0.00022259, 0.00036518, -0.00000115, 0.00000000],
+		[-6.27329881, -0.00036331, 0.00022256, 0.00036514, -0.00000115, 0.00000000],
+		[-6.27329891, -0.00036327, 0.00022254, 0.00036510, -0.00000115, 0.00000000],
+		[-6.27329902, -0.00036323, 0.00022251, 0.00036505, -0.00000115, 0.00000000],
+		[-6.27329912, -0.00036318, 0.00022248, 0.00036501, -0.00000115, 0.00000000],
+		[-6.27329922, -0.00036314, 0.00022246, 0.00036497, -0.00000115, 0.00000000],
+		[-6.27329932, -0.00036310, 0.00022243, 0.00036492, -0.00000115, 0.00000000],
+		[-6.27329942, -0.00036306, 0.00022241, 0.00036488, -0.00000115, 0.00000000],
+		[-6.27329953, -0.00036301, 0.00022238, 0.00036484, -0.00000115, 0.00000000],
+		[-6.27329963, -0.00036297, 0.00022235, 0.00036480, -0.00000115, 0.00000000],
+		[-6.27329973, -0.00036293, 0.00022233, 0.00036475, -0.00000115, 0.00000000],
+		[-6.27329983, -0.00036289, 0.00022230, 0.00036471, -0.00000115, 0.00000000],
+		[-6.27329993, -0.00036284, 0.00022228, 0.00036467, -0.00000115, 0.00000000],
+		[-6.27330004, -0.00036280, 0.00022225, 0.00036462, -0.00000115, 0.00000000],
+		[-6.27330014, -0.00036276, 0.00022222, 0.00036458, -0.00000115, 0.00000000],
+		[-6.27330024, -0.00036272, 0.00022220, 0.00036454, -0.00000115, 0.00000000],
+		[-6.27330034, -0.00036267, 0.00022217, 0.00036450, -0.00000115, 0.00000000],
+		[-6.27330044, -0.00036263, 0.00022215, 0.00036445, -0.00000115, 0.00000000],
+		[-6.27330054, -0.00036259, 0.00022212, 0.00036441, -0.00000115, 0.00000000],
+		[-6.27330065, -0.00036255, 0.00022209, 0.00036437, -0.00000115, 0.00000000],
+		[-6.27330075, -0.00036250, 0.00022207, 0.00036433, -0.00000115, 0.00000000],
+		[-6.27330085, -0.00036246, 0.00022204, 0.00036428, -0.00000115, 0.00000000],
+		[-6.27330095, -0.00036242, 0.00022202, 0.00036424, -0.00000115, 0.00000000],
+		[-6.27330105, -0.00036238, 0.00022199, 0.00036420, -0.00000115, 0.00000000],
+		[-6.27330115, -0.00036233, 0.00022196, 0.00036416, -0.00000115, 0.00000000],
+		[-6.27330126, -0.00036229, 0.00022194, 0.00036411, -0.00000115, 0.00000000],
+		[-6.27330136, -0.00036225, 0.00022191, 0.00036407, -0.00000115, 0.00000000],
+		[-6.27330146, -0.00036221, 0.00022189, 0.00036403, -0.00000115, 0.00000000],
+		[-6.27330156, -0.00036216, 0.00022186, 0.00036398, -0.00000115, 0.00000000],
+		[-6.27330166, -0.00036212, 0.00022183, 0.00036394, -0.00000115, 0.00000000],
+		[-6.27330176, -0.00036208, 0.00022181, 0.00036390, -0.00000115, 0.00000000],
+		[-6.27330186, -0.00036204, 0.00022178, 0.00036386, -0.00000115, 0.00000000],
+		[-6.27330197, -0.00036199, 0.00022176, 0.00036381, -0.00000115, 0.00000000],
+		[-6.27330207, -0.00036195, 0.00022173, 0.00036377, -0.00000115, 0.00000000],
+		[-6.27330217, -0.00036191, 0.00022170, 0.00036373, -0.00000115, 0.00000000],
+		[-6.27330227, -0.00036187, 0.00022168, 0.00036369, -0.00000115, 0.00000000],
+		[-6.27330237, -0.00036182, 0.00022165, 0.00036364, -0.00000115, 0.00000000],
+		[-6.27330247, -0.00036178, 0.00022163, 0.00036360, -0.00000115, 0.00000000],
+		[-6.27330257, -0.00036174, 0.00022160, 0.00036356, -0.00000115, 0.00000000],
+		[-6.27330267, -0.00036170, 0.00022157, 0.00036352, -0.00000115, 0.00000000],
+		[-6.27330278, -0.00036166, 0.00022155, 0.00036347, -0.00000115, 0.00000000],
+		[-6.27330288, -0.00036161, 0.00022152, 0.00036343, -0.00000115, 0.00000000],
+		[-6.27330298, -0.00036157, 0.00022150, 0.00036339, -0.00000115, 0.00000000],
+		[-6.27330308, -0.00036153, 0.00022147, 0.00036335, -0.00000115, 0.00000000],
+		[-6.27330318, -0.00036149, 0.00022144, 0.00036330, -0.00000115, 0.00000000],
+		[-6.27330328, -0.00036144, 0.00022142, 0.00036326, -0.00000115, 0.00000000],
+		[-6.27330338, -0.00036140, 0.00022139, 0.00036322, -0.00000115, 0.00000000],
+		[-6.27330348, -0.00036136, 0.00022137, 0.00036318, -0.00000115, 0.00000000],
+		[-6.27330358, -0.00036132, 0.00022134, 0.00036313, -0.00000115, 0.00000000],
+		[-6.27330368, -0.00036128, 0.00022132, 0.00036309, -0.00000115, 0.00000000],
+		[-6.27330379, -0.00036123, 0.00022129, 0.00036305, -0.00000115, 0.00000000],
+		[-6.27330389, -0.00036119, 0.00022126, 0.00036301, -0.00000115, 0.00000000],
+		[-6.27330399, -0.00036115, 0.00022124, 0.00036297, -0.00000115, 0.00000000],
+		[-6.27330409, -0.00036111, 0.00022121, 0.00036292, -0.00000115, 0.00000000],
+		[-6.27330419, -0.00036107, 0.00022119, 0.00036288, -0.00000115, 0.00000000],
+		[-6.27330429, -0.00036102, 0.00022116, 0.00036284, -0.00000115, 0.00000000],
+		[-6.27330439, -0.00036098, 0.00022113, 0.00036280, -0.00000115, 0.00000000],
+		[-6.27330449, -0.00036094, 0.00022111, 0.00036275, -0.00000115, 0.00000000],
+		[-6.27330459, -0.00036090, 0.00022108, 0.00036271, -0.00000115, 0.00000000],
+		[-6.27330469, -0.00036085, 0.00022106, 0.00036267, -0.00000115, 0.00000000],
+		[-6.27330479, -0.00036081, 0.00022103, 0.00036263, -0.00000115, 0.00000000],
+		[-6.27330489, -0.00036077, 0.00022101, 0.00036258, -0.00000115, 0.00000000],
+		[-6.27330499, -0.00036073, 0.00022098, 0.00036254, -0.00000115, 0.00000000],
+		[-6.27330510, -0.00036069, 0.00022095, 0.00036250, -0.00000115, 0.00000000],
+		[-6.27330520, -0.00036064, 0.00022093, 0.00036246, -0.00000115, 0.00000000],
+		[-6.27330530, -0.00036060, 0.00022090, 0.00036242, -0.00000115, 0.00000000],
+		[-6.27330540, -0.00036056, 0.00022088, 0.00036237, -0.00000115, 0.00000000],
+		[-6.27330550, -0.00036052, 0.00022085, 0.00036233, -0.00000115, 0.00000000],
+		[-6.27330560, -0.00036048, 0.00022083, 0.00036229, -0.00000115, 0.00000000],
+		[-6.27330570, -0.00036043, 0.00022080, 0.00036225, -0.00000115, 0.00000000],
+		[-6.27330580, -0.00036039, 0.00022077, 0.00036220, -0.00000115, 0.00000000],
+		[-6.27330590, -0.00036035, 0.00022075, 0.00036216, -0.00000115, 0.00000000],
+		[-6.27330600, -0.00036031, 0.00022072, 0.00036212, -0.00000115, 0.00000000],
+		[-6.27330610, -0.00036027, 0.00022070, 0.00036208, -0.00000115, 0.00000000],
+		[-6.27330620, -0.00036023, 0.00022067, 0.00036204, -0.00000115, 0.00000000],
+		[-6.27330630, -0.00036018, 0.00022065, 0.00036199, -0.00000115, 0.00000000],
+		[-6.27330640, -0.00036014, 0.00022062, 0.00036195, -0.00000115, 0.00000000],
+		[-6.27330650, -0.00036010, 0.00022059, 0.00036191, -0.00000115, 0.00000000],
+		[-6.27330660, -0.00036006, 0.00022057, 0.00036187, -0.00000115, 0.00000000],
+		[-6.27330670, -0.00036002, 0.00022054, 0.00036183, -0.00000115, 0.00000000],
+		[-6.27330680, -0.00035997, 0.00022052, 0.00036178, -0.00000115, 0.00000000],
+		[-6.27330690, -0.00035993, 0.00022049, 0.00036174, -0.00000115, 0.00000000],
+		[-6.27330700, -0.00035989, 0.00022047, 0.00036170, -0.00000115, 0.00000000],
+		[-6.27330710, -0.00035985, 0.00022044, 0.00036166, -0.00000115, 0.00000000],
+		[-6.27330720, -0.00035981, 0.00022041, 0.00036162, -0.00000115, 0.00000000],
+		[-6.27330730, -0.00035976, 0.00022039, 0.00036157, -0.00000115, 0.00000000],
+		[-6.27330740, -0.00035972, 0.00022036, 0.00036153, -0.00000115, 0.00000000],
+		[-6.27330750, -0.00035968, 0.00022034, 0.00036149, -0.00000115, 0.00000000],
+		[-6.27330760, -0.00035964, 0.00022031, 0.00036145, -0.00000115, 0.00000000],
+		[-6.27330770, -0.00035960, 0.00022029, 0.00036141, -0.00000115, 0.00000000],
+		[-6.27330780, -0.00035956, 0.00022026, 0.00036136, -0.00000115, 0.00000000],
+		[-6.27330790, -0.00035951, 0.00022024, 0.00036132, -0.00000115, 0.00000000],
+		[-6.27330800, -0.00035947, 0.00022021, 0.00036128, -0.00000115, 0.00000000],
+		[-6.27330810, -0.00035943, 0.00022018, 0.00036124, -0.00000115, 0.00000000],
+		[-6.27330820, -0.00035939, 0.00022016, 0.00036120, -0.00000115, 0.00000000],
+		[-6.27330830, -0.00035935, 0.00022013, 0.00036115, -0.00000115, 0.00000000],
+		[-6.27330840, -0.00035931, 0.00022011, 0.00036111, -0.00000115, 0.00000000],
+		[-6.27330850, -0.00035926, 0.00022008, 0.00036107, -0.00000115, 0.00000000],
+		[-6.27330860, -0.00035922, 0.00022006, 0.00036103, -0.00000115, 0.00000000],
+		[-6.27330870, -0.00035918, 0.00022003, 0.00036099, -0.00000115, 0.00000000],
+		[-6.27330880, -0.00035914, 0.00022001, 0.00036094, -0.00000115, 0.00000000],
+		[-6.27330890, -0.00035910, 0.00021998, 0.00036090, -0.00000115, 0.00000000],
+		[-6.27330900, -0.00035906, 0.00021995, 0.00036086, -0.00000115, 0.00000000],
+		[-6.27330910, -0.00035901, 0.00021993, 0.00036082, -0.00000115, 0.00000000],
+		[-6.27330920, -0.00035897, 0.00021990, 0.00036078, -0.00000115, 0.00000000],
+		[-6.27330930, -0.00035893, 0.00021988, 0.00036073, -0.00000115, 0.00000000],
+		[-6.27330940, -0.00035889, 0.00021985, 0.00036069, -0.00000115, 0.00000000],
+		[-6.27330950, -0.00035885, 0.00021983, 0.00036065, -0.00000115, 0.00000000],
+		[-6.27330960, -0.00035881, 0.00021980, 0.00036061, -0.00000115, 0.00000000],
+		[-6.27330970, -0.00035876, 0.00021978, 0.00036057, -0.00000115, 0.00000000],
+		[-6.27330980, -0.00035872, 0.00021975, 0.00036053, -0.00000115, 0.00000000],
+		[-6.27330990, -0.00035868, 0.00021972, 0.00036048, -0.00000115, 0.00000000],
+		[-6.27331000, -0.00035864, 0.00021970, 0.00036044, -0.00000115, 0.00000000],
+		[-6.27331010, -0.00035860, 0.00021967, 0.00036040, -0.00000115, 0.00000000],
+		[-6.27331020, -0.00035856, 0.00021965, 0.00036036, -0.00000115, 0.00000000],
+		[-6.27331030, -0.00035851, 0.00021962, 0.00036032, -0.00000115, 0.00000000],
+		[-6.27331040, -0.00035847, 0.00021960, 0.00036028, -0.00000115, 0.00000000],
+		[-6.27331050, -0.00035843, 0.00021957, 0.00036023, -0.00000115, 0.00000000],
+		[-6.27331059, -0.00035839, 0.00021955, 0.00036019, -0.00000115, 0.00000000],
+		[-6.27331069, -0.00035835, 0.00021952, 0.00036015, -0.00000115, 0.00000000],
+		[-6.27331079, -0.00035831, 0.00021950, 0.00036011, -0.00000115, 0.00000000],
+		[-6.27331089, -0.00035827, 0.00021947, 0.00036007, -0.00000115, 0.00000000],
+		[-6.27331099, -0.00035822, 0.00021944, 0.00036002, -0.00000115, 0.00000000],
+		[-6.27331109, -0.00035818, 0.00021942, 0.00035998, -0.00000115, 0.00000000],
+		[-6.27331119, -0.00035814, 0.00021939, 0.00035994, -0.00000115, 0.00000000],
+		[-6.27331129, -0.00035810, 0.00021937, 0.00035990, -0.00000115, 0.00000000],
+		[-6.27331139, -0.00035806, 0.00021934, 0.00035986, -0.00000115, 0.00000000],
+		[-6.27331149, -0.00035802, 0.00021932, 0.00035982, -0.00000115, 0.00000000],
+		[-6.27331159, -0.00035798, 0.00021929, 0.00035978, -0.00000115, 0.00000000],
+		[-6.27331169, -0.00035793, 0.00021927, 0.00035973, -0.00000115, 0.00000000],
+		[-6.27331179, -0.00035789, 0.00021924, 0.00035969, -0.00000115, 0.00000000],
+		[-6.27331188, -0.00035785, 0.00021922, 0.00035965, -0.00000115, 0.00000000],
+		[-6.27331198, -0.00035781, 0.00021919, 0.00035961, -0.00000115, 0.00000000],
+		[-6.27331208, -0.00035777, 0.00021917, 0.00035957, -0.00000115, 0.00000000],
+		[-6.27331218, -0.00035773, 0.00021914, 0.00035953, -0.00000115, 0.00000000],
+		[-6.27331228, -0.00035769, 0.00021911, 0.00035948, -0.00000115, 0.00000000],
+		[-6.27331238, -0.00035764, 0.00021909, 0.00035944, -0.00000115, 0.00000000],
+		[-6.27331248, -0.00035760, 0.00021906, 0.00035940, -0.00000115, 0.00000000],
+		[-6.27331258, -0.00035756, 0.00021904, 0.00035936, -0.00000115, 0.00000000],
+		[-6.27331268, -0.00035752, 0.00021901, 0.00035932, -0.00000115, 0.00000000],
+		[-6.27331277, -0.00035748, 0.00021899, 0.00035928, -0.00000115, 0.00000000],
+		[-6.27331287, -0.00035744, 0.00021896, 0.00035923, -0.00000115, 0.00000000],
+		[-6.27331297, -0.00035740, 0.00021894, 0.00035919, -0.00000115, 0.00000000],
+		[-6.27331307, -0.00035736, 0.00021891, 0.00035915, -0.00000115, 0.00000000],
+		[-6.27331317, -0.00035731, 0.00021889, 0.00035911, -0.00000115, 0.00000000],
+		[-6.27331327, -0.00035727, 0.00021886, 0.00035907, -0.00000115, 0.00000000],
+		[-6.27331337, -0.00035723, 0.00021884, 0.00035903, -0.00000115, 0.00000000],
+		[-6.27331347, -0.00035719, 0.00021881, 0.00035899, -0.00000115, 0.00000000],
+		[-6.27331356, -0.00035715, 0.00021879, 0.00035894, -0.00000115, 0.00000000],
+		[-6.27331366, -0.00035711, 0.00021876, 0.00035890, -0.00000115, 0.00000000],
+		[-6.27331376, -0.00035707, 0.00021874, 0.00035886, -0.00000115, 0.00000000],
+		[-6.27331386, -0.00035703, 0.00021871, 0.00035882, -0.00000115, 0.00000000],
+		[-6.27331396, -0.00035698, 0.00021869, 0.00035878, -0.00000115, 0.00000000],
+		[-6.27331406, -0.00035694, 0.00021866, 0.00035874, -0.00000115, 0.00000000],
+		[-6.27331416, -0.00035690, 0.00021863, 0.00035870, -0.00000115, 0.00000000],
+		[-6.27331425, -0.00035686, 0.00021861, 0.00035866, -0.00000115, 0.00000000],
+		[-6.27331435, -0.00035682, 0.00021858, 0.00035861, -0.00000115, 0.00000000],
+		[-6.27331445, -0.00035678, 0.00021856, 0.00035857, -0.00000115, 0.00000000],
+		[-6.27331455, -0.00035674, 0.00021853, 0.00035853, -0.00000115, 0.00000000],
+		[-6.27331465, -0.00035670, 0.00021851, 0.00035849, -0.00000115, 0.00000000],
+		[-6.27331475, -0.00035666, 0.00021848, 0.00035845, -0.00000115, 0.00000000],
+		[-6.27331485, -0.00035661, 0.00021846, 0.00035841, -0.00000115, 0.00000000],
+		[-6.27331494, -0.00035657, 0.00021843, 0.00035837, -0.00000115, 0.00000000],
+		[-6.27331504, -0.00035653, 0.00021841, 0.00035832, -0.00000115, 0.00000000],
+		[-6.27331514, -0.00035649, 0.00021838, 0.00035828, -0.00000115, 0.00000000],
+		[-6.27331524, -0.00035645, 0.00021836, 0.00035824, -0.00000115, 0.00000000],
+		[-6.27331534, -0.00035641, 0.00021833, 0.00035820, -0.00000115, 0.00000000],
+		[-6.27331543, -0.00035637, 0.00021831, 0.00035816, -0.00000115, 0.00000000],
+		[-6.27331553, -0.00035633, 0.00021828, 0.00035812, -0.00000115, 0.00000000],
+		[-6.27331563, -0.00035629, 0.00021826, 0.00035808, -0.00000115, 0.00000000],
+		[-6.27331573, -0.00035625, 0.00021823, 0.00035804, -0.00000115, 0.00000000],
+		[-6.27331583, -0.00035620, 0.00021821, 0.00035799, -0.00000115, 0.00000000],
+		[-6.27331593, -0.00035616, 0.00021818, 0.00035795, -0.00000115, 0.00000000],
+		[-6.27331602, -0.00035612, 0.00021816, 0.00035791, -0.00000115, 0.00000000],
+		[-6.27331612, -0.00035608, 0.00021813, 0.00035787, -0.00000115, 0.00000000],
+		[-6.27331622, -0.00035604, 0.00021811, 0.00035783, -0.00000115, 0.00000000],
+		[-6.27331632, -0.00035600, 0.00021808, 0.00035779, -0.00000115, 0.00000000],
+		[-6.27331642, -0.00035596, 0.00021806, 0.00035775, -0.00000115, 0.00000000],
+		[-6.27331651, -0.00035592, 0.00021803, 0.00035771, -0.00000115, 0.00000000],
+		[-6.27331661, -0.00035588, 0.00021801, 0.00035767, -0.00000115, 0.00000000],
+		[-6.27331671, -0.00035584, 0.00021798, 0.00035762, -0.00000115, 0.00000000],
+		[-6.27331681, -0.00035579, 0.00021796, 0.00035758, -0.00000115, 0.00000000],
+		[-6.27331691, -0.00035575, 0.00021793, 0.00035754, -0.00000115, 0.00000000],
+		[-6.27331700, -0.00035571, 0.00021791, 0.00035750, -0.00000115, 0.00000000],
+		[-6.27331710, -0.00035567, 0.00021788, 0.00035746, -0.00000115, 0.00000000],
+		[-6.27331720, -0.00035563, 0.00021786, 0.00035742, -0.00000115, 0.00000000],
+		[-6.27331730, -0.00035559, 0.00021783, 0.00035738, -0.00000115, 0.00000000],
+		[-6.27331740, -0.00035555, 0.00021781, 0.00035734, -0.00000115, 0.00000000],
+		[-6.27331749, -0.00035551, 0.00021778, 0.00035730, -0.00000115, 0.00000000],
+		[-6.27331759, -0.00035547, 0.00021776, 0.00035725, -0.00000115, 0.00000000],
+		[-6.27331769, -0.00035543, 0.00021773, 0.00035721, -0.00000115, 0.00000000],
+		[-6.27331779, -0.00035539, 0.00021771, 0.00035717, -0.00000115, 0.00000000],
+		[-6.27331788, -0.00035535, 0.00021768, 0.00035713, -0.00000115, 0.00000000],
+		[-6.27331798, -0.00035530, 0.00021766, 0.00035709, -0.00000115, 0.00000000],
+		[-6.27331808, -0.00035526, 0.00021763, 0.00035705, -0.00000115, 0.00000000],
+		[-6.27331818, -0.00035522, 0.00021761, 0.00035701, -0.00000115, 0.00000000],
+		[-6.27331827, -0.00035518, 0.00021758, 0.00035697, -0.00000115, 0.00000000],
+		[-6.27331837, -0.00035514, 0.00021756, 0.00035693, -0.00000115, 0.00000000],
+		[-6.27331847, -0.00035510, 0.00021753, 0.00035689, -0.00000115, 0.00000000],
+		[-6.27331857, -0.00035506, 0.00021751, 0.00035684, -0.00000115, 0.00000000],
+		[-6.27331866, -0.00035502, 0.00021748, 0.00035680, -0.00000115, 0.00000000],
+		[-6.27331876, -0.00035498, 0.00021746, 0.00035676, -0.00000115, 0.00000000],
+		[-6.27331886, -0.00035494, 0.00021743, 0.00035672, -0.00000115, 0.00000000],
+		[-6.27331896, -0.00035490, 0.00021741, 0.00035668, -0.00000115, 0.00000000],
+		[-6.27331905, -0.00035486, 0.00021738, 0.00035664, -0.00000115, 0.00000000],
+		[-6.27331915, -0.00035482, 0.00021736, 0.00035660, -0.00000115, 0.00000000],
+		[-6.27331925, -0.00035478, 0.00021733, 0.00035656, -0.00000115, 0.00000000],
+		[-6.27331935, -0.00035473, 0.00021731, 0.00035652, -0.00000115, 0.00000000],
+		[-6.27331944, -0.00035469, 0.00021728, 0.00035648, -0.00000115, 0.00000000],
+		[-6.27331954, -0.00035465, 0.00021726, 0.00035644, -0.00000115, 0.00000000],
+		[-6.27331964, -0.00035461, 0.00021723, 0.00035640, -0.00000115, 0.00000000],
+		[-6.27331974, -0.00035457, 0.00021721, 0.00035635, -0.00000115, 0.00000000],
+		[-6.27331983, -0.00035453, 0.00021718, 0.00035631, -0.00000115, 0.00000000],
+		[-6.27331993, -0.00035449, 0.00021716, 0.00035627, -0.00000115, 0.00000000],
+		[-6.27332003, -0.00035445, 0.00021713, 0.00035623, -0.00000115, 0.00000000],
+		[-6.27332012, -0.00035441, 0.00021711, 0.00035619, -0.00000115, 0.00000000],
+		[-6.27332022, -0.00035437, 0.00021708, 0.00035615, -0.00000115, 0.00000000],
+		[-6.27332032, -0.00035433, 0.00021706, 0.00035611, -0.00000115, 0.00000000],
+		[-6.27332042, -0.00035429, 0.00021703, 0.00035607, -0.00000115, 0.00000000],
+		[-6.27332051, -0.00035425, 0.00021701, 0.00035603, -0.00000115, 0.00000000],
+		[-6.27332061, -0.00035421, 0.00021698, 0.00035599, -0.00000115, 0.00000000],
+		[-6.27332071, -0.00035417, 0.00021696, 0.00035595, -0.00000115, 0.00000000],
+		[-6.27332080, -0.00035413, 0.00021693, 0.00035591, -0.00000115, 0.00000000],
+		[-6.27332090, -0.00035409, 0.00021691, 0.00035587, -0.00000115, 0.00000000],
+		[-6.27332100, -0.00035405, 0.00021688, 0.00035582, -0.00000115, 0.00000000],
+		[-6.27332109, -0.00035400, 0.00021686, 0.00035578, -0.00000115, 0.00000000],
+		[-6.27332119, -0.00035396, 0.00021683, 0.00035574, -0.00000115, 0.00000000],
+		[-6.27332129, -0.00035392, 0.00021681, 0.00035570, -0.00000115, 0.00000000],
+		[-6.27332139, -0.00035388, 0.00021678, 0.00035566, -0.00000115, 0.00000000],
+		[-6.27332148, -0.00035384, 0.00021676, 0.00035562, -0.00000115, 0.00000000],
+		[-6.27332158, -0.00035380, 0.00021673, 0.00035558, -0.00000115, 0.00000000],
+		[-6.27332168, -0.00035376, 0.00021671, 0.00035554, -0.00000115, 0.00000000],
+		[-6.27332177, -0.00035372, 0.00021669, 0.00035550, -0.00000115, 0.00000000],
+		[-6.27332187, -0.00035368, 0.00021666, 0.00035546, -0.00000115, 0.00000000],
+		[-6.27332197, -0.00035364, 0.00021664, 0.00035542, -0.00000115, 0.00000000],
+		[-6.27332206, -0.00035360, 0.00021661, 0.00035538, -0.00000115, 0.00000000],
+		[-6.27332216, -0.00035356, 0.00021659, 0.00035534, -0.00000115, 0.00000000],
+		[-6.27332226, -0.00035352, 0.00021656, 0.00035530, -0.00000115, 0.00000000],
+		[-6.27332235, -0.00035348, 0.00021654, 0.00035526, -0.00000115, 0.00000000],
+		[-6.27332245, -0.00035344, 0.00021651, 0.00035522, -0.00000115, 0.00000000],
+		[-6.27332255, -0.00035340, 0.00021649, 0.00035517, -0.00000115, 0.00000000],
+		[-6.27332264, -0.00035336, 0.00021646, 0.00035513, -0.00000115, 0.00000000],
+		[-6.27332274, -0.00035332, 0.00021644, 0.00035509, -0.00000115, 0.00000000],
+		[-6.27332284, -0.00035328, 0.00021641, 0.00035505, -0.00000115, 0.00000000],
+		[-6.27332293, -0.00035324, 0.00021639, 0.00035501, -0.00000115, 0.00000000],
+		[-6.27332303, -0.00035320, 0.00021636, 0.00035497, -0.00000115, 0.00000000],
+		[-6.27332313, -0.00035316, 0.00021634, 0.00035493, -0.00000115, 0.00000000],
+		[-6.27332322, -0.00035312, 0.00021631, 0.00035489, -0.00000115, 0.00000000],
+		[-6.27332332, -0.00035308, 0.00021629, 0.00035485, -0.00000115, 0.00000000],
+		[-6.27332341, -0.00035304, 0.00021626, 0.00035481, -0.00000115, 0.00000000],
+		[-6.27332351, -0.00035300, 0.00021624, 0.00035477, -0.00000115, 0.00000000],
+		[-6.27332361, -0.00035296, 0.00021622, 0.00035473, -0.00000115, 0.00000000],
+		[-6.27332370, -0.00035291, 0.00021619, 0.00035469, -0.00000115, 0.00000000],
+		[-6.27332380, -0.00035287, 0.00021617, 0.00035465, -0.00000115, 0.00000000],
+		[-6.27332390, -0.00035283, 0.00021614, 0.00035461, -0.00000115, 0.00000000],
+		[-6.27332399, -0.00035279, 0.00021612, 0.00035457, -0.00000115, 0.00000000],
+		[-6.27332409, -0.00035275, 0.00021609, 0.00035453, -0.00000115, 0.00000000],
+		[-6.27332418, -0.00035271, 0.00021607, 0.00035449, -0.00000115, 0.00000000],
+		[-6.27332428, -0.00035267, 0.00021604, 0.00035445, -0.00000115, 0.00000000],
+		[-6.27332438, -0.00035263, 0.00021602, 0.00035441, -0.00000115, 0.00000000],
+		[-6.27332447, -0.00035259, 0.00021599, 0.00035437, -0.00000115, 0.00000000],
+		[-6.27332457, -0.00035255, 0.00021597, 0.00035432, -0.00000115, 0.00000000],
+		[-6.27332467, -0.00035251, 0.00021594, 0.00035428, -0.00000115, 0.00000000],
+		[-6.27332476, -0.00035247, 0.00021592, 0.00035424, -0.00000115, 0.00000000],
+		[-6.27332486, -0.00035243, 0.00021590, 0.00035420, -0.00000115, 0.00000000],
+		[-6.27332495, -0.00035239, 0.00021587, 0.00035416, -0.00000115, 0.00000000],
+		[-6.27332505, -0.00035235, 0.00021585, 0.00035412, -0.00000115, 0.00000000],
+		[-6.27332515, -0.00035231, 0.00021582, 0.00035408, -0.00000115, 0.00000000],
+		[-6.27332524, -0.00035227, 0.00021580, 0.00035404, -0.00000115, 0.00000000],
+		[-6.27332534, -0.00035223, 0.00021577, 0.00035400, -0.00000115, 0.00000000],
+		[-6.27332543, -0.00035219, 0.00021575, 0.00035396, -0.00000115, 0.00000000],
+		[-6.27332553, -0.00035215, 0.00021572, 0.00035392, -0.00000115, 0.00000000],
+		[-6.27332563, -0.00035211, 0.00021570, 0.00035388, -0.00000115, 0.00000000],
+		[-6.27332572, -0.00035207, 0.00021567, 0.00035384, -0.00000115, 0.00000000],
+		[-6.27332582, -0.00035203, 0.00021565, 0.00035380, -0.00000115, 0.00000000],
+		[-6.27332591, -0.00035199, 0.00021563, 0.00035376, -0.00000115, 0.00000000],
+		[-6.27332601, -0.00035195, 0.00021560, 0.00035372, -0.00000115, 0.00000000],
+		[-6.27332611, -0.00035191, 0.00021558, 0.00035368, -0.00000115, 0.00000000],
+		[-6.27332620, -0.00035187, 0.00021555, 0.00035364, -0.00000115, 0.00000000],
+		[-6.27332630, -0.00035183, 0.00021553, 0.00035360, -0.00000115, 0.00000000],
+		[-6.27332639, -0.00035179, 0.00021550, 0.00035356, -0.00000115, 0.00000000],
+		[-6.27332649, -0.00035175, 0.00021548, 0.00035352, -0.00000115, 0.00000000],
+		[-6.27332658, -0.00035171, 0.00021545, 0.00035348, -0.00000115, 0.00000000],
+		[-6.27332668, -0.00035167, 0.00021543, 0.00035344, -0.00000115, 0.00000000],
+		[-6.27332678, -0.00035163, 0.00021540, 0.00035340, -0.00000115, 0.00000000],
+		[-6.27332687, -0.00035159, 0.00021538, 0.00035336, -0.00000115, 0.00000000],
+		[-6.27332697, -0.00035155, 0.00021536, 0.00035332, -0.00000115, 0.00000000],
+		[-6.27332706, -0.00035151, 0.00021533, 0.00035328, -0.00000115, 0.00000000],
+		[-6.27332716, -0.00035147, 0.00021531, 0.00035324, -0.00000115, 0.00000000],
+		[-6.27332725, -0.00035143, 0.00021528, 0.00035320, -0.00000115, 0.00000000],
+		[-6.27332735, -0.00035139, 0.00021526, 0.00035316, -0.00000115, 0.00000000],
+		[-6.27332744, -0.00035135, 0.00021523, 0.00035312, -0.00000115, 0.00000000],
+		[-6.27332754, -0.00035131, 0.00021521, 0.00035308, -0.00000115, 0.00000000],
+		[-6.27332763, -0.00035127, 0.00021518, 0.00035304, -0.00000115, 0.00000000],
+		[-6.27332773, -0.00035123, 0.00021516, 0.00035300, -0.00000115, 0.00000000],
+		[-6.27332783, -0.00035119, 0.00021514, 0.00035296, -0.00000115, 0.00000000],
+		[-6.27332792, -0.00035115, 0.00021511, 0.00035292, -0.00000115, 0.00000000],
+		[-6.27332802, -0.00035111, 0.00021509, 0.00035288, -0.00000115, 0.00000000],
+		[-6.27332811, -0.00035107, 0.00021506, 0.00035284, -0.00000115, 0.00000000],
+		[-6.27332821, -0.00035103, 0.00021504, 0.00035280, -0.00000115, 0.00000000],
+		[-6.27332830, -0.00035099, 0.00021501, 0.00035276, -0.00000115, 0.00000000],
+		[-6.27332840, -0.00035095, 0.00021499, 0.00035272, -0.00000115, 0.00000000],
+		[-6.27332849, -0.00035091, 0.00021496, 0.00035268, -0.00000115, 0.00000000],
+		[-6.27332859, -0.00035087, 0.00021494, 0.00035264, -0.00000115, 0.00000000],
+		[-6.27332868, -0.00035084, 0.00021492, 0.00035260, -0.00000115, 0.00000000],
+		[-6.27332878, -0.00035080, 0.00021489, 0.00035256, -0.00000115, 0.00000000],
+		[-6.27332887, -0.00035076, 0.00021487, 0.00035252, -0.00000115, 0.00000000],
+		[-6.27332897, -0.00035072, 0.00021484, 0.00035248, -0.00000115, 0.00000000],
+		[-6.27332906, -0.00035068, 0.00021482, 0.00035244, -0.00000115, 0.00000000],
+		[-6.27332916, -0.00035064, 0.00021479, 0.00035240, -0.00000115, 0.00000000],
+		[-6.27332925, -0.00035060, 0.00021477, 0.00035236, -0.00000115, 0.00000000],
+		[-6.27332935, -0.00035056, 0.00021475, 0.00035232, -0.00000115, 0.00000000],
+		[-6.27332944, -0.00035052, 0.00021472, 0.00035228, -0.00000115, 0.00000000],
+		[-6.27332954, -0.00035048, 0.00021470, 0.00035224, -0.00000115, 0.00000000],
+		[-6.27332963, -0.00035044, 0.00021467, 0.00035220, -0.00000115, 0.00000000],
+		[-6.27332973, -0.00035040, 0.00021465, 0.00035216, -0.00000115, 0.00000000],
+		[-6.27332982, -0.00035036, 0.00021462, 0.00035212, -0.00000115, 0.00000000],
+		[-6.27332992, -0.00035032, 0.00021460, 0.00035208, -0.00000115, 0.00000000],
+		[-6.27333001, -0.00035028, 0.00021458, 0.00035204, -0.00000115, 0.00000000],
+		[-6.27333011, -0.00035024, 0.00021455, 0.00035200, -0.00000115, 0.00000000],
+		[-6.27333020, -0.00035020, 0.00021453, 0.00035196, -0.00000115, 0.00000000],
+		[-6.27333030, -0.00035016, 0.00021450, 0.00035192, -0.00000115, 0.00000000],
+		[-6.27333039, -0.00035012, 0.00021448, 0.00035188, -0.00000115, 0.00000000],
+		[-6.27333049, -0.00035008, 0.00021445, 0.00035184, -0.00000115, 0.00000000],
+		[-6.27333058, -0.00035004, 0.00021443, 0.00035180, -0.00000115, 0.00000000],
+		[-6.27333068, -0.00035000, 0.00021441, 0.00035176, -0.00000115, 0.00000000],
+		[-6.27333077, -0.00034996, 0.00021438, 0.00035172, -0.00000115, 0.00000000],
+		[-6.27333087, -0.00034992, 0.00021436, 0.00035168, -0.00000115, 0.00000000],
+		[-6.27333096, -0.00034988, 0.00021433, 0.00035164, -0.00000115, 0.00000000],
+		[-6.27333106, -0.00034984, 0.00021431, 0.00035160, -0.00000115, 0.00000000],
+		[-6.27333115, -0.00034980, 0.00021428, 0.00035156, -0.00000115, 0.00000000],
+		[-6.27333125, -0.00034976, 0.00021426, 0.00035152, -0.00000115, 0.00000000],
+		[-6.27333134, -0.00034973, 0.00021424, 0.00035148, -0.00000115, 0.00000000],
+		[-6.27333144, -0.00034969, 0.00021421, 0.00035144, -0.00000115, 0.00000000],
+		[-6.27333153, -0.00034965, 0.00021419, 0.00035140, -0.00000115, 0.00000000],
+		[-6.27333162, -0.00034961, 0.00021416, 0.00035136, -0.00000115, 0.00000000],
+		[-6.27333172, -0.00034957, 0.00021414, 0.00035132, -0.00000115, 0.00000000],
+		[-6.27333181, -0.00034953, 0.00021412, 0.00035128, -0.00000115, 0.00000000],
+		[-6.27333191, -0.00034949, 0.00021409, 0.00035124, -0.00000115, 0.00000000],
+		[-6.27333200, -0.00034945, 0.00021407, 0.00035120, -0.00000115, 0.00000000],
+		[-6.27333210, -0.00034941, 0.00021404, 0.00035117, -0.00000115, 0.00000000],
+		[-6.27333219, -0.00034937, 0.00021402, 0.00035113, -0.00000115, 0.00000000],
+		[-6.27333229, -0.00034933, 0.00021399, 0.00035109, -0.00000115, 0.00000000],
+		[-6.27333238, -0.00034929, 0.00021397, 0.00035105, -0.00000115, 0.00000000],
+		[-6.27333247, -0.00034925, 0.00021395, 0.00035101, -0.00000115, 0.00000000],
+		[-6.27333257, -0.00034921, 0.00021392, 0.00035097, -0.00000115, 0.00000000],
+		[-6.27333266, -0.00034917, 0.00021390, 0.00035093, -0.00000115, 0.00000000],
+		[-6.27333276, -0.00034913, 0.00021387, 0.00035089, -0.00000115, 0.00000000],
+		[-6.27333285, -0.00034909, 0.00021385, 0.00035085, -0.00000115, 0.00000000],
+		[-6.27333295, -0.00034905, 0.00021383, 0.00035081, -0.00000115, 0.00000000],
+		[-6.27333304, -0.00034902, 0.00021380, 0.00035077, -0.00000115, 0.00000000],
+		[-6.27333313, -0.00034898, 0.00021378, 0.00035073, -0.00000115, 0.00000000],
+		[-6.27333323, -0.00034894, 0.00021375, 0.00035069, -0.00000115, 0.00000000],
+		[-6.27333332, -0.00034890, 0.00021373, 0.00035065, -0.00000115, 0.00000000],
+		[-6.27333342, -0.00034886, 0.00021370, 0.00035061, -0.00000115, 0.00000000],
+		[-6.27333351, -0.00034882, 0.00021368, 0.00035057, -0.00000115, 0.00000000],
+		[-6.27333360, -0.00034878, 0.00021366, 0.00035053, -0.00000115, 0.00000000],
+		[-6.27333370, -0.00034874, 0.00021363, 0.00035049, -0.00000115, 0.00000000],
+		[-6.27333379, -0.00034870, 0.00021361, 0.00035045, -0.00000115, 0.00000000],
+		[-6.27333389, -0.00034866, 0.00021358, 0.00035041, -0.00000115, 0.00000000],
+		[-6.27333398, -0.00034862, 0.00021356, 0.00035037, -0.00000115, 0.00000000],
+		[-6.27333408, -0.00034858, 0.00021354, 0.00035033, -0.00000115, 0.00000000],
+		[-6.27333417, -0.00034854, 0.00021351, 0.00035030, -0.00000115, 0.00000000],
+		[-6.27333426, -0.00034850, 0.00021349, 0.00035026, -0.00000115, 0.00000000],
+		[-6.27333436, -0.00034847, 0.00021346, 0.00035022, -0.00000115, 0.00000000],
+		[-6.27333445, -0.00034843, 0.00021344, 0.00035018, -0.00000115, 0.00000000],
+		[-6.27333454, -0.00034839, 0.00021342, 0.00035014, -0.00000115, 0.00000000],
+		[-6.27333464, -0.00034835, 0.00021339, 0.00035010, -0.00000115, 0.00000000],
+		[-6.27333473, -0.00034831, 0.00021337, 0.00035006, -0.00000115, 0.00000000],
+		[-6.27333483, -0.00034827, 0.00021334, 0.00035002, -0.00000115, 0.00000000],
+		[-6.27333492, -0.00034823, 0.00021332, 0.00034998, -0.00000115, 0.00000000],
+		[-6.27333501, -0.00034819, 0.00021330, 0.00034994, -0.00000115, 0.00000000],
+		[-6.27333511, -0.00034815, 0.00021327, 0.00034990, -0.00000115, 0.00000000],
+		[-6.27333520, -0.00034811, 0.00021325, 0.00034986, -0.00000115, 0.00000000],
+		[-6.27333530, -0.00034807, 0.00021322, 0.00034982, -0.00000115, 0.00000000],
+		[-6.27333539, -0.00034803, 0.00021320, 0.00034978, -0.00000115, 0.00000000],
+		[-6.27333548, -0.00034800, 0.00021318, 0.00034974, -0.00000115, 0.00000000],
+		[-6.27333558, -0.00034796, 0.00021315, 0.00034970, -0.00000115, 0.00000000],
+		[-6.27333567, -0.00034792, 0.00021313, 0.00034967, -0.00000115, 0.00000000],
+		[-6.27333576, -0.00034788, 0.00021310, 0.00034963, -0.00000115, 0.00000000],
+		[-6.27333586, -0.00034784, 0.00021308, 0.00034959, -0.00000115, 0.00000000],
+		[-6.27333595, -0.00034780, 0.00021306, 0.00034955, -0.00000115, 0.00000000],
+		[-6.27333604, -0.00034776, 0.00021303, 0.00034951, -0.00000115, 0.00000000],
+		[-6.27333614, -0.00034772, 0.00021301, 0.00034947, -0.00000115, 0.00000000],
+		[-6.27333623, -0.00034768, 0.00021298, 0.00034943, -0.00000115, 0.00000000],
+		[-6.27333632, -0.00034764, 0.00021296, 0.00034939, -0.00000115, 0.00000000],
+		[-6.27333642, -0.00034760, 0.00021294, 0.00034935, -0.00000115, 0.00000000],
+		[-6.27333651, -0.00034757, 0.00021291, 0.00034931, -0.00000115, 0.00000000],
+		[-6.27333661, -0.00034753, 0.00021289, 0.00034927, -0.00000115, 0.00000000],
+		[-6.27333670, -0.00034749, 0.00021286, 0.00034923, -0.00000115, 0.00000000],
+		[-6.27333679, -0.00034745, 0.00021284, 0.00034919, -0.00000115, 0.00000000],
+		[-6.27333689, -0.00034741, 0.00021282, 0.00034915, -0.00000115, 0.00000000],
+		[-6.27333698, -0.00034737, 0.00021279, 0.00034912, -0.00000115, 0.00000000],
+		[-6.27333707, -0.00034733, 0.00021277, 0.00034908, -0.00000115, 0.00000000],
+		[-6.27333717, -0.00034729, 0.00021275, 0.00034904, -0.00000115, 0.00000000],
+		[-6.27333726, -0.00034725, 0.00021272, 0.00034900, -0.00000115, 0.00000000],
+		[-6.27333735, -0.00034721, 0.00021270, 0.00034896, -0.00000115, 0.00000000],
+		[-6.27333745, -0.00034718, 0.00021267, 0.00034892, -0.00000115, 0.00000000],
+		[-6.27333754, -0.00034714, 0.00021265, 0.00034888, -0.00000115, 0.00000000],
+		[-6.27333763, -0.00034710, 0.00021263, 0.00034884, -0.00000115, 0.00000000],
+		[-6.27333772, -0.00034706, 0.00021260, 0.00034880, -0.00000115, 0.00000000],
+		[-6.27333782, -0.00034702, 0.00021258, 0.00034876, -0.00000115, 0.00000000],
+		[-6.27333791, -0.00034698, 0.00021255, 0.00034872, -0.00000115, 0.00000000],
+		[-6.27333800, -0.00034694, 0.00021253, 0.00034869, -0.00000115, 0.00000000],
+		[-6.27333810, -0.00034690, 0.00021251, 0.00034865, -0.00000115, 0.00000000],
+		[-6.27333819, -0.00034686, 0.00021248, 0.00034861, -0.00000115, 0.00000000],
+		[-6.27333828, -0.00034683, 0.00021246, 0.00034857, -0.00000115, 0.00000000],
+		[-6.27333838, -0.00034679, 0.00021244, 0.00034853, -0.00000115, 0.00000000],
+		[-6.27333847, -0.00034675, 0.00021241, 0.00034849, -0.00000115, 0.00000000],
+		[-6.27333856, -0.00034671, 0.00021239, 0.00034845, -0.00000115, 0.00000000],
+		[-6.27333866, -0.00034667, 0.00021236, 0.00034841, -0.00000115, 0.00000000],
+		[-6.27333875, -0.00034663, 0.00021234, 0.00034837, -0.00000115, 0.00000000],
+		[-6.27333884, -0.00034659, 0.00021232, 0.00034833, -0.00000115, 0.00000000],
+		[-6.27333893, -0.00034655, 0.00021229, 0.00034829, -0.00000115, 0.00000000],
+		[-6.27333903, -0.00034652, 0.00021227, 0.00034826, -0.00000115, 0.00000000],
+		[-6.27333912, -0.00034648, 0.00021225, 0.00034822, -0.00000115, 0.00000000],
+		[-6.27333921, -0.00034644, 0.00021222, 0.00034818, -0.00000115, 0.00000000],
+		[-6.27333931, -0.00034640, 0.00021220, 0.00034814, -0.00000115, 0.00000000],
+		[-6.27333940, -0.00034636, 0.00021217, 0.00034810, -0.00000115, 0.00000000],
+		[-6.27333949, -0.00034632, 0.00021215, 0.00034806, -0.00000115, 0.00000000],
+		[-6.27333958, -0.00034628, 0.00021213, 0.00034802, -0.00000115, 0.00000000],
+		[-6.27333968, -0.00034624, 0.00021210, 0.00034798, -0.00000115, 0.00000000],
+		[-6.27333977, -0.00034620, 0.00021208, 0.00034794, -0.00000115, 0.00000000],
+		[-6.27333986, -0.00034617, 0.00021206, 0.00034791, -0.00000115, 0.00000000],
+		[-6.27333995, -0.00034613, 0.00021203, 0.00034787, -0.00000115, 0.00000000],
+		[-6.27334005, -0.00034609, 0.00021201, 0.00034783, -0.00000115, 0.00000000],
+		[-6.27334014, -0.00034605, 0.00021198, 0.00034779, -0.00000115, 0.00000000],
+		[-6.27334023, -0.00034601, 0.00021196, 0.00034775, -0.00000115, 0.00000000],
+		[-6.27334033, -0.00034597, 0.00021194, 0.00034771, -0.00000115, 0.00000000],
+		[-6.27334042, -0.00034593, 0.00021191, 0.00034767, -0.00000115, 0.00000000],
+		[-6.27334051, -0.00034590, 0.00021189, 0.00034763, -0.00000115, 0.00000000],
+		[-6.27334060, -0.00034586, 0.00021187, 0.00034759, -0.00000115, 0.00000000],
+		[-6.27334070, -0.00034582, 0.00021184, 0.00034756, -0.00000115, 0.00000000],
+		[-6.27334079, -0.00034578, 0.00021182, 0.00034752, -0.00000115, 0.00000000],
+		[-6.27334088, -0.00034574, 0.00021179, 0.00034748, -0.00000115, 0.00000000],
+		[-6.27334097, -0.00034570, 0.00021177, 0.00034744, -0.00000115, 0.00000000],
+		[-6.27334107, -0.00034566, 0.00021175, 0.00034740, -0.00000115, 0.00000000],
+		[-6.27334116, -0.00034563, 0.00021172, 0.00034736, -0.00000115, 0.00000000],
+		[-6.27334125, -0.00034559, 0.00021170, 0.00034732, -0.00000115, 0.00000000],
+		[-6.27334134, -0.00034555, 0.00021168, 0.00034728, -0.00000115, 0.00000000],
+		[-6.27334143, -0.00034551, 0.00021165, 0.00034725, -0.00000115, 0.00000000],
+		[-6.27334153, -0.00034547, 0.00021163, 0.00034721, -0.00000115, 0.00000000],
+		[-6.27334162, -0.00034543, 0.00021161, 0.00034717, -0.00000115, 0.00000000],
+		[-6.27334171, -0.00034539, 0.00021158, 0.00034713, -0.00000115, 0.00000000],
+		[-6.27334180, -0.00034536, 0.00021156, 0.00034709, -0.00000115, 0.00000000],
+		[-6.27334190, -0.00034532, 0.00021153, 0.00034705, -0.00000115, 0.00000000],
+		[-6.27334199, -0.00034528, 0.00021151, 0.00034701, -0.00000115, 0.00000000],
+		[-6.27334208, -0.00034524, 0.00021149, 0.00034697, -0.00000115, 0.00000000],
+		[-6.27334217, -0.00034520, 0.00021146, 0.00034694, -0.00000115, 0.00000000],
+		[-6.27334226, -0.00034516, 0.00021144, 0.00034690, -0.00000115, 0.00000000],
+		[-6.27334236, -0.00034512, 0.00021142, 0.00034686, -0.00000115, 0.00000000],
+		[-6.27334245, -0.00034509, 0.00021139, 0.00034682, -0.00000115, 0.00000000],
+		[-6.27334254, -0.00034505, 0.00021137, 0.00034678, -0.00000115, 0.00000000],
+		[-6.27334263, -0.00034501, 0.00021135, 0.00034674, -0.00000115, 0.00000000],
+		[-6.27334273, -0.00034497, 0.00021132, 0.00034670, -0.00000115, 0.00000000],
+		[-6.27334282, -0.00034493, 0.00021130, 0.00034666, -0.00000115, 0.00000000],
+		[-6.27334291, -0.00034489, 0.00021128, 0.00034663, -0.00000115, 0.00000000],
+		[-6.27334300, -0.00034486, 0.00021125, 0.00034659, -0.00000115, 0.00000000],
+		[-6.27334309, -0.00034482, 0.00021123, 0.00034655, -0.00000115, 0.00000000],
+		[-6.27334319, -0.00034478, 0.00021120, 0.00034651, -0.00000115, 0.00000000],
+		[-6.27334328, -0.00034474, 0.00021118, 0.00034647, -0.00000115, 0.00000000],
+		[-6.27334337, -0.00034470, 0.00021116, 0.00034643, -0.00000115, 0.00000000],
+		[-6.27334346, -0.00034466, 0.00021113, 0.00034639, -0.00000115, 0.00000000],
+		[-6.27334355, -0.00034462, 0.00021111, 0.00034636, -0.00000115, 0.00000000],
+		[-6.27334364, -0.00034459, 0.00021109, 0.00034632, -0.00000115, 0.00000000],
+		[-6.27334374, -0.00034455, 0.00021106, 0.00034628, -0.00000115, 0.00000000],
+		[-6.27334383, -0.00034451, 0.00021104, 0.00034624, -0.00000115, 0.00000000],
+		[-6.27334392, -0.00034447, 0.00021102, 0.00034620, -0.00000115, 0.00000000],
+		[-6.27334401, -0.00034443, 0.00021099, 0.00034616, -0.00000115, 0.00000000],
+		[-6.27334410, -0.00034439, 0.00021097, 0.00034612, -0.00000115, 0.00000000],
+		[-6.27334420, -0.00034436, 0.00021095, 0.00034609, -0.00000115, 0.00000000],
+		[-6.27334429, -0.00034432, 0.00021092, 0.00034605, -0.00000115, 0.00000000],
+		[-6.27334438, -0.00034428, 0.00021090, 0.00034601, -0.00000115, 0.00000000],
+		[-6.27334447, -0.00034424, 0.00021088, 0.00034597, -0.00000115, 0.00000000],
+		[-6.27334456, -0.00034420, 0.00021085, 0.00034593, -0.00000115, 0.00000000],
+		[-6.27334465, -0.00034417, 0.00021083, 0.00034589, -0.00000115, 0.00000000],
+		[-6.27334475, -0.00034413, 0.00021081, 0.00034586, -0.00000115, 0.00000000],
+		[-6.27334484, -0.00034409, 0.00021078, 0.00034582, -0.00000115, 0.00000000],
+		[-6.27334493, -0.00034405, 0.00021076, 0.00034578, -0.00000115, 0.00000000],
+		[-6.27334502, -0.00034401, 0.00021073, 0.00034574, -0.00000115, 0.00000000],
+		[-6.27334511, -0.00034397, 0.00021071, 0.00034570, -0.00000115, 0.00000000],
+		[-6.27334520, -0.00034394, 0.00021069, 0.00034566, -0.00000115, 0.00000000],
+		[-6.27334529, -0.00034390, 0.00021066, 0.00034562, -0.00000115, 0.00000000],
+		[-6.27334539, -0.00034386, 0.00021064, 0.00034559, -0.00000115, 0.00000000],
+		[-6.27334548, -0.00034382, 0.00021062, 0.00034555, -0.00000115, 0.00000000],
+		[-6.27334557, -0.00034378, 0.00021059, 0.00034551, -0.00000115, 0.00000000],
+		[-6.27334566, -0.00034374, 0.00021057, 0.00034547, -0.00000115, 0.00000000],
+		[-6.27334575, -0.00034371, 0.00021055, 0.00034543, -0.00000116, 0.00000000],
+		[-6.27334584, -0.00034367, 0.00021052, 0.00034539, -0.00000116, 0.00000000],
+		[-6.27334593, -0.00034363, 0.00021050, 0.00034536, -0.00000116, 0.00000000],
+		[-6.27334603, -0.00034359, 0.00021048, 0.00034532, -0.00000116, 0.00000000],
+		[-6.27334612, -0.00034355, 0.00021045, 0.00034528, -0.00000116, 0.00000000],
+		[-6.27334621, -0.00034352, 0.00021043, 0.00034524, -0.00000116, 0.00000000],
+		[-6.27334630, -0.00034348, 0.00021041, 0.00034520, -0.00000116, 0.00000000],
+		[-6.27334639, -0.00034344, 0.00021038, 0.00034516, -0.00000116, 0.00000000],
+		[-6.27334648, -0.00034340, 0.00021036, 0.00034513, -0.00000116, 0.00000000],
+		[-6.27334657, -0.00034336, 0.00021034, 0.00034509, -0.00000116, 0.00000000],
+		[-6.27334666, -0.00034333, 0.00021031, 0.00034505, -0.00000116, 0.00000000],
+		[-6.27334676, -0.00034329, 0.00021029, 0.00034501, -0.00000116, 0.00000000],
+		[-6.27334685, -0.00034325, 0.00021027, 0.00034497, -0.00000116, 0.00000000],
+		[-6.27334694, -0.00034321, 0.00021024, 0.00034494, -0.00000116, 0.00000000],
+		[-6.27334703, -0.00034317, 0.00021022, 0.00034490, -0.00000116, 0.00000000],
+		[-6.27334712, -0.00034313, 0.00021020, 0.00034486, -0.00000116, 0.00000000],
+		[-6.27334721, -0.00034310, 0.00021017, 0.00034482, -0.00000116, 0.00000000],
+		[-6.27334730, -0.00034306, 0.00021015, 0.00034478, -0.00000116, 0.00000000],
+		[-6.27334739, -0.00034302, 0.00021013, 0.00034474, -0.00000116, 0.00000000],
+		[-6.27334748, -0.00034298, 0.00021010, 0.00034471, -0.00000116, 0.00000000],
+		[-6.27334758, -0.00034294, 0.00021008, 0.00034467, -0.00000116, 0.00000000],
+		[-6.27334767, -0.00034291, 0.00021006, 0.00034463, -0.00000116, 0.00000000],
+		[-6.27334776, -0.00034287, 0.00021003, 0.00034459, -0.00000116, 0.00000000],
+		[-6.27334785, -0.00034283, 0.00021001, 0.00034455, -0.00000116, 0.00000000],
+		[-6.27334794, -0.00034279, 0.00020999, 0.00034451, -0.00000116, 0.00000000],
+		[-6.27334803, -0.00034276, 0.00020996, 0.00034448, -0.00000116, 0.00000000],
+		[-6.27334812, -0.00034272, 0.00020994, 0.00034444, -0.00000116, 0.00000000],
+		[-6.27334821, -0.00034268, 0.00020992, 0.00034440, -0.00000116, 0.00000000],
+		[-6.27334830, -0.00034264, 0.00020989, 0.00034436, -0.00000116, 0.00000000],
+		[-6.27334839, -0.00034260, 0.00020987, 0.00034432, -0.00000116, 0.00000000],
+		[-6.27334848, -0.00034257, 0.00020985, 0.00034429, -0.00000116, 0.00000000],
+		[-6.27334857, -0.00034253, 0.00020983, 0.00034425, -0.00000116, 0.00000000],
+		[-6.27334867, -0.00034249, 0.00020980, 0.00034421, -0.00000116, 0.00000000],
+		[-6.27334876, -0.00034245, 0.00020978, 0.00034417, -0.00000116, 0.00000000],
+		[-6.27334885, -0.00034241, 0.00020976, 0.00034413, -0.00000116, 0.00000000],
+		[-6.27334894, -0.00034238, 0.00020973, 0.00034410, -0.00000116, 0.00000000],
+		[-6.27334903, -0.00034234, 0.00020971, 0.00034406, -0.00000116, 0.00000000],
+		[-6.27334912, -0.00034230, 0.00020969, 0.00034402, -0.00000116, 0.00000000],
+		[-6.27334921, -0.00034226, 0.00020966, 0.00034398, -0.00000116, 0.00000000],
+		[-6.27334930, -0.00034222, 0.00020964, 0.00034394, -0.00000116, 0.00000000],
+		[-6.27334939, -0.00034219, 0.00020962, 0.00034391, -0.00000116, 0.00000000],
+		[-6.27334948, -0.00034215, 0.00020959, 0.00034387, -0.00000116, 0.00000000],
+		[-6.27334957, -0.00034211, 0.00020957, 0.00034383, -0.00000116, 0.00000000],
+		[-6.27334966, -0.00034207, 0.00020955, 0.00034379, -0.00000116, 0.00000000],
+		[-6.27334975, -0.00034204, 0.00020952, 0.00034375, -0.00000116, 0.00000000],
+		[-6.27334984, -0.00034200, 0.00020950, 0.00034372, -0.00000116, 0.00000000],
+		[-6.27334993, -0.00034196, 0.00020948, 0.00034368, -0.00000116, 0.00000000],
+		[-6.27335002, -0.00034192, 0.00020945, 0.00034364, -0.00000116, 0.00000000],
+		[-6.27335011, -0.00034188, 0.00020943, 0.00034360, -0.00000116, 0.00000000],
+		[-6.27335021, -0.00034185, 0.00020941, 0.00034356, -0.00000116, 0.00000000],
+		[-6.27335030, -0.00034181, 0.00020938, 0.00034353, -0.00000116, 0.00000000],
+		[-6.27335039, -0.00034177, 0.00020936, 0.00034349, -0.00000116, 0.00000000],
+		[-6.27335048, -0.00034173, 0.00020934, 0.00034345, -0.00000116, 0.00000000],
+		[-6.27335057, -0.00034170, 0.00020932, 0.00034341, -0.00000116, 0.00000000],
+		[-6.27335066, -0.00034166, 0.00020929, 0.00034337, -0.00000116, 0.00000000],
+		[-6.27335075, -0.00034162, 0.00020927, 0.00034334, -0.00000116, 0.00000000],
+		[-6.27335084, -0.00034158, 0.00020925, 0.00034330, -0.00000116, 0.00000000],
+		[-6.27335093, -0.00034154, 0.00020922, 0.00034326, -0.00000116, 0.00000000],
+		[-6.27335102, -0.00034151, 0.00020920, 0.00034322, -0.00000116, 0.00000000],
+		[-6.27335111, -0.00034147, 0.00020918, 0.00034318, -0.00000116, 0.00000000],
+		[-6.27335120, -0.00034143, 0.00020915, 0.00034315, -0.00000116, 0.00000000],
+		[-6.27335129, -0.00034139, 0.00020913, 0.00034311, -0.00000116, 0.00000000],
+		[-6.27335138, -0.00034136, 0.00020911, 0.00034307, -0.00000116, 0.00000000],
+		[-6.27335147, -0.00034132, 0.00020908, 0.00034303, -0.00000116, 0.00000000],
+		[-6.27335156, -0.00034128, 0.00020906, 0.00034300, -0.00000116, 0.00000000],
+		[-6.27335165, -0.00034124, 0.00020904, 0.00034296, -0.00000116, 0.00000000],
+		[-6.27335174, -0.00034121, 0.00020902, 0.00034292, -0.00000116, 0.00000000],
+		[-6.27335183, -0.00034117, 0.00020899, 0.00034288, -0.00000116, 0.00000000],
+		[-6.27335192, -0.00034113, 0.00020897, 0.00034284, -0.00000116, 0.00000000],
+		[-6.27335201, -0.00034109, 0.00020895, 0.00034281, -0.00000116, 0.00000000],
+		[-6.27335210, -0.00034106, 0.00020892, 0.00034277, -0.00000116, 0.00000000],
+		[-6.27335219, -0.00034102, 0.00020890, 0.00034273, -0.00000116, 0.00000000],
+		[-6.27335228, -0.00034098, 0.00020888, 0.00034269, -0.00000116, 0.00000000],
+		[-6.27335237, -0.00034094, 0.00020885, 0.00034266, -0.00000116, 0.00000000],
+		[-6.27335246, -0.00034091, 0.00020883, 0.00034262, -0.00000116, 0.00000000],
+		[-6.27335255, -0.00034087, 0.00020881, 0.00034258, -0.00000116, 0.00000000],
+		[-6.27335264, -0.00034083, 0.00020878, 0.00034254, -0.00000116, 0.00000000],
+		[-6.27335273, -0.00034079, 0.00020876, 0.00034250, -0.00000116, 0.00000000],
+		[-6.27335282, -0.00034076, 0.00020874, 0.00034247, -0.00000116, 0.00000000],
+		[-6.27335291, -0.00034072, 0.00020872, 0.00034243, -0.00000116, 0.00000000],
+		[-6.27335300, -0.00034068, 0.00020869, 0.00034239, -0.00000116, 0.00000000],
+		[-6.27335309, -0.00034064, 0.00020867, 0.00034235, -0.00000116, 0.00000000],
+		[-6.27335318, -0.00034061, 0.00020865, 0.00034232, -0.00000116, 0.00000000],
+		[-6.27335327, -0.00034057, 0.00020862, 0.00034228, -0.00000116, 0.00000000],
+		[-6.27335336, -0.00034053, 0.00020860, 0.00034224, -0.00000116, 0.00000000],
+		[-6.27335345, -0.00034049, 0.00020858, 0.00034220, -0.00000116, 0.00000000],
+		[-6.27335354, -0.00034046, 0.00020856, 0.00034217, -0.00000116, 0.00000000],
+		[-6.27335363, -0.00034042, 0.00020853, 0.00034213, -0.00000116, 0.00000000],
+		[-6.27335372, -0.00034038, 0.00020851, 0.00034209, -0.00000116, 0.00000000],
+		[-6.27335380, -0.00034034, 0.00020849, 0.00034205, -0.00000116, 0.00000000],
+		[-6.27335389, -0.00034031, 0.00020846, 0.00034201, -0.00000116, 0.00000000],
+		[-6.27335398, -0.00034027, 0.00020844, 0.00034198, -0.00000116, 0.00000000],
+		[-6.27335407, -0.00034023, 0.00020842, 0.00034194, -0.00000116, 0.00000000],
+		[-6.27335416, -0.00034019, 0.00020839, 0.00034190, -0.00000116, 0.00000000],
+		[-6.27335425, -0.00034016, 0.00020837, 0.00034186, -0.00000116, 0.00000000],
+		[-6.27335434, -0.00034012, 0.00020835, 0.00034183, -0.00000116, 0.00000000],
+		[-6.27335443, -0.00034008, 0.00020833, 0.00034179, -0.00000116, 0.00000000],
+		[-6.27335452, -0.00034004, 0.00020830, 0.00034175, -0.00000116, 0.00000000],
+		[-6.27335461, -0.00034001, 0.00020828, 0.00034171, -0.00000116, 0.00000000],
+		[-6.27335470, -0.00033997, 0.00020826, 0.00034168, -0.00000116, 0.00000000],
+		[-6.27335479, -0.00033993, 0.00020823, 0.00034164, -0.00000116, 0.00000000],
+		[-6.27335488, -0.00033989, 0.00020821, 0.00034160, -0.00000116, 0.00000000],
+		[-6.27335497, -0.00033986, 0.00020819, 0.00034156, -0.00000116, 0.00000000],
+		[-6.27335506, -0.00033982, 0.00020817, 0.00034153, -0.00000116, 0.00000000],
+		[-6.27335515, -0.00033978, 0.00020814, 0.00034149, -0.00000116, 0.00000000],
+		[-6.27335524, -0.00033975, 0.00020812, 0.00034145, -0.00000116, 0.00000000],
+		[-6.27335533, -0.00033971, 0.00020810, 0.00034141, -0.00000116, 0.00000000],
+		[-6.27335541, -0.00033967, 0.00020807, 0.00034138, -0.00000116, 0.00000000],
+		[-6.27335550, -0.00033963, 0.00020805, 0.00034134, -0.00000116, 0.00000000],
+		[-6.27335559, -0.00033960, 0.00020803, 0.00034130, -0.00000116, 0.00000000],
+		[-6.27335568, -0.00033956, 0.00020801, 0.00034126, -0.00000116, 0.00000000],
+		[-6.27335577, -0.00033952, 0.00020798, 0.00034123, -0.00000116, 0.00000000],
+		[-6.27335586, -0.00033948, 0.00020796, 0.00034119, -0.00000116, 0.00000000],
+		[-6.27335595, -0.00033945, 0.00020794, 0.00034115, -0.00000116, 0.00000000],
+		[-6.27335604, -0.00033941, 0.00020791, 0.00034111, -0.00000116, 0.00000000],
+		[-6.27335613, -0.00033937, 0.00020789, 0.00034108, -0.00000116, 0.00000000],
+		[-6.27335622, -0.00033934, 0.00020787, 0.00034104, -0.00000116, 0.00000000],
+		[-6.27335631, -0.00033930, 0.00020785, 0.00034100, -0.00000116, 0.00000000],
+		[-6.27335639, -0.00033926, 0.00020782, 0.00034097, -0.00000116, 0.00000000],
+		[-6.27335648, -0.00033922, 0.00020780, 0.00034093, -0.00000116, 0.00000000],
+		[-6.27335657, -0.00033919, 0.00020778, 0.00034089, -0.00000116, 0.00000000],
+		[-6.27335666, -0.00033915, 0.00020776, 0.00034085, -0.00000116, 0.00000000],
+		[-6.27335675, -0.00033911, 0.00020773, 0.00034082, -0.00000116, 0.00000000],
+		[-6.27335684, -0.00033908, 0.00020771, 0.00034078, -0.00000116, 0.00000000],
+		[-6.27335693, -0.00033904, 0.00020769, 0.00034074, -0.00000116, 0.00000000],
+		[-6.27335702, -0.00033900, 0.00020766, 0.00034070, -0.00000116, 0.00000000],
+		[-6.27335711, -0.00033896, 0.00020764, 0.00034067, -0.00000116, 0.00000000],
+		[-6.27335720, -0.00033893, 0.00020762, 0.00034063, -0.00000116, 0.00000000],
+		[-6.27335728, -0.00033889, 0.00020760, 0.00034059, -0.00000116, 0.00000000],
+		[-6.27335737, -0.00033885, 0.00020757, 0.00034055, -0.00000116, 0.00000000],
+		[-6.27335746, -0.00033882, 0.00020755, 0.00034052, -0.00000116, 0.00000000],
+		[-6.27335755, -0.00033878, 0.00020753, 0.00034048, -0.00000116, 0.00000000],
+		[-6.27335764, -0.00033874, 0.00020751, 0.00034044, -0.00000116, 0.00000000],
+		[-6.27335773, -0.00033870, 0.00020748, 0.00034041, -0.00000116, 0.00000000],
+		[-6.27335782, -0.00033867, 0.00020746, 0.00034037, -0.00000116, 0.00000000],
+		[-6.27335791, -0.00033863, 0.00020744, 0.00034033, -0.00000116, 0.00000000],
+		[-6.27335799, -0.00033859, 0.00020741, 0.00034029, -0.00000116, 0.00000000],
+		[-6.27335808, -0.00033856, 0.00020739, 0.00034026, -0.00000116, 0.00000000],
+		[-6.27335817, -0.00033852, 0.00020737, 0.00034022, -0.00000116, 0.00000000],
+		[-6.27335826, -0.00033848, 0.00020735, 0.00034018, -0.00000116, 0.00000000],
+		[-6.27335835, -0.00033845, 0.00020732, 0.00034015, -0.00000116, 0.00000000],
+		[-6.27335844, -0.00033841, 0.00020730, 0.00034011, -0.00000116, 0.00000000],
+		[-6.27335853, -0.00033837, 0.00020728, 0.00034007, -0.00000116, 0.00000000],
+		[-6.27335861, -0.00033833, 0.00020726, 0.00034003, -0.00000116, 0.00000000],
+		[-6.27335870, -0.00033830, 0.00020723, 0.00034000, -0.00000116, 0.00000000],
+		[-6.27335879, -0.00033826, 0.00020721, 0.00033996, -0.00000116, 0.00000000],
+		[-6.27335888, -0.00033822, 0.00020719, 0.00033992, -0.00000116, 0.00000000],
+		[-6.27335897, -0.00033819, 0.00020716, 0.00033988, -0.00000116, 0.00000000],
+		[-6.27335906, -0.00033815, 0.00020714, 0.00033985, -0.00000116, 0.00000000],
+		[-6.27335915, -0.00033811, 0.00020712, 0.00033981, -0.00000116, 0.00000000],
+		[-6.27335923, -0.00033808, 0.00020710, 0.00033977, -0.00000116, 0.00000000],
+		[-6.27335932, -0.00033804, 0.00020707, 0.00033974, -0.00000116, 0.00000000],
+		[-6.27335941, -0.00033800, 0.00020705, 0.00033970, -0.00000116, 0.00000000],
+		[-6.27335950, -0.00033797, 0.00020703, 0.00033966, -0.00000116, 0.00000000],
+		[-6.27335959, -0.00033793, 0.00020701, 0.00033963, -0.00000116, 0.00000000],
+		[-6.27335968, -0.00033789, 0.00020698, 0.00033959, -0.00000116, 0.00000000],
+		[-6.27335976, -0.00033785, 0.00020696, 0.00033955, -0.00000116, 0.00000000],
+		[-6.27335985, -0.00033782, 0.00020694, 0.00033951, -0.00000116, 0.00000000],
+		[-6.27335994, -0.00033778, 0.00020692, 0.00033948, -0.00000116, 0.00000000],
+		[-6.27336003, -0.00033774, 0.00020689, 0.00033944, -0.00000116, 0.00000000],
+		[-6.27336012, -0.00033771, 0.00020687, 0.00033940, -0.00000116, 0.00000000],
+		[-6.27336021, -0.00033767, 0.00020685, 0.00033937, -0.00000116, 0.00000000],
+		[-6.27336029, -0.00033763, 0.00020683, 0.00033933, -0.00000116, 0.00000000],
+		[-6.27336038, -0.00033760, 0.00020680, 0.00033929, -0.00000116, 0.00000000],
+		[-6.27336047, -0.00033756, 0.00020678, 0.00033925, -0.00000116, 0.00000000],
+		[-6.27336056, -0.00033752, 0.00020676, 0.00033922, -0.00000116, 0.00000000],
+		[-6.27336065, -0.00033749, 0.00020674, 0.00033918, -0.00000116, 0.00000000],
+		[-6.27336073, -0.00033745, 0.00020671, 0.00033914, -0.00000116, 0.00000000],
+		[-6.27336082, -0.00033741, 0.00020669, 0.00033911, -0.00000116, 0.00000000],
+		[-6.27336091, -0.00033738, 0.00020667, 0.00033907, -0.00000116, 0.00000000],
+		[-6.27336100, -0.00033734, 0.00020665, 0.00033903, -0.00000116, 0.00000000],
+		[-6.27336109, -0.00033730, 0.00020662, 0.00033900, -0.00000116, 0.00000000],
+		[-6.27336117, -0.00033727, 0.00020660, 0.00033896, -0.00000116, 0.00000000],
+		[-6.27336126, -0.00033723, 0.00020658, 0.00033892, -0.00000116, 0.00000000],
+		[-6.27336135, -0.00033719, 0.00020656, 0.00033889, -0.00000116, 0.00000000],
+		[-6.27336144, -0.00033716, 0.00020653, 0.00033885, -0.00000116, 0.00000000],
+		[-6.27336153, -0.00033712, 0.00020651, 0.00033881, -0.00000116, 0.00000000],
+		[-6.27336161, -0.00033708, 0.00020649, 0.00033877, -0.00000116, 0.00000000],
+		[-6.27336170, -0.00033705, 0.00020647, 0.00033874, -0.00000116, 0.00000000],
+		[-6.27336179, -0.00033701, 0.00020644, 0.00033870, -0.00000116, 0.00000000],
+		[-6.27336188, -0.00033697, 0.00020642, 0.00033866, -0.00000116, 0.00000000],
+		[-6.27336197, -0.00033694, 0.00020640, 0.00033863, -0.00000116, 0.00000000],
+		[-6.27336205, -0.00033690, 0.00020638, 0.00033859, -0.00000116, 0.00000000],
+		[-6.27336214, -0.00033686, 0.00020635, 0.00033855, -0.00000116, 0.00000000],
+		[-6.27336223, -0.00033683, 0.00020633, 0.00033852, -0.00000116, 0.00000000],
+		[-6.27336232, -0.00033679, 0.00020631, 0.00033848, -0.00000116, 0.00000000],
+		[-6.27336240, -0.00033675, 0.00020629, 0.00033844, -0.00000116, 0.00000000],
+		[-6.27336249, -0.00033672, 0.00020626, 0.00033841, -0.00000116, 0.00000000],
+		[-6.27336258, -0.00033668, 0.00020624, 0.00033837, -0.00000116, 0.00000000],
+		[-6.27336267, -0.00033664, 0.00020622, 0.00033833, -0.00000116, 0.00000000],
+		[-6.27336275, -0.00033661, 0.00020620, 0.00033830, -0.00000116, 0.00000000],
+		[-6.27336284, -0.00033657, 0.00020617, 0.00033826, -0.00000116, 0.00000000],
+		[-6.27336293, -0.00033653, 0.00020615, 0.00033822, -0.00000116, 0.00000000],
+		[-6.27336302, -0.00033650, 0.00020613, 0.00033819, -0.00000116, 0.00000000],
+		[-6.27336311, -0.00033646, 0.00020611, 0.00033815, -0.00000116, 0.00000000],
+		[-6.27336319, -0.00033642, 0.00020608, 0.00033811, -0.00000116, 0.00000000],
+		[-6.27336328, -0.00033639, 0.00020606, 0.00033808, -0.00000116, 0.00000000],
+		[-6.27336337, -0.00033635, 0.00020604, 0.00033804, -0.00000116, 0.00000000],
+		[-6.27336346, -0.00033631, 0.00020602, 0.00033800, -0.00000116, 0.00000000],
+		[-6.27336354, -0.00033628, 0.00020599, 0.00033796, -0.00000116, 0.00000000],
+		[-6.27336363, -0.00033624, 0.00020597, 0.00033793, -0.00000116, 0.00000000],
+		[-6.27336372, -0.00033620, 0.00020595, 0.00033789, -0.00000116, 0.00000000],
+		[-6.27336381, -0.00033617, 0.00020593, 0.00033785, -0.00000116, 0.00000000],
+		[-6.27336389, -0.00033613, 0.00020590, 0.00033782, -0.00000116, 0.00000000],
+		[-6.27336398, -0.00033609, 0.00020588, 0.00033778, -0.00000116, 0.00000000],
+		[-6.27336407, -0.00033606, 0.00020586, 0.00033774, -0.00000116, 0.00000000],
+		[-6.27336415, -0.00033602, 0.00020584, 0.00033771, -0.00000116, 0.00000000],
+		[-6.27336424, -0.00033598, 0.00020582, 0.00033767, -0.00000116, 0.00000000],
+		[-6.27336433, -0.00033595, 0.00020579, 0.00033763, -0.00000116, 0.00000000],
+		[-6.27336442, -0.00033591, 0.00020577, 0.00033760, -0.00000116, 0.00000000],
+		[-6.27336450, -0.00033587, 0.00020575, 0.00033756, -0.00000116, 0.00000000],
+		[-6.27336459, -0.00033584, 0.00020573, 0.00033752, -0.00000116, 0.00000000],
+		[-6.27336468, -0.00033580, 0.00020570, 0.00033749, -0.00000116, 0.00000000],
+		[-6.27336477, -0.00033577, 0.00020568, 0.00033745, -0.00000116, 0.00000000],
+		[-6.27336485, -0.00033573, 0.00020566, 0.00033742, -0.00000116, 0.00000000],
+		[-6.27336494, -0.00033569, 0.00020564, 0.00033738, -0.00000116, 0.00000000],
+		[-6.27336503, -0.00033566, 0.00020561, 0.00033734, -0.00000116, 0.00000000],
+		[-6.27336511, -0.00033562, 0.00020559, 0.00033731, -0.00000116, 0.00000000],
+		[-6.27336520, -0.00033558, 0.00020557, 0.00033727, -0.00000116, 0.00000000],
+		[-6.27336529, -0.00033555, 0.00020555, 0.00033723, -0.00000116, 0.00000000],
+		[-6.27336538, -0.00033551, 0.00020553, 0.00033720, -0.00000116, 0.00000000],
+		[-6.27336546, -0.00033547, 0.00020550, 0.00033716, -0.00000116, 0.00000000],
+		[-6.27336555, -0.00033544, 0.00020548, 0.00033712, -0.00000116, 0.00000000],
+		[-6.27336564, -0.00033540, 0.00020546, 0.00033709, -0.00000116, 0.00000000],
+		[-6.27336572, -0.00033537, 0.00020544, 0.00033705, -0.00000116, 0.00000000],
+		[-6.27336581, -0.00033533, 0.00020541, 0.00033701, -0.00000116, 0.00000000],
+		[-6.27336590, -0.00033529, 0.00020539, 0.00033698, -0.00000116, 0.00000000],
+		[-6.27336598, -0.00033526, 0.00020537, 0.00033694, -0.00000116, 0.00000000],
+		[-6.27336607, -0.00033522, 0.00020535, 0.00033690, -0.00000116, 0.00000000],
+		[-6.27336616, -0.00033518, 0.00020532, 0.00033687, -0.00000116, 0.00000000],
+		[-6.27336625, -0.00033515, 0.00020530, 0.00033683, -0.00000116, 0.00000000],
+		[-6.27336633, -0.00033511, 0.00020528, 0.00033679, -0.00000116, 0.00000000],
+		[-6.27336642, -0.00033508, 0.00020526, 0.00033676, -0.00000116, 0.00000000],
+		[-6.27336651, -0.00033504, 0.00020524, 0.00033672, -0.00000116, 0.00000000],
+		[-6.27336659, -0.00033500, 0.00020521, 0.00033668, -0.00000116, 0.00000000],
+		[-6.27336668, -0.00033497, 0.00020519, 0.00033665, -0.00000116, 0.00000000],
+		[-6.27336677, -0.00033493, 0.00020517, 0.00033661, -0.00000116, 0.00000000],
+		[-6.27336685, -0.00033489, 0.00020515, 0.00033658, -0.00000116, 0.00000000],
+		[-6.27336694, -0.00033486, 0.00020512, 0.00033654, -0.00000116, 0.00000000],
+		[-6.27336703, -0.00033482, 0.00020510, 0.00033650, -0.00000116, 0.00000000],
+		[-6.27336711, -0.00033479, 0.00020508, 0.00033647, -0.00000116, 0.00000000],
+		[-6.27336720, -0.00033475, 0.00020506, 0.00033643, -0.00000116, 0.00000000],
+		[-6.27336729, -0.00033471, 0.00020504, 0.00033639, -0.00000116, 0.00000000],
+		[-6.27336737, -0.00033468, 0.00020501, 0.00033636, -0.00000116, 0.00000000],
+		[-6.27336746, -0.00033464, 0.00020499, 0.00033632, -0.00000116, 0.00000000],
+		[-6.27336755, -0.00033460, 0.00020497, 0.00033628, -0.00000116, 0.00000000],
+		[-6.27336763, -0.00033457, 0.00020495, 0.00033625, -0.00000116, 0.00000000],
+		[-6.27336772, -0.00033453, 0.00020493, 0.00033621, -0.00000116, 0.00000000],
+		[-6.27336781, -0.00033450, 0.00020490, 0.00033618, -0.00000116, 0.00000000],
+		[-6.27336789, -0.00033446, 0.00020488, 0.00033614, -0.00000116, 0.00000000],
+		[-6.27336798, -0.00033442, 0.00020486, 0.00033610, -0.00000116, 0.00000000],
+		[-6.27336807, -0.00033439, 0.00020484, 0.00033607, -0.00000116, 0.00000000],
+		[-6.27336815, -0.00033435, 0.00020481, 0.00033603, -0.00000116, 0.00000000],
+		[-6.27336824, -0.00033432, 0.00020479, 0.00033599, -0.00000116, 0.00000000],
+		[-6.27336833, -0.00033428, 0.00020477, 0.00033596, -0.00000116, 0.00000000],
+		[-6.27336841, -0.00033424, 0.00020475, 0.00033592, -0.00000116, 0.00000000],
+		[-6.27336850, -0.00033421, 0.00020473, 0.00033588, -0.00000116, 0.00000000],
+		[-6.27336858, -0.00033417, 0.00020470, 0.00033585, -0.00000116, 0.00000000],
+		[-6.27336867, -0.00033413, 0.00020468, 0.00033581, -0.00000116, 0.00000000],
+		[-6.27336876, -0.00033410, 0.00020466, 0.00033578, -0.00000116, 0.00000000],
+		[-6.27336884, -0.00033406, 0.00020464, 0.00033574, -0.00000116, 0.00000000],
+		[-6.27336893, -0.00033403, 0.00020462, 0.00033570, -0.00000116, 0.00000000],
+		[-6.27336902, -0.00033399, 0.00020459, 0.00033567, -0.00000116, 0.00000000],
+		[-6.27336910, -0.00033395, 0.00020457, 0.00033563, -0.00000116, 0.00000000],
+		[-6.27336919, -0.00033392, 0.00020455, 0.00033559, -0.00000116, 0.00000000],
+		[-6.27336927, -0.00033388, 0.00020453, 0.00033556, -0.00000116, 0.00000000],
+		[-6.27336936, -0.00033385, 0.00020451, 0.00033552, -0.00000116, 0.00000000],
+		[-6.27336945, -0.00033381, 0.00020448, 0.00033549, -0.00000116, 0.00000000],
+		[-6.27336953, -0.00033377, 0.00020446, 0.00033545, -0.00000116, 0.00000000],
+		[-6.27336962, -0.00033374, 0.00020444, 0.00033541, -0.00000116, 0.00000000],
+		[-6.27336971, -0.00033370, 0.00020442, 0.00033538, -0.00000116, 0.00000000],
+		[-6.27336979, -0.00033367, 0.00020439, 0.00033534, -0.00000116, 0.00000000],
+		[-6.27336988, -0.00033363, 0.00020437, 0.00033531, -0.00000116, 0.00000000],
+		[-6.27336996, -0.00033359, 0.00020435, 0.00033527, -0.00000116, 0.00000000],
+		[-6.27337005, -0.00033356, 0.00020433, 0.00033523, -0.00000116, 0.00000000],
+		[-6.27337014, -0.00033352, 0.00020431, 0.00033520, -0.00000116, 0.00000000],
+		[-6.27337022, -0.00033349, 0.00020428, 0.00033516, -0.00000116, 0.00000000],
+		[-6.27337031, -0.00033345, 0.00020426, 0.00033513, -0.00000116, 0.00000000],
+		[-6.27337039, -0.00033342, 0.00020424, 0.00033509, -0.00000116, 0.00000000],
+		[-6.27337048, -0.00033338, 0.00020422, 0.00033505, -0.00000116, 0.00000000],
+		[-6.27337057, -0.00033334, 0.00020420, 0.00033502, -0.00000116, 0.00000000],
+		[-6.27337065, -0.00033331, 0.00020417, 0.00033498, -0.00000116, 0.00000000],
+		[-6.27337074, -0.00033327, 0.00020415, 0.00033494, -0.00000116, 0.00000000],
+		[-6.27337082, -0.00033324, 0.00020413, 0.00033491, -0.00000116, 0.00000000],
+		[-6.27337091, -0.00033320, 0.00020411, 0.00033487, -0.00000116, 0.00000000],
+		[-6.27337100, -0.00033316, 0.00020409, 0.00033484, -0.00000116, 0.00000000],
+		[-6.27337108, -0.00033313, 0.00020406, 0.00033480, -0.00000116, 0.00000000],
+		[-6.27337117, -0.00033309, 0.00020404, 0.00033476, -0.00000116, 0.00000000],
+		[-6.27337125, -0.00033306, 0.00020402, 0.00033473, -0.00000116, 0.00000000],
+		[-6.27337134, -0.00033302, 0.00020400, 0.00033469, -0.00000116, 0.00000000],
+		[-6.27337142, -0.00033298, 0.00020398, 0.00033466, -0.00000116, 0.00000000],
+		[-6.27337151, -0.00033295, 0.00020395, 0.00033462, -0.00000116, 0.00000000],
+		[-6.27337160, -0.00033291, 0.00020393, 0.00033458, -0.00000116, 0.00000000],
+		[-6.27337168, -0.00033288, 0.00020391, 0.00033455, -0.00000116, 0.00000000],
+		[-6.27337177, -0.00033284, 0.00020389, 0.00033451, -0.00000116, 0.00000000],
+		[-6.27337185, -0.00033281, 0.00020387, 0.00033448, -0.00000116, 0.00000000],
+		[-6.27337194, -0.00033277, 0.00020385, 0.00033444, -0.00000116, 0.00000000],
+		[-6.27337202, -0.00033273, 0.00020382, 0.00033440, -0.00000116, 0.00000000],
+		[-6.27337211, -0.00033270, 0.00020380, 0.00033437, -0.00000116, 0.00000000],
+		[-6.27337220, -0.00033266, 0.00020378, 0.00033433, -0.00000116, 0.00000000],
+		[-6.27337228, -0.00033263, 0.00020376, 0.00033430, -0.00000116, 0.00000000],
+		[-6.27337237, -0.00033259, 0.00020374, 0.00033426, -0.00000116, 0.00000000],
+		[-6.27337245, -0.00033256, 0.00020371, 0.00033422, -0.00000116, 0.00000000],
+		[-6.27337254, -0.00033252, 0.00020369, 0.00033419, -0.00000116, 0.00000000],
+		[-6.27337262, -0.00033248, 0.00020367, 0.00033415, -0.00000116, 0.00000000],
+		[-6.27337271, -0.00033245, 0.00020365, 0.00033412, -0.00000116, 0.00000000],
+		[-6.27337279, -0.00033241, 0.00020363, 0.00033408, -0.00000116, 0.00000000],
+		[-6.27337288, -0.00033238, 0.00020360, 0.00033405, -0.00000116, 0.00000000],
+		[-6.27337297, -0.00033234, 0.00020358, 0.00033401, -0.00000116, 0.00000000],
+		[-6.27337305, -0.00033231, 0.00020356, 0.00033397, -0.00000116, 0.00000000],
+		[-6.27337314, -0.00033227, 0.00020354, 0.00033394, -0.00000116, 0.00000000],
+		[-6.27337322, -0.00033223, 0.00020352, 0.00033390, -0.00000116, 0.00000000],
+		[-6.27337331, -0.00033220, 0.00020350, 0.00033387, -0.00000116, 0.00000000],
+		[-6.27337339, -0.00033216, 0.00020347, 0.00033383, -0.00000116, 0.00000000],
+		[-6.27337348, -0.00033213, 0.00020345, 0.00033379, -0.00000116, 0.00000000],
+		[-6.27337356, -0.00033209, 0.00020343, 0.00033376, -0.00000116, 0.00000000],
+		[-6.27337365, -0.00033206, 0.00020341, 0.00033372, -0.00000116, 0.00000000],
+		[-6.27337373, -0.00033202, 0.00020339, 0.00033369, -0.00000116, 0.00000000],
+		[-6.27337382, -0.00033198, 0.00020336, 0.00033365, -0.00000116, 0.00000000],
+		[-6.27337390, -0.00033195, 0.00020334, 0.00033362, -0.00000116, 0.00000000],
+		[-6.27337399, -0.00033191, 0.00020332, 0.00033358, -0.00000116, 0.00000000],
+		[-6.27337407, -0.00033188, 0.00020330, 0.00033354, -0.00000116, 0.00000000],
+		[-6.27337416, -0.00033184, 0.00020328, 0.00033351, -0.00000116, 0.00000000],
+		[-6.27337425, -0.00033181, 0.00020326, 0.00033347, -0.00000116, 0.00000000],
+		[-6.27337433, -0.00033177, 0.00020323, 0.00033344, -0.00000116, 0.00000000],
+		[-6.27337442, -0.00033174, 0.00020321, 0.00033340, -0.00000116, 0.00000000],
+		[-6.27337450, -0.00033170, 0.00020319, 0.00033337, -0.00000116, 0.00000000],
+		[-6.27337459, -0.00033166, 0.00020317, 0.00033333, -0.00000116, 0.00000000],
+		[-6.27337467, -0.00033163, 0.00020315, 0.00033329, -0.00000116, 0.00000000],
+		[-6.27337476, -0.00033159, 0.00020312, 0.00033326, -0.00000116, 0.00000000],
+		[-6.27337484, -0.00033156, 0.00020310, 0.00033322, -0.00000116, 0.00000000],
+		[-6.27337493, -0.00033152, 0.00020308, 0.00033319, -0.00000116, 0.00000000],
+		[-6.27337501, -0.00033149, 0.00020306, 0.00033315, -0.00000116, 0.00000000],
+		[-6.27337510, -0.00033145, 0.00020304, 0.00033312, -0.00000116, 0.00000000],
+		[-6.27337518, -0.00033142, 0.00020302, 0.00033308, -0.00000116, 0.00000000],
+		[-6.27337527, -0.00033138, 0.00020299, 0.00033304, -0.00000116, 0.00000000],
+		[-6.27337535, -0.00033135, 0.00020297, 0.00033301, -0.00000116, 0.00000000],
+		[-6.27337544, -0.00033131, 0.00020295, 0.00033297, -0.00000116, 0.00000000],
+		[-6.27337552, -0.00033127, 0.00020293, 0.00033294, -0.00000116, 0.00000000],
+		[-6.27337561, -0.00033124, 0.00020291, 0.00033290, -0.00000116, 0.00000000],
+		[-6.27337569, -0.00033120, 0.00020289, 0.00033287, -0.00000116, 0.00000000],
+		[-6.27337578, -0.00033117, 0.00020286, 0.00033283, -0.00000116, 0.00000000],
+		[-6.27337586, -0.00033113, 0.00020284, 0.00033279, -0.00000116, 0.00000000],
+		[-6.27337594, -0.00033110, 0.00020282, 0.00033276, -0.00000116, 0.00000000],
+		[-6.27337603, -0.00033106, 0.00020280, 0.00033272, -0.00000116, 0.00000000],
+		[-6.27337611, -0.00033103, 0.00020278, 0.00033269, -0.00000116, 0.00000000],
+		[-6.27337620, -0.00033099, 0.00020275, 0.00033265, -0.00000116, 0.00000000],
+		[-6.27337628, -0.00033096, 0.00020273, 0.00033262, -0.00000116, 0.00000000],
+		[-6.27337637, -0.00033092, 0.00020271, 0.00033258, -0.00000116, 0.00000000],
+		[-6.27337645, -0.00033088, 0.00020269, 0.00033255, -0.00000116, 0.00000000],
+		[-6.27337654, -0.00033085, 0.00020267, 0.00033251, -0.00000116, 0.00000000],
+		[-6.27337662, -0.00033081, 0.00020265, 0.00033247, -0.00000116, 0.00000000],
+		[-6.27337671, -0.00033078, 0.00020262, 0.00033244, -0.00000116, 0.00000000],
+		[-6.27337679, -0.00033074, 0.00020260, 0.00033240, -0.00000116, 0.00000000],
+		[-6.27337688, -0.00033071, 0.00020258, 0.00033237, -0.00000116, 0.00000000],
+		[-6.27337696, -0.00033067, 0.00020256, 0.00033233, -0.00000116, 0.00000000],
+		[-6.27337705, -0.00033064, 0.00020254, 0.00033230, -0.00000116, 0.00000000],
+		[-6.27337713, -0.00033060, 0.00020252, 0.00033226, -0.00000116, 0.00000000],
+		[-6.27337721, -0.00033057, 0.00020250, 0.00033223, -0.00000116, 0.00000000],
+		[-6.27337730, -0.00033053, 0.00020247, 0.00033219, -0.00000116, 0.00000000],
+		[-6.27337738, -0.00033050, 0.00020245, 0.00033216, -0.00000116, 0.00000000],
+		[-6.27337747, -0.00033046, 0.00020243, 0.00033212, -0.00000116, 0.00000000],
+		[-6.27337755, -0.00033043, 0.00020241, 0.00033208, -0.00000116, 0.00000000],
+		[-6.27337764, -0.00033039, 0.00020239, 0.00033205, -0.00000116, 0.00000000],
+		[-6.27337772, -0.00033035, 0.00020237, 0.00033201, -0.00000116, 0.00000000],
+		[-6.27337781, -0.00033032, 0.00020234, 0.00033198, -0.00000116, 0.00000000],
+		[-6.27337789, -0.00033028, 0.00020232, 0.00033194, -0.00000116, 0.00000000],
+		[-6.27337797, -0.00033025, 0.00020230, 0.00033191, -0.00000116, 0.00000000],
+		[-6.27337806, -0.00033021, 0.00020228, 0.00033187, -0.00000116, 0.00000000],
+		[-6.27337814, -0.00033018, 0.00020226, 0.00033184, -0.00000116, 0.00000000],
+		[-6.27337823, -0.00033014, 0.00020224, 0.00033180, -0.00000116, 0.00000000],
+		[-6.27337831, -0.00033011, 0.00020221, 0.00033177, -0.00000116, 0.00000000],
+		[-6.27337840, -0.00033007, 0.00020219, 0.00033173, -0.00000116, 0.00000000],
+		[-6.27337848, -0.00033004, 0.00020217, 0.00033169, -0.00000116, 0.00000000],
+		[-6.27337856, -0.00033000, 0.00020215, 0.00033166, -0.00000116, 0.00000000],
+		[-6.27337865, -0.00032997, 0.00020213, 0.00033162, -0.00000116, 0.00000000],
+		[-6.27337873, -0.00032993, 0.00020211, 0.00033159, -0.00000116, 0.00000000],
+		[-6.27337882, -0.00032990, 0.00020208, 0.00033155, -0.00000116, 0.00000000],
+		[-6.27337890, -0.00032986, 0.00020206, 0.00033152, -0.00000116, 0.00000000],
+		[-6.27337899, -0.00032983, 0.00020204, 0.00033148, -0.00000116, 0.00000000],
+		[-6.27337907, -0.00032979, 0.00020202, 0.00033145, -0.00000116, 0.00000000],
+		[-6.27337915, -0.00032976, 0.00020200, 0.00033141, -0.00000116, 0.00000000],
+		[-6.27337924, -0.00032972, 0.00020198, 0.00033138, -0.00000116, 0.00000000],
+		[-6.27337932, -0.00032969, 0.00020196, 0.00033134, -0.00000116, 0.00000000],
+		[-6.27337941, -0.00032965, 0.00020193, 0.00033131, -0.00000116, 0.00000000],
+		[-6.27337949, -0.00032962, 0.00020191, 0.00033127, -0.00000116, 0.00000000],
+		[-6.27337957, -0.00032958, 0.00020189, 0.00033124, -0.00000116, 0.00000000],
+		[-6.27337966, -0.00032955, 0.00020187, 0.00033120, -0.00000116, 0.00000000],
+		[-6.27337974, -0.00032951, 0.00020185, 0.00033116, -0.00000116, 0.00000000],
+		[-6.27337983, -0.00032948, 0.00020183, 0.00033113, -0.00000116, 0.00000000],
+		[-6.27337991, -0.00032944, 0.00020181, 0.00033109, -0.00000116, 0.00000000],
+		[-6.27337999, -0.00032941, 0.00020178, 0.00033106, -0.00000116, 0.00000000],
+		[-6.27338008, -0.00032937, 0.00020176, 0.00033102, -0.00000116, 0.00000000],
+		[-6.27338016, -0.00032934, 0.00020174, 0.00033099, -0.00000116, 0.00000000],
+		[-6.27338025, -0.00032930, 0.00020172, 0.00033095, -0.00000116, 0.00000000],
+		[-6.27338033, -0.00032927, 0.00020170, 0.00033092, -0.00000116, 0.00000000],
+		[-6.27338041, -0.00032923, 0.00020168, 0.00033088, -0.00000116, 0.00000000],
+		[-6.27338050, -0.00032920, 0.00020165, 0.00033085, -0.00000116, 0.00000000],
+		[-6.27338058, -0.00032916, 0.00020163, 0.00033081, -0.00000116, 0.00000000],
+		[-6.27338067, -0.00032913, 0.00020161, 0.00033078, -0.00000116, 0.00000000],
+		[-6.27338075, -0.00032909, 0.00020159, 0.00033074, -0.00000116, 0.00000000],
+		[-6.27338083, -0.00032906, 0.00020157, 0.00033071, -0.00000116, 0.00000000],
+		[-6.27338092, -0.00032902, 0.00020155, 0.00033067, -0.00000116, 0.00000000],
+		[-6.27338100, -0.00032899, 0.00020153, 0.00033064, -0.00000116, 0.00000000],
+		[-6.27338108, -0.00032895, 0.00020150, 0.00033060, -0.00000116, 0.00000000],
+		[-6.27338117, -0.00032892, 0.00020148, 0.00033057, -0.00000116, 0.00000000],
+		[-6.27338125, -0.00032888, 0.00020146, 0.00033053, -0.00000116, 0.00000000],
+		[-6.27338134, -0.00032885, 0.00020144, 0.00033050, -0.00000116, 0.00000000],
+		[-6.27338142, -0.00032881, 0.00020142, 0.00033046, -0.00000116, 0.00000000],
+		[-6.27338150, -0.00032878, 0.00020140, 0.00033043, -0.00000116, 0.00000000],
+		[-6.27338159, -0.00032874, 0.00020138, 0.00033039, -0.00000116, 0.00000000],
+		[-6.27338167, -0.00032871, 0.00020135, 0.00033036, -0.00000116, 0.00000000],
+		[-6.27338175, -0.00032867, 0.00020133, 0.00033032, -0.00000116, 0.00000000],
+		[-6.27338184, -0.00032864, 0.00020131, 0.00033029, -0.00000116, 0.00000000],
+		[-6.27338192, -0.00032860, 0.00020129, 0.00033025, -0.00000116, 0.00000000],
+		[-6.27338200, -0.00032857, 0.00020127, 0.00033022, -0.00000116, 0.00000000],
+		[-6.27338209, -0.00032853, 0.00020125, 0.00033018, -0.00000116, 0.00000000],
+		[-6.27338217, -0.00032850, 0.00020123, 0.00033015, -0.00000116, 0.00000000],
+		[-6.27338225, -0.00032846, 0.00020121, 0.00033011, -0.00000116, 0.00000000],
+		[-6.27338234, -0.00032843, 0.00020118, 0.00033008, -0.00000116, 0.00000000],
+		[-6.27338242, -0.00032839, 0.00020116, 0.00033004, -0.00000116, 0.00000000],
+		[-6.27338250, -0.00032836, 0.00020114, 0.00033001, -0.00000116, 0.00000000],
+		[-6.27338259, -0.00032832, 0.00020112, 0.00032997, -0.00000116, 0.00000000],
+		[-6.27338267, -0.00032829, 0.00020110, 0.00032994, -0.00000116, 0.00000000],
+		[-6.27338275, -0.00032825, 0.00020108, 0.00032990, -0.00000116, 0.00000000],
+		[-6.27338284, -0.00032822, 0.00020106, 0.00032987, -0.00000116, 0.00000000],
+		[-6.27338292, -0.00032818, 0.00020103, 0.00032983, -0.00000116, 0.00000000],
+		[-6.27338300, -0.00032815, 0.00020101, 0.00032980, -0.00000116, 0.00000000],
+		[-6.27338309, -0.00032811, 0.00020099, 0.00032976, -0.00000116, 0.00000000],
+		[-6.27338317, -0.00032808, 0.00020097, 0.00032973, -0.00000116, 0.00000000],
+		[-6.27338325, -0.00032804, 0.00020095, 0.00032969, -0.00000116, 0.00000000],
+		[-6.27338334, -0.00032801, 0.00020093, 0.00032966, -0.00000116, 0.00000000],
+		[-6.27338342, -0.00032797, 0.00020091, 0.00032962, -0.00000116, 0.00000000],
+		[-6.27338350, -0.00032794, 0.00020089, 0.00032959, -0.00000116, 0.00000000],
+		[-6.27338359, -0.00032791, 0.00020086, 0.00032955, -0.00000116, 0.00000000],
+		[-6.27338367, -0.00032787, 0.00020084, 0.00032952, -0.00000116, 0.00000000],
+		[-6.27338375, -0.00032784, 0.00020082, 0.00032948, -0.00000116, 0.00000000],
+		[-6.27338384, -0.00032780, 0.00020080, 0.00032945, -0.00000116, 0.00000000],
+		[-6.27338392, -0.00032777, 0.00020078, 0.00032941, -0.00000116, 0.00000000],
+		[-6.27338400, -0.00032773, 0.00020076, 0.00032938, -0.00000116, 0.00000000],
+		[-6.27338409, -0.00032770, 0.00020074, 0.00032934, -0.00000116, 0.00000000],
+		[-6.27338417, -0.00032766, 0.00020072, 0.00032931, -0.00000116, 0.00000000],
+		[-6.27338425, -0.00032763, 0.00020069, 0.00032927, -0.00000116, 0.00000000],
+		[-6.27338433, -0.00032759, 0.00020067, 0.00032924, -0.00000116, 0.00000000],
+		[-6.27338442, -0.00032756, 0.00020065, 0.00032920, -0.00000116, 0.00000000],
+		[-6.27338450, -0.00032752, 0.00020063, 0.00032917, -0.00000116, 0.00000000],
+		[-6.27338458, -0.00032749, 0.00020061, 0.00032913, -0.00000116, 0.00000000],
+		[-6.27338467, -0.00032745, 0.00020059, 0.00032910, -0.00000116, 0.00000000],
+		[-6.27338475, -0.00032742, 0.00020057, 0.00032906, -0.00000116, 0.00000000],
+		[-6.27338483, -0.00032739, 0.00020055, 0.00032903, -0.00000116, 0.00000000],
+		[-6.27338492, -0.00032735, 0.00020052, 0.00032899, -0.00000116, 0.00000000],
+		[-6.27338500, -0.00032732, 0.00020050, 0.00032896, -0.00000116, 0.00000000],
+		[-6.27338508, -0.00032728, 0.00020048, 0.00032892, -0.00000116, 0.00000000],
+		[-6.27338516, -0.00032725, 0.00020046, 0.00032889, -0.00000116, 0.00000000],
+		[-6.27338525, -0.00032721, 0.00020044, 0.00032885, -0.00000116, 0.00000000],
+		[-6.27338533, -0.00032718, 0.00020042, 0.00032882, -0.00000116, 0.00000000],
+		[-6.27338541, -0.00032714, 0.00020040, 0.00032878, -0.00000116, 0.00000000],
+		[-6.27338550, -0.00032711, 0.00020038, 0.00032875, -0.00000116, 0.00000000],
+		[-6.27338558, -0.00032707, 0.00020035, 0.00032872, -0.00000116, 0.00000000],
+		[-6.27338566, -0.00032704, 0.00020033, 0.00032868, -0.00000116, 0.00000000],
+		[-6.27338574, -0.00032700, 0.00020031, 0.00032865, -0.00000116, 0.00000000],
+		[-6.27338583, -0.00032697, 0.00020029, 0.00032861, -0.00000116, 0.00000000],
+		[-6.27338591, -0.00032694, 0.00020027, 0.00032858, -0.00000116, 0.00000000],
+		[-6.27338599, -0.00032690, 0.00020025, 0.00032854, -0.00000116, 0.00000000],
+		[-6.27338607, -0.00032687, 0.00020023, 0.00032851, -0.00000116, 0.00000000],
+		[-6.27338616, -0.00032683, 0.00020021, 0.00032847, -0.00000116, 0.00000000],
+		[-6.27338624, -0.00032680, 0.00020019, 0.00032844, -0.00000116, 0.00000000],
+		[-6.27338632, -0.00032676, 0.00020016, 0.00032840, -0.00000116, 0.00000000],
+		[-6.27338640, -0.00032673, 0.00020014, 0.00032837, -0.00000116, 0.00000000],
+		[-6.27338649, -0.00032669, 0.00020012, 0.00032833, -0.00000116, 0.00000000],
+		[-6.27338657, -0.00032666, 0.00020010, 0.00032830, -0.00000116, 0.00000000],
+		[-6.27338665, -0.00032663, 0.00020008, 0.00032826, -0.00000116, 0.00000000],
+		[-6.27338674, -0.00032659, 0.00020006, 0.00032823, -0.00000116, 0.00000000],
+		[-6.27338682, -0.00032656, 0.00020004, 0.00032820, -0.00000116, 0.00000000],
+		[-6.27338690, -0.00032652, 0.00020002, 0.00032816, -0.00000116, 0.00000000],
+		[-6.27338698, -0.00032649, 0.00020000, 0.00032813, -0.00000116, 0.00000000],
+		[-6.27338706, -0.00032645, 0.00019997, 0.00032809, -0.00000116, 0.00000000],
+		[-6.27338715, -0.00032642, 0.00019995, 0.00032806, -0.00000116, 0.00000000],
+		[-6.27338723, -0.00032638, 0.00019993, 0.00032802, -0.00000116, 0.00000000],
+		[-6.27338731, -0.00032635, 0.00019991, 0.00032799, -0.00000116, 0.00000000],
+		[-6.27338739, -0.00032632, 0.00019989, 0.00032795, -0.00000116, 0.00000000],
+		[-6.27338748, -0.00032628, 0.00019987, 0.00032792, -0.00000116, 0.00000000],
+		[-6.27338756, -0.00032625, 0.00019985, 0.00032788, -0.00000116, 0.00000000],
+		[-6.27338764, -0.00032621, 0.00019983, 0.00032785, -0.00000116, 0.00000000],
+		[-6.27338772, -0.00032618, 0.00019981, 0.00032781, -0.00000116, 0.00000000],
+		[-6.27338781, -0.00032614, 0.00019978, 0.00032778, -0.00000116, 0.00000000],
+		[-6.27338789, -0.00032611, 0.00019976, 0.00032775, -0.00000116, 0.00000000],
+		[-6.27338797, -0.00032607, 0.00019974, 0.00032771, -0.00000116, 0.00000000],
+		[-6.27338805, -0.00032604, 0.00019972, 0.00032768, -0.00000116, 0.00000000],
+		[-6.27338814, -0.00032601, 0.00019970, 0.00032764, -0.00000116, 0.00000000],
+		[-6.27338822, -0.00032597, 0.00019968, 0.00032761, -0.00000116, 0.00000000],
+		[-6.27338830, -0.00032594, 0.00019966, 0.00032757, -0.00000116, 0.00000000],
+		[-6.27338838, -0.00032590, 0.00019964, 0.00032754, -0.00000116, 0.00000000],
+		[-6.27338846, -0.00032587, 0.00019962, 0.00032750, -0.00000116, 0.00000000],
+		[-6.27338855, -0.00032583, 0.00019960, 0.00032747, -0.00000116, 0.00000000],
+		[-6.27338863, -0.00032580, 0.00019957, 0.00032744, -0.00000116, 0.00000000],
+		[-6.27338871, -0.00032577, 0.00019955, 0.00032740, -0.00000116, 0.00000000],
+		[-6.27338879, -0.00032573, 0.00019953, 0.00032737, -0.00000116, 0.00000000],
+		[-6.27338887, -0.00032570, 0.00019951, 0.00032733, -0.00000116, 0.00000000],
+		[-6.27338896, -0.00032566, 0.00019949, 0.00032730, -0.00000116, 0.00000000],
+		[-6.27338904, -0.00032563, 0.00019947, 0.00032726, -0.00000116, 0.00000000],
+		[-6.27338912, -0.00032559, 0.00019945, 0.00032723, -0.00000116, 0.00000000],
+		[-6.27338920, -0.00032556, 0.00019943, 0.00032719, -0.00000116, 0.00000000],
+		[-6.27338928, -0.00032553, 0.00019941, 0.00032716, -0.00000116, 0.00000000],
+		[-6.27338937, -0.00032549, 0.00019939, 0.00032713, -0.00000116, 0.00000000],
+		[-6.27338945, -0.00032546, 0.00019936, 0.00032709, -0.00000116, 0.00000000],
+		[-6.27338953, -0.00032542, 0.00019934, 0.00032706, -0.00000116, 0.00000000],
+		[-6.27338961, -0.00032539, 0.00019932, 0.00032702, -0.00000116, 0.00000000],
+		[-6.27338969, -0.00032536, 0.00019930, 0.00032699, -0.00000116, 0.00000000],
+		[-6.27338978, -0.00032532, 0.00019928, 0.00032695, -0.00000116, 0.00000000],
+		[-6.27338986, -0.00032529, 0.00019926, 0.00032692, -0.00000116, 0.00000000],
+		[-6.27338994, -0.00032525, 0.00019924, 0.00032688, -0.00000116, 0.00000000],
+		[-6.27339002, -0.00032522, 0.00019922, 0.00032685, -0.00000116, 0.00000000],
+		[-6.27339010, -0.00032518, 0.00019920, 0.00032682, -0.00000116, 0.00000000],
+		[-6.27339019, -0.00032515, 0.00019918, 0.00032678, -0.00000116, 0.00000000],
+		[-6.27339027, -0.00032512, 0.00019915, 0.00032675, -0.00000116, 0.00000000],
+		[-6.27339035, -0.00032508, 0.00019913, 0.00032671, -0.00000116, 0.00000000],
+		[-6.27339043, -0.00032505, 0.00019911, 0.00032668, -0.00000116, 0.00000000],
+		[-6.27339051, -0.00032501, 0.00019909, 0.00032664, -0.00000116, 0.00000000],
+		[-6.27339059, -0.00032498, 0.00019907, 0.00032661, -0.00000116, 0.00000000],
+		[-6.27339068, -0.00032495, 0.00019905, 0.00032658, -0.00000116, 0.00000000],
+		[-6.27339076, -0.00032491, 0.00019903, 0.00032654, -0.00000116, 0.00000000],
+		[-6.27339084, -0.00032488, 0.00019901, 0.00032651, -0.00000116, 0.00000000],
+		[-6.27339092, -0.00032484, 0.00019899, 0.00032647, -0.00000116, 0.00000000],
+		[-6.27339100, -0.00032481, 0.00019897, 0.00032644, -0.00000116, 0.00000000],
+		[-6.27339108, -0.00032477, 0.00019895, 0.00032640, -0.00000116, 0.00000000],
+		[-6.27339117, -0.00032474, 0.00019892, 0.00032637, -0.00000116, 0.00000000],
+		[-6.27339125, -0.00032471, 0.00019890, 0.00032634, -0.00000116, 0.00000000],
+		[-6.27339133, -0.00032467, 0.00019888, 0.00032630, -0.00000116, 0.00000000],
+		[-6.27339141, -0.00032464, 0.00019886, 0.00032627, -0.00000116, 0.00000000],
+		[-6.27339149, -0.00032460, 0.00019884, 0.00032623, -0.00000116, 0.00000000],
+		[-6.27339157, -0.00032457, 0.00019882, 0.00032620, -0.00000116, 0.00000000],
+		[-6.27339165, -0.00032454, 0.00019880, 0.00032617, -0.00000116, 0.00000000],
+		[-6.27339174, -0.00032450, 0.00019878, 0.00032613, -0.00000116, 0.00000000],
+		[-6.27339182, -0.00032447, 0.00019876, 0.00032610, -0.00000116, 0.00000000],
+		[-6.27339190, -0.00032443, 0.00019874, 0.00032606, -0.00000116, 0.00000000],
+		[-6.27339198, -0.00032440, 0.00019872, 0.00032603, -0.00000116, 0.00000000],
+		[-6.27339206, -0.00032437, 0.00019870, 0.00032599, -0.00000116, 0.00000000],
+		[-6.27339214, -0.00032433, 0.00019867, 0.00032596, -0.00000116, 0.00000000],
+		[-6.27339222, -0.00032430, 0.00019865, 0.00032593, -0.00000116, 0.00000000],
+		[-6.27339231, -0.00032426, 0.00019863, 0.00032589, -0.00000116, 0.00000000],
+		[-6.27339239, -0.00032423, 0.00019861, 0.00032586, -0.00000116, 0.00000000],
+		[-6.27339247, -0.00032420, 0.00019859, 0.00032582, -0.00000116, 0.00000000],
+		[-6.27339255, -0.00032416, 0.00019857, 0.00032579, -0.00000116, 0.00000000],
+		[-6.27339263, -0.00032413, 0.00019855, 0.00032576, -0.00000116, 0.00000000],
+		[-6.27339271, -0.00032409, 0.00019853, 0.00032572, -0.00000116, 0.00000000],
+		[-6.27339279, -0.00032406, 0.00019851, 0.00032569, -0.00000116, 0.00000000],
+		[-6.27339287, -0.00032403, 0.00019849, 0.00032565, -0.00000116, 0.00000000],
+		[-6.27339296, -0.00032399, 0.00019847, 0.00032562, -0.00000116, 0.00000000],
+		[-6.27339304, -0.00032396, 0.00019845, 0.00032558, -0.00000116, 0.00000000],
+		[-6.27339312, -0.00032393, 0.00019843, 0.00032555, -0.00000116, 0.00000000],
+		[-6.27339320, -0.00032389, 0.00019840, 0.00032552, -0.00000116, 0.00000000],
+		[-6.27339328, -0.00032386, 0.00019838, 0.00032548, -0.00000116, 0.00000000],
+		[-6.27339336, -0.00032382, 0.00019836, 0.00032545, -0.00000116, 0.00000000],
+		[-6.27339344, -0.00032379, 0.00019834, 0.00032541, -0.00000116, 0.00000000],
+		[-6.27339352, -0.00032376, 0.00019832, 0.00032538, -0.00000116, 0.00000000],
+		[-6.27339360, -0.00032372, 0.00019830, 0.00032535, -0.00000116, 0.00000000],
+		[-6.27339369, -0.00032369, 0.00019828, 0.00032531, -0.00000116, 0.00000000],
+		[-6.27339377, -0.00032365, 0.00019826, 0.00032528, -0.00000116, 0.00000000],
+		[-6.27339385, -0.00032362, 0.00019824, 0.00032524, -0.00000116, 0.00000000],
+		[-6.27339393, -0.00032359, 0.00019822, 0.00032521, -0.00000116, 0.00000000],
+		[-6.27339401, -0.00032355, 0.00019820, 0.00032518, -0.00000116, 0.00000000],
+		[-6.27339409, -0.00032352, 0.00019818, 0.00032514, -0.00000116, 0.00000000],
+		[-6.27339417, -0.00032349, 0.00019816, 0.00032511, -0.00000116, 0.00000000],
+		[-6.27339425, -0.00032345, 0.00019813, 0.00032507, -0.00000116, 0.00000000],
+		[-6.27339433, -0.00032342, 0.00019811, 0.00032504, -0.00000116, 0.00000000],
+		[-6.27339441, -0.00032338, 0.00019809, 0.00032501, -0.00000116, 0.00000000],
+		[-6.27339450, -0.00032335, 0.00019807, 0.00032497, -0.00000116, 0.00000000],
+		[-6.27339458, -0.00032332, 0.00019805, 0.00032494, -0.00000116, 0.00000000],
+		[-6.27339466, -0.00032328, 0.00019803, 0.00032490, -0.00000116, 0.00000000],
+		[-6.27339474, -0.00032325, 0.00019801, 0.00032487, -0.00000116, 0.00000000],
+		[-6.27339482, -0.00032321, 0.00019799, 0.00032484, -0.00000116, 0.00000000],
+		[-6.27339490, -0.00032318, 0.00019797, 0.00032480, -0.00000116, 0.00000000],
+		[-6.27339498, -0.00032315, 0.00019795, 0.00032477, -0.00000116, 0.00000000],
+		[-6.27339506, -0.00032311, 0.00019793, 0.00032473, -0.00000116, 0.00000000],
+		[-6.27339514, -0.00032308, 0.00019791, 0.00032470, -0.00000116, 0.00000000],
+		[-6.27339522, -0.00032305, 0.00019789, 0.00032467, -0.00000116, 0.00000000],
+		[-6.27339530, -0.00032301, 0.00019787, 0.00032463, -0.00000116, 0.00000000],
+		[-6.27339538, -0.00032298, 0.00019785, 0.00032460, -0.00000116, 0.00000000],
+		[-6.27339546, -0.00032295, 0.00019782, 0.00032457, -0.00000116, 0.00000000],
+		[-6.27339555, -0.00032291, 0.00019780, 0.00032453, -0.00000116, 0.00000000],
+		[-6.27339563, -0.00032288, 0.00019778, 0.00032450, -0.00000116, 0.00000000],
+		[-6.27339571, -0.00032284, 0.00019776, 0.00032446, -0.00000116, 0.00000000],
+		[-6.27339579, -0.00032281, 0.00019774, 0.00032443, -0.00000116, 0.00000000],
+		[-6.27339587, -0.00032278, 0.00019772, 0.00032440, -0.00000116, 0.00000000],
+		[-6.27339595, -0.00032274, 0.00019770, 0.00032436, -0.00000116, 0.00000000],
+		[-6.27339603, -0.00032271, 0.00019768, 0.00032433, -0.00000116, 0.00000000],
+		[-6.27339611, -0.00032268, 0.00019766, 0.00032429, -0.00000116, 0.00000000],
+		[-6.27339619, -0.00032264, 0.00019764, 0.00032426, -0.00000116, 0.00000000],
+		[-6.27339627, -0.00032261, 0.00019762, 0.00032423, -0.00000116, 0.00000000],
+		[-6.27339635, -0.00032258, 0.00019760, 0.00032419, -0.00000116, 0.00000000],
+		[-6.27339643, -0.00032254, 0.00019758, 0.00032416, -0.00000116, 0.00000000],
+		[-6.27339651, -0.00032251, 0.00019756, 0.00032413, -0.00000116, 0.00000000],
+		[-6.27339659, -0.00032247, 0.00019754, 0.00032409, -0.00000116, 0.00000000],
+		[-6.27339667, -0.00032244, 0.00019752, 0.00032406, -0.00000116, 0.00000000],
+		[-6.27339675, -0.00032241, 0.00019749, 0.00032402, -0.00000116, 0.00000000],
+		[-6.27339683, -0.00032237, 0.00019747, 0.00032399, -0.00000116, 0.00000000],
+		[-6.27339691, -0.00032234, 0.00019745, 0.00032396, -0.00000116, 0.00000000],
+		[-6.27339699, -0.00032231, 0.00019743, 0.00032392, -0.00000116, 0.00000000],
+		[-6.27339708, -0.00032227, 0.00019741, 0.00032389, -0.00000116, 0.00000000],
+		[-6.27339716, -0.00032224, 0.00019739, 0.00032386, -0.00000116, 0.00000000],
+		[-6.27339724, -0.00032221, 0.00019737, 0.00032382, -0.00000116, 0.00000000],
+		[-6.27339732, -0.00032217, 0.00019735, 0.00032379, -0.00000116, 0.00000000],
+		[-6.27339740, -0.00032214, 0.00019733, 0.00032375, -0.00000116, 0.00000000],
+		[-6.27339748, -0.00032210, 0.00019731, 0.00032372, -0.00000116, 0.00000000],
+		[-6.27339756, -0.00032207, 0.00019729, 0.00032369, -0.00000116, 0.00000000],
+		[-6.27339764, -0.00032204, 0.00019727, 0.00032365, -0.00000116, 0.00000000],
+		[-6.27339772, -0.00032200, 0.00019725, 0.00032362, -0.00000116, 0.00000000],
+		[-6.27339780, -0.00032197, 0.00019723, 0.00032359, -0.00000116, 0.00000000],
+		[-6.27339788, -0.00032194, 0.00019721, 0.00032355, -0.00000116, 0.00000000],
+		[-6.27339796, -0.00032190, 0.00019719, 0.00032352, -0.00000116, 0.00000000],
+		[-6.27339804, -0.00032187, 0.00019717, 0.00032349, -0.00000116, 0.00000000],
+		[-6.27339812, -0.00032184, 0.00019715, 0.00032345, -0.00000116, 0.00000000],
+		[-6.27339820, -0.00032180, 0.00019713, 0.00032342, -0.00000116, 0.00000000],
+		[-6.27339828, -0.00032177, 0.00019710, 0.00032338, -0.00000116, 0.00000000],
+		[-6.27339836, -0.00032174, 0.00019708, 0.00032335, -0.00000116, 0.00000000],
+		[-6.27339844, -0.00032170, 0.00019706, 0.00032332, -0.00000116, 0.00000000],
+		[-6.27339852, -0.00032167, 0.00019704, 0.00032328, -0.00000116, 0.00000000],
+		[-6.27339860, -0.00032164, 0.00019702, 0.00032325, -0.00000116, 0.00000000],
+		[-6.27339868, -0.00032160, 0.00019700, 0.00032322, -0.00000116, 0.00000000],
+		[-6.27339876, -0.00032157, 0.00019698, 0.00032318, -0.00000116, 0.00000000],
+		[-6.27339884, -0.00032154, 0.00019696, 0.00032315, -0.00000116, 0.00000000],
+		[-6.27339892, -0.00032150, 0.00019694, 0.00032312, -0.00000116, 0.00000000],
+		[-6.27339900, -0.00032147, 0.00019692, 0.00032308, -0.00000116, 0.00000000],
+		[-6.27339908, -0.00032144, 0.00019690, 0.00032305, -0.00000116, 0.00000000],
+		[-6.27339916, -0.00032140, 0.00019688, 0.00032302, -0.00000116, 0.00000000],
+		[-6.27339924, -0.00032137, 0.00019686, 0.00032298, -0.00000116, 0.00000000],
+		[-6.27339932, -0.00032134, 0.00019684, 0.00032295, -0.00000116, 0.00000000],
+		[-6.27339940, -0.00032130, 0.00019682, 0.00032291, -0.00000116, 0.00000000],
+		[-6.27339948, -0.00032127, 0.00019680, 0.00032288, -0.00000116, 0.00000000],
+		[-6.27339956, -0.00032124, 0.00019678, 0.00032285, -0.00000116, 0.00000000],
+		[-6.27339964, -0.00032120, 0.00019676, 0.00032281, -0.00000116, 0.00000000],
+		[-6.27339972, -0.00032117, 0.00019674, 0.00032278, -0.00000116, 0.00000000],
+		[-6.27339980, -0.00032114, 0.00019672, 0.00032275, -0.00000116, 0.00000000],
+		[-6.27339988, -0.00032110, 0.00019670, 0.00032271, -0.00000116, 0.00000000],
+		[-6.27339996, -0.00032107, 0.00019668, 0.00032268, -0.00000116, 0.00000000],
+		[-6.27340004, -0.00032104, 0.00019665, 0.00032265, -0.00000116, 0.00000000],
+		[-6.27340012, -0.00032100, 0.00019663, 0.00032261, -0.00000116, 0.00000000],
+		[-6.27340020, -0.00032097, 0.00019661, 0.00032258, -0.00000116, 0.00000000],
+		[-6.27340028, -0.00032094, 0.00019659, 0.00032255, -0.00000116, 0.00000000],
+		[-6.27340036, -0.00032090, 0.00019657, 0.00032251, -0.00000116, 0.00000000],
+		[-6.27340043, -0.00032087, 0.00019655, 0.00032248, -0.00000116, 0.00000000],
+		[-6.27340051, -0.00032084, 0.00019653, 0.00032245, -0.00000116, 0.00000000],
+		[-6.27340059, -0.00032080, 0.00019651, 0.00032241, -0.00000116, 0.00000000],
+		[-6.27340067, -0.00032077, 0.00019649, 0.00032238, -0.00000116, 0.00000000],
+		[-6.27340075, -0.00032074, 0.00019647, 0.00032235, -0.00000116, 0.00000000],
+		[-6.27340083, -0.00032070, 0.00019645, 0.00032231, -0.00000116, 0.00000000],
+		[-6.27340091, -0.00032067, 0.00019643, 0.00032228, -0.00000116, 0.00000000],
+		[-6.27340099, -0.00032064, 0.00019641, 0.00032225, -0.00000116, 0.00000000],
+		[-6.27340107, -0.00032060, 0.00019639, 0.00032221, -0.00000116, 0.00000000],
+		[-6.27340115, -0.00032057, 0.00019637, 0.00032218, -0.00000116, 0.00000000],
+		[-6.27340123, -0.00032054, 0.00019635, 0.00032215, -0.00000116, 0.00000000],
+		[-6.27340131, -0.00032050, 0.00019633, 0.00032211, -0.00000116, 0.00000000],
+		[-6.27340139, -0.00032047, 0.00019631, 0.00032208, -0.00000116, 0.00000000],
+		[-6.27340147, -0.00032044, 0.00019629, 0.00032205, -0.00000116, 0.00000000],
+		[-6.27340155, -0.00032040, 0.00019627, 0.00032201, -0.00000116, 0.00000000],
+		[-6.27340163, -0.00032037, 0.00019625, 0.00032198, -0.00000116, 0.00000000],
+		[-6.27340171, -0.00032034, 0.00019623, 0.00032195, -0.00000116, 0.00000000],
+		[-6.27340179, -0.00032031, 0.00019621, 0.00032191, -0.00000116, 0.00000000],
+		[-6.27340187, -0.00032027, 0.00019619, 0.00032188, -0.00000116, 0.00000000],
+		[-6.27340194, -0.00032024, 0.00019617, 0.00032185, -0.00000116, 0.00000000],
+		[-6.27340202, -0.00032021, 0.00019615, 0.00032181, -0.00000116, 0.00000000],
+		[-6.27340210, -0.00032017, 0.00019613, 0.00032178, -0.00000116, 0.00000000],
+		[-6.27340218, -0.00032014, 0.00019611, 0.00032175, -0.00000116, 0.00000000],
+		[-6.27340226, -0.00032011, 0.00019608, 0.00032171, -0.00000116, 0.00000000],
+		[-6.27340234, -0.00032007, 0.00019606, 0.00032168, -0.00000116, 0.00000000],
+		[-6.27340242, -0.00032004, 0.00019604, 0.00032165, -0.00000116, 0.00000000],
+		[-6.27340250, -0.00032001, 0.00019602, 0.00032161, -0.00000116, 0.00000000],
+		[-6.27340258, -0.00031997, 0.00019600, 0.00032158, -0.00000116, 0.00000000],
+		[-6.27340266, -0.00031994, 0.00019598, 0.00032155, -0.00000116, 0.00000000],
+		[-6.27340274, -0.00031991, 0.00019596, 0.00032151, -0.00000116, 0.00000000],
+		[-6.27340282, -0.00031987, 0.00019594, 0.00032148, -0.00000116, 0.00000000],
+		[-6.27340290, -0.00031984, 0.00019592, 0.00032145, -0.00000116, 0.00000000],
+		[-6.27340297, -0.00031981, 0.00019590, 0.00032141, -0.00000116, 0.00000000],
+		[-6.27340305, -0.00031978, 0.00019588, 0.00032138, -0.00000116, 0.00000000],
+		[-6.27340313, -0.00031974, 0.00019586, 0.00032135, -0.00000116, 0.00000000],
+		[-6.27340321, -0.00031971, 0.00019584, 0.00032131, -0.00000116, 0.00000000],
+		[-6.27340329, -0.00031968, 0.00019582, 0.00032128, -0.00000116, 0.00000000],
+		[-6.27340337, -0.00031964, 0.00019580, 0.00032125, -0.00000116, 0.00000000],
+		[-6.27340345, -0.00031961, 0.00019578, 0.00032121, -0.00000116, 0.00000000],
+		[-6.27340353, -0.00031958, 0.00019576, 0.00032118, -0.00000116, 0.00000000],
+		[-6.27340361, -0.00031954, 0.00019574, 0.00032115, -0.00000116, 0.00000000],
+		[-6.27340369, -0.00031951, 0.00019572, 0.00032111, -0.00000116, 0.00000000],
+		[-6.27340377, -0.00031948, 0.00019570, 0.00032108, -0.00000116, 0.00000000],
+		[-6.27340384, -0.00031945, 0.00019568, 0.00032105, -0.00000116, 0.00000000],
+		[-6.27340392, -0.00031941, 0.00019566, 0.00032102, -0.00000116, 0.00000000],
+		[-6.27340400, -0.00031938, 0.00019564, 0.00032098, -0.00000116, 0.00000000],
+		[-6.27340408, -0.00031935, 0.00019562, 0.00032095, -0.00000116, 0.00000000],
+		[-6.27340416, -0.00031931, 0.00019560, 0.00032092, -0.00000116, 0.00000000],
+		[-6.27340424, -0.00031928, 0.00019558, 0.00032088, -0.00000116, 0.00000000],
+		[-6.27340432, -0.00031925, 0.00019556, 0.00032085, -0.00000116, 0.00000000],
+		[-6.27340440, -0.00031922, 0.00019554, 0.00032082, -0.00000116, 0.00000000],
+		[-6.27340448, -0.00031918, 0.00019552, 0.00032078, -0.00000116, 0.00000000],
+		[-6.27340455, -0.00031915, 0.00019550, 0.00032075, -0.00000116, 0.00000000],
+		[-6.27340463, -0.00031912, 0.00019548, 0.00032072, -0.00000116, 0.00000000],
+		[-6.27340471, -0.00031908, 0.00019546, 0.00032068, -0.00000116, 0.00000000],
+		[-6.27340479, -0.00031905, 0.00019544, 0.00032065, -0.00000116, 0.00000000],
+		[-6.27340487, -0.00031902, 0.00019542, 0.00032062, -0.00000116, 0.00000000],
+		[-6.27340495, -0.00031899, 0.00019540, 0.00032059, -0.00000116, 0.00000000],
+		[-6.27340503, -0.00031895, 0.00019538, 0.00032055, -0.00000116, 0.00000000],
+		[-6.27340511, -0.00031892, 0.00019536, 0.00032052, -0.00000116, 0.00000000],
+		[-6.27340518, -0.00031889, 0.00019534, 0.00032049, -0.00000116, 0.00000000],
+		[-6.27340526, -0.00031885, 0.00019532, 0.00032045, -0.00000116, 0.00000000],
+		[-6.27340534, -0.00031882, 0.00019530, 0.00032042, -0.00000116, 0.00000000],
+		[-6.27340542, -0.00031879, 0.00019528, 0.00032039, -0.00000116, 0.00000000],
+		[-6.27340550, -0.00031876, 0.00019526, 0.00032035, -0.00000116, 0.00000000],
+		[-6.27340558, -0.00031872, 0.00019524, 0.00032032, -0.00000116, 0.00000000],
+		[-6.27340566, -0.00031869, 0.00019522, 0.00032029, -0.00000116, 0.00000000],
+		[-6.27340573, -0.00031866, 0.00019520, 0.00032026, -0.00000116, 0.00000000],
+		[-6.27340581, -0.00031862, 0.00019518, 0.00032022, -0.00000116, 0.00000000],
+		[-6.27340589, -0.00031859, 0.00019516, 0.00032019, -0.00000116, 0.00000000],
+		[-6.27340597, -0.00031856, 0.00019514, 0.00032016, -0.00000116, 0.00000000],
+		[-6.27340605, -0.00031853, 0.00019512, 0.00032012, -0.00000116, 0.00000000],
+		[-6.27340613, -0.00031849, 0.00019510, 0.00032009, -0.00000116, 0.00000000],
+		[-6.27340621, -0.00031846, 0.00019508, 0.00032006, -0.00000116, 0.00000000],
+		[-6.27340628, -0.00031843, 0.00019506, 0.00032002, -0.00000116, 0.00000000],
+		[-6.27340636, -0.00031839, 0.00019504, 0.00031999, -0.00000116, 0.00000000],
+		[-6.27340644, -0.00031836, 0.00019502, 0.00031996, -0.00000116, 0.00000000],
+		[-6.27340652, -0.00031833, 0.00019500, 0.00031993, -0.00000116, 0.00000000],
+		[-6.27340660, -0.00031830, 0.00019498, 0.00031989, -0.00000116, 0.00000000],
+		[-6.27340668, -0.00031826, 0.00019496, 0.00031986, -0.00000116, 0.00000000],
+		[-6.27340675, -0.00031823, 0.00019494, 0.00031983, -0.00000116, 0.00000000],
+		[-6.27340683, -0.00031820, 0.00019492, 0.00031979, -0.00000116, 0.00000000],
+		[-6.27340691, -0.00031817, 0.00019490, 0.00031976, -0.00000116, 0.00000000],
+		[-6.27340699, -0.00031813, 0.00019488, 0.00031973, -0.00000116, 0.00000000],
+		[-6.27340707, -0.00031810, 0.00019486, 0.00031970, -0.00000116, 0.00000000],
+		[-6.27340715, -0.00031807, 0.00019484, 0.00031966, -0.00000116, 0.00000000],
+		[-6.27340722, -0.00031803, 0.00019482, 0.00031963, -0.00000116, 0.00000000],
+		[-6.27340730, -0.00031800, 0.00019480, 0.00031960, -0.00000116, 0.00000000],
+		[-6.27340738, -0.00031797, 0.00019478, 0.00031956, -0.00000116, 0.00000000],
+		[-6.27340746, -0.00031794, 0.00019476, 0.00031953, -0.00000116, 0.00000000],
+		[-6.27340754, -0.00031790, 0.00019474, 0.00031950, -0.00000116, 0.00000000],
+		[-6.27340761, -0.00031787, 0.00019472, 0.00031947, -0.00000116, 0.00000000],
+		[-6.27340769, -0.00031784, 0.00019470, 0.00031943, -0.00000116, 0.00000000],
+		[-6.27340777, -0.00031781, 0.00019468, 0.00031940, -0.00000116, 0.00000000],
+		[-6.27340785, -0.00031777, 0.00019466, 0.00031937, -0.00000116, 0.00000000],
+		[-6.27340793, -0.00031774, 0.00019464, 0.00031933, -0.00000116, 0.00000000],
+		[-6.27340801, -0.00031771, 0.00019462, 0.00031930, -0.00000116, 0.00000000],
+		[-6.27340808, -0.00031768, 0.00019460, 0.00031927, -0.00000116, 0.00000000],
+		[-6.27340816, -0.00031764, 0.00019458, 0.00031924, -0.00000116, 0.00000000],
+		[-6.27340824, -0.00031761, 0.00019456, 0.00031920, -0.00000116, 0.00000000],
+		[-6.27340832, -0.00031758, 0.00019454, 0.00031917, -0.00000116, 0.00000000],
+		[-6.27340840, -0.00031755, 0.00019452, 0.00031914, -0.00000116, 0.00000000],
+		[-6.27340847, -0.00031751, 0.00019450, 0.00031911, -0.00000116, 0.00000000],
+		[-6.27340855, -0.00031748, 0.00019448, 0.00031907, -0.00000116, 0.00000000],
+		[-6.27340863, -0.00031745, 0.00019446, 0.00031904, -0.00000116, 0.00000000],
+		[-6.27340871, -0.00031742, 0.00019444, 0.00031901, -0.00000116, 0.00000000],
+		[-6.27340879, -0.00031738, 0.00019442, 0.00031897, -0.00000116, 0.00000000],
+		[-6.27340886, -0.00031735, 0.00019440, 0.00031894, -0.00000116, 0.00000000],
+		[-6.27340894, -0.00031732, 0.00019438, 0.00031891, -0.00000116, 0.00000000],
+		[-6.27340902, -0.00031728, 0.00019436, 0.00031888, -0.00000116, 0.00000000],
+		[-6.27340910, -0.00031725, 0.00019434, 0.00031884, -0.00000116, 0.00000000],
+		[-6.27340917, -0.00031722, 0.00019432, 0.00031881, -0.00000116, 0.00000000],
+		[-6.27340925, -0.00031719, 0.00019430, 0.00031878, -0.00000116, 0.00000000],
+		[-6.27340933, -0.00031715, 0.00019428, 0.00031875, -0.00000116, 0.00000000],
+		[-6.27340941, -0.00031712, 0.00019426, 0.00031871, -0.00000116, 0.00000000],
+		[-6.27340949, -0.00031709, 0.00019424, 0.00031868, -0.00000116, 0.00000000],
+		[-6.27340956, -0.00031706, 0.00019422, 0.00031865, -0.00000116, 0.00000000],
+		[-6.27340964, -0.00031702, 0.00019420, 0.00031862, -0.00000116, 0.00000000],
+		[-6.27340972, -0.00031699, 0.00019418, 0.00031858, -0.00000116, 0.00000000],
+		[-6.27340980, -0.00031696, 0.00019416, 0.00031855, -0.00000116, 0.00000000],
+		[-6.27340987, -0.00031693, 0.00019414, 0.00031852, -0.00000116, 0.00000000],
+		[-6.27340995, -0.00031690, 0.00019412, 0.00031848, -0.00000116, 0.00000000],
+		[-6.27341003, -0.00031686, 0.00019410, 0.00031845, -0.00000116, 0.00000000],
+		[-6.27341011, -0.00031683, 0.00019408, 0.00031842, -0.00000116, 0.00000000],
+		[-6.27341019, -0.00031680, 0.00019406, 0.00031839, -0.00000116, 0.00000000],
+		[-6.27341026, -0.00031677, 0.00019404, 0.00031835, -0.00000116, 0.00000000],
+		[-6.27341034, -0.00031673, 0.00019402, 0.00031832, -0.00000116, 0.00000000],
+		[-6.27341042, -0.00031670, 0.00019400, 0.00031829, -0.00000116, 0.00000000],
+		[-6.27341050, -0.00031667, 0.00019398, 0.00031826, -0.00000116, 0.00000000],
+		[-6.27341057, -0.00031664, 0.00019396, 0.00031822, -0.00000116, 0.00000000],
+		[-6.27341065, -0.00031660, 0.00019394, 0.00031819, -0.00000116, 0.00000000],
+		[-6.27341073, -0.00031657, 0.00019392, 0.00031816, -0.00000116, 0.00000000],
+		[-6.27341081, -0.00031654, 0.00019390, 0.00031813, -0.00000116, 0.00000000],
+		[-6.27341088, -0.00031651, 0.00019388, 0.00031809, -0.00000116, 0.00000000],
+		[-6.27341096, -0.00031647, 0.00019386, 0.00031806, -0.00000116, 0.00000000],
+		[-6.27341104, -0.00031644, 0.00019384, 0.00031803, -0.00000116, 0.00000000],
+		[-6.27341112, -0.00031641, 0.00019382, 0.00031800, -0.00000116, 0.00000000],
+		[-6.27341119, -0.00031638, 0.00019380, 0.00031796, -0.00000116, 0.00000000],
+		[-6.27341127, -0.00031634, 0.00019378, 0.00031793, -0.00000116, 0.00000000],
+		[-6.27341135, -0.00031631, 0.00019376, 0.00031790, -0.00000116, 0.00000000],
+		[-6.27341143, -0.00031628, 0.00019374, 0.00031787, -0.00000116, 0.00000000],
+		[-6.27341150, -0.00031625, 0.00019372, 0.00031783, -0.00000116, 0.00000000],
+		[-6.27341158, -0.00031622, 0.00019370, 0.00031780, -0.00000116, 0.00000000],
+		[-6.27341166, -0.00031618, 0.00019368, 0.00031777, -0.00000116, 0.00000000],
+		[-6.27341173, -0.00031615, 0.00019366, 0.00031774, -0.00000116, 0.00000000],
+		[-6.27341181, -0.00031612, 0.00019364, 0.00031770, -0.00000116, 0.00000000],
+		[-6.27341189, -0.00031609, 0.00019362, 0.00031767, -0.00000116, 0.00000000],
+		[-6.27341197, -0.00031605, 0.00019360, 0.00031764, -0.00000116, 0.00000000],
+		[-6.27341204, -0.00031602, 0.00019358, 0.00031761, -0.00000116, 0.00000000],
+		[-6.27341212, -0.00031599, 0.00019356, 0.00031757, -0.00000116, 0.00000000],
+		[-6.27341220, -0.00031596, 0.00019354, 0.00031754, -0.00000116, 0.00000000],
+		[-6.27341228, -0.00031592, 0.00019352, 0.00031751, -0.00000116, 0.00000000],
+		[-6.27341235, -0.00031589, 0.00019350, 0.00031748, -0.00000116, 0.00000000],
+		[-6.27341243, -0.00031586, 0.00019348, 0.00031744, -0.00000116, 0.00000000],
+		[-6.27341251, -0.00031583, 0.00019346, 0.00031741, -0.00000116, 0.00000000],
+		[-6.27341258, -0.00031580, 0.00019344, 0.00031738, -0.00000116, 0.00000000],
+		[-6.27341266, -0.00031576, 0.00019342, 0.00031735, -0.00000116, 0.00000000],
+		[-6.27341274, -0.00031573, 0.00019340, 0.00031732, -0.00000116, 0.00000000],
+		[-6.27341282, -0.00031570, 0.00019338, 0.00031728, -0.00000116, 0.00000000],
+		[-6.27341289, -0.00031567, 0.00019336, 0.00031725, -0.00000116, 0.00000000],
+		[-6.27341297, -0.00031563, 0.00019334, 0.00031722, -0.00000116, 0.00000000],
+		[-6.27341305, -0.00031560, 0.00019333, 0.00031719, -0.00000116, 0.00000000],
+		[-6.27341312, -0.00031557, 0.00019331, 0.00031715, -0.00000116, 0.00000000],
+		[-6.27341320, -0.00031554, 0.00019329, 0.00031712, -0.00000116, 0.00000000],
+		[-6.27341328, -0.00031551, 0.00019327, 0.00031709, -0.00000116, 0.00000000],
+		[-6.27341336, -0.00031547, 0.00019325, 0.00031706, -0.00000116, 0.00000000],
+		[-6.27341343, -0.00031544, 0.00019323, 0.00031702, -0.00000116, 0.00000000],
+		[-6.27341351, -0.00031541, 0.00019321, 0.00031699, -0.00000116, 0.00000000],
+		[-6.27341359, -0.00031538, 0.00019319, 0.00031696, -0.00000116, 0.00000000],
+		[-6.27341366, -0.00031535, 0.00019317, 0.00031693, -0.00000116, 0.00000000],
+		[-6.27341374, -0.00031531, 0.00019315, 0.00031689, -0.00000116, 0.00000000],
+		[-6.27341382, -0.00031528, 0.00019313, 0.00031686, -0.00000116, 0.00000000],
+		[-6.27341389, -0.00031525, 0.00019311, 0.00031683, -0.00000116, 0.00000000],
+		[-6.27341397, -0.00031522, 0.00019309, 0.00031680, -0.00000116, 0.00000000],
+		[-6.27341405, -0.00031519, 0.00019307, 0.00031677, -0.00000116, 0.00000000],
+		[-6.27341412, -0.00031515, 0.00019305, 0.00031673, -0.00000116, 0.00000000],
+		[-6.27341420, -0.00031512, 0.00019303, 0.00031670, -0.00000116, 0.00000000],
+		[-6.27341428, -0.00031509, 0.00019301, 0.00031667, -0.00000116, 0.00000000],
+		[-6.27341435, -0.00031506, 0.00019299, 0.00031664, -0.00000116, 0.00000000],
+		[-6.27341443, -0.00031502, 0.00019297, 0.00031660, -0.00000116, 0.00000000],
+		[-6.27341451, -0.00031499, 0.00019295, 0.00031657, -0.00000116, 0.00000000],
+		[-6.27341459, -0.00031496, 0.00019293, 0.00031654, -0.00000116, 0.00000000],
+		[-6.27341466, -0.00031493, 0.00019291, 0.00031651, -0.00000116, 0.00000000],
+		[-6.27341474, -0.00031490, 0.00019289, 0.00031648, -0.00000116, 0.00000000],
+		[-6.27341482, -0.00031486, 0.00019287, 0.00031644, -0.00000116, 0.00000000],
+		[-6.27341489, -0.00031483, 0.00019285, 0.00031641, -0.00000116, 0.00000000],
+		[-6.27341497, -0.00031480, 0.00019283, 0.00031638, -0.00000116, 0.00000000],
+		[-6.27341505, -0.00031477, 0.00019281, 0.00031635, -0.00000116, 0.00000000],
+		[-6.27341512, -0.00031474, 0.00019279, 0.00031631, -0.00000116, 0.00000000],
+		[-6.27341520, -0.00031470, 0.00019277, 0.00031628, -0.00000116, 0.00000000],
+		[-6.27341528, -0.00031467, 0.00019275, 0.00031625, -0.00000116, 0.00000000],
+		[-6.27341535, -0.00031464, 0.00019274, 0.00031622, -0.00000116, 0.00000000],
+		[-6.27341543, -0.00031461, 0.00019272, 0.00031619, -0.00000116, 0.00000000],
+		[-6.27341550, -0.00031458, 0.00019270, 0.00031615, -0.00000116, 0.00000000],
+		[-6.27341558, -0.00031454, 0.00019268, 0.00031612, -0.00000116, 0.00000000],
+		[-6.27341566, -0.00031451, 0.00019266, 0.00031609, -0.00000116, 0.00000000],
+		[-6.27341573, -0.00031448, 0.00019264, 0.00031606, -0.00000116, 0.00000000],
+		[-6.27341581, -0.00031445, 0.00019262, 0.00031603, -0.00000116, 0.00000000],
+		[-6.27341589, -0.00031442, 0.00019260, 0.00031599, -0.00000116, 0.00000000],
+		[-6.27341596, -0.00031438, 0.00019258, 0.00031596, -0.00000116, 0.00000000],
+		[-6.27341604, -0.00031435, 0.00019256, 0.00031593, -0.00000116, 0.00000000],
+		[-6.27341612, -0.00031432, 0.00019254, 0.00031590, -0.00000116, 0.00000000],
+		[-6.27341619, -0.00031429, 0.00019252, 0.00031587, -0.00000116, 0.00000000],
+		[-6.27341627, -0.00031426, 0.00019250, 0.00031583, -0.00000116, 0.00000000],
+		[-6.27341635, -0.00031423, 0.00019248, 0.00031580, -0.00000116, 0.00000000],
+		[-6.27341642, -0.00031419, 0.00019246, 0.00031577, -0.00000116, 0.00000000],
+		[-6.27341650, -0.00031416, 0.00019244, 0.00031574, -0.00000116, 0.00000000],
+		[-6.27341658, -0.00031413, 0.00019242, 0.00031571, -0.00000116, 0.00000000],
+		[-6.27341665, -0.00031410, 0.00019240, 0.00031567, -0.00000116, 0.00000000],
+		[-6.27341673, -0.00031407, 0.00019238, 0.00031564, -0.00000116, 0.00000000],
+		[-6.27341680, -0.00031403, 0.00019236, 0.00031561, -0.00000116, 0.00000000],
+		[-6.27341688, -0.00031400, 0.00019234, 0.00031558, -0.00000116, 0.00000000],
+		[-6.27341696, -0.00031397, 0.00019232, 0.00031554, -0.00000116, 0.00000000],
+		[-6.27341703, -0.00031394, 0.00019231, 0.00031551, -0.00000116, 0.00000000],
+		[-6.27341711, -0.00031391, 0.00019229, 0.00031548, -0.00000116, 0.00000000],
+		[-6.27341719, -0.00031387, 0.00019227, 0.00031545, -0.00000116, 0.00000000],
+		[-6.27341726, -0.00031384, 0.00019225, 0.00031542, -0.00000116, 0.00000000],
+		[-6.27341734, -0.00031381, 0.00019223, 0.00031538, -0.00000116, 0.00000000],
+		[-6.27341741, -0.00031378, 0.00019221, 0.00031535, -0.00000116, 0.00000000],
+		[-6.27341749, -0.00031375, 0.00019219, 0.00031532, -0.00000116, 0.00000000],
+		[-6.27341757, -0.00031372, 0.00019217, 0.00031529, -0.00000116, 0.00000000],
+		[-6.27341764, -0.00031368, 0.00019215, 0.00031526, -0.00000116, 0.00000000],
+		[-6.27341772, -0.00031365, 0.00019213, 0.00031523, -0.00000116, 0.00000000],
+		[-6.27341779, -0.00031362, 0.00019211, 0.00031519, -0.00000116, 0.00000000],
+		[-6.27341787, -0.00031359, 0.00019209, 0.00031516, -0.00000116, 0.00000000],
+		[-6.27341795, -0.00031356, 0.00019207, 0.00031513, -0.00000116, 0.00000000],
+		[-6.27341802, -0.00031353, 0.00019205, 0.00031510, -0.00000116, 0.00000000],
+		[-6.27341810, -0.00031349, 0.00019203, 0.00031507, -0.00000116, 0.00000000],
+		[-6.27341817, -0.00031346, 0.00019201, 0.00031503, -0.00000116, 0.00000000],
+		[-6.27341825, -0.00031343, 0.00019199, 0.00031500, -0.00000116, 0.00000000],
+		[-6.27341833, -0.00031340, 0.00019197, 0.00031497, -0.00000116, 0.00000000],
+		[-6.27341840, -0.00031337, 0.00019195, 0.00031494, -0.00000116, 0.00000000],
+		[-6.27341848, -0.00031333, 0.00019194, 0.00031491, -0.00000116, 0.00000000],
+		[-6.27341855, -0.00031330, 0.00019192, 0.00031487, -0.00000116, 0.00000000],
+		[-6.27341863, -0.00031327, 0.00019190, 0.00031484, -0.00000116, 0.00000000],
+		[-6.27341871, -0.00031324, 0.00019188, 0.00031481, -0.00000116, 0.00000000],
+		[-6.27341878, -0.00031321, 0.00019186, 0.00031478, -0.00000116, 0.00000000],
+		[-6.27341886, -0.00031318, 0.00019184, 0.00031475, -0.00000116, 0.00000000],
+		[-6.27341893, -0.00031314, 0.00019182, 0.00031471, -0.00000116, 0.00000000],
+		[-6.27341901, -0.00031311, 0.00019180, 0.00031468, -0.00000116, 0.00000000],
+		[-6.27341909, -0.00031308, 0.00019178, 0.00031465, -0.00000116, 0.00000000],
+		[-6.27341916, -0.00031305, 0.00019176, 0.00031462, -0.00000116, 0.00000000],
+		[-6.27341924, -0.00031302, 0.00019174, 0.00031459, -0.00000116, 0.00000000],
+		[-6.27341931, -0.00031299, 0.00019172, 0.00031456, -0.00000116, 0.00000000],
+		[-6.27341939, -0.00031295, 0.00019170, 0.00031452, -0.00000116, 0.00000000],
+		[-6.27341946, -0.00031292, 0.00019168, 0.00031449, -0.00000116, 0.00000000],
+		[-6.27341954, -0.00031289, 0.00019166, 0.00031446, -0.00000116, 0.00000000],
+		[-6.27341962, -0.00031286, 0.00019164, 0.00031443, -0.00000116, 0.00000000],
+		[-6.27341969, -0.00031283, 0.00019162, 0.00031440, -0.00000116, 0.00000000],
+		[-6.27341977, -0.00031280, 0.00019161, 0.00031437, -0.00000116, 0.00000000],
+		[-6.27341984, -0.00031276, 0.00019159, 0.00031433, -0.00000116, 0.00000000],
+		[-6.27341992, -0.00031273, 0.00019157, 0.00031430, -0.00000116, 0.00000000],
+		[-6.27341999, -0.00031270, 0.00019155, 0.00031427, -0.00000116, 0.00000000],
+		[-6.27342007, -0.00031267, 0.00019153, 0.00031424, -0.00000116, 0.00000000],
+		[-6.27342015, -0.00031264, 0.00019151, 0.00031421, -0.00000116, 0.00000000],
+		[-6.27342022, -0.00031261, 0.00019149, 0.00031417, -0.00000116, 0.00000000],
+		[-6.27342030, -0.00031258, 0.00019147, 0.00031414, -0.00000116, 0.00000000],
+		[-6.27342037, -0.00031254, 0.00019145, 0.00031411, -0.00000116, 0.00000000],
+		[-6.27342045, -0.00031251, 0.00019143, 0.00031408, -0.00000116, 0.00000000],
+		[-6.27342052, -0.00031248, 0.00019141, 0.00031405, -0.00000116, 0.00000000],
+		[-6.27342060, -0.00031245, 0.00019139, 0.00031402, -0.00000116, 0.00000000],
+		[-6.27342067, -0.00031242, 0.00019137, 0.00031398, -0.00000116, 0.00000000],
+		[-6.27342075, -0.00031239, 0.00019135, 0.00031395, -0.00000116, 0.00000000],
+		[-6.27342083, -0.00031235, 0.00019133, 0.00031392, -0.00000116, 0.00000000],
+		[-6.27342090, -0.00031232, 0.00019132, 0.00031389, -0.00000116, 0.00000000],
+		[-6.27342098, -0.00031229, 0.00019130, 0.00031386, -0.00000116, 0.00000000],
+		[-6.27342105, -0.00031226, 0.00019128, 0.00031383, -0.00000116, 0.00000000],
+		[-6.27342113, -0.00031223, 0.00019126, 0.00031379, -0.00000116, 0.00000000],
+		[-6.27342120, -0.00031220, 0.00019124, 0.00031376, -0.00000116, 0.00000000],
+		[-6.27342128, -0.00031217, 0.00019122, 0.00031373, -0.00000116, 0.00000000],
+		[-6.27342135, -0.00031213, 0.00019120, 0.00031370, -0.00000116, 0.00000000],
+		[-6.27342143, -0.00031210, 0.00019118, 0.00031367, -0.00000116, 0.00000000],
+		[-6.27342150, -0.00031207, 0.00019116, 0.00031364, -0.00000116, 0.00000000],
+		[-6.27342158, -0.00031204, 0.00019114, 0.00031360, -0.00000116, 0.00000000],
+		[-6.27342166, -0.00031201, 0.00019112, 0.00031357, -0.00000116, 0.00000000],
+		[-6.27342173, -0.00031198, 0.00019110, 0.00031354, -0.00000116, 0.00000000],
+		[-6.27342181, -0.00031195, 0.00019108, 0.00031351, -0.00000116, 0.00000000],
+		[-6.27342188, -0.00031191, 0.00019106, 0.00031348, -0.00000116, 0.00000000],
+		[-6.27342196, -0.00031188, 0.00019105, 0.00031345, -0.00000116, 0.00000000],
+		[-6.27342203, -0.00031185, 0.00019103, 0.00031341, -0.00000116, 0.00000000],
+		[-6.27342211, -0.00031182, 0.00019101, 0.00031338, -0.00000116, 0.00000000],
+		[-6.27342218, -0.00031179, 0.00019099, 0.00031335, -0.00000116, 0.00000000],
+		[-6.27342226, -0.00031176, 0.00019097, 0.00031332, -0.00000116, 0.00000000],
+		[-6.27342233, -0.00031173, 0.00019095, 0.00031329, -0.00000116, 0.00000000],
+		[-6.27342241, -0.00031169, 0.00019093, 0.00031326, -0.00000116, 0.00000000],
+		[-6.27342248, -0.00031166, 0.00019091, 0.00031323, -0.00000116, 0.00000000],
+		[-6.27342256, -0.00031163, 0.00019089, 0.00031319, -0.00000116, 0.00000000],
+		[-6.27342263, -0.00031160, 0.00019087, 0.00031316, -0.00000116, 0.00000000],
+		[-6.27342271, -0.00031157, 0.00019085, 0.00031313, -0.00000116, 0.00000000],
+		[-6.27342278, -0.00031154, 0.00019083, 0.00031310, -0.00000116, 0.00000000],
+		[-6.27342286, -0.00031151, 0.00019081, 0.00031307, -0.00000116, 0.00000000],
+		[-6.27342293, -0.00031147, 0.00019080, 0.00031304, -0.00000116, 0.00000000],
+		[-6.27342301, -0.00031144, 0.00019078, 0.00031300, -0.00000116, 0.00000000],
+		[-6.27342308, -0.00031141, 0.00019076, 0.00031297, -0.00000116, 0.00000000],
+		[-6.27342316, -0.00031138, 0.00019074, 0.00031294, -0.00000116, 0.00000000],
+		[-6.27342323, -0.00031135, 0.00019072, 0.00031291, -0.00000116, 0.00000000],
+		[-6.27342331, -0.00031132, 0.00019070, 0.00031288, -0.00000116, 0.00000000],
+		[-6.27342338, -0.00031129, 0.00019068, 0.00031285, -0.00000116, 0.00000000],
+		[-6.27342346, -0.00031126, 0.00019066, 0.00031282, -0.00000116, 0.00000000],
+		[-6.27342353, -0.00031122, 0.00019064, 0.00031278, -0.00000116, 0.00000000],
+		[-6.27342361, -0.00031119, 0.00019062, 0.00031275, -0.00000116, 0.00000000],
+		[-6.27342368, -0.00031116, 0.00019060, 0.00031272, -0.00000116, 0.00000000],
+		[-6.27342376, -0.00031113, 0.00019058, 0.00031269, -0.00000116, 0.00000000],
+		[-6.27342383, -0.00031110, 0.00019057, 0.00031266, -0.00000116, 0.00000000],
+		[-6.27342391, -0.00031107, 0.00019055, 0.00031263, -0.00000116, 0.00000000],
+		[-6.27342398, -0.00031104, 0.00019053, 0.00031260, -0.00000116, 0.00000000],
+		[-6.27342406, -0.00031101, 0.00019051, 0.00031256, -0.00000116, 0.00000000],
+		[-6.27342413, -0.00031097, 0.00019049, 0.00031253, -0.00000116, 0.00000000],
+		[-6.27342421, -0.00031094, 0.00019047, 0.00031250, -0.00000116, 0.00000000],
+		[-6.27342428, -0.00031091, 0.00019045, 0.00031247, -0.00000116, 0.00000000],
+		[-6.27342436, -0.00031088, 0.00019043, 0.00031244, -0.00000116, 0.00000000],
+		[-6.27342443, -0.00031085, 0.00019041, 0.00031241, -0.00000116, 0.00000000],
+		[-6.27342451, -0.00031082, 0.00019039, 0.00031238, -0.00000116, 0.00000000],
+		[-6.27342458, -0.00031079, 0.00019037, 0.00031235, -0.00000116, 0.00000000],
+		[-6.27342466, -0.00031076, 0.00019035, 0.00031231, -0.00000116, 0.00000000],
+		[-6.27342473, -0.00031072, 0.00019034, 0.00031228, -0.00000116, 0.00000000],
+		[-6.27342480, -0.00031069, 0.00019032, 0.00031225, -0.00000116, 0.00000000],
+		[-6.27342488, -0.00031066, 0.00019030, 0.00031222, -0.00000116, 0.00000000],
+		[-6.27342495, -0.00031063, 0.00019028, 0.00031219, -0.00000116, 0.00000000],
+		[-6.27342503, -0.00031060, 0.00019026, 0.00031216, -0.00000116, 0.00000000],
+		[-6.27342510, -0.00031057, 0.00019024, 0.00031213, -0.00000116, 0.00000000],
+		[-6.27342518, -0.00031054, 0.00019022, 0.00031209, -0.00000116, 0.00000000],
+		[-6.27342525, -0.00031051, 0.00019020, 0.00031206, -0.00000116, 0.00000000],
+		[-6.27342533, -0.00031047, 0.00019018, 0.00031203, -0.00000116, 0.00000000],
+		[-6.27342540, -0.00031044, 0.00019016, 0.00031200, -0.00000116, 0.00000000],
+		[-6.27342548, -0.00031041, 0.00019014, 0.00031197, -0.00000116, 0.00000000],
+		[-6.27342555, -0.00031038, 0.00019013, 0.00031194, -0.00000116, 0.00000000],
+		[-6.27342563, -0.00031035, 0.00019011, 0.00031191, -0.00000116, 0.00000000],
+		[-6.27342570, -0.00031032, 0.00019009, 0.00031188, -0.00000116, 0.00000000],
+		[-6.27342577, -0.00031029, 0.00019007, 0.00031184, -0.00000116, 0.00000000],
+		[-6.27342585, -0.00031026, 0.00019005, 0.00031181, -0.00000116, 0.00000000],
+		[-6.27342592, -0.00031023, 0.00019003, 0.00031178, -0.00000116, 0.00000000],
+		[-6.27342600, -0.00031019, 0.00019001, 0.00031175, -0.00000116, 0.00000000],
+		[-6.27342607, -0.00031016, 0.00018999, 0.00031172, -0.00000116, 0.00000000],
+		[-6.27342615, -0.00031013, 0.00018997, 0.00031169, -0.00000116, 0.00000000],
+		[-6.27342622, -0.00031010, 0.00018995, 0.00031166, -0.00000116, 0.00000000],
+		[-6.27342630, -0.00031007, 0.00018993, 0.00031163, -0.00000116, 0.00000000],
+		[-6.27342637, -0.00031004, 0.00018992, 0.00031159, -0.00000116, 0.00000000],
+		[-6.27342644, -0.00031001, 0.00018990, 0.00031156, -0.00000116, 0.00000000],
+		[-6.27342652, -0.00030998, 0.00018988, 0.00031153, -0.00000116, 0.00000000],
+		[-6.27342659, -0.00030995, 0.00018986, 0.00031150, -0.00000116, 0.00000000],
+		[-6.27342667, -0.00030992, 0.00018984, 0.00031147, -0.00000116, 0.00000000],
+		[-6.27342674, -0.00030988, 0.00018982, 0.00031144, -0.00000116, 0.00000000],
+		[-6.27342682, -0.00030985, 0.00018980, 0.00031141, -0.00000116, 0.00000000],
+		[-6.27342689, -0.00030982, 0.00018978, 0.00031138, -0.00000116, 0.00000000],
+		[-6.27342696, -0.00030979, 0.00018976, 0.00031134, -0.00000116, 0.00000000],
+		[-6.27342704, -0.00030976, 0.00018974, 0.00031131, -0.00000116, 0.00000000],
+		[-6.27342711, -0.00030973, 0.00018973, 0.00031128, -0.00000116, 0.00000000],
+		[-6.27342719, -0.00030970, 0.00018971, 0.00031125, -0.00000116, 0.00000000],
+		[-6.27342726, -0.00030967, 0.00018969, 0.00031122, -0.00000116, 0.00000000],
+		[-6.27342733, -0.00030964, 0.00018967, 0.00031119, -0.00000116, 0.00000000],
+		[-6.27342741, -0.00030961, 0.00018965, 0.00031116, -0.00000116, 0.00000000],
+		[-6.27342748, -0.00030957, 0.00018963, 0.00031113, -0.00000116, 0.00000000],
+		[-6.27342756, -0.00030954, 0.00018961, 0.00031110, -0.00000116, 0.00000000],
+		[-6.27342763, -0.00030951, 0.00018959, 0.00031106, -0.00000116, 0.00000000],
+		[-6.27342771, -0.00030948, 0.00018957, 0.00031103, -0.00000116, 0.00000000],
+		[-6.27342778, -0.00030945, 0.00018956, 0.00031100, -0.00000116, 0.00000000]
+	];
+
+	// Cut off series at maxdeg
+	love_numbers.splice(maxdeg + 1, love_numbers.length - maxdeg + 1);
+
+	// Retrieve right type
+
+	/*
+	Arrow function to retrieve column of values
+
+	Sources:
+	 - https://stackoverflow.com/questions/7848004/get-column-from-a-two-dimensional-array
+
+	TODO:
+	- Place this in another scope so that it is available generally as a helper 
+	function.
+	*/
+	const array_column = (arr, n) => arr.map(x => x[n]);
+
+	let series = [];
+	if (type === 'loadingverticaldisplacement') {
+		series = array_column(love_numbers, 0);
+	} else if (type === 'loadinggravitationalpotential') {
+		series = array_column(love_numbers, 1);
+	} else if (type === 'loadinghorizontaldisplacement') {
+		series = array_column(love_numbers, 2);
+	} else if (type === 'tidalverticaldisplacement') {
+		series = array_column(love_numbers, 3);
+	} else if (type === 'tidalgravitationalpotential') {
+		series = array_column(love_numbers, 4);
+	} else if (type === 'tidalhorizontaldisplacement') {
+		series = array_column(love_numbers, 5);
+	} else {
+		error('love_numbers error message: unknown type: ' + type);
+	}
+
+	// Choose degree 1 term for CF reference system
+	if (frame === 'CM') {
+		// pass
+	} else if (frame === 'CF') {
+		if (type === 'loadingverticaldisplacement') {
+			series[1] = -0.269;
+		} else if (type === 'loadinggravitationalpotential') {
+			series[1] = -0.021;
+		} else if (type === 'loadinghorizontaldisplacement') {
+			series[1] = -0.134;
+		}
+	} else {
+		error('love_numbers error message: unknown reference frame:' + frame);
+	}
+
+	return series;
+} //}}}
Index: issm/trunk/src/m/boundaryconditions/getlovenumbers.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/getlovenumbers.py	(revision 25994)
+++ issm/trunk/src/m/boundaryconditions/getlovenumbers.py	(revision 26744)
@@ -5,21 +5,25 @@
 
 def getlovenumbers(*args): #{{{
-    '''
-    GETLOVENUMBERS - provide love numbers retrieved from: 
+    """GETLOVENUMBERS - provide love numbers retrieved from: 
     http://www.srosat.com/iag-jsg/loveNb.php in a chosen reference frame
 
-        Usage:
-            series = love_numbers('type', 'loadingverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', 1001)
+    Usage:
+        series = love_numbers('type', 'loadingverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', 1001)
 
-        - type = one of 'loadingverticaldisplacement', 
-        'loadinggravitationalpotential', 'loadinghorizontaldisplacement', 
-        'tidalverticaldisplacement', 'tidalgravitationalpotential', 
-        'tidalhorizontaldisplacement'
-        - reference_frame = one of 'CM' (default) and 'CF'
-        - maxdeg = default 1000
+    - type = one of 'loadingverticaldisplacement', 
+    'loadinggravitationalpotential', 'loadinghorizontaldisplacement', 
+    'tidalverticaldisplacement', 'tidalgravitationalpotential', 
+    'tidalhorizontaldisplacement'
+    - reference_frame = one of 'CM' (default) and 'CF'
+    - maxdeg = default 1000
 
-        Example:
-            h = love_number
-    '''
+    Example:
+        h = getlovenumbers('type', 'loadingverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+        k = getlovenumbers('type', 'loadinggravitationalpotential', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+        l = getlovenumbers('type', 'loadinghorizontaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+        th = getlovenumbers('type', 'tidalverticaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+        tk = getlovenumbers('type', 'tidalgravitationalpotential', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+        tl = getlovenumbers('type', 'tidalhorizontaldisplacement', 'referenceframe', 'CM', 'maxdeg', maxdeg)
+    """
 
     TYPES = [
@@ -32,9 +36,12 @@
     ]
 
-    #recover options
+    # Recover options
     options = pairoptions(*args)
     type = options.getfieldvalue('type')
     frame = options.getfieldvalue('referenceframe', 'CM')
     maxdeg = options.getfieldvalue('maxdeg', 1000)
+
+    if (maxdeg > 10000):
+        raise Exception('PREM love numbers computed only for deg < 10,000. Request lower maxdeg')
 
     if type not in TYPES:
@@ -10045,8 +10052,8 @@
     ])
 
-    #cut off series at maxdeg
+    # Cut off series at maxdeg
     love_numbers = np.delete(love_numbers, range(maxdeg + 1, len(love_numbers)), axis=0)
 
-    #retrieve right type
+    # Retrieve right type
     if type == 'loadingverticaldisplacement':
         series = love_numbers[:, 0]
@@ -10062,5 +10069,5 @@
         series = love_numbers[:, 5]
     else:
-        raise Exception("love_numbers error message: unknown type: {}".format(type))
+        raise Exception('love_numbers error message: unknown type: {}'.format(type))
 
     #choose degree 1 term for CF reference system
@@ -10075,5 +10082,5 @@
             series[1] = 0.134
     else:
-        raise Exception("love_numbers error message: unknown reference frame: {}".format(frame))
+        raise Exception('love_numbers error message: unknown reference frame: {}'.format(frame))
 
     return series
Index: issm/trunk/src/m/classes/SMBautoregression.m
===================================================================
--- issm/trunk/src/m/classes/SMBautoregression.m	(revision 26744)
+++ issm/trunk/src/m/classes/SMBautoregression.m	(revision 26744)
@@ -0,0 +1,122 @@
+%SMBautoregression Class definition
+%
+%   Usage:
+%      SMBautoregression=SMBautoregression();
+
+classdef SMBautoregression
+	properties (SetAccess=public)
+		num_basins        = 0;
+		beta0             = NaN;
+		beta1             = NaN;
+		ar_order          = 0;
+		ar_initialtime    = 0;
+		ar_timestep       = 0;
+		phi               = NaN;
+		basin_id          = NaN;
+		steps_per_step    = 1;
+		averaging         = 0;
+		requested_outputs = {};
+	end
+	methods
+		function self = SMBautoregression(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = extrude(self,md) % {{{
+			%Nothing for now
+		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
+		function self = initialize(self,md) % {{{
+			if isnan(self.beta1)
+				self.beta1 = zeros(1,self.num_basins); %no trend in SMB
+				disp('      smb.beta1 (trend) not specified: value set to 0');
+			end
+			if (self.ar_order==0)
+				self.ar_order = 1; %dummy 1 value for autoregression
+				self.phi      = zeros(self.num_basins,self.ar_order); %autoregression coefficients all set to 0 
+				disp('      smb.ar_order (order of autoregressive model) not specified: order of autoregressive model set to 0');
+			end
+			if (self.ar_initialtime==0)
+				self.ar_initialtime = md.timestepping.start_time; %autoregression model has no prescribed initial time
+				disp('      smb.ar_initialtime (initial time in the autoregressive model parameterization) not specified: set to md.timestepping.start_time');
+			end
+			if (self.ar_timestep==0)
+				self.ar_timestep = md.timestepping.time_step; %autoregression model has no prescribed time step
+				disp('      smb.ar_timestep (timestep of autoregressive model) not specified: set to md.timestepping.time_step');
+			end
+			if isnan(self.phi)
+				self.phi = zeros(self.num_basins,self.ar_order); %autoregression model of order 0 
+				disp('      smb.phi (lag coefficients) not specified: order of autoregressive model set to 0');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.ar_order    = 0.0; %autoregression model of order 0
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) 
+
+			if ismember('MasstransportAnalysis',analyses),
+				md = checkfield(md,'fieldname','smb.num_basins','numel',1,'NaN',1,'Inf',1,'>',0);
+				md = checkfield(md,'fieldname','smb.basin_id','Inf',1,'>=',0,'<=',md.smb.num_basins,'size',[md.mesh.numberofelements,1]);
+				md = checkfield(md,'fieldname','smb.beta0','NaN',1,'Inf',1,'size',[1,md.smb.num_basins],'numel',md.smb.num_basins); %scheme fails if passed as column vector
+				md = checkfield(md,'fieldname','smb.beta1','NaN',1,'Inf',1,'size',[1,md.smb.num_basins],'numel',md.smb.num_basins); %scheme fails if passed as column vector
+				md = checkfield(md,'fieldname','smb.ar_order','numel',1,'NaN',1,'Inf',1,'>=',0);
+				md = checkfield(md,'fieldname','smb.ar_initialtime','numel',1,'NaN',1,'Inf',1); 
+				md = checkfield(md,'fieldname','smb.ar_timestep','numel',1,'NaN',1,'Inf',1,'>=',md.timestepping.time_step); %autoregression time step cannot be finer than ISSM timestep
+				md = checkfield(md,'fieldname','smb.phi','NaN',1,'Inf',1,'size',[md.smb.num_basins,md.smb.ar_order]);
+			end
+			md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
+			md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
+		end 
+		function disp(self) % {{{
+			disp(sprintf('   surface forcings parameters:'));
+			fielddisplay(self,'num_basins','number of different basins [unitless]');
+			fielddisplay(self,'basin_id','basin number assigned to each element [unitless]');
+			fielddisplay(self,'beta0','basin-specific intercept values [m ice eq./yr]');
+			fielddisplay(self,'beta1','basin-specific trend values [m ice eq. yr^(-2)]');
+			fielddisplay(self,'ar_order','order of the autoregressive model [unitless]');
+			fielddisplay(self,'ar_initialtime','initial time assumed in the autoregressive model parameterization [yr]');
+			fielddisplay(self,'ar_timestep','time resolution of the autoregressive model [yr]');
+			fielddisplay(self,'phi','basin-specific vectors of lag coefficients [unitless]');
+			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
+			fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
+			disp(sprintf('%51s  0: Arithmetic (default)',' '));
+			disp(sprintf('%51s  1: Geometric',' '));
+			disp(sprintf('%51s  2: Harmonic',' '));
+			fielddisplay(self,'requested_outputs','additional outputs requested');
+
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+
+			yts=md.constants.yts;
+
+			WriteData(fid,prefix,'name','md.smb.model','data',55,'format','Integer');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','num_basins','format','Integer');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','ar_order','format','Integer');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','ar_initialtime','format','Double','scale',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','ar_timestep','format','Double','scale',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','basin_id','data',self.basin_id-1,'name','md.smb.basin_id','format','IntMat','mattype',2); %0-indexed
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','beta0','format','DoubleMat','name','md.smb.beta0','scale',1./yts,'yts',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','beta1','format','DoubleMat','name','md.smb.beta1','scale',1./(yts^2),'yts',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','phi','format','DoubleMat','name','md.smb.phi','yts',yts); 
+			WriteData(fid,prefix,'object',self,'fieldname','steps_per_step','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','averaging','format','Integer');
+
+			%process requested outputs
+			outputs = self.requested_outputs;
+			pos  = find(ismember(outputs,'default'));
+			if ~isempty(pos),
+				outputs(pos) = [];                         %remove 'default' from outputs
+				outputs      = [outputs defaultoutputs(self,md)]; %add defaults
+			end
+			WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
+
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/SMBautoregression.py
===================================================================
--- issm/trunk/src/m/classes/SMBautoregression.py	(revision 26744)
+++ issm/trunk/src/m/classes/SMBautoregression.py	(revision 26744)
@@ -0,0 +1,128 @@
+import numpy as np
+
+from checkfield import *
+from fielddisplay import fielddisplay
+from project3d import *
+from WriteData import *
+
+
+class SMBautoregression(object):
+    """SMBAUTOREGRESSION class definition
+
+    Usage:
+        SMBautoregression = SMBautoregression()
+    """
+
+    def __init__(self, *args):  # {{{
+        self.num_basins = 0
+        self.beta0 = np.nan
+        self.beta1 = np.nan
+        self.ar_order = 0
+        self.ar_initialtime = 0
+        self.ar_timestep = 0
+        self.phi = np.nan
+        self.basin_id = np.nan
+        self.steps_per_step = 1
+        self.averaging = 0
+        self.requested_outputs = []
+
+        nargs = len(args)
+        if nargs == 0:
+            self.setdefaultparameters()
+        else:
+            raise Exception('constructor not supported')
+    # }}}
+
+    def __repr__(self):  # {{{
+        s = '   surface forcings parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'num_basins', 'number of different basins [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'basin_id', 'basin number assigned to each element [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta0', 'basin-specific intercept values [m ice eq./yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta1', 'basin-specific trend values [m ice eq. yr^(-2)]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_order', 'order of the autoregressive model [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_initialtime', 'initial time assumed in the autoregressive model parameterization [yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_timestep', 'time resolution of the autoregressive model [yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'phi', 'basin-specific vectors of lag coefficients [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'covmat', 'inter-basin covariance matrix for multivariate normal noise at each time step [m^2 ice eq. yr^(-2)]'))
+        s += '{}\n'.format(fielddisplay(self, 'randomflag', 'whether to apply real randomness (true) or pseudo-randomness with fixed seed (false)'))
+        s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
+        s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
+        s += '\t\t{}\n'.format('0: Arithmetic (default)')
+        s += '\t\t{}\n'.format('1: Geometric')
+        s += '\t\t{}\n'.format('2: Harmonic')
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
+        return s
+    # }}}
+
+    def setdefaultparameters(self): #{{{
+        self.ar_order = 0.0 # Autoregression model of order 0
+    # }}}
+
+    def extrude(self, md):  # {{{
+        return self # Nothing for now
+    # }}}
+
+    def defaultoutputs(self, md):  # {{{
+        return []
+    # }}}
+
+    def initialize(self, md):  # {{{
+        if np.all(np.isnan(self.beta1)):
+            self.beta1 = np.zeros((1, self.num_basins)) # No trend in SMB
+            print('      smb.beta1 (trend) not specified: value set to 0')
+        if self.ar_order == 0:
+            self.ar_order = 1 # Dummy 1 value for autoregression
+            self.phi = np.zeros((self.num_basins, self.ar_order)) # Autorgression coefficients all set to 0
+            print('      smb.ar_order (order of autoregressive model) not specified: order of autoregressive model set to 0')
+        if self.ar_initialtime == 0:
+            self.ar_initialtime = md.timestepping.start_time # Autoregression model has no prescribed initial time
+            print('      smb.ar_initialtime (initial time in the autoregressive model parameterization) not specified: set to md.timestepping.start_time')
+        if self.ar_timestep == 0:
+            self.ar_timestep = md.timestepping.time_step # Autoregression model has no prescribed time step
+            print('      smb.ar_timestep (timestep of autoregressive model) not specified: set to md.timestepping.time_step')
+        if np.all(np.isnan(self.phi)):
+            self.phi = np.zeros((self.num_basins, self.ar_order)) # Autoregression model of order 0
+            print('      smb.phi (lag coefficients) not specified: order of autoregressive model set to 0')
+        return self
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if 'MasstransportAnalysis' in analyses:
+            md = checkfield(md, 'fieldname', 'smb.num_basins', 'numel', 1, 'NaN', 1, 'Inf', 1, '>', 0)
+            md = checkfield(md, 'fieldname', 'smb.basin_id', 'Inf', 1, '>=', 0, '<=', md.smb.num_basins, 'size', [md.mesh.numberofelements])
+            md = checkfield(md, 'fieldname', 'smb.beta0', 'NaN', 1, 'Inf', 1, 'size', [1, md.smb.num_basins], 'numel', md.smb.num_basins) # Scheme fails if passed as column vector
+            md = checkfield(md, 'fieldname', 'smb.beta1', 'NaN', 1, 'Inf', 1, 'size', [1, md.smb.num_basins], 'numel', md.smb.num_basins) # Scheme fails if passed as column vector; NOTE: As opposed to MATLAB implementation, pass list
+            md = checkfield(md, 'fieldname', 'smb.ar_order', 'numel', 1, 'NaN', 1, 'Inf', 1, '>=', 0)
+            md = checkfield(md, 'fieldname', 'smb.ar_initialtime', 'numel', 1, 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'fieldname', 'smb.ar_timestep', 'numel', 1, 'NaN', 1, 'Inf', 1, '>=', md.timestepping.time_step) # Autoregression time step cannot be finer than ISSM timestep
+            md = checkfield(md, 'fieldname', 'smb.phi', 'NaN', 1, 'Inf', 1, 'size', [md.smb.num_basins, md.smb.ar_order])
+        md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
+        md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2])
+        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
+        return md
+    # }}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        yts = md.constants.yts
+
+        WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 55, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'num_basins', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ar_order', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ar_initialtime', 'format', 'Double', 'scale', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'ar_timestep', 'format', 'Double', 'scale', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'basin_id', 'data', self.basin_id, 'name', 'md.smb.basin_id', 'format', 'IntMat', 'mattype', 2) # 0-indexed
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'beta0', 'format', 'DoubleMat', 'name', 'md.smb.beta0', 'scale', 1 / yts, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'beta1', 'format', 'DoubleMat', 'name', 'md.smb.beta1', 'scale', 1 / (yts ** 2), 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'phi', 'format', 'DoubleMat', 'name', 'md.smb.phi', 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer')
+
+        # Process requested outputs
+        outputs = self.requested_outputs
+        indices = [i for i, x in enumerate(outputs) if x == 'default']
+        if len(indices) > 0:
+            outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:]
+            outputs = outputscopy
+        WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray')
+
+    # }}}
Index: issm/trunk/src/m/classes/SMBcomponents.m
===================================================================
--- issm/trunk/src/m/classes/SMBcomponents.m	(revision 25994)
+++ issm/trunk/src/m/classes/SMBcomponents.m	(revision 26744)
@@ -6,5 +6,4 @@
 classdef SMBcomponents
 	properties (SetAccess=public)
-		isclimatology = 0;
 		accumulation = NaN;
 		runoff = NaN;
@@ -13,4 +12,5 @@
 		averaging = 0;
 		requested_outputs     = {};
+		isclimatology;
 	end
 	methods
@@ -21,4 +21,16 @@
 					error('constructor not supported');
 			end
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
+			fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
+			fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]');
+			fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
+			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
+			fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
+			disp(sprintf('%51s  0: Arithmetic (default)',' '));
+			disp(sprintf('%51s  1: Geometric',' '));
+			disp(sprintf('%51s  2: Harmonic',' '));
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function self = extrude(self,md) % {{{
@@ -38,13 +50,13 @@
 			if isnan(self.accumulation)
 				self.accumulation=zeros(md.mesh.numberofvertices,1);
-				disp('	no smb.accumulation specified: values set as zero');
+				disp('      no smb.accumulation specified: values set as zero');
 			end
 			if isnan(self.evaporation)
 				self.evaporation=zeros(md.mesh.numberofvertices,1);
-				disp('	no smb.evaporation specified: values set as zero');
+				disp('      no smb.evaporation specified: values set as zero');
 			end
 			if isnan(self.runoff)
 				self.runoff=zeros(md.mesh.numberofvertices,1);
-				disp('	no smb.runoff specified: values set as zero');
+				disp('      no smb.runoff specified: values set as zero');
 			end
 
@@ -65,26 +77,4 @@
 			md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
 			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
-			md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
-			if (self.isclimatology)
-				md = checkfield(md,'fieldname', 'smb.accumulation', 'size',[md.mesh.numberofvertices+1],...
-						'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.runoff', 'size',[md.mesh.numberofvertices+1],...
-						'message',['runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.evaporation', 'size',[md.mesh.numberofvertices+1],...
-						'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-			end
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('	  surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
-			fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
-			fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]');
-			fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
-			fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
-			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
-			fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
-			disp(sprintf('%51s  0: Arithmetic (default)',' '));
-			disp(sprintf('%51s  1: Geometric',' '));
-			disp(sprintf('%51s  2: Harmonic',' '));
-			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -93,7 +83,7 @@
 
 			WriteData(fid,prefix,'name','md.smb.model','data',2,'format','Integer');
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
 			WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer');
 			WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer');
@@ -102,9 +92,8 @@
 			pos  = find(ismember(outputs,'default'));
 			if ~isempty(pos),
-				outputs(pos) = [];			       %remove 'default' from outputs
+				outputs(pos) = [];                            %remove 'default' from outputs
 				outputs	 = [outputs defaultoutputs(self,md)]; %add defaults
 			end
 			WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isclimatology','format','Boolean');
 
 		end % }}}
Index: issm/trunk/src/m/classes/SMBcomponents.py
===================================================================
--- issm/trunk/src/m/classes/SMBcomponents.py	(revision 25994)
+++ issm/trunk/src/m/classes/SMBcomponents.py	(revision 26744)
@@ -15,5 +15,4 @@
 
     def __init__(self, *args):  # {{{
-        self.isclimatology = 0
         self.accumulation = np.nan
         self.runoff = np.nan
@@ -22,4 +21,5 @@
         self.averaging = 0
         self.requested_outputs = []
+        self.isclimatology = np.nan
 
         nargs = len(args)
@@ -31,9 +31,8 @@
 
     def __repr__(self):  # {{{
-        s = '   surface forcings parameters (SMB = accumulation-runoff-evaporation):\n'
+        s = '   surface forcings parameters (SMB=accumulation-runoff-evaporation) :\n'
         s += '{}\n'.format(fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))
         s += '{}\n'.format(fielddisplay(self, 'runoff', 'amount of ice melt lost from the ice column [m/yr ice eq]'))
         s += '{}\n'.format(fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))
-        s += '{}\n'.format(fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
         s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
         s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
@@ -46,7 +45,7 @@
 
     def extrude(self, md):  # {{{
-        self.mass_balance = project3d(md, 'vector', self.accumulation, 'type', 'node')
-        self.mass_balance = project3d(md, 'vector', self.runoff, 'type', 'node')
-        self.mass_balance = project3d(md, 'vector', self.evaporation, 'type', 'node')
+        self.accumulation = project3d(md, 'vector', self.accumulation, 'type', 'node')
+        self.runoff = project3d(md, 'vector', self.runoff, 'type', 'node')
+        self.evaporation = project3d(md, 'vector', self.evaporation, 'type', 'node')
         return self
     # }}}
@@ -59,12 +58,11 @@
         if np.all(np.isnan(self.accumulation)):
             self.accumulation = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.accumulation specified: values set as zero")
+            print('      no SMB.accumulation specified: values set as zero')
+        if np.all(np.isnan(self.evaporation)):
+            self.evaporation = np.zeros((md.mesh.numberofvertices))
+            print('      no SMB.evaporation specified: values set as zero')
         if np.all(np.isnan(self.runoff)):
             self.runoff = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.runoff specified: values set as zero")
-
-        if np.all(np.isnan(self.evaporation)):
-            self.evaporation = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.evaporation specified: values set as zero")
+            print('      no SMB.runoff specified: values set as zero')
         return self
     # }}}
@@ -81,11 +79,5 @@
         md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
         md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2])
-        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
-        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
-        if self.isclimatology:
-            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices + 1],
-                'message', 'accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.runoff', 'size', [md.mesh.numberofvertices + 1], 'message', 'runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices + 1], 'message', 'evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
+        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
         return md
     # }}}
@@ -95,10 +87,10 @@
 
         WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 2, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoff', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoff', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer')
-    #process requested outputs
+        # Process requested outputs
         outputs = self.requested_outputs
         indices = [i for i, x in enumerate(outputs) if x == 'default']
@@ -107,9 +99,4 @@
             outputs = outputscopy
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isclimatology', 'format', 'Boolean')
-        if (self.isclimatology > 0):
-            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices + 1], 'message', 'accumulation must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.runoff', 'size', [md.mesh.numberofvertices + 1], 'message', 'runoff must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices + 1], 'message', 'evaporation must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
 
     # }}}
Index: issm/trunk/src/m/classes/SMBforcing.js
===================================================================
--- issm/trunk/src/m/classes/SMBforcing.js	(revision 25994)
+++ issm/trunk/src/m/classes/SMBforcing.js	(revision 26744)
@@ -12,5 +12,10 @@
 		console.log(sprintf('   surface forcings parameters:'));
 		fielddisplay(this,'mass_balance','surface mass balance [m/yr ice eq]');
+		fielddisplay(this,'steps_per_step', 'number of smb steps per time step');
 		fielddisplay(this,'requested_outputs','additional outputs requested');
+		fielddisplay(this,'averaging','averaging methods from short to long steps');
+		console.log(sprintf('%51s  0: Arithmetic (default)',' '));
+		console.log(sprintf('%51s  1: Geometric',' '));
+		console.log(sprintf('%51s  2: Harmonic',' '));
 	} // }}}
 	this.defaultoutputs = function(){ // {{{
@@ -33,5 +38,5 @@
     } // }}}
     this.checkconsistency = function(md,solution,analyses) { //{{{
-
+		if (solution=='TransientSolution' && md.transient.issmb == 0) return;
         if(ArrayAnyEqual(ArrayIsMember('MasstransportAnalysis',analyses),1)){
             checkfield(md,'fieldname','smb.mass_balance','timeseries',1,'NaN',1,'Inf',1);
@@ -40,6 +45,7 @@
             checkfield(md,'fieldname','smb.mass_balance','size',[md.mesh.numberofvertices,1],'NaN',1,'Inf',1);
         }
-        checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
-
+		checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
+		checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
+		checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0,1,2]);
     } // }}}
     this.marshall=function(md,prefix,fid) { //{{{
@@ -49,4 +55,6 @@
         WriteData(fid,prefix,'name','md.smb.model','data',1,'format','Integer');
         WriteData(fid,prefix,'object',this,'class','smb','fieldname','mass_balance','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+		WriteData(fid,prefix,'object',this,'fieldname','steps_per_step','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','averaging','format','Integer');
 
         //process requested outputs
@@ -66,6 +74,8 @@
 	//properties 
     // {{{
-	this.mass_balance = NaN;
-	this.requested_outputs      = [];
+	this.mass_balance 	   = NaN;
+	this.requested_outputs = [];
+	this.steps_per_step    = 1;
+	this.averaging         = 0;
 	this.setdefaultparameters();
     // }}}
Index: issm/trunk/src/m/classes/SMBforcing.m
===================================================================
--- issm/trunk/src/m/classes/SMBforcing.m	(revision 25994)
+++ issm/trunk/src/m/classes/SMBforcing.m	(revision 26744)
@@ -6,9 +6,9 @@
 classdef SMBforcing
 	properties (SetAccess=public)
-		isclimatology     = 0;
 		mass_balance      = NaN;
 		steps_per_step    = 1;
 		requested_outputs = {};
 		averaging         = 0;
+		isclimatology;
 	end
 	methods
@@ -55,15 +55,9 @@
 			md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
 			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
-			md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
 			md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2]);
-			if (self.isclimatology)
-				md = checkfield(md,'fieldname', 'smb.mass_balance', 'size',[md.mesh.numberofvertices+1],...
-						'message',['mass_balance must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-			end
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   surface forcings parameters:'));
 			fielddisplay(self,'mass_balance','surface mass balance [m/yr ice eq]');
-			fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
 			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
 			fielddisplay(self,'requested_outputs','additional outputs requested');
@@ -90,5 +84,4 @@
 			end
 			WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isclimatology','format','Boolean');
 
 		end % }}}
@@ -97,5 +90,4 @@
 			writejs1Darray(fid,[modelname '.smb.mass_balance'],self.mass_balance);
 			writejscellstring(fid,[modelname '.smb.requested_outputs'],self.requested_outputs);
-			writejs1Darray(fid,[modelname '.smb.isclimatology'],self.isclimatology);
 
 		end % }}}
Index: issm/trunk/src/m/classes/SMBforcing.py
===================================================================
--- issm/trunk/src/m/classes/SMBforcing.py	(revision 25994)
+++ issm/trunk/src/m/classes/SMBforcing.py	(revision 26744)
@@ -15,9 +15,9 @@
 
     def __init__(self, *args):  # {{{
-        self.isclimatology = 0
         self.mass_balance = np.nan
         self.steps_per_step = 1
         self.requested_outputs = []
         self.averaging = 0
+        self.isclimatology = np.nan
 
         nargs = len(args)
@@ -31,11 +31,10 @@
         s = '   surface forcings parameters:\n'
         s += '{}\n'.format(fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]'))
-        s += '{}\n'.format(fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
         s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
         s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
         s += '\t\t{}\n'.format('0: Arithmetic (default)')
         s += '\t\t{}\n'.format('1: Geometric')
         s += '\t\t{}\n'.format('2: Harmonic')
-        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
         return s
     #}}}
@@ -53,5 +52,5 @@
         if np.all(np.isnan(self.mass_balance)):
             self.mass_balance = np.zeros((md.mesh.numberofvertices))
-            print("      no SMBforcing.mass_balance specified: values set as zero")
+            print("      no smb.mass_balance specified: values set as zero")
         return self
     #}}}
@@ -67,7 +66,4 @@
         md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2])
         md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
-        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
-        if self.isclimatology:
-            md = checkfield(md, 'fieldname', 'smb.mass_balance', 'size', [md.mesh.numberofvertices + 1], 'message', 'mass_balance must have md.mesh.numberofvertices + 1 rows in order to force a climatology')
         return md
     # }}}
@@ -76,5 +72,5 @@
         yts = md.constants.yts
         WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 1, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'mass_balance', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'mass_balance', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer')
@@ -87,4 +83,3 @@
             outputs = outputscopy
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isclimatology', 'format', 'Boolean')
     # }}}
Index: issm/trunk/src/m/classes/SMBgemb.m
===================================================================
--- issm/trunk/src/m/classes/SMBgemb.m	(revision 25994)
+++ issm/trunk/src/m/classes/SMBgemb.m	(revision 26744)
@@ -22,6 +22,7 @@
 		isdensification;
 		isturbulentflux;
+		isconstrainsurfaceT;
 		isclimatology;
-		isconstrainsurfaceT;
+		isdeltaLWup;
 
 		%inputs:
@@ -41,6 +42,8 @@
 
 		%optional inputs:
-		aValue = NaN; %Albedo forcing at every element.  Used only if aIdx == 0.
-		teValue = NaN; %Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)
+		aValue = NaN; %Albedo forcing at every element.  Used only if aIdx == 0, or density exceeds adThresh
+		teValue = NaN; %Outward longwave radiation thermal emissivity forcing at every element (default in code is 1). 
+		               %Used only if eIdx== 0, or effective grain radius exceeds teThresh
+		dulwrfValue = NaN; %Delta with which to perturn the long wave radiation upwards. Use if isdeltaLWup is true;  
 
 		% Initialization of snow properties
@@ -53,4 +56,5 @@
 		Wini = NaN; %Water content (kg m-2)
 		Aini = NaN; %albedo (0-1)
+		Adiffini = NaN; %albedo, diffusive radiation (0-1)
 		Tini = NaN; %snow temperature (K)
 		Sizeini = NaN; %Number of layers
@@ -58,27 +62,32 @@
 		%settings:
 		aIdx   = NaN; %method for calculating albedo and subsurface absorption (default is 1)
-			      % 0: direct input from aValue parameter
-			      % 1: effective grain radius [Gardner & Sharp, 2009]
-			      % 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003]], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)
-			      % 3: density and cloud amount [Greuell & Konzelmann, 1994]
-			      % 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
-
-		swIdx  = NaN; % apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, with snow density (taken from Bassford, 2004))
+		% 0: direct input from aValue parameter, no use of adThresh
+		% 1: effective grain radius [Gardner & Sharp, 2009]
+		% 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003]], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)
+		% 3: density and cloud amount [Greuell & Konzelmann, 1994]
+		% 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
+
+		eIdx   = NaN; %method for calculating emissivity (default is 1)
+		% 0: direct input from teValue parameter, no use of teThresh
+		% 1: default value of 1, in areas with grain radius below teThresh
+		% 2: default value of 1, in areas with grain radius below teThresh and areas of dry snow (not bare ice or wet) at the surface
+
+		swIdx  = NaN; % apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002))
 
 		denIdx = NaN; %densification model to use (default is 2):
-			      % 1 = emperical model of Herron and Langway (1980)
-			      % 2 = semi-emperical model of Anthern et al. (2010)
-			      % 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
-			      % 4 = DO NOT USE: emperical model of Li and Zwally (2004)
-			      % 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
-			      % 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
-			      % 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
+		% 1 = emperical model of Herron and Langway (1980)
+		% 2 = semi-emperical model of Anthern et al. (2010)
+		% 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
+		% 4 = DO NOT USE: emperical model of Li and Zwally (2004)
+		% 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
+		% 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
+		% 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
 
 		dsnowIdx = NaN; %model for fresh snow accumulation density (default is 1):
-				% 0 = Original GEMB value, 150 kg/m^3
-				% 1 = Antarctica value of fresh snow density, 350 kg/m^3
-				% 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)
-				% 3 = Antarctica model of Kaspers et al. (2004)
-				% 4 = Greenland model of Kuipers Munneke et al. (2015)
+		% 0 = Original GEMB value, 150 kg/m^3
+		% 1 = Antarctica value of fresh snow density, 350 kg/m^3
+		% 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)
+		% 3 = Antarctica model of Kaspers et al. (2004)
+		% 4 = Greenland model of Kuipers Munneke et al. (2015)
 
 		zTop  = NaN; % depth over which grid length is constant at the top of the snopack (default 10) [m]
@@ -92,16 +101,25 @@
 
 		%specific albedo parameters:
+		%Method 1
+		dswdiffrf = NaN; %downward diffusive shortwave radiation flux [W/m^2]
+		szaValue = NaN; %Solar Zenith Angle [degree]
+		cotValue = NaN; %Cloud Optical Thickness
+		ccsnowValue = NaN; %concentration of light absorbing carbon for snow [ppm1]
+		cciceValue = NaN; %concentration of light absorbing carbon for ice [ppm1]
 		%Method 1 and 2:
 		aSnow = NaN; % new snow albedo (0.64 - 0.89)
 		aIce  = NaN; % range 0.27-0.58 for old snow
-			     %Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo
+		%Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo
 		cldFrac = NaN; % average cloud amount
-			       %Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005)
+		%Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005)
 		t0wet = NaN; % time scale for wet snow (15-21.9)
 		t0dry = NaN; % warm snow timescale (30)
 		K     = NaN; % time scale temperature coef. (7)
 		adThresh = NaN; %Apply aIdx method to all areas with densities below this value,
-		                %or else apply direct input value from aValue, allowing albedo to be altered.
-				%Default value is rho water (1023 kg m-3).
+		%or else apply direct input value from aValue, allowing albedo to be altered.
+		%Default value is rho water (1023 kg m-3).
+		teThresh = NaN; %Apply eIdx method to all areas with grain radii below this value,
+		%or else apply direct input value from teValue, allowing emissivity to be altered.
+		%Default value is a effective grain radius of 10 mm.
 
 		%densities:
@@ -115,5 +133,6 @@
 		requested_outputs      = {};
 
-		%Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM.
+		%Several fields are missing from the standard GEMB model, which are 
+		%captured intrinsically by ISSM.
 		%dateN: that's the last row of the above fields.
 		%dt:    included in dateN. Not an input.
@@ -132,163 +151,4 @@
 			end
 		end % }}}
-		function self = extrude(self,md) % {{{
-
-			self.Ta=project3d(md,'vector',self.Ta,'type','node');
-			self.V=project3d(md,'vector',self.V,'type','node');
-			self.dswrf=project3d(md,'vector',self.dswrf,'type','node');
-			self.dswrf=project3d(md,'vector',self.dswrf,'type','node');
-			self.P=project3d(md,'vector',self.P,'type','node');
-			self.eAir=project3d(md,'vector',self.eAir,'type','node');
-			self.pAir=project3d(md,'vector',self.pAir,'type','node');
-
-			if (aIdx == 0) & ~isnan(self.aValue)
-				self.aValue=project3d(md,'vector',self.aValue,'type','node');
-			end
-			if ~isnan(self.teValue)
-				self.teValue=project3d(md,'vector',self.teValue,'type','node');
-			end
-
-
-		end % }}}
-		function list = defaultoutputs(self,md) % {{{
-			list = {'SmbMassBalance'};
-		end % }}}
-		function self = setdefaultparameters(self,mesh,geometry) % {{{
-
-			self.isgraingrowth=1;
-			self.isalbedo=1;
-			self.isshortwave=1;
-			self.isthermal=1;
-			self.isaccumulation=1;
-			self.ismelt=1;
-			self.isdensification=1;
-			self.isturbulentflux=1;
-			self.isclimatology=0;
-			self.isconstrainsurfaceT=0;
-
-			self.aIdx = 1;
-			self.swIdx = 1;
-			self.denIdx = 2;
-			self.dsnowIdx = 1;
-			self.zTop=10*ones(mesh.numberofelements,1);
-			self.dzTop = .05* ones (mesh.numberofelements,1);
-			self.dzMin = self.dzTop/2;
-			self.InitDensityScaling = 1.0;
-			self.ThermoDeltaTScaling = 1/11;
-
-			self.Vmean=10.0*ones(mesh.numberofelements,1);
-
-			self.zMax=250*ones(mesh.numberofelements,1);
-			self.zMin=130*ones(mesh.numberofelements,1);
-			self.zY = 1.025*ones(mesh.numberofelements,1);
-			self.outputFreq = 30;
-
-			%additional albedo parameters
-			self.aSnow = 0.85;
-			self.aIce = 0.48;
-			self.cldFrac = 0.1;
-			self.t0wet = 15;
-			self.t0dry = 30;
-			self.K = 7;
-			self.adThresh = 1023;
-
-			self.teValue = ones(mesh.numberofelements,1);
-			self.aValue = self.aSnow*ones(mesh.numberofelements,1);
-
-			self.Dzini=0.05*ones(mesh.numberofelements,2);
-			self.Dini=910.0*ones(mesh.numberofelements,2);
-			self.Reini=2.5*ones(mesh.numberofelements,2);
-			self.Gdnini=0.0*ones(mesh.numberofelements,2);
-			self.Gspini=0.0*ones(mesh.numberofelements,2);
-			self.ECini=0.0*ones(mesh.numberofelements,1);
-			self.Wini=0.0*ones(mesh.numberofelements,2);
-			self.Aini=self.aSnow*ones(mesh.numberofelements,2);
-			self.Tini=273.15*ones(mesh.numberofelements,2);
-			% 		/!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
-			% 		If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
-			self.Sizeini=2*ones(mesh.numberofelements,1);
-
-		end % }}}
-		function md = checkconsistency(self,md,solution,analyses) % {{{
-
-			md = checkfield(md,'fieldname','smb.isgraingrowth','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isalbedo','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isshortwave','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isthermal','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isaccumulation','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.ismelt','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isdensification','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isturbulentflux','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
-			md = checkfield(md,'fieldname','smb.isconstrainsurfaceT','values',[0 1]);
-
-			md = checkfield(md,'fieldname','smb.Ta','timeseries',1,'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value
-			md = checkfield(md,'fieldname','smb.V','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<',45,'size',size(self.Ta)); %max 500 km/h
-			md = checkfield(md,'fieldname','smb.dswrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400,'size',size(self.Ta));
-			md = checkfield(md,'fieldname','smb.dlwrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'size',size(self.Ta));
-			md = checkfield(md,'fieldname','smb.P','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',200,'size',size(self.Ta));
-			md = checkfield(md,'fieldname','smb.eAir','timeseries',1,'NaN',1,'Inf',1,'size',size(self.Ta));
-
-			if (self.isclimatology)
-				md = checkfield(md,'fieldname', 'smb.Ta', 'size',[md.mesh.numberofelements+1],...
-						'message',['Ta must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.V', 'size',[md.mesh.numberofelements+1],...
-						'message',['V must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.dswrf', 'size',[md.mesh.numberofelements+1],...
-						'message',['dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.dlwrf', 'size',[md.mesh.numberofelements+1],...
-						'message',['dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.P', 'size',[md.mesh.numberofelements+1],...
-						'message',['P must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.eAir', 'size',[md.mesh.numberofelements+1],...
-						'message',['eAir must have md.mesh.numberofelements+1 rows in order to force a climatology']);
-			end
-
-			md = checkfield(md,'fieldname','smb.Tmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value
-			md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);
-			md = checkfield(md,'fieldname','smb.Vmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);
-			md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
-			md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
-
-			md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);
-
-			md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);
-			md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]);
-			md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5,6,7]);
-			md = checkfield(md,'fieldname','smb.dsnowIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);
-
-			md = checkfield(md,'fieldname','smb.zTop','NaN',1,'Inf',1,'>=',0);
-			md = checkfield(md,'fieldname','smb.dzTop','NaN',1,'Inf',1,'>',0);
-			md = checkfield(md,'fieldname','smb.dzMin','NaN',1,'Inf',1,'>',0);
-			md = checkfield(md,'fieldname','smb.zY','NaN',1,'Inf',1,'>=',1);
-			md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max
-			md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
-			md = checkfield(md,'fieldname','smb.ThermoDeltaTScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
-			md = checkfield(md,'fieldname','smb.adThresh','NaN',1,'Inf',1,'>=',0);
-
-			switch self.aIdx,
-				case 0
-					md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);
-				case {1 2}
-					md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89);
-					md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58);
-				case 3
-					md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'>=',0,'<=',1);
-				case 4
-					md = checkfield(md,'fieldname','smb.t0wet','NaN',1,'Inf',1,'>=',15,'<=',21.9);
-					md = checkfield(md,'fieldname','smb.t0dry','NaN',1,'Inf',1,'>=',30,'<=',30);
-					md = checkfield(md,'fieldname','smb.K','NaN',1,'Inf',1,'>=',7,'<=',7);
-			end
-
-			%check zTop is < local thickness:
-			he=sum(md.geometry.thickness(md.mesh.elements),2)/size(md.mesh.elements,2);
-			if any(he<self.zTop),
-				error('SMBgemb consistency check error: zTop should be smaller than local ice thickness');
-			end
-			md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
-			md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
-			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
-
-		end % }}}
 		function disp(self) % {{{
 
@@ -303,10 +163,11 @@
 			fielddisplay(self,'isdensification','run densification module (default true)');
 			fielddisplay(self,'isturbulentflux','run turbulant heat fluxes module (default true)');
-			fielddisplay(self,'isconstrainsurfaceT','constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change');
-			fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
+			fielddisplay(self,'isconstrainsurfaceT','constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change (default false)');
+			fielddisplay(self,'isdeltaLWup','set to true to invoke a bias in the long wave upward spatially, specified by dulwrfValue (default false)'); 
 			fielddisplay(self,'Ta','2 m air temperature, in Kelvin');
 			fielddisplay(self,'V','wind speed (m s-1)');
-			fielddisplay(self,'dlwrf','downward shortwave radiation flux [W/m^2]');
-			fielddisplay(self,'dswrf','downward longwave radiation flux [W/m^2]');
+			fielddisplay(self,'dswrf','downward shortwave radiation flux [W/m^2]');
+			fielddisplay(self,'dswdiffrf','downward diffusive portion of shortwave radiation flux (default to 0) [W/m^2]');
+			fielddisplay(self,'dlwrf','downward longwave radiation flux [W/m^2]');
 			fielddisplay(self,'P','precipitation [mm w.e. / m^2]');
 			fielddisplay(self,'eAir','screen level vapor pressure [Pa]');
@@ -328,11 +189,17 @@
 			fielddisplay(self,'adThresh',{'Apply aIdx method to all areas with densities below this value,','or else apply direct input value from aValue, allowing albedo to be altered.'});
 			fielddisplay(self,'aIdx',{'method for calculating albedo and subsurface absorption (default is 1)',...
-					    '0: direct input from aValue parameter',...
-					    '1: effective grain radius [Gardner & Sharp, 2009]',...
-					    '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',...
-					    '3: density and cloud amount [Greuell & Konzelmann, 1994]',...
-					    '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'})
-
+				'0: direct input from aValue parameter',...
+				'1: effective grain radius [Gardner & Sharp, 2009]',...
+				'2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',...
+				'3: density and cloud amount [Greuell & Konzelmann, 1994]',...
+				'4: exponential time decay & wetness [Bougamont & Bamber, 2005]'})
+
+			fielddisplay(self,'dulwrfValue','Specified bias to be applied to the outward long wave radiation every element (W/m-2, +upward)');
 			fielddisplay(self,'teValue','Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)');
+			fielddisplay(self,'teThresh',{'Apply eIdx method to all areas with effective grain radius below this value,','or else apply direct input value from teValue, allowing emissivity to be altered.'});
+			fielddisplay(self,'eIdx',{'method for calculating emissivity (default is 1)',...
+				'0: direct input from teValue parameter, no use of teThresh',...
+				'1: default value of 1, in areas with grain radius below teThresh',...
+				'2: default value of 1, in areas with grain radius below teThresh and areas of dry snow (not bare ice or wet) at the surface'});
 
 			%snow properties init
@@ -345,15 +212,20 @@
 			fielddisplay(self,'Wini','Initial snow water content when restart [kg m-2]');
 			fielddisplay(self,'Aini','Initial albedo when restart [-]');
+			fielddisplay(self,'Adiffini','Initial diffusive radiation albedo when restart (default to 1) [-]');
 			fielddisplay(self,'Tini','Initial snow temperature when restart [K]');
 			fielddisplay(self,'Sizeini','Initial number of layers when restart [-]');
 
-
 			%additional albedo parameters:
+			fielddisplay(self,'aValue','Albedo forcing at every element');
 			switch self.aIdx
-				case {0 5}
-					fielddisplay(self,'aValue','Albedo forcing at every element.  Used only if aIdx == {0,5}.');
 				case {1 2}
 					fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)');
 					fielddisplay(self,'aIce','albedo of ice (0.27-0.58)');
+					if self.aIdx==1
+						fielddisplay(self,'szaValue','Solar Zenith Angle [degree]');
+						fielddisplay(self,'cotValue','Cloud Optical Thickness');
+						fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]');
+						fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]');
+					end
 				case 3
 					fielddisplay(self,'cldFrac','average cloud amount');
@@ -364,19 +236,19 @@
 			end
 
-			fielddisplay(self,'swIdx','apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, with snow density (taken from Bassford, 2004)]');
+			fielddisplay(self,'swIdx','apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)]');
 			fielddisplay(self,'denIdx',{'densification model to use (default is 2):',...
-					    '1 = emperical model of Herron and Langway (1980)',...
-					    '2 = semi-emperical model of Anthern et al. (2010)',...
-					    '3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)',...
-					    '4 = DO NOT USE: emperical model of Li and Zwally (2004)',...
-					    '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',...
-					    '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',...
-					    '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'});
+				'1 = emperical model of Herron and Langway (1980)',...
+				'2 = semi-emperical model of Anthern et al. (2010)',...
+				'3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)',...
+				'4 = DO NOT USE: emperical model of Li and Zwally (2004)',...
+				'5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',...
+				'6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',...
+				'7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'});
 			fielddisplay(self,'dsnowIdx',{'model for fresh snow accumulation density (default is 1):',...
-					    '0 = Original GEMB value, 150 kg/m^3',...
-					    '1 = Antarctica value of fresh snow density, 350 kg/m^3',...
-					    '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',...
-					    '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',...
-					    '4 = Greenland model of Kuipers Munneke et al. (2015)'});
+				'0 = Original GEMB value, 150 kg/m^3',...
+				'1 = Antarctica value of fresh snow density, 350 kg/m^3',...
+				'2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)',...
+				'3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',...
+				'4 = Greenland model of Kuipers Munneke et al. (2015)'});
 
 			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
@@ -387,4 +259,212 @@
 			fielddisplay(self,'requested_outputs','additional outputs requested');
 
+
+		end % }}}
+		function self = extrude(self,md) % {{{
+
+			self.Ta=project3d(md,'vector',self.Ta,'type','element');
+			self.V=project3d(md,'vector',self.V,'type','element');
+			self.dswrf=project3d(md,'vector',self.dswrf,'type','element');
+			self.dslrf=project3d(md,'vector',self.dslrf,'type','element');
+			self.P=project3d(md,'vector',self.P,'type','element');
+			self.eAir=project3d(md,'vector',self.eAir,'type','element');
+			self.pAir=project3d(md,'vector',self.pAir,'type','element');
+
+			if ~isnan(self.Dzini)
+				self.Dzini=project3d(md,'vector',self.Dzini,'type','element');
+			end
+			if ~isnan(self.Dini)
+				self.Dini=project3d(md,'vector',self.Dini,'type','element');
+			end
+			if ~isnan(self.Reini)
+				self.Reini=project3d(md,'vector',self.Reini,'type','element');
+			end
+			if ~isnan(self.Gdnini)
+				self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element');
+			end
+			if ~isnan(self.Gspini)
+				self.Gspini=project3d(md,'vector',self.Gspini,'type','element');
+			end
+			if ~isnan(self.ECini)
+				self.ECini=project3d(md,'vector',self.ECini,'type','element');
+			end
+			if ~isnan(self.Wini)
+				self.Wini=project3d(md,'vector',self.Wini,'type','element');
+			end
+			if ~isnan(self.Aini)
+				self.Aini=project3d(md,'vector',self.Aini,'type','element');
+			end
+			if ~isnan(self.Adiffini)
+				self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element');
+			end
+			if ~isnan(self.Tini)
+				self.Tini=project3d(md,'vector',self.Tini,'type','element');
+			end
+
+			if ~isnan(self.dswdiffrf)
+				self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element');
+			end
+			if ~isnan(self.szaValue)
+				self.szaValue=project3d(md,'vector',self.szaValue,'type','element');
+			end
+			if ~isnan(self.cotValue)
+				self.cotValue=project3d(md,'vector',self.cotValue,'type','element');
+			end
+			if ~isnan(self.ccsnowValue)
+				self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element');
+			end
+			if ~isnan(self.cciceValue)
+				self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element');
+			end
+			if ~isnan(self.aValue)
+				self.aValue=project3d(md,'vector',self.aValue,'type','element');
+			end
+			if ~isnan(self.teValue)
+				self.teValue=project3d(md,'vector',self.teValue,'type','element');
+			end
+
+		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {'SmbMassBalance','SmbAccumulatedMassBalance'};
+		end % }}}
+		function self = setdefaultparameters(self,mesh,geometry) % {{{
+
+			self.isgraingrowth=1;
+			self.isalbedo=1;
+			self.isshortwave=1;
+			self.isthermal=1;
+			self.isaccumulation=1;
+			self.ismelt=1;
+			self.isdensification=1;
+			self.isturbulentflux=1;
+			self.isconstrainsurfaceT=0;
+			self.isdeltaLWup=0;
+
+			self.aIdx = 1;
+			self.eIdx = 1;
+			self.swIdx = 1;
+			self.denIdx = 2;
+			self.dsnowIdx = 1;
+			self.zTop=10*ones(mesh.numberofelements,1);
+			self.dzTop = .05* ones (mesh.numberofelements,1);
+			self.dzMin = self.dzTop/2;
+			self.InitDensityScaling = 1.0;
+			self.ThermoDeltaTScaling = 1/11;
+
+			self.Vmean=10.0*ones(mesh.numberofelements,1);
+
+			self.zMax=250*ones(mesh.numberofelements,1);
+			self.zMin=130*ones(mesh.numberofelements,1);
+			self.zY = 1.025*ones(mesh.numberofelements,1);
+			self.outputFreq = 30;
+
+			%additional albedo parameters
+			self.aSnow = 0.85;
+			self.aIce = 0.48;
+			self.cldFrac = 0.1;
+			self.t0wet = 15;
+			self.t0dry = 30;
+			self.K = 7;
+			self.adThresh = 1023;
+			self.teThresh = 10;
+
+			self.teValue = ones(mesh.numberofelements,1);
+			self.aValue = self.aSnow*ones(mesh.numberofelements,1);
+			self.dulwrfValue = zeros(mesh.numberofelements,1);
+
+			self.dswdiffrf=0.0*ones(mesh.numberofelements,1);
+			self.szaValue=0.0*ones(mesh.numberofelements,1);
+			self.cotValue=0.0*ones(mesh.numberofelements,1);
+			self.ccsnowValue=0.0*ones(mesh.numberofelements,1);
+			self.cciceValue=0.0*ones(mesh.numberofelements,1);
+
+			self.Dzini=0.05*ones(mesh.numberofelements,2);
+			self.Dini=910.0*ones(mesh.numberofelements,2);
+			self.Reini=2.5*ones(mesh.numberofelements,2);
+			self.Gdnini=0.0*ones(mesh.numberofelements,2);
+			self.Gspini=0.0*ones(mesh.numberofelements,2);
+			self.ECini=0.0*ones(mesh.numberofelements,1);
+			self.Wini=0.0*ones(mesh.numberofelements,2);
+			self.Aini=self.aSnow*ones(mesh.numberofelements,2);
+			self.Adiffini=ones(mesh.numberofelements,2);
+			self.Tini=273.15*ones(mesh.numberofelements,2);
+			% 		/!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
+			% 		If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
+			self.Sizeini=2*ones(mesh.numberofelements,1);
+
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			md = checkfield(md,'fieldname','smb.isgraingrowth','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isalbedo','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isshortwave','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isthermal','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isaccumulation','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.ismelt','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isdensification','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isturbulentflux','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isconstrainsurfaceT','values',[0 1]);
+			md = checkfield(md,'fieldname','smb.isdeltaLWup','values',[0 1]);
+
+			md = checkfield(md,'fieldname','smb.Ta','timeseries',1,'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value
+			md = checkfield(md,'fieldname','smb.V','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<',45,'size',size(self.Ta)); %max 500 km/h
+			md = checkfield(md,'fieldname','smb.dswrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400,'size',size(self.Ta));
+			md = checkfield(md,'fieldname','smb.dswdiffrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400);
+			md = checkfield(md,'fieldname','smb.dlwrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'size',size(self.Ta));
+			md = checkfield(md,'fieldname','smb.P','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',200,'size',size(self.Ta));
+			md = checkfield(md,'fieldname','smb.eAir','timeseries',1,'NaN',1,'Inf',1,'size',size(self.Ta));
+
+			md = checkfield(md,'fieldname','smb.Tmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value
+			md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',0);
+			md = checkfield(md,'fieldname','smb.Vmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);
+			md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
+			md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);
+
+			md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);
+			md = checkfield(md,'fieldname','smb.dulwrfValue','timeseries',1,'NaN',1,'Inf',1);
+
+			md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);
+			md = checkfield(md,'fieldname','smb.eIdx','NaN',1,'Inf',1,'values',[0,1,2]);
+			md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]);
+			md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5,6,7]);
+			md = checkfield(md,'fieldname','smb.dsnowIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);
+
+			md = checkfield(md,'fieldname','smb.zTop','NaN',1,'Inf',1,'>=',0);
+			md = checkfield(md,'fieldname','smb.dzTop','NaN',1,'Inf',1,'>',0);
+			md = checkfield(md,'fieldname','smb.dzMin','NaN',1,'Inf',1,'>',0);
+			md = checkfield(md,'fieldname','smb.zY','NaN',1,'Inf',1,'>=',1);
+			md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max
+			md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
+			md = checkfield(md,'fieldname','smb.ThermoDeltaTScaling','NaN',1,'Inf',1,'>=',0,'<=',1);
+			md = checkfield(md,'fieldname','smb.adThresh','NaN',1,'Inf',1,'>=',0);
+			md = checkfield(md,'fieldname','smb.teThresh','NaN',1,'Inf',1,'>=',0);
+
+			md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);
+			switch self.aIdx,
+				case {1 2}
+					md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89);
+					md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58);
+					if self.aIdx==1
+						md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90);
+						md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);
+						md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);
+						md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);
+					end
+				case 3
+					md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'>=',0,'<=',1);
+				case 4
+					md = checkfield(md,'fieldname','smb.t0wet','NaN',1,'Inf',1,'>=',15,'<=',21.9);
+					md = checkfield(md,'fieldname','smb.t0dry','NaN',1,'Inf',1,'>=',30,'<=',30);
+					md = checkfield(md,'fieldname','smb.K','NaN',1,'Inf',1,'>=',7,'<=',7);
+			end
+
+			%check zTop is < local thickness:
+			he=sum(md.geometry.thickness(md.mesh.elements),2)/size(md.mesh.elements,2);
+			if any(he<self.zTop),
+				error('SMBgemb consistency check error: zTop should be smaller than local ice thickness');
+			end
+			md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
+			md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
 
 		end % }}}
@@ -403,10 +483,11 @@
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isdensification','format','Boolean');
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isturbulentflux','format','Boolean');
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isclimatology','format','Boolean');
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isconstrainsurfaceT','format','Boolean');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isdeltaLWup','format','Boolean');
 
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Ta','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','V','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','dswrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','dswdiffrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','dlwrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','P','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
@@ -427,4 +508,5 @@
 
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','aIdx','format','Integer');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','eIdx','format','Integer');
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','swIdx','format','Integer');
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','denIdx','format','Integer');
@@ -440,7 +522,13 @@
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','K','format','Double');
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','adThresh','format','Double');
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','teThresh','format','Double');
 
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','aValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','teValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','dulwrfValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','szaValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','cotValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','ccsnowValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','cciceValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
 
 			%snow properties init
@@ -453,4 +541,5 @@
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Wini','format','DoubleMat','mattype',3);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Aini','format','DoubleMat','mattype',3);
+			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Adiffini','format','DoubleMat','mattype',3);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tini','format','DoubleMat','mattype',3);
 			WriteData(fid,prefix,'object',self,'class','smb','fieldname','Sizeini','format','IntMat','mattype',2);
@@ -466,4 +555,28 @@
 				error('All GEMB forcings (Ta, P, V, dswrf, dlwrf, eAir, pAir) must have the same time steps in the final row!');
 			end
+			if size(md.smb.teValue,2)>1 & any(md.smb.teValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing teValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.dswdiffrf,2)>1 & any(md.smb.dswdiffrf(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing dswdiffrf is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.dulwrfValue,2)>1 & any(md.smb.dulwrfValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing dulwrfValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.aValue,2)>1 & any(md.smb.aValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing aValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.szaValue,2)>1 & any(md.smb.szaValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing szaValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.cotValue,2)>1 & any(md.smb.cotValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing cotValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.ccsnowValue,2)>1 & any(md.smb.ccsnowValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing ccsnowValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
+			if size(md.smb.cciceValue,2)>1 & any(md.smb.cciceValue(end,:) - md.smb.Ta(end,:) ~= 0)
+				error('If GEMB forcing cciceValue is transient, it must have the same time steps as input Ta in the final row!');
+			end
 			time=self.Ta(end,:); %assume all forcings are on the same time step
 			dtime=diff(time,1);
Index: issm/trunk/src/m/classes/SMBgemb.py
===================================================================
--- issm/trunk/src/m/classes/SMBgemb.py	(revision 25994)
+++ issm/trunk/src/m/classes/SMBgemb.py	(revision 26744)
@@ -8,29 +8,31 @@
 
 class SMBgemb(object):
+    """SMBGEMB class definition
+
+    Usage:
+        SMB = SMBgemb()
     """
-    SMBgemb Class definition
-
-       Usage:
-          SMB = SMBgemb()
-    """
 
     def __init__(self, *args):  # {{{
-        #each one of these properties is a transient forcing to the GEMB model, loaded from meteorological data derived
-        #from an automatic weather stations (AWS). Each property is therefore a matrix, of size (numberofvertices x number
-        #of time steps. )
+        """Each one of these properties is a transient forcing to the GEMB 
+        model, loaded from meteorological data derived from an automatic 
+        weather stations (AWS). Each property is therefore a matrix, of size 
+        (numberofvertices x number of time steps.
+        """
 
         #solution choices
-        #check these:
-        #self.isgraingrowth = 0
-        #self.issmbgradients = 0
-        #isalbedo
-        #isshortwave
-        #isthermal
-        #isaccumulation
-        #ismelt
-        #isdensification
-        #isturbulentflux
-
-        #inputs:
+        self.isgraingrowth = 0
+        self.isalbedo = 0
+        self.isshortwave = 0
+        self.isthermal = 0
+        self.isaccumulation = 0
+        self.ismelt = 0
+        self.isdensification = 0
+        self.isturbulentflux = 0
+        self.isconstrainsurfaceT = 0
+        self.isdeltaLWup = 0
+        self.isclimatology = np.nan
+
+        # Inputs
         self.Ta                     = np.nan    # 2 m air temperature, in Kelvin
         self.V                      = np.nan    # wind speed (m/s-1)
@@ -40,4 +42,5 @@
         self.eAir                   = np.nan    # screen level vapor pressure [Pa]
         self.pAir                   = np.nan    # surface pressure [Pa]
+
         self.Tmean                  = np.nan    # mean annual temperature [K]
         self.Vmean                  = np.nan    # mean annual wind velocity [m s-1]
@@ -46,7 +49,8 @@
         self.Vz                     = np.nan    # height above ground at which wind (V) was sampled [m]
 
-        #optional inputs:
-        self.aValue                 = np.nan    # Albedo forcing at every element.  Used only if aIdx == 0.
-        self.teValue                = np.nan    # Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)
+        # Optional inputs
+        self.aValue                 = np.nan    # Albedo forcing at every element. Used only if aIdx == 0, or density exceeds adThresh.
+        self.teValue                = np.nan    # Outward longwave radiation thermal emissivity forcing at every element (default in code is 1), Used only if eIdx== 0, or effective grain radius exceeds teThresh
+        dulwrfValue                 = np.nan    #Delta with which to perturn the long wave radiation upwards. Use if isdeltaLWup is true
 
         # Initialization of snow properties
@@ -54,40 +58,48 @@
         self.Dini                   = np.nan    # snow density (kg m-3)
         self.Reini                  = np.nan    # effective grain size (mm)
-        self.Gdnini                 = np.nan    # grain dricity (0-1)
+        self.Gdnini                 = np.nan    # grain dendricity (0-1)
         self.Gspini                 = np.nan    # grain sphericity (0-1)
         self.ECini                  = np.nan    # evaporation/condensation (kg m-2)
         self.Wini                   = np.nan    # Water content (kg m-2)
         self.Aini                   = np.nan    # albedo (0-1)
+        self.Adiffini               = np.nan    # albedo, diffusive radiation (0-1)
         self.Tini                   = np.nan    # snow temperature (K)
         self.Sizeini                = np.nan    # Number of layers
 
-        #settings:
+        # Settings
         self.aIdx                   = np.nan    # method for calculating albedo and subsurface absorption (default is 1)
-            # 0: direct input from aValue parameter
-            # 1: effective grain radius [Gardner & Sharp, 2009]
-            # 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)
-            # 3: density and cloud amount [Greuell & Konzelmann, 1994]
-            # 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
-
-        self.swIdx                  = np.nan    # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, with snow density (taken from Bassford, 2004))
+        # 0: direct input from aValue parameter, no use of adThresh
+        # 1: effective grain radius [Gardner & Sharp, 2009]
+        # 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)
+        # 3: density and cloud amount [Greuell & Konzelmann, 1994]
+        # 4: exponential time decay & wetness [Bougamont & Bamber, 2005]
+        
+        self.eIdx                   = np.nan    #method for calculating emissivity (default is 1)
+        # 0: direct input from teValue parameter, no use of teThresh
+        # 1: default value of 1, in areas with grain radius below teThresh
+        # 2: default value of 1, in areas with grain radius below teThresh and areas of dry snow (not bare ice or wet) at the surface
+
+        self.swIdx                  = np.nan    # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002))
+
         self.denIdx                 = np.nan    # densification model to use (default is 2):
-            # 1 = emperical model of Herron and Langway (1980)
-            # 2 = semi-emperical model of Anthern et al. (2010)
-            # 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
-            # 4 = DO NOT USE: emperical model of Li and Zwally (2004)
-            # 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
-            # 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
-            # 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
+        # 1 = emperical model of Herron and Langway (1980)
+        # 2 = semi-emperical model of Anthern et al. (2010)
+        # 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)
+        # 4 = DO NOT USE: emperical model of Li and Zwally (2004)
+        # 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)
+        # 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)
+        # 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)
 
         self.dsnowIdx               = np.nan    # model for fresh snow accumulation density (default is 1):
-            # 0 = Original GEMB value, 150 kg/m^3
-            # 1 = Antarctica value of fresh snow density, 350 kg/m^3
-            # 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)
-            # 3 = Antarctica model of Kaspers et al. (2004)
-            # 4 = Greenland model of Kuipers Munneke et al. (2015)
+        # 0 = Original GEMB value, 150 kg/m^3
+        # 1 = Antarctica value of fresh snow density, 350 kg/m^3
+        # 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)
+        # 3 = Antarctica model of Kaspers et al. (2004)
+        # 4 = Greenland model of Kuipers Munneke et al. (2015)
 
         self.zTop                   = np.nan    # depth over which grid length is constant at the top of the snopack (default 10) [m]
         self.dzTop                  = np.nan    # initial top vertical grid spacing (default .05) [m]
         self.dzMin                  = np.nan    # initial min vertical allowable grid spacing (default dzMin/2) [m]
+
         self.zY                     = np.nan    # strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]
         self.zMax                   = np.nan    # initial max model depth (default is min(thickness, 250)) [m]
@@ -95,6 +107,12 @@
         self.outputFreq             = np.nan    # output frequency in days (default is monthly, 30)
 
-        #specific albedo parameters:
-        #Method 1 and 2:
+        # Specific albedo parameters
+        # Method 1
+        self.dswdiffrf              = np.nan    # downward diffusive shortwave radiation flux [W/m^2]
+        self.szaValue               = np.nan    # Solar Zenith Angle [degree]
+        self.cotValue               = np.nan    # Cloud Optical Thickness
+        self.ccsnowValue            = np.nan    # concentration of light absorbing carbon for snow [ppm1]
+        self.cciceValue             = np.nan    # concentration of light absorbing carbon for ice [ppm1]
+        # Method 1 and 2
         self.aSnow                  = np.nan    # new snow albedo (0.64 - 0.89)
         self.aIce                   = np.nan    # range 0.27-0.58 for old snow
@@ -108,9 +126,12 @@
         # or else apply direct input value from aValue, allowing albedo to be altered.
         # Default value is rho water (1023 kg m-3).
-
-        #densities:
+        teThresh                    = np.nan    #Apply eIdx method to all areas with grain radii below this value,
+        #or else apply direct input value from teValue, allowing emissivity to be altered.
+        #Default value is a effective grain radius of 10 mm.
+
+        # Densities
         self.InitDensityScaling     = np.nan    # initial scaling factor multiplying the density of ice, which describes the density of the snowpack.
 
-        #thermo:
+        # Thermal
         self.ThermoDeltaTScaling    = np.nan    # scaling factor to multiply the thermal diffusion timestep (delta t)
 
@@ -119,5 +140,6 @@
         self.requested_outputs      = []
 
-        #Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM.
+        #Several fields are missing from the standard GEMB model, which are 
+        #captured intrinsically by ISSM.
         #dateN: that's the last row of the above fields.
         #dt:    included in dateN. Not an input.
@@ -125,11 +147,10 @@
 
         nargin = len(args)
-        if nargin:
-            if nargin == 2:
-                mesh = args[0]
-                geometry = args[1]
-                self.setdefaultparameters(mesh, geometry)
-            else:
-                raise Exception('constructor not supported: need mesh and geometry to set defaults')
+        if nargin == 2:
+            mesh = args[0]
+            geometry = args[1]
+            self.setdefaultparameters(mesh, geometry)
+        else:
+            raise Exception('constructor not supported: need mesh and geometry to set defaults')
         #}}}
 
@@ -138,109 +159,153 @@
         #string = "#s\n#s"%(string, fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]'))
         #string = "#s\n#s"%(string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
-        string = '   surface forcings for SMB GEMB model :'
-        string = "%s\n%s" % (string, fielddisplay(self, 'issmbgradients', 'is smb gradients method activated (0 or 1, default is 0)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isgraingrowth', 'run grain growth module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isalbedo', 'run albedo module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isshortwave', 'run short wave module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isthermal', 'run thermal module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isaccumulation', 'run accumulation module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'ismelt', 'run melting  module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isdensification', 'run densification module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isturbulentflux', 'run turbulant heat fluxes module (default true)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isconstrainsurfaceT', 'constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'V', 'wind speed (m s-1)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward shortwave radiation flux [W/m^2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward longwave radiation flux [W/m^2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'eAir', 'screen level vapor pressure [Pa]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'pAir', 'surface pressure [Pa]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Tmean', 'mean annual temperature [K]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'C', 'mean annual snow accumulation [kg m-2 yr-1]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Vmean', 'mean annual temperature [m s-1] (default 10 m/s)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Tz', 'height above ground at which temperature (T) was sampled [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Vz', 'height above ground at which wind (V) eas sampled [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'zTop', 'depth over which grid length is constant at the top of the snopack (default 10) [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'dzTop', 'initial top vertical grid spacing (default .05) [m] '))
-        string = "%s\n%s" % (string, fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin/2) [m] '))
-        string = "%s\n%s" % (string, fielddisplay(self, 'zMax', 'initial max model depth (default is min(thickness, 500)) [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'zMin', 'initial min model depth (default is min(thickness, 30)) [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'zY', 'strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'InitDensityScaling', ['initial scaling factor multiplying the density of ice', 'which describes the density of the snowpack.']))
-        string = "%s\n%s" % (string, fielddisplay(self, 'ThermoDeltaTScaling', 'scaling factor to multiply the thermal diffusion timestep (delta t)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'outputFreq', 'output frequency in days (default is monthly, 30)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'adThresh', 'Apply aIdx method to all areas with densities below this value, ', 'or else apply direct input value from aValue, allowing albedo to be altered.'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'aIdx', ['method for calculating albedo and subsurface absorption (default is 1)',
-                                                                 '0: direct input from aValue parameter',
-                                                                 '1: effective grain radius [Gardner & Sharp, 2009]',
-                                                                 '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',
-                                                                 '3: density and cloud amount [Greuell & Konzelmann, 1994]',
-                                                                 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]']))
-        string = "%s\n%s" % (string, fielddisplay(self, 'teValue', 'Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)'))
-        #snow properties init
-        string = "%s\n%s" % (string, fielddisplay(self, 'Dzini', 'Initial cell depth when restart [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m-3]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Reini', 'Initial grain size when restart [mm]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [-]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [-]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'ECini', 'Initial evaporation/condensation when restart [kg m-2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Aini', 'Initial albedo when restart [-]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [-]'))
-
-        #additional albedo parameters:
+        s = '   surface forcings for SMB GEMB model :\n'
+        s += '{}\n'.format(fielddisplay(self, 'isgraingrowth', 'run grain growth module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isalbedo', 'run albedo module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isshortwave', 'run short wave module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isthermal', 'run thermal module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isaccumulation', 'run accumulation module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'ismelt', 'run melting  module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isdensification', 'run densification module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isturbulentflux', 'run turbulant heat fluxes module (default true)'))
+        s += '{}\n'.format(fielddisplay(self, 'isconstrainsurfaceT', 'constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change (default false)'))
+        s += '{}\n'.format(fielddisplay(self, 'isdeltaLWup', 'set to true to invoke a bias in the long wave upward spatially, specified by dulwrfValue (default false)'))
+        s += '{}\n'.format(fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin'))
+        s += '{}\n'.format(fielddisplay(self, 'V', 'wind speed (m s-1)'))
+        s += '{}\n'.format(fielddisplay(self, 'dswrf', 'downward shortwave radiation flux [W/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'dswdiffrf', 'downward diffusive portion of shortwave radiation flux (default to 0) [W/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'dlwrf', 'downward longwave radiation flux [W/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'eAir', 'screen level vapor pressure [Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'pAir', 'surface pressure [Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'Tmean', 'mean annual temperature [K]'))
+        s += '{}\n'.format(fielddisplay(self, 'C', 'mean annual snow accumulation [kg m-2 yr-1]'))
+        s += '{}\n'.format(fielddisplay(self, 'Vmean', 'mean annual temperature [m s-1] (default 10 m/s)'))
+        s += '{}\n'.format(fielddisplay(self, 'Tz', 'height above ground at which temperature (T) was sampled [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'Vz', 'height above ground at which wind (V) eas sampled [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'zTop', 'depth over which grid length is constant at the top of the snopack (default 10) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'dzTop', 'initial top vertical grid spacing (default .05) [m] '))
+        s += '{}\n'.format(fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin/2) [m] '))
+        s += '{}\n'.format(fielddisplay(self, 'zMax', 'initial max model depth (default is min(thickness, 500)) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'zMin', 'initial min model depth (default is min(thickness, 30)) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'zY', 'strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]'))
+        s += '{}\n'.format(fielddisplay(self, 'InitDensityScaling', ['initial scaling factor multiplying the density of ice', 'which describes the density of the snowpack.']))
+        s += '{}\n'.format(fielddisplay(self, 'ThermoDeltaTScaling', 'scaling factor to multiply the thermal diffusion timestep (delta t)'))
+        s += '{}\n'.format(fielddisplay(self, 'outputFreq', 'output frequency in days (default is monthly, 30)'))
+        s += '{}\n'.format(fielddisplay(self, 'adThresh', 'Apply aIdx method to all areas with densities below this value, ', 'or else apply direct input value from aValue, allowing albedo to be altered.'))
+        s += '{}\n'.format(fielddisplay(self, 'aIdx', ['method for calculating albedo and subsurface absorption (default is 1)',
+            '0: direct input from aValue parameter',
+            '1: effective grain radius [Gardner & Sharp, 2009]',
+            '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',
+            '3: density and cloud amount [Greuell & Konzelmann, 1994]',
+            '4: exponential time decay & wetness [Bougamont & Bamber, 2005]']))
+
+        s += '{}\n'.format(fielddisplay(self, 'dulwrfValue', 'Specified bias to be applied to the outward long wave radiation every element (W/m-2, +upward)'))
+        s += '{}\n'.format(fielddisplay(self, 'teValue', 'Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'teThresh', ['Apply eIdx method to all areas with effective grain radius below this value,', 'or else apply direct input value from teValue, allowing emissivity to be altered.']))
+        s += '{}\n'.format(fielddisplay(self, 'eIdx', ['method for calculating emissivity (default is 1)',
+            '0: direct input from teValue parameter, no use of teThresh',
+            '1: default value of 1, in areas with grain radius below teThresh',
+            '2: default value of 1, in areas with grain radius below teThresh and areas of dry snow (not bare ice or wet) at the surface']))
+
+        # Snow properties init
+        s += '{}\n'.format(fielddisplay(self, 'Dzini', 'Initial cell depth when restart [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m-3]'))
+        s += '{}\n'.format(fielddisplay(self, 'Reini', 'Initial grain size when restart [mm]'))
+        s += '{}\n'.format(fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [-]'))
+        s += '{}\n'.format(fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [-]'))
+        s += '{}\n'.format(fielddisplay(self, 'ECini', 'Initial evaporation/condensation when restart [kg m-2]'))
+        s += '{}\n'.format(fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]'))
+        s += '{}\n'.format(fielddisplay(self, 'Aini', 'Initial albedo when restart [-]'))
+        s += '{}\n'.format(fielddisplay(self, 'Adiffini', 'Initial diffusive radiation albedo when restart (default to 1) [-]'))
+        s += '{}\n'.format(fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]'))
+        s += '{}\n'.format(fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [-]'))
+
+        # Additional albedo parameters
+        s += '{}\n'.format(fielddisplay(self, 'aValue', 'Albedo forcing at every element'))
         if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
-            string = "%s\n%s" % (string, fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)'))
-            string = "%s\n%s" % (string, fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)'))
-        elif self.aIdx == 0:
-            string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element.  Used only if aIdx == {0, 5}'))
-        elif self.aIdx == 5:
-            string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element.  Used only if aIdx == {0, 5}'))
+            s += '{}\n'.format(fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)'))
+            s += '{}\n'.format(fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)'))
+            if self.aIdx == 1:
+                s += '{}\n'.format(fielddisplay(self,'szaValue','Solar Zenith Angle [degree]'))
+                s += '{}\n'.format(fielddisplay(self,'cotValue','Cloud Optical Thickness'))
+                s += '{}\n'.format(fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]'))
+                s += '{}\n'.format(fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]'))
         elif self.aIdx == 3:
-            string = "%s\n%s" % (string, fielddisplay(self, 'cldFrac', 'average cloud amount'))
+            s += '{}\n'.format(fielddisplay(self, 'cldFrac', 'average cloud amount'))
         elif self.aIdx == 4:
-            string = "%s\n%s" % (string, fielddisplay(self, 't0wet', 'time scale for wet snow (15-21.9) [d]'))
-            string = "%s\n%s" % (string, fielddisplay(self, 't0dry', 'warm snow timescale (30) [d]'))
-            string = "%s\n%s" % (string, fielddisplay(self, 'K', 'time scale temperature coef. (7) [d]'))
-
-        string = "%s\n%s" % (string, fielddisplay(self, 'swIdx', 'apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, with snow density (taken from Bassford, 2004)]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'denIdx', ['densification model to use (default is 2):',
-                                                                   '1 = emperical model of Herron and Langway (1980)',
-                                                                   '2 = semi-emperical model of Anthern et al. (2010)',
-                                                                   '3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)',
-                                                                   '4 = DO NOT USE: emperical model of Li and Zwally (2004)',
-                                                                   '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',
-                                                                   '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',
-                                                                   '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)']))
-        string = "%s\n%s" % (string, fielddisplay(self, 'dsnowIdx', ['model for fresh snow accumulation density (default is 1):',
-                                                                     '0 = Original GEMB value, 150 kg/m^3',
-                                                                     '1 = Antarctica value of fresh snow density, 350 kg/m^3',
-                                                                     '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',
-                                                                     '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',
-                                                                     '4 = Greenland model of Kuipers Munneke et al. (2015)']))
-        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
-        string = "%s\n\t\t%s" % (string, '0: Arithmetic (default)')
-        string = "%s\n\t\t%s" % (string, '1: Geometric')
-        string = "%s\n\t\t%s" % (string, '2: Harmonic')
-        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
-        return string
+            s += '{}\n'.format(fielddisplay(self, 't0wet', 'time scale for wet snow (15-21.9) [d]'))
+            s += '{}\n'.format(fielddisplay(self, 't0dry', 'warm snow timescale (30) [d]'))
+            s += '{}\n'.format(fielddisplay(self, 'K', 'time scale temperature coef. (7) [d]'))
+
+        s += '{}\n'.format(fielddisplay(self, 'swIdx', 'apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)]'))
+        s += '{}\n'.format(fielddisplay(self, 'denIdx', ['densification model to use (default is 2):',
+            '1 = emperical model of Herron and Langway (1980)',
+            '2 = semi-emperical model of Anthern et al. (2010)',
+            '3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)',
+            '4 = DO NOT USE: emperical model of Li and Zwally (2004)',
+            '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',
+            '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',
+            '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)']))
+        s += '{}\n'.format(fielddisplay(self, 'dsnowIdx', ['model for fresh snow accumulation density (default is 1):',
+            '0 = Original GEMB value, 150 kg/m^3',
+            '1 = Antarctica value of fresh snow density, 350 kg/m^3',
+            '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)',
+            '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',
+            '4 = Greenland model of Kuipers Munneke et al. (2015)']))
+
+        s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
+        s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
+        s += '\t\t{}\n'.format('0: Arithmetic (default)')
+        s += '\t\t{}\n'.format('1: Geometric')
+        s += '\t\t{}\n'.format('2: Harmonic')
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
+        return s
     #}}}
 
     def extrude(self, md):  # {{{
-        self.Ta = project3d(md, 'vector', self.Ta, 'type', 'node')
-        self.V = project3d(md, 'vector', self.V, 'type', 'node')
-        self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'node')
-        self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'node')
-        self.P = project3d(md, 'vector', self.P, 'type', 'node')
-        self.eAir = project3d(md, 'vector', self.eAir, 'type', 'node')
-        self.pAir = project3d(md, 'vector', self.pAir, 'type', 'node')
-
-        if (self.aIdx == 0) and np.isnan(self.aValue):
-            self.aValue = project3d(md, 'vector', self.aValue, 'type', 'node')
-        if np.isnan(self.teValue):
-            self.teValue = project3d(md, 'vector', self.teValue, 'type', 'node')
+        self.Ta = project3d(md, 'vector', self.Ta, 'type', 'element')
+        self.V = project3d(md, 'vector', self.V, 'type', 'element')
+        self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'element')
+        self.dslrf = project3d(md, 'vector', self.dslrf, 'type', 'element')
+        self.P = project3d(md, 'vector', self.P, 'type', 'element')
+        self.eAir = project3d(md, 'vector', self.eAir, 'type', 'element')
+        self.pAir = project3d(md, 'vector', self.pAir, 'type', 'element')
+
+        if not np.isnan(self.Dzini):
+            self.self.Dzini=project3d(md,'vector',self.self.Dzini,'type','element');
+        if not np.isnan(self.Dini):
+            self.self.Dini=project3d(md,'vector',self.Dini,'type','element');
+        if not np.isnan(self.Reini):
+            self.self.Reini=project3d(md,'vector',self.Reini,'type','element');
+        if not np.isnan(self.Gdnini):
+            self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element');
+        if not np.isnan(self.Gspini):
+            self.Gspini=project3d(md,'vector',self.Gspini,'type','element');
+        if not np.isnan(self.ECini):
+            self.ECini=project3d(md,'vector',self.ECini,'type','element');
+        if not np.isnan(self.Wini):
+            self.Wini=project3d(md,'vector',self.Wini,'type','element');
+        if not np.isnan(self.Aini):
+            self.Aini=project3d(md,'vector',self.Aini,'type','element');
+        if not np.isnan(self.Adiffini):
+            self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element');
+        if not np.isnan(self.Tini):
+            self.Tini=project3d(md,'vector',self.Tini,'type','element');
+
+        if not np.isnan(self.dswdiffrf):
+            self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element');
+        if not np.isnan(self.szaValue):
+            self.szaValue=project3d(md,'vector',self.szaValue,'type','element');
+        if not np.isnan(self.cotValue):
+            self.cotValue=project3d(md,'vector',self.cotValue,'type','element');
+        if not np.isnan(self.ccsnowValue):
+            self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element');
+        if not np.isnan(self.cciceValue):
+            self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element');
+
+        if not np.isnan(self.aValue):
+            self.aValue = project3d(md, 'vector', self.aValue, 'type', 'element')
+        if not np.isnan(self.teValue):
+            self.teValue = project3d(md, 'vector', self.teValue, 'type', 'element')
 
         return self
@@ -248,10 +313,9 @@
 
     def defaultoutputs(self, md):  # {{{
-        return ['SmbMassBalance']
+        return ['SmbMassBalance','SmbAccumulatedMassBalance']
     #}}}
 
     def setdefaultparameters(self, mesh, geometry):  # {{{
         self.isgraingrowth = 1
-        self.issmbgradients = 0
         self.isalbedo = 1
         self.isshortwave = 1
@@ -261,13 +325,14 @@
         self.isdensification = 1
         self.isturbulentflux = 1
-        self.isclimatology = 0
         self.isconstrainsurfaceT = 0
+        self.isdeltaLWup = 0
 
         self.aIdx = 1
+        self.eIdx = 1
         self.swIdx = 1
         self.denIdx = 2
         self.dsnowIdx = 1
         self.zTop = 10 * np.ones((mesh.numberofelements,))
-        self.dzTop = .05 * np.ones((mesh.numberofelements,))
+        self.dzTop = 0.05 * np.ones((mesh.numberofelements,))
         self.dzMin = self.dzTop / 2
         self.InitDensityScaling = 1.0
@@ -281,5 +346,5 @@
         self.outputFreq = 30
 
-        #additional albedo parameters
+        # Additional albedo parameters
         self.aSnow = 0.85
         self.aIce = 0.48
@@ -289,7 +354,15 @@
         self.K = 7
         self.adThresh = 1023
+        self.teThresh = 10
 
         self.teValue = np.ones((mesh.numberofelements,))
         self.aValue = self.aSnow * np.ones(mesh.numberofelements,)
+        self.dulwrfValue = np.zeros((mesh.numberofelements,))
+
+        self.dswdiffrf = 0.0 * np.ones(mesh.numberofelements,)
+        self.szaValue = 0.0 * np.ones(mesh.numberofelements,)
+        self.cotValue = 0.0 * np.ones(mesh.numberofelements,)
+        self.ccsnowValue = 0.0 * np.ones(mesh.numberofelements,)
+        self.cciceValue = 0.0 * np.ones(mesh.numberofelements,)
 
         self.Dzini = 0.05 * np.ones((mesh.numberofelements, 2))
@@ -300,8 +373,13 @@
         self.ECini = 0.0 * np.ones((mesh.numberofelements,))
         self.Wini = 0.0 * np.ones((mesh.numberofelements, 2))
-        self.Aini = self.aSnow * np.ones((mesh.numberofelements, 2))
+        self.Aini = 0.0 * np.ones((mesh.numberofelements, 2))
+        self.Adiffini = np.ones((mesh.numberofelements, 2))
         self.Tini = 273.15 * np.ones((mesh.numberofelements, 2))
-#       /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).
-#       If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp
+        #       /!\ Default value of Tini must be equal to Tmean but don't know 
+        #           Tmean yet (computed when atmospheric forcings are 
+        #           interpolated on mesh).
+        #           If initialization without restart, this value will be 
+        #           overwritten when snow parameters are retrieved in 
+        #           Element.cpp
         self.Sizeini = 2 * np.ones((mesh.numberofelements,))
     #}}}
@@ -310,5 +388,4 @@
 
         md = checkfield(md, 'fieldname', 'smb.isgraingrowth', 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'smb.issmbgradients', 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'smb.isalbedo', 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'smb.isshortwave', 'values', [0, 1])
@@ -318,5 +395,5 @@
         md = checkfield(md, 'fieldname', 'smb.isdensification', 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'smb.isturbulentflux', 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'smb.isdeltaLWup', 'values',[0, 1])
         md = checkfield(md, 'fieldname', 'smb.isconstrainsurfaceT', 'values', [0, 1])
 
@@ -324,18 +401,11 @@
         md = checkfield(md, 'fieldname', 'smb.V', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '<', 45, 'size', np.shape(self.Ta))  #max 500 km/h
         md = checkfield(md, 'fieldname', 'smb.dswrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1400, 'size', np.shape(self.Ta))
+        md = checkfield(md, 'fieldname', 'smb.dswdiffrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1400)
         md = checkfield(md, 'fieldname', 'smb.dlwrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, 'size', np.shape(self.Ta))
         md = checkfield(md, 'fieldname', 'smb.P', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 200, 'size', np.shape(self.Ta))
         md = checkfield(md, 'fieldname', 'smb.eAir', 'timeseries', 1, 'NaN', 1, 'Inf', 1, 'size', np.shape(self.Ta))
 
-        if (self.isclimatology > 0):
-            md = checkfield(md, 'fieldname', 'smb.Ta', 'size', [md.mesh.numberofelements + 1], 'message', 'Ta must have md.mesh.numberofelements+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.V', 'size', [md.mesh.numberofelements + 1], 'message', 'V must have md.mesh.numberofelements+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.dswrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.dlwrf', 'size', [md.mesh.numberofelements + 1], 'message', 'dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.P', 'size', [md.mesh.numberofelements + 1], 'message', 'P must have md.mesh.numberofelements+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.eAir', 'size', [md.mesh.numberofelements + 1], 'message', 'eAir must have md.mesh.numberofelements+1 rows in order to force a climatology')
-
         md = checkfield(md, 'fieldname', 'smb.Tmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '>', 273 - 100, '<', 273 + 100)  #-100/100 celsius min/max value
-        md = checkfield(md, 'fieldname', 'smb.C', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0)
+        md = checkfield(md, 'fieldname', 'smb.C', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> ', 0)
         md = checkfield(md, 'fieldname', 'smb.Vmean', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0)
         md = checkfield(md, 'fieldname', 'smb.Tz', 'size', [md.mesh.numberofelements], 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 5000)
@@ -343,6 +413,8 @@
 
         md = checkfield(md, 'fieldname', 'smb.teValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
+        md = checkfield(md, 'fieldname', 'smb.dulwrfValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
 
         md = checkfield(md, 'fieldname', 'smb.aIdx', 'NaN', 1, 'Inf', 1, 'values', [0, 1, 2, 3, 4])
+        md = checkfield(md, 'fieldname', 'smb.eIdx', 'NaN', 1, 'Inf', 1, 'values', [0, 1, 2])
         md = checkfield(md, 'fieldname', 'smb.swIdx', 'NaN', 1, 'Inf', 1, 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'smb.denIdx', 'NaN', 1, 'Inf', 1, 'values', [1, 2, 3, 4, 5, 6, 7])
@@ -357,10 +429,15 @@
         md = checkfield(md, 'fieldname', 'smb.ThermoDeltaTScaling', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1)
         md = checkfield(md, 'fieldname', 'smb.adThresh', 'NaN', 1, 'Inf', 1, '>=', 0)
-
+        md = checkfield(md, 'fieldname', 'smb.teThresh', 'NaN', 1, 'Inf',1,'>=',0)
+        
+        md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
         if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)):
             md = checkfield(md, 'fieldname', 'smb.aSnow', 'NaN', 1, 'Inf', 1, '> = ', .64, '< = ', .89)
             md = checkfield(md, 'fieldname', 'smb.aIce', 'NaN', 1, 'Inf', 1, '> = ', .27, '< = ', .58)
-        elif self.aIdx == 0:
-            md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)
+            if self.aIdx == 1:
+                md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90)
+                md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0)
+                md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0)
+                md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0)
         elif self.aIdx == 3:
             md = checkfield(md, 'fieldname', 'smb.cldFrac', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1)
@@ -370,5 +447,5 @@
             md = checkfield(md, 'fieldname', 'smb.K', 'NaN', 1, 'Inf', 1, '> = ', 7, '< = ', 7)
 
-        #check zTop is < local thickness:
+        # Check zTop is < local thickness
         he = np.sum(md.geometry.thickness[md.mesh.elements - 1], axis=1) / np.size(md.mesh.elements, 1)
         if np.any(he < self.zTop):
@@ -386,5 +463,4 @@
 
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isgraingrowth', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'issmbgradients', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isalbedo', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isshortwave', 'format', 'Boolean')
@@ -394,9 +470,11 @@
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isdensification', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isturbulentflux', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isclimatology', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isconstrainsurfaceT', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isdeltaLWup','format','Boolean')
+
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Ta', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'V', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dswrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dswdiffrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dlwrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'P', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
@@ -417,4 +495,5 @@
 
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'aIdx', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'eIdx', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'swIdx', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'denIdx', 'format', 'Integer')
@@ -430,7 +509,13 @@
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'K', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'adThresh', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'teThresh', 'format', 'Double')
 
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'aValue', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'teValue', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts)
+        WriteData(fid,prefix,'object',self,'class','smb','fieldname','dulwrfValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts)
+        WriteData(fid,prefix,'object',self,'class','smb','fieldname','szaValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts)
+        WriteData(fid,prefix,'object',self,'class','smb','fieldname','cotValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts)
+        WriteData(fid,prefix,'object',self,'class','smb','fieldname','ccsnowValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts)
+        WriteData(fid,prefix,'object',self,'class','smb','fieldname','cciceValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts)
 
         #snow properties init
@@ -443,13 +528,31 @@
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Wini', 'format', 'DoubleMat', 'mattype', 3)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Aini', 'format', 'DoubleMat', 'mattype', 3)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Adiffini', 'format', 'DoubleMat', 'mattype', 3)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tini', 'format', 'DoubleMat', 'mattype', 3)
         WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Sizeini', 'format', 'IntMat', 'mattype', 2)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer')
-        #figure out dt from forcings:
+        # Figure out dt from forcings
         if (np.any(self.P[-1] - self.Ta[-1] != 0) | np.any(self.V[-1] - self.Ta[-1] != 0) | np.any(self.dswrf[-1] - self.Ta[-1] != 0) | np.any(self.dlwrf[-1] - self.Ta[-1] != 0) | np.any(self.eAir[-1] - self.Ta[-1] != 0) | np.any(self.pAir[-1] - self.Ta[-1] != 0)):
             raise IOError('All GEMB forcings (Ta, P, V, dswrf, dlwrf, eAir, pAir) must have the same time steps in the final row!')
 
-        time = self.Ta[-1]  #assume all forcings are on the same time step
+        if ((np.ndim(self.teValue)>1) & np.any(self.teValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing teValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.dswdiffrf)>1) & np.any(self.dswdiffrf[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing dswdiffrf is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.aValue)>1) & np.any(self.aValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing aValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.dulwrfValue)>1) & np.any(self.dulwrfValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing dulwrfValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.szaValue)>1) & np.any(self.szaValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing szaValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.cotValue)>1) & np.any(self.cotValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing cotValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.ccsnowValue)>1) & np.any(self.ccsnowValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing ccsnowValue is transient, it must have the same time steps as input Ta in the final row!')
+        if ((np.ndim(self.cciceValue)>1) & np.any(self.cciceValue[-1] - self.Ta[-1] != 0)):
+            raise IOError('If GEMB forcing cciceValue is transient, it must have the same time steps as input Ta in the final row!')
+
+        time = self.Ta[-1]  # Assume all forcings are on the same time step
         dtime = np.diff(time, n=1, axis=0)
         dt = min(dtime)
@@ -459,7 +562,7 @@
         # Check if smb_dt goes evenly into transient core time step
         if (md.timestepping.time_step % dt >= 1e-10):
-            raise IOError('smb_dt/dt = #f. The number of SMB time steps in one transient core time step has to be an an integer', md.timestepping.time_step / dt)
-
-        #process requested outputs
+            raise IOError('smb_dt/dt = {}. The number of SMB time steps in one transient core time step has to be an an integer'.format(md.timestepping.time_step / dt))
+
+        # Process requested outputs
         outputs = self.requested_outputs
         indices = [i for i, x in enumerate(outputs) if x == 'default']
Index: issm/trunk/src/m/classes/SMBmeltcomponents.m
===================================================================
--- issm/trunk/src/m/classes/SMBmeltcomponents.m	(revision 25994)
+++ issm/trunk/src/m/classes/SMBmeltcomponents.m	(revision 26744)
@@ -6,12 +6,12 @@
 classdef SMBmeltcomponents
 	properties (SetAccess=public)
-		isclimatology = 0;
 		accumulation = NaN;
 		evaporation = NaN;
 		melt = NaN;
 		refreeze = NaN;
-		steps_per_step=1;
+		steps_per_step = 1;
 		averaging = 0;
-		requested_outputs      = {};
+		requested_outputs= {};
+		isclimatology;
 	end
 	methods
@@ -22,4 +22,17 @@
 					error('constructor not supported');
 			end
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :'));
+			fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
+			fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
+			fielddisplay(self,'melt','amount of ice melt in ice column [m/yr ice eq]');
+			fielddisplay(self,'refreeze','amount of ice melt refrozen in ice column [m/yr ice eq]');
+			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
+			fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
+			disp(sprintf('%51s  0: Arithmetic (default)',' '));
+			disp(sprintf('%51s  1: Geometric',' '));
+			disp(sprintf('%51s  2: Harmonic',' '));
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function self = extrude(self,md) % {{{
@@ -71,29 +84,4 @@
 			md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
 			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
-			md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
-			if (self.isclimatology)
-				md = checkfield(md,'fieldname', 'smb.accumulation', 'size',[md.mesh.numberofvertices+1],...
-						'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.melt', 'size',[md.mesh.numberofvertices+1],...
-						'message',['melt must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.refreeze', 'size',[md.mesh.numberofvertices+1],...
-						'message',['refreeze must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-				md = checkfield(md,'fieldname', 'smb.evaporation', 'size',[md.mesh.numberofvertices+1],...
-						'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);
-			end
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :'));
-			fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
-			fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
-			fielddisplay(self,'melt','amount of ice melt in ice column [m/yr ice eq]');
-			fielddisplay(self,'refreeze','amount of ice melt refrozen in ice column [m/yr ice eq]');
-			fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)');
-			fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
-			fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
-			disp(sprintf('%51s  0: Arithmetic (default)',' '));
-			disp(sprintf('%51s  1: Geometric',' '));
-			disp(sprintf('%51s  2: Harmonic',' '));
-			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -117,5 +105,4 @@
 			end
 			WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
-			WriteData(fid,prefix,'object',self,'class','smb','fieldname','isclimatology','format','Boolean');
 
 		end % }}}
Index: issm/trunk/src/m/classes/SMBmeltcomponents.py
===================================================================
--- issm/trunk/src/m/classes/SMBmeltcomponents.py	(revision 25994)
+++ issm/trunk/src/m/classes/SMBmeltcomponents.py	(revision 26744)
@@ -1,4 +1,6 @@
+import numpy as np
+
+from checkfield import *
 from fielddisplay import fielddisplay
-from checkfield import *
 from project3d import *
 from WriteData import *
@@ -6,35 +8,39 @@
 
 class SMBmeltcomponents(object):
-    """
-    SMBmeltcomponents Class definition
+    """SMBMELTCOMPONENTS lass definition
 
-       Usage:
-          SMBmeltcomponents = SMBmeltcomponents();
+    Usage:
+        SMBmeltcomponents = SMBmeltcomponents();
     """
 
-    def __init__(self):  # {{{
-        self.accumulation = float('NaN')
-        self.runoff = float('NaN')
-        self.evaporation = float('NaN')
-        self.isclimatology = 0
+    def __init__(self, *args):  # {{{
+        self.accumulation = np.nan
+        self.evaporation = np.nan
+        self.melt = np.nan
+        self.refreeze = np.nan
         self.steps_per_step = 1
         self.averaging = 0
         self.requested_outputs = []
+        self.isclimatology = np.nan
+
+        if len(args) == 0:
+            pass
+        else:
+            error('constructor not supported')
     #}}}
 
     def __repr__(self):  # {{{
-        string = "   surface forcings parameters with melt (SMB = accumulation-evaporation-melt+refreeze) :"
-        string = "%s\n%s" % (string, fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m/yr ice eq]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m/yr ice eq]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'isclimatology', 'repeat all forcings when past last forcing time (default false)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
-        string = "%s\n\t\t%s" % (string, '0: Arithmetic (default)')
-        string = "%s\n\t\t%s" % (string, '1: Geometric')
-        string = "%s\n\t\t%s" % (string, '2: Harmonic')
-        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
-        return string
+        s = '   surface forcings parameters with melt (SMB = accumulation-evaporation-melt+refreeze) :\n'
+        s += '{}\n'.format(fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))
+        s += '{}\n'.format(fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))
+        s += '{}\n'.format(fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m/yr ice eq]'))
+        s += '{}\n'.format(fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m/yr ice eq]'))
+        s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))
+        s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))
+        s += '\t\t{}\n'.format('0: Arithmetic (default)')
+        s += '\t\t{}\n'.format('1: Geometric')
+        s += '\t\t{}\n'.format('2: Harmonic')
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
+        return s
     #}}}
 
@@ -54,49 +60,48 @@
         if np.all(np.isnan(self.accumulation)):
             self.accumulation = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.accumulation specified: values set as zero")
+            print("      no smb.accumulation specified: values set as zero")
 
         if np.all(np.isnan(self.evaporation)):
             self.evaporation = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.evaporation specified: values set as zero")
+            print("      no smb.evaporation specified: values set as zero")
+
+        if np.all(np.isnan(self.refreeze)):
+            self.refreeze = np.zeros((md.mesh.numberofvertices))
+            print("      no smb.refreeze specified: values set as zero")
 
         if np.all(np.isnan(self.melt)):
             self.melt = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.melt specified: values set as zero")
-
-        if np.all(np.isnan(self.refreeze)):
-            self.refreeze = np.zeros((md.mesh.numberofvertices))
-            print("      no SMB.refreeze specified: values set as zero")
+            print("      no smb.melt specified: values set as zero")
 
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses):    # {{{
+    def checkconsistency(self, md, solution, analyses):  # {{{
         if 'MasstransportAnalysis' in analyses:
             md = checkfield(md, 'fieldname', 'smb.accumulation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
             md = checkfield(md, 'fieldname', 'smb.melt', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
 
         if 'BalancethicknessAnalysis' in analyses:
             md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
             md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
 
         md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1])
         md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2])
-        md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
-        md = checkfield(md, 'fieldname', 'smb.isclimatology', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1)
         return md
     # }}}
-    def marshall(self, prefix, md, fid):    # {{{
+    def marshall(self, prefix, md, fid):  # {{{
 
         yts = md.constants.yts
 
         WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 3, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'melt', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'refreeze', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'melt', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'refreeze', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer')
@@ -109,10 +114,3 @@
             outputs = outputscopy
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray')
-        WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isclimatology', 'format', 'Boolean')
-        if (self.isclimatology > 0):
-            md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices + 1], 'message', 'accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices + 1], 'message', 'melt must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices + 1], 'message', 'refreeze must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-            md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices + 1], 'message', 'evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology')
-
     # }}}
Index: issm/trunk/src/m/classes/additionalsolidearthsolution.m
===================================================================
--- issm/trunk/src/m/classes/additionalsolidearthsolution.m	(revision 26744)
+++ issm/trunk/src/m/classes/additionalsolidearthsolution.m	(revision 26744)
@@ -0,0 +1,43 @@
+%ADDITIONALSOLIDEARTHSOLUTION class definition
+%
+%   Usage:
+%      addsol=additionalsolidearthsolution();
+
+classdef additionalsolidearthsolution < solidearthsolution
+	properties (SetAccess=public) 
+	end
+	methods
+		function self = additionalsolidearthsolution(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.setdefaultparameters@solidearthsolution();
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.solidearth.settings.isgrd==0), 
+				error('additionalsolidearthsolution checkconsistency error message: need to run GRD solution if you are supplying a GRD additional pattern solution');
+			end
+			self.checkconsistency@solidearthsolution(md,solution,analyses);
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   external: additionalsolidearth solution:'));
+			self.disp@solidearthsolution();
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			WriteData(fid,prefix,'data',1,'name','md.solidearth.external.nature','format','Integer'); %code 1 for additionalsolidearthsolution class
+			self.marshall@solidearthsolution(prefix,md,fid);
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+			self.savemodeljs@solidearthsolution(fid,modelname);
+		end % }}}
+		function self = extrude(self,md) % {{{
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/amr.js
===================================================================
--- issm/trunk/src/m/classes/amr.js	(revision 25994)
+++ issm/trunk/src/m/classes/amr.js	(revision 26744)
@@ -7,10 +7,20 @@
 	//methods
 	this.setdefaultparameters = function(){// {{{
+
+		//hmin and hmax
 		this.hmin								= 100.;
 		this.hmax								= 100.e3;
+
+		//fields
 		this.fieldname							= "Vel";
 		this.err								= 3.;
+
+		//keep metric?
 		this.keepmetric							= 1;
+
+		//control of element lengths
 		this.gradation							= 1.5;
+
+		//other criterias
 		this.groundingline_resolution			= 500.;
 		this.groundingline_distance				= 0;
@@ -25,4 +35,7 @@
 		this.deviatoricerror_groupthreshold		= 0;	
 		this.deviatoricerror_maximum			= 0;	
+
+		//is restart? This calls femmodel->ReMesh() before first time step. 
+		this.restart							= 0;
 	}// }}}
 	this.disp= function(){// {{{
@@ -45,4 +58,6 @@
 		fielddisplay(this,'deviatoricerror_groupthreshold','maximum group threshold deviatoricstress error permitted');
 		fielddisplay(this,'deviatoricerror_maximum','maximum deviatoricstress error permitted');
+		fielddisplay(this,'deviatoricerror_maximum','maximum deviatoricstress error permitted');
+		fielddisplay(this,'restart','indicates if ReMesh() will call before first time step');
 	}// }}}
 	this.classname= function(){// {{{
@@ -67,4 +82,5 @@
 		checkfield(md,'fieldname','amr.deviatoricerror_groupthreshold','numel',[1],'>=',0,'<=',1,'NaN',1);
 		checkfield(md,'fieldname','amr.deviatoricerror_maximum','numel',[1],'>=',0,'NaN',1,'Inf',1);
+		checkfield(md,'fieldname','amr.restart','numel',[1],'>=',0,'<=',1,'NaN',1);
 	} // }}}
 	this.marshall=function(md,prefix,fid) { //{{{
@@ -88,4 +104,5 @@
 		WriteData(fid,prefix,'object',this,'fieldname','deviatoricerror_groupthreshold','format','Double');
 		WriteData(fid,prefix,'object',this,'fieldname','deviatoricerror_maximum','format','Double');
+		WriteData(fid,prefix,'object',this,'fieldname','restart','format','Integer');
 	}//}}}
 	this.fix=function() { //{{{
@@ -111,4 +128,5 @@
 	this.deviatoricerror_groupthreshold		= 0.;
 	this.deviatoricerror_maximum			= 0.;
+	this.restart							= 0.;
 
 	this.setdefaultparameters();
Index: issm/trunk/src/m/classes/amr.m
===================================================================
--- issm/trunk/src/m/classes/amr.m	(revision 25994)
+++ issm/trunk/src/m/classes/amr.m	(revision 26744)
@@ -84,5 +84,5 @@
 			self.gradation=1.5;
 
-			%other criterias
+			%other criteria
 			self.groundingline_resolution=500.;
 			self.groundingline_distance=0.;
Index: issm/trunk/src/m/classes/amr.py
===================================================================
--- issm/trunk/src/m/classes/amr.py	(revision 25994)
+++ issm/trunk/src/m/classes/amr.py	(revision 26744)
@@ -5,6 +5,5 @@
 
 class amr(object):
-    """
-    AMR Class definition
+    """AMR Class definition
 
     Usage:
@@ -12,75 +11,85 @@
     """
 
-    def __init__(self):  # {{{
-        self.hmin = 0.
-        self.hmax = 0.
+    def __init__(self): #{{{
+        self.hmin = 0
+        self.hmax = 0
         self.fieldname = ''
-        self.err = 0.
-        self.keepmetric = 0.
-        self.gradation = 0.
-        self.groundingline_resolution = 0.
-        self.groundingline_distance = 0.
-        self.icefront_resolution = 0.
-        self.icefront_distance = 0.
-        self.thicknesserror_resolution = 0.
-        self.thicknesserror_threshold = 0.
-        self.thicknesserror_groupthreshold = 0.
-        self.thicknesserror_maximum = 0.
-        self.deviatoricerror_resolution = 0.
-        self.deviatoricerror_threshold = 0.
-        self.deviatoricerror_groupthreshold = 0.
-        self.deviatoricerror_maximum = 0.
-        self.restart = 0.
-    #set defaults
+        self.err = 0
+        self.keepmetric = 0
+        self.gradation = 0
+        self.groundingline_resolution = 0
+        self.groundingline_distance = 0
+        self.icefront_resolution = 0
+        self.icefront_distance = 0
+        self.thicknesserror_resolution = 0
+        self.thicknesserror_threshold = 0
+        self.thicknesserror_groupthreshold = 0
+        self.thicknesserror_maximum = 0
+        self.deviatoricerror_resolution = 0
+        self.deviatoricerror_threshold = 0
+        self.deviatoricerror_groupthreshold = 0
+        self.deviatoricerror_maximum = 0
+        self.restart = 0
+
         self.setdefaultparameters()
     #}}}
 
-    def __repr__(self):  # {{{
-        string = "   amr parameters:"
-        string = "%s\n%s" % (string, fielddisplay(self, "hmin", "minimum element length"))
-        string = "%s\n%s" % (string, fielddisplay(self, "hmax", "maximum element length"))
-        string = "%s\n%s" % (string, fielddisplay(self, "fieldname", "name of input that will be used to compute the metric (should be an input of FemModel)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "keepmetric", "indicates whether the metric should be kept every remeshing time"))
-        string = "%s\n%s" % (string, fielddisplay(self, "gradation", "maximum ratio between two adjacent edges"))
-        string = "%s\n%s" % (string, fielddisplay(self, "groundingline_resolution", "element length near the grounding line"))
-        string = "%s\n%s" % (string, fielddisplay(self, "groundingline_distance", "distance around the grounding line which elements will be refined"))
-        string = "%s\n%s" % (string, fielddisplay(self, "icefront_resolution", "element length near the ice front"))
-        string = "%s\n%s" % (string, fielddisplay(self, "icefront_distance", "distance around the ice front which elements will be refined"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thicknesserror_resolution", "element length when thickness error estimator is used"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thicknesserror_threshold", "maximum threshold thickness error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thicknesserror_groupthreshold", "maximum group threshold thickness error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thicknesserror_maximum", "maximum thickness error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "deviatoricerror_resolution", "element length when deviatoric stress error estimator is used"))
-        string = "%s\n%s" % (string, fielddisplay(self, "deviatoricerror_threshold", "maximum threshold deviatoricstress error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "deviatoricerror_groupthreshold", "maximum group threshold deviatoric stress error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "deviatoricerror_maximum", "maximum deviatoricstress error permitted"))
-        string = "%s\n%s" % (string, fielddisplay(self, "restart", "indicates if ReMesh() will call before first time step"))
-        return string
+    def __repr__(self): #{{{
+        s = '   amr parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'hmin', 'minimum element length'))
+        s += '{}\n'.format(fielddisplay(self, 'hmax', 'maximum element length'))
+        s += '{}\n'.format(fielddisplay(self, 'fieldname', 'name of input that will be used to compute the metric (should be an input of FemModel)'))
+        s += '{}\n'.format(fielddisplay(self, 'keepmetric', 'indicates whether the metric should be kept every remeshing time'))
+        s += '{}\n'.format(fielddisplay(self, 'gradation', 'maximum ratio between two adjacent edges'))
+        s += '{}\n'.format(fielddisplay(self, 'groundingline_resolution', 'element length near the grounding line'))
+        s += '{}\n'.format(fielddisplay(self, 'groundingline_distance', 'distance around the grounding line which elements will be refined'))
+        s += '{}\n'.format(fielddisplay(self, 'icefront_resolution', 'element length near the ice front'))
+        s += '{}\n'.format(fielddisplay(self, 'icefront_distance', 'distance around the ice front which elements will be refined'))
+        s += '{}\n'.format(fielddisplay(self, 'thicknesserror_resolution', 'element length when thickness error estimator is used'))
+        s += '{}\n'.format(fielddisplay(self, 'thicknesserror_threshold', 'maximum threshold thickness error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'thicknesserror_groupthreshold', 'maximum group threshold thickness error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'thicknesserror_maximum', 'maximum thickness error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'deviatoricerror_resolution', 'element length when deviatoric stress error estimator is used'))
+        s += '{}\n'.format(fielddisplay(self, 'deviatoricerror_threshold', 'maximum threshold deviatoricstress error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'deviatoricerror_groupthreshold', 'maximum group threshold deviatoric stress error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'deviatoricerror_maximum', 'maximum deviatoricstress error permitted'))
+        s += '{}\n'.format(fielddisplay(self, 'restart', 'indicates if ReMesh() will call before first time step'))
+        return s
     #}}}
 
-    def setdefaultparameters(self):  # {{{
-        self.hmin = 100.
-        self.hmax = 100.e3
+    def setdefaultparameters(self): #{{{
+        self.hmin = 100
+        self.hmax = 100e3
+
+        # Fields
         self.fieldname = 'Vel'
-        self.err = 3.
+        self.err = 3
+
+        # Keep metric?
         self.keepmetric = 1
+
+        # Control of element lengths
         self.gradation = 1.5
-        self.groundingline_resolution = 500.
+
+        # Other criteria
+        self.groundingline_resolution = 500
         self.groundingline_distance = 0
-        self.icefront_resolution = 500.
+        self.icefront_resolution = 500
         self.icefront_distance = 0
-        self.thicknesserror_resolution = 500.
+        self.thicknesserror_resolution = 500
         self.thicknesserror_threshold = 0
         self.thicknesserror_groupthreshold = 0
         self.thicknesserror_maximum = 0
-        self.deviatoricerror_resolution = 500.
+        self.deviatoricerror_resolution = 500
         self.deviatoricerror_threshold = 0
         self.deviatoricerror_groupthreshold = 0
         self.deviatoricerror_maximum = 0
-        self.restart = 0.
+
+        # Is restart? This calls femmodel->ReMesh() before first time step.
+        self.restart = 0
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses):  # {{{
+    def checkconsistency(self, md, solution, analyses): #{{{
         md = checkfield(md, 'fieldname', 'amr.hmax', 'numel', [1], '>', 0, 'NaN', 1)
         md = checkfield(md, 'fieldname', 'amr.hmin', 'numel', [1], '>', 0, '<', self.hmax, 'NaN', 1)
@@ -101,7 +110,7 @@
         md = checkfield(md, 'fieldname', 'amr.restart', 'numel', [1], '>=', 0, '<=', 1, 'NaN', 1)
         return md
-    # }}}
+   # }}}
 
-    def marshall(self, prefix, md, fid):  # {{{
+    def marshall(self, prefix, md, fid): #{{{
         WriteData(fid, prefix, 'name', 'md.amr.type', 'data', 1, 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'hmin', 'format', 'Double')
@@ -124,3 +133,3 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'deviatoricerror_maximum', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'class', 'amr', 'fieldname', 'restart', 'format', 'Integer')
-    # }}}
+    #}}}
Index: issm/trunk/src/m/classes/balancethickness.js
===================================================================
--- issm/trunk/src/m/classes/balancethickness.js	(revision 25994)
+++ issm/trunk/src/m/classes/balancethickness.js	(revision 26744)
@@ -40,4 +40,7 @@
 			WriteData(fid,prefix,'object',this,'fieldname','thickening_rate','format','DoubleMat','mattype',1,'scale',1/yts);
 			WriteData(fid,prefix,'object',this,'fieldname','stabilization','format','Integer');
+
+			WriteData(fid,prefix,'object',this,'fieldname','slopex','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','slopey','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','omega','format','DoubleMat','mattype',1);
 
@@ -53,5 +56,8 @@
 	this.thickening_rate   = NaN;
 	this.stabilization     = 0;
+
 	this.omega             = NaN;
+	this.slopex            = NaN;
+	this.slopey            = NaN;
 	this.setdefaultparameters();
 	//}}}
Index: issm/trunk/src/m/classes/basalforcings.m
===================================================================
--- issm/trunk/src/m/classes/basalforcings.m	(revision 25994)
+++ issm/trunk/src/m/classes/basalforcings.m	(revision 26744)
@@ -11,9 +11,4 @@
 	end
 	methods
-		function self = extrude(self,md) % {{{
-			self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1); 
-			self.floatingice_melting_rate=project3d(md,'vector',self.floatingice_melting_rate,'type','node','layer',1); 
-			self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','node','layer',1); %bedrock only gets geothermal flux
-		end % }}}
 		function self = basalforcings(varargin) % {{{
 			switch nargin
@@ -23,4 +18,17 @@
 					error('constructor not supported');
 			end
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   basal forcings parameters:'));
+
+			fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) [m/yr]');
+			fielddisplay(self,'floatingice_melting_rate','basal melting rate (positive if melting) [m/yr]');
+			fielddisplay(self,'geothermalflux','geothermal heat flux [W/m^2]');
+
+		end % }}}
+		function self = extrude(self,md) % {{{
+			self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1); 
+			self.floatingice_melting_rate=project3d(md,'vector',self.floatingice_melting_rate,'type','node','layer',1); 
+			self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','node','layer',1); %bedrock only gets geothermal flux
 		end % }}}
 		function self = initialize(self,md) % {{{
@@ -56,12 +64,4 @@
 			end
 		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   basal forcings parameters:'));
-
-			fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) [m/yr]');
-			fielddisplay(self,'floatingice_melting_rate','basal melting rate (positive if melting) [m/yr]');
-			fielddisplay(self,'geothermalflux','geothermal heat flux [W/m^2]');
-
-		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
 
@@ -69,7 +69,7 @@
 
 			WriteData(fid,prefix,'name','md.basalforcings.model','data',1,'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
-			WriteData(fid,prefix,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
-			WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts)
+			WriteData(fid,prefix,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts)
+			WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
Index: issm/trunk/src/m/classes/basalforcings.py
===================================================================
--- issm/trunk/src/m/classes/basalforcings.py	(revision 25994)
+++ issm/trunk/src/m/classes/basalforcings.py	(revision 26744)
@@ -21,13 +21,11 @@
         self.setdefaultparameters()
     #}}}
-
     def __repr__(self):  # {{{
         s = '   basal forcings parameters:\n'
-        s += '{}\n'.format(fielddisplay(self, "groundedice_melting_rate", "basal melting rate (positive if melting) [m / yr]"))
-        s += '{}\n'.format(fielddisplay(self, "floatingice_melting_rate", "basal melting rate (positive if melting) [m / yr]"))
-        s += '{}\n'.format(fielddisplay(self, "geothermalflux", "geothermal heat flux [W / m^2]"))
+        s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'geothermalflux', 'geothermal heat flux [W/m^2]'))
         return s
     #}}}
-
     def extrude(self, md):  # {{{
         self.groundedice_melting_rate = project3d(md, 'vector', self.groundedice_melting_rate, 'type', 'node', 'layer', 1)
@@ -36,19 +34,16 @@
         return self
     #}}}
-
     def initialize(self, md):  # {{{
         if np.all(np.isnan(self.groundedice_melting_rate)):
             self.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices, ))
-            print("      no basalforcings.groundedice_melting_rate specified: values set as zero")
+            print('      no basalforcings.groundedice_melting_rate specified: values set as zero')
         if np.all(np.isnan(self.floatingice_melting_rate)):
             self.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices, ))
-            print("      no basalforcings.floatingice_melting_rate specified: values set as zero")
+            print('      no basalforcings.floatingice_melting_rate specified: values set as zero')
         return self
     #}}}
-
     def setdefaultparameters(self):  # {{{
         return self
     #}}}
-
     def checkconsistency(self, md, solution, analyses):  # {{{
         if 'MasstransportAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.ismasstransport:
@@ -64,10 +59,9 @@
         return md
     # }}}
-
     def marshall(self, prefix, md, fid):  # {{{
         yts = md.constants.yts
         WriteData(fid, prefix, 'name', 'md.basalforcings.model', 'data', 1, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'groundedice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'floatingice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'geothermalflux', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'groundedice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'floatingice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'geothermalflux', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     # }}}
Index: issm/trunk/src/m/classes/basalforcingsismip6.m
===================================================================
--- issm/trunk/src/m/classes/basalforcingsismip6.m	(revision 25994)
+++ issm/trunk/src/m/classes/basalforcingsismip6.m	(revision 26744)
@@ -59,5 +59,5 @@
 			md = checkfield(md,'fieldname','basalforcings.gamma_0','numel',1,'NaN',1,'Inf',1,'>',0);
 			md = checkfield(md,'fieldname','basalforcings.tf_depths','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'numel',md.basalforcings.num_basins);
+			md = checkfield(md,'fieldname','basalforcings.delta_t','NaN',1,'Inf',1,'numel',md.basalforcings.num_basins,'size',[1,md.basalforcings.num_basins]);
 			md = checkfield(md,'fieldname','basalforcings.islocal','values',[0 1]);
 			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'>=',0,'timeseries',1);
Index: issm/trunk/src/m/classes/calving.js
===================================================================
--- issm/trunk/src/m/classes/calving.js	(revision 25994)
+++ issm/trunk/src/m/classes/calving.js	(revision 26744)
@@ -35,4 +35,5 @@
 		this.fix=function() { //{{{
 			this.calvingrate=NullFix(this.calvingrate,NaN);
+			this.meltingrate=NullFix(this.meltingrate,NaN);
 		}//}}}
 	//properties 
Index: issm/trunk/src/m/classes/calving.py
===================================================================
--- issm/trunk/src/m/classes/calving.py	(revision 25994)
+++ issm/trunk/src/m/classes/calving.py	(revision 26744)
@@ -16,20 +16,19 @@
     def __init__(self):  # {{{
         self.calvingrate = np.nan
-        self.setdefaultparameters()
-
+        #self.setdefaultparameters() # Uncomment if/when setdefaultparameters is used
     #}}}
 
     def __repr__(self):  # {{{
         s = '   Calving parameters:'
-        s += '{}\n'.format(fielddisplay(self, 'calvingrate', 'calving rate at given location [m / a]'))
+        s += '{}\n'.format(fielddisplay(self, 'calvingrate', 'calving rate at given location [m/a]'))
         return s
+    #}}}
+
+    def setdefaultparameters(self):  # {{{
+        return self
     #}}}
 
     def extrude(self, md):  # {{{
         self.calvingrate = project3d(md, 'vector', self.calvingrate, 'type', 'node')
-        return self
-    #}}}
-
-    def setdefaultparameters(self):  # {{{
         return self
     #}}}
Index: issm/trunk/src/m/classes/calvingcrevassedepth.m
===================================================================
--- issm/trunk/src/m/classes/calvingcrevassedepth.m	(revision 25994)
+++ issm/trunk/src/m/classes/calvingcrevassedepth.m	(revision 26744)
@@ -6,5 +6,6 @@
 classdef calvingcrevassedepth
 	properties (SetAccess=public) 
-		crevasse_opening_stress=1.;
+		crevasse_opening_stress=1;
+		crevasse_threshold     =1.;
 		water_height = 0.;
 	end
@@ -32,6 +33,7 @@
 		function self = setdefaultparameters(self) % {{{
 			
-			self.water_height = 0.;
-			crevasse_opening_stress=1.;
+			crevasse_threshold      = 1.;
+			crevasse_opening_stress = 1;
+         self.water_height       = 0.;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -40,4 +42,5 @@
 
 			md = checkfield(md,'fieldname','calving.crevasse_opening_stress','numel',[1],'values',[0,1]);
+         md = checkfield(md,'fieldname','calving.crevasse_threshold','numel',[1],'>',0,'<=',1);
 			md = checkfield(md,'fieldname','calving.water_height','NaN',1,'Inf',1,'timeseries',1,'>=',0);
 		end % }}}
@@ -45,4 +48,5 @@
 			disp(sprintf('   Calving Pi parameters:'));
 			fielddisplay(self,'crevasse_opening_stress','0: stress only in the ice-flow direction, 1: max principal');
+			fielddisplay(self,'crevasse_threshold','ratio of full thickness to calve (e.g. 0.75 is for 75% of the total ice thickness)');
 			fielddisplay(self,'water_height','water height in the crevasse [m]');
 
@@ -52,4 +56,5 @@
 			WriteData(fid,prefix,'name','md.calving.law','data',6,'format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','crevasse_opening_stress','format','Integer');
+         WriteData(fid,prefix,'object',self,'fieldname','crevasse_threshold','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','water_height','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 		end % }}}
Index: issm/trunk/src/m/classes/calvingcrevassedepth.py
===================================================================
--- issm/trunk/src/m/classes/calvingcrevassedepth.py	(revision 26744)
+++ issm/trunk/src/m/classes/calvingcrevassedepth.py	(revision 26744)
@@ -0,0 +1,51 @@
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+#from project3d import project3d # Uncomment if/when extrude is implemented
+from WriteData import WriteData
+
+
+class calvingcrevassedepth(object):
+    """CALVINCREVASSEDEPTH class definition
+
+    Usage:
+        calvingcrevassedepth = calvingcrevassedepth()
+    """
+
+    def __init__(self):  # {{{
+        self.crevasse_opening_stress = 1
+        self.crevasse_threshold      = 1.
+        self.water_height            = 0.
+
+        #self.setdefaultparameters() # Uncomment if/when setdefaultparameters is used
+    #}}}
+    def __repr__(self):  # {{{
+        s = '   Calving Pi parameters:'
+        s += '{}\n'.format(fielddisplay(self, 'crevasse_opening_stress', '0: stress only in the ice-flow direction, 1: max principal'))
+        s += '{}\n'.format(fielddisplay(self, 'crevasse_threshold', 'ratio of full thickness to calve (e.g. 0.75 is for 75% of the total ice thickness)'))
+        s += '{}\n'.format(fielddisplay(self, 'water_height', 'water height in the crevasse [m]'))
+        return s
+    #}}}
+    def setdefaultparameters(self):  # {{{
+        return self
+    #}}}
+    def extrude(self, md):  # {{{
+        return self
+    #}}}
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        #Early return
+        if solution != 'TransientSolution' or not md.transient.ismovingfront:
+            return md
+
+        md = checkfield(md, 'fieldname', 'calving.crevasse_opening_stress', 'numel', [1], 'values', [0,1])
+        md = checkfield(md, 'fieldname', 'calving.crevasse_threshold', 'numel', [1], '>', 0., '<=', 1.)
+        md = checkfield(md, 'fieldname', 'calving.water_height', 'NaN', 1, 'Inf', 1, 'timeseries', 1, '>=', 0) 
+
+        return md
+    # }}}
+    def marshall(self, prefix, md, fid):  # {{{
+        yts = md.constants.yts
+        WriteData(fid, prefix, 'name', 'md.calving.law', 'data', 6, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'crevasse_opening_stress', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'crevasse_threshold', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'water_height', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+    # }}}
Index: issm/trunk/src/m/classes/calvingdev2.m
===================================================================
--- issm/trunk/src/m/classes/calvingdev2.m	(revision 25994)
+++ issm/trunk/src/m/classes/calvingdev2.m	(revision 26744)
@@ -42,6 +42,6 @@
 			if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1);
-			md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1);
+			md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','calving.height_above_floatation','<=',0);
 		end % }}}
Index: issm/trunk/src/m/classes/calvingvonmises.m
===================================================================
--- issm/trunk/src/m/classes/calvingvonmises.m	(revision 25994)
+++ issm/trunk/src/m/classes/calvingvonmises.m	(revision 26744)
@@ -44,6 +44,6 @@
 			if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'nan',1,'Inf',1);
-			md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'nan',1,'Inf',1);
+			md = checkfield(md,'fieldname','calving.stress_threshold_groundedice','>',0,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','calving.stress_threshold_floatingice','>',0,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','calving.min_thickness','>=',0,'NaN',1,'Inf',1,'numel',1);
 		end % }}}
Index: issm/trunk/src/m/classes/calvingvonmises.py
===================================================================
--- issm/trunk/src/m/classes/calvingvonmises.py	(revision 25994)
+++ issm/trunk/src/m/classes/calvingvonmises.py	(revision 26744)
@@ -1,20 +1,18 @@
+from checkfield import checkfield
 from fielddisplay import fielddisplay
-from checkfield import checkfield
 from WriteData import WriteData
 
 
 class calvingvonmises(object):
-    """
-    CALVINGVONMISES class definition
+    """CALVINGVONMISES class definition
 
-       Usage:
-          calvingvonmises = calvingvonmises()
+    Usage:
+        calvingvonmises = calvingvonmises()
     """
 
     def __init__(self):  # {{{
-
-        self.stress_threshold_groundedice = 0.
-        self.stress_threshold_floatingice = 0.
-        self.min_thickness = 0.
+        self.stress_threshold_groundedice = 0
+        self.stress_threshold_floatingice = 0
+        self.min_thickness = 0
 
     #set defaults
@@ -24,10 +22,9 @@
 
     def __repr__(self):  # {{{
-        string = '   Calving VonMises parameters:'
-        string = "%s\n%s" % (string, fielddisplay(self, 'stress_threshold_groundedice', 'sigma_max applied to grounded ice only [Pa]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'stress_threshold_floatingice', 'sigma_max applied to floating ice only [Pa]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'min_thickness', 'minimum thickness below which no ice is allowed [m]'))
-
-        return string
+        s = '   Calving VonMises parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'stress_threshold_groundedice', 'sigma_max applied to grounded ice only [Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'stress_threshold_floatingice', 'sigma_max applied to floating ice only [Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'min_thickness', 'minimum thickness below which no ice is allowed [m]'))
+        return s
     #}}}
 
@@ -37,9 +34,9 @@
 
     def setdefaultparameters(self):  # {{{
-        #Default sigma max
+        # Default sigma max
         self.stress_threshold_groundedice = 1e6
         self.stress_threshold_floatingice = 150e3
 
-        #turn off min_thickness by default.
+        # Turn off min_thickness by default
         self.min_thickness = 0.
         return self
@@ -47,6 +44,6 @@
 
     def checkconsistency(self, md, solution, analyses):  # {{{
-        #Early return
-        if solution == 'TransientSolution' or md.transient.ismovingfront == 0:
+        # Early return
+        if solution == 'TransientSolution' or not md.transient.ismovingfront:
             return
 
Index: issm/trunk/src/m/classes/cflevelsetmisfit.m
===================================================================
--- issm/trunk/src/m/classes/cflevelsetmisfit.m	(revision 26744)
+++ issm/trunk/src/m/classes/cflevelsetmisfit.m	(revision 26744)
@@ -0,0 +1,103 @@
+%MISFIT class definition
+%
+%   Usage:
+%      cflevelsetmisfit=cflevelsetmisfit();
+%      cflevelsetmisfit=cflevelsetmisfit('name','CalvingFrontPosition',...
+%                    'definitionstring','Outputdefinition1',... 
+%							'model_string','MaskIceLevelset',...
+%                    'observation_string','LevelsetObservations',...
+%                    'observation',md.mask.ice_levelset,...
+%                    'weights',ones(md.mesh.numberofvertices,1),...
+%                    'weights_string','WeightsLevelsetObservations',...
+%							'datatime',time);
+%
+%
+
+classdef cflevelsetmisfit
+	properties (SetAccess=public)
+		%cflevelsetmisfit
+		name               = '';
+		definitionstring   = ''; %string that identifies this output definition uniquely, from 'Outputdefinition[1-100]'
+		model_string       = ''; %string for field that is modeled
+		observation        = NaN; %observed field that we compare the model against
+		observation_string = ''; %string for observed field.
+		weights            = NaN; %weight coefficients for every vertex
+		weights_string     = ''; %string to identify this particular set of weights
+		datatime				 = 0; %time in years from start that the data is from 
+		cumulated          = NaN; %do we cumulate cflevelsetmisfit through time?
+	end
+	
+	methods
+		function self = extrude(self,md) % {{{
+			if ~isnan(self.weights)
+				self.weights=project3d(md,'vector',self.weights,'type','node');
+			end
+			if ~isnan(self.observation)
+				self.observation=project3d(md,'vector',self.observation,'type','node');
+			end
+		end % }}}
+		function self = cflevelsetmisfit(varargin) % {{{
+			if nargin==0,
+				self=setdefaultparameters(self);
+			else
+				%use provided options to change fields
+				options=pairoptions(varargin{:});
+
+				%get name
+				self.name=getfieldvalue(options,'name','');
+				self.definitionstring=getfieldvalue(options,'definitionstring');
+				self.model_string=getfieldvalue(options,'model_string');
+				self.observation=getfieldvalue(options,'observation',NaN);
+				self.observation_string=getfieldvalue(options,'observation_string');
+				self.weights=getfieldvalue(options,'weights',NaN);
+				self.weights_string=getfieldvalue(options,'weights_string','');
+				self.datatime = getfieldvalue(options, 'datatime');
+
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.datatime = 0;
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ischar(self.name),
+				error('cflevelsetmisfit error message: ''name'' field should be a string!');
+			end
+			OutputdefinitionStringArray={};
+			for i=1:100
+				OutputdefinitionStringArray{i}=strcat('Outputdefinition',num2str(i));
+			end
+			md = checkfield(md,'fieldname','self.definitionstring','field',self.definitionstring,'values',OutputdefinitionStringArray);
+
+			md = checkfield(md,'fieldname','self.observation','field',self.observation,'timeseries',1,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','self.weights','field',self.weights,'timeseries',1,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','self.datatime','field',self.datatime,'<=',md.timestepping.final_time);
+
+		end % }}}
+		function md = disp(self) % {{{
+		
+			disp(sprintf('   TimeMisfit:\n'));
+
+			fielddisplay(self,'name','identifier for this cflevelsetmisfit response');
+			fielddisplay(self,'definitionstring','string that identifies this output definition uniquely, from ''Outputdefinition[1-10]''');
+			fielddisplay(self,'model_string','string for field that is modeled');
+			fielddisplay(self,'observation','observed field that we compare the model against');
+			fielddisplay(self,'observation_string','observation string');
+			fielddisplay(self,'weights','weights (at vertices) to apply to the cflevelsetmisfit');
+			fielddisplay(self,'weights_string','string for weights for identification purposes');
+			fielddisplay(self,'datatime','time to compare data to model for misfit');
+
+		end % }}}
+		function md = marshall(self,prefix,md,fid) % {{{
+
+		WriteData(fid,prefix,'data',self.name,'name','md.cflevelsetmisfit.name','format','String');
+		WriteData(fid,prefix,'data',self.definitionstring,'name','md.cflevelsetmisfit.definitionstring','format','String');
+		WriteData(fid,prefix,'data',self.model_string,'name','md.cflevelsetmisfit.model_string','format','String');
+		WriteData(fid,prefix,'data',self.observation,'name','md.cflevelsetmisfit.observation','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+		WriteData(fid,prefix,'data',self.observation_string,'name','md.cflevelsetmisfit.observation_string','format','String');
+		WriteData(fid,prefix,'data',self.weights,'name','md.cflevelsetmisfit.weights','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+		WriteData(fid,prefix,'data',self.weights_string,'name','md.cflevelsetmisfit.weights_string','format','String');
+		WriteData(fid,prefix,'data',round(self.datatime*md.constants.yts),'name','md.cflevelsetmisfit.datatime','format','Double');
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/cfsurfacelogvel.m
===================================================================
--- issm/trunk/src/m/classes/cfsurfacelogvel.m	(revision 25994)
+++ issm/trunk/src/m/classes/cfsurfacelogvel.m	(revision 26744)
@@ -101,5 +101,5 @@
 		WriteData(fid,prefix,'data',self.weights,'name','md.cfsurfacelogvel.weights','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 		WriteData(fid,prefix,'data',self.weights_string,'name','md.cfsurfacelogvel.weights_string','format','String');
-		WriteData(fid,prefix,'data',round(self.datatime*md.constants.yts),'name','md.cfsurfacelogvel.datatime','format','Integer');
+		WriteData(fid,prefix,'data',round(self.datatime*md.constants.yts),'name','md.cfsurfacelogvel.datatime','format','Double');
 		end % }}}
 	end
Index: issm/trunk/src/m/classes/cfsurfacesquare.m
===================================================================
--- issm/trunk/src/m/classes/cfsurfacesquare.m	(revision 25994)
+++ issm/trunk/src/m/classes/cfsurfacesquare.m	(revision 26744)
@@ -98,5 +98,5 @@
 		WriteData(fid,prefix,'data',self.weights,'name','md.cfsurfacesquare.weights','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 		WriteData(fid,prefix,'data',self.weights_string,'name','md.cfsurfacesquare.weights_string','format','String');
-		WriteData(fid,prefix,'data',round(self.datatime*md.constants.yts),'name','md.cfsurfacesquare.datatime','format','Integer');
+		WriteData(fid,prefix,'data',round(self.datatime*md.constants.yts),'name','md.cfsurfacesquare.datatime','format','Double');
 		end % }}}
 	end
Index: issm/trunk/src/m/classes/clusters/acenet.m
===================================================================
--- issm/trunk/src/m/classes/clusters/acenet.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/acenet.m	(revision 26744)
@@ -7,164 +7,164 @@
 
 classdef acenet
-    properties (SetAccess=public) 
-		 % {{{
-		 %name='glacdyn.ace-net.ca'
-		 name='placentia.ace-net.ca'
-		 %name='brasdor.ace-net.ca'
-		 login='klemorza';
-		 np=10;
-		 port=0;
-		 queue='longq';
-		 time=10;
-		 % codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global
-		 codepath='/home/klemorza/issm/trunk-jpl/bin'; % this one is for issm on my acenet directory
-		 %executionpath='/home/klemorza/issm/trunk-jpl/execution';
-		 %executionpath='/home/klemorza/scratch/issmres.dir';
-		 executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir';                 
-		 %}}}
-	 end
-	 methods
-		 function cluster=acenet(varargin) % {{{
-			 %use provided options to change fields
-			 options=pairoptions(varargin{:});
-			 %initialize cluster using user settings if provided
-			 if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
+	properties (SetAccess=public)
+		% {{{
+		%name='glacdyn.ace-net.ca'
+		name='placentia.ace-net.ca'
+		%name='brasdor.ace-net.ca'
+		login='klemorza';
+		np=10;
+		port=0;
+		queue='longq';
+		time=10;
+		% codepath='/usr/local/issm-r11321/bin'; % this one is for issm on acenet global
+		codepath='/home/klemorza/issm/trunk-jpl/bin'; % this one is for issm on my acenet directory
+		%executionpath='/home/klemorza/issm/trunk-jpl/execution';
+		%executionpath='/home/klemorza/scratch/issmres.dir';
+		executionpath='/net/glacdyn-data/glacdyn/1/klemorza/issm.dir';
+		%}}}
+	end
+	methods
+		function cluster=acenet(varargin) % {{{
+			%use provided options to change fields
+			options=pairoptions(varargin{:});
+			%initialize cluster using user settings if provided
+			if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
 
-			 %OK get other fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}} 
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-                 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%OK get other fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}} 
+		function disp(cluster) % {{{
+			% display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'debug','shortq','longq'};
-			 queue_requirements_time=[48*1 48*7 48*15];
-			 queue_requirements_np=[32 128 256];
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			available_queues={'debug','shortq','longq'};
+			queue_requirements_time=[48*1 48*7 48*15];
+			queue_requirements_np=[32 128 256];
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#$ -cwd\n');
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -cwd\n');
 
-                         fprintf(fid,'#$ -N issm\n');
-                         % fprintf(fid,'#$ -l h_rt=00:15:00\n');
-                         % fprintf(fid,'#$ -l h_rt=5:00:0\n');
-                         % fprintf(fid,'#$ -l h_rt=25:00:0\n');
-                         % fprintf(fid,'#$ -l h_rt=47:59:00\n');
-                         % fprintf(fid,'#$ -l h_rt=72:00:0\n');
-                         % fprintf(fid,'#$ -l h_rt=96:00:0\n');
-                         % fprintf(fid,'#$ -l h_rt=336:00:0\n');
-                         tstr = sprintf('#$ -l h_rt=%i:00:00\n',cluster.time);
-                         fprintf(fid,tstr);
+			fprintf(fid,'#$ -N issm\n');
+			% fprintf(fid,'#$ -l h_rt=00:15:00\n');
+			% fprintf(fid,'#$ -l h_rt=5:00:0\n');
+			% fprintf(fid,'#$ -l h_rt=25:00:0\n');
+			% fprintf(fid,'#$ -l h_rt=47:59:00\n');
+			% fprintf(fid,'#$ -l h_rt=72:00:0\n');
+			% fprintf(fid,'#$ -l h_rt=96:00:0\n');
+			% fprintf(fid,'#$ -l h_rt=336:00:0\n');
+			tstr = sprintf('#$ -l h_rt=%i:00:00\n',cluster.time);
+			fprintf(fid,tstr);
 
-                         fprintf(fid,'#$ -l h_vmem=2G\n');
+			fprintf(fid,'#$ -l h_vmem=2G\n');
 
-                         if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir')
-                             % ---- Which acent queue to use ----
-                             fprintf(fid,'#$ -q short.q@*,medium.q@*\n');
-                             %fprintf(fid,'#$ -q medium.q@*,long.q@*\n');
-                             %fprintf(fid,'#$ -q medium.q@*\n');
-                             %fprintf(fid,'#$ -q short.q@*\n');
-                             % Acenet nodes with 16cpus and more than 60G mem
-                             % fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n');
-                             % ---- cpus on different nodes ----
-                             if cluster.np==4
-                                 % -------- All cpus in the same node --------          
-                                 fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
-                             else
-                                 fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand
-                             end
-                         
-                         elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir')
-                             % ---- Which node for Lev's queue are selected ----
-                             fprintf(fid,'#$ -q tarasov.q\n');
-                             fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n');
-                             %fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n');
-                             %fprintf(fid,'#$ -l h=cl0* \n');
-                             % fprintf(fid,'#$ -l h=cl338 \n');
-                             
-                             if cluster.np==4
-                                 % -------- All cpus in the same node --------          
-                                 fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
-                             else
-                                 fprintf(fid,'#$ -pe ompi* %i\n',cluster.np);
-                                 %fprintf(fid,'#$ -pe 4per %i\n',cluster.np);
-                                 %fprintf(fid,'#$ -pe 8per %i\n',cluster.np);
-                             end
-                         end
-                                                  
-                         % ---- misc ----
-                         fprintf(fid,'#$ -j y\n');
-                         
-                         fprintf(fid,'module purge\n');
-                         %fprintf(fid,'module load gcc openmpi/gcc\n');
-                         %fprintf(fid,'module unload openmpi\n');
-                         fprintf(fid,'module load intel/12.1.7.367\n');
-                         fprintf(fid,'module load openmpi/intel/1.2.9\n');
+			if strcmp(cluster.executionpath,'/home/klemorza/scratch/issmres.dir')
+				% ---- Which acent queue to use ----
+				fprintf(fid,'#$ -q short.q@*,medium.q@*\n');
+				%fprintf(fid,'#$ -q medium.q@*,long.q@*\n');
+				%fprintf(fid,'#$ -q medium.q@*\n');
+				%fprintf(fid,'#$ -q short.q@*\n');
+				% Acenet nodes with 16cpus and more than 60G mem
+				% fprintf(fid,'#$ -l h=cl001|cl002|cl003|cl004|cl005|cl006|cl007|cl008|cl009|cl010|cl011|cl012|cl021|cl022|cl023|cl024 \n');
+				% ---- cpus on different nodes ----
+				if cluster.np==4
+					% -------- All cpus in the same node --------          
+					fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
+				else
+					fprintf(fid,'#$ -pe ompi %i\n',cluster.np); % To avoid green acenet that does not have InfiniBand
+				end
 
-                         fprintf(fid,'module load gsl\n');
-                         %fprintf(fid,'module load issm\n');
-                         fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-                         fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-                         fprintf(fid,'\n');
-                         fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',...
-                                 cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
-                         %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
-			 fclose(fid);
+			elseif strcmp(cluster.executionpath,'/net/glacdyn-data/glacdyn/1/klemorza/issm.dir')
+				% ---- Which node for Lev's queue are selected ----
+				fprintf(fid,'#$ -q tarasov.q\n');
+				fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n');
+				%fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269 \n');
+				%fprintf(fid,'#$ -l h=cl0* \n');
+				% fprintf(fid,'#$ -l h=cl338 \n');
+				
+				if cluster.np==4
+					% -------- All cpus in the same node --------          
+					fprintf(fid,'#$ -pe openmp %i\n',cluster.np);
+				else
+					fprintf(fid,'#$ -pe ompi* %i\n',cluster.np);
+					%fprintf(fid,'#$ -pe 4per %i\n',cluster.np);
+					%fprintf(fid,'#$ -pe 8per %i\n',cluster.np);
+				end
+			end
+						
+			% ---- misc ----
+			fprintf(fid,'#$ -j y\n');
+			
+			fprintf(fid,'module purge\n');
+			%fprintf(fid,'module load gcc openmpi/gcc\n');
+			%fprintf(fid,'module unload openmpi\n');
+			fprintf(fid,'module load intel/12.1.7.367\n');
+			fprintf(fid,'module load openmpi/intel/1.2.9\n');
 
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			fprintf(fid,'module load gsl\n');
+			%fprintf(fid,'module load issm\n');
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'\n');
+			fprintf(fid,'mpiexec %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog\n',...
+					cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
+			%fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
+			fclose(fid);
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 system(compressstring);
+		end
+		%}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			system(compressstring);
 
-		 end %}}}
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		end %}}}
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+		function Download(cluster,dirname,filelist) % {{{
 
-		 end %}}}
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/aci.m
===================================================================
--- issm/trunk/src/m/classes/clusters/aci.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/aci.m	(revision 26744)
@@ -53,5 +53,5 @@
 			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.ppn*cluster.nodes,1)
 
-			%Miscelaneous
+			%Miscellaneous
 			if cluster.ppn>20, md = checkmessage(md,'cannot request more that 20 cores per node'); end
 			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
Index: issm/trunk/src/m/classes/clusters/aurora.m
===================================================================
--- issm/trunk/src/m/classes/clusters/aurora.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/aurora.m	(revision 26744)
@@ -1,3 +1,3 @@
-%AURORA class definition
+%AURORA cluster class definition
 %
 %   Usage:
@@ -7,128 +7,131 @@
 
 classdef aurora
-    properties (SetAccess=public) 
-		 % {{{
-		 name='aurora.jpl.nasa.gov'
-		 login='username';
-		 numnodes = 1;
-		 cpuspernode = 24;
-		 modules = {'intel/cluster-toolkit-2013.5.192'};
-		 port=1070;
-		 queue='shortq';
-		 time=3*60;
-		 codepath='~/issm/trunk/';
-		 executionpath='~/issm/trunk/execution/';
-		 mpipath='/opt/intel/impi/4.1.3/intel64/bin/';
-		 %}}}
-	 end
-	 methods
-		 function cluster=aurora(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='aurora.jpl.nasa.gov'
+		login='username';
+		numnodes = 1;
+		cpuspernode = 24;
+		modules = {'intel/cluster-toolkit-2013.5.192'};
+		port=1070;
+		queue='shortq';
+		time=3*60;
+		codepath='~/issm/trunk/';
+		executionpath='~/issm/trunk/execution/';
+		mpipath='/opt/intel/impi/4.1.3/intel64/bin/';
+		%}}}
+	end
+	methods
+		function cluster=aurora(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('aurora_settings')==2), aurora_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('aurora_settings')==2), aurora_settings; end
 
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    mpipath: %s',cluster.mpipath));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'debugq','shortq','mediumq','longq','verylongq'};
-			 queue_requirements_time=[60*1 60*3 60*12 60*48 60*192];
-			 queue_requirements_np=[16 256 256 128 128];
+			available_queues={'debugq','shortq','mediumq','longq','verylongq'};
+			queue_requirements_time=[60*1 60*3 60*12 60*48 60*192];
+			queue_requirements_np=[16 256 256 128 128];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.numnodes.*cluster.cpuspernode,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.numnodes.*cluster.cpuspernode,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-			 executable='issm.exe';
-			 if isdakota,
-				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				 if (version>=6),
-					 executable='issm_dakota.exe';
-				 end
-			 end
-			 if isoceancoupling,
-				 executable='issm_ocean.exe';
-			 end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+			if isoceancoupling,
+				executable='issm_ocean.exe';
+			end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#PBS -l select=%i:ncpus=%i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -q %s\n',cluster.queue);
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n',modelname);
-			 fprintf(fid,'source /usr/share/Modules/init/bash\n');
-			 for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n\n']); end
-			 fprintf(fid,'export PATH="$PATH:."\n\n');
-			 fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
-			 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');      
-			 fprintf(fid,'export PATH="$PATH:.:%s"\n',cluster.mpipath);
-			 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
-			 fprintf(fid,'cd $PBS_O_WORKDIR\n');
-			 fprintf(fid,'mpirun -n %i %s/%s %s %s %s',cluster.np(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#PBS -l select=%i:ncpus=%i\n',cluster.numnodes,cluster.cpuspernode);
+			fprintf(fid,'#PBS -N %s\n',modelname);
+			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#PBS -q %s\n',cluster.queue);
+			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+			fprintf(fid,'#PBS -e %s.errlog \n',modelname);
+			fprintf(fid,'source /usr/share/Modules/init/bash\n');
+			for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n\n']); end
+			fprintf(fid,'export PATH="$PATH:."\n\n');
+			fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
+			fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');      
+			fprintf(fid,'export PATH="$PATH:.:%s"\n',cluster.mpipath);
+			fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'cd $PBS_O_WORKDIR\n');
+			fprintf(fid,'mpirun -n %i %s/%s %s %s %s',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		end
+		%}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-			 end
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+			end
 
-			 disp('launching solution sequence on remote cluster');
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+			disp('launching solution sequence on remote cluster');
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
 
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/camhpc.m
===================================================================
--- issm/trunk/src/m/classes/clusters/camhpc.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/camhpc.m	(revision 26744)
@@ -1,3 +1,3 @@
-%PFE class definition
+%CAMHPC cluster class definition
 %
 %   Usage:
@@ -7,145 +7,145 @@
 
 classdef camhpc
-    properties (SetAccess=public)  
-		 % {{{
-		 name          = 'camhpc'
-		 login         = '';
-		 numnodes      = 20;
-		 cpuspernode   = 8;
-		 port          = 8000;
-		 project       = '';
-		 partition     = '';
-		 codepath      = '';
-		 executionpath = '';
-		 interactive   = 0;
-		 time          = 24*60;
-		 memory        = 2;
-	 end
-	 %}}}
-	 methods
-		 function cluster=camhpc(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name          = 'camhpc'
+		login         = '';
+		numnodes      = 20;
+		cpuspernode   = 8;
+		port          = 8000;
+		project       = '';
+		partition     = '';
+		codepath      = '';
+		executionpath = '';
+		interactive   = 0;
+		time          = 24*60;
+		memory        = 2;
+	end
+	%}}}
+	methods
+		function cluster=camhpc(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('camhpc_settings')==2), camhpc_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('camhpc_settings')==2), camhpc_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    project: %s',cluster.project));
-			 disp(sprintf('    partition: %s',cluster.partition));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    memory: %i',cluster.memory));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    project: %s',cluster.project));
+			disp(sprintf('    partition: %s',cluster.partition));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    memory: %i',cluster.memory));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'ARNOLD-SL3-CPU'}; % Updated for csd3 NSA 28/3/18
-			 queue_requirements_time=[Inf Inf];
-			 queue_requirements_np=[80 80];
+			available_queues={'ARNOLD-SL3-CPU'}; % Updated for csd3 NSA 28/3/18
+			queue_requirements_time=[Inf Inf];
+			queue_requirements_np=[80 80];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.np,1)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.project,cluster.nprocs(),1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-             disp(modelname)
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
-			 fprintf(fid,'#SBATCH -p %s \n',cluster.partition);
-			 fprintf(fid,'#SBATCH -A %s \n',cluster.project);
-			 fprintf(fid,'#SBATCH --mail-type=ALL\n');
-			 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60) %walltime is in seconds.
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			%write queuing script
+			disp(modelname)
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
+			fprintf(fid,'#SBATCH -p %s \n',cluster.partition);
+			fprintf(fid,'#SBATCH -A %s \n',cluster.project);
+			fprintf(fid,'#SBATCH --mail-type=ALL\n');
+			fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
+			fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60) %walltime is in seconds.
+			fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
+			disp('launching solution sequence on remote cluster');
              %
              % qsub replaced by sbatch for csd3 system NSA 28/3/18
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/castor.m
===================================================================
--- issm/trunk/src/m/classes/clusters/castor.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/castor.m	(revision 26744)
@@ -7,101 +7,101 @@
 
 classdef castor
-    properties (SetAccess=public) 
-		 % {{{
-		 name='castor'
-		 login='username';
-		 np   =128;
-		 port=0;
-		 queue='shortc';
-		 time=180;
-		 codepath='/workp/edw/issm-2.0/bin'
-		 executionpath='/workp/edw/Testing/Execution'
-		 %}}}
-	 end
-	 methods
-		 function cluster=castor(varargin) % {{{
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='castor'
+		login='username';
+		np=128;
+		port=0;
+		queue='shortc';
+		time=180;
+		codepath='/workp/edw/issm-2.0/bin'
+		executionpath='/workp/edw/Testing/Execution'
+		%}}}
+	end
+	methods
+		function cluster=castor(varargin) % {{{
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'shortc','longc'};
-			 queue_requirements_time=[180 720];
-			 queue_requirements_np=[128 128];
+			available_queues={'shortc','longc'};
+			queue_requirements_time=[180 720];
+			queue_requirements_np=[128 128];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/sh\n');
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
-			 if ~isempty(queue),
-				 fprintf(fid,'#PBS -q %s\n',cluster.queue);
-			 end
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n',modelname);
-			 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
-			 fprintf(fid,'cd $PBS_O_WORKDIR\n');
-			 fprintf(fid,'export OMP_NUM_THREADS=1\n');
-			 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/sh\n');
+			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#PBS -N %s\n',modelname);
+			fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
+			if ~isempty(queue),
+				fprintf(fid,'#PBS -q %s\n',cluster.queue);
+			end
+			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+			fprintf(fid,'#PBS -e %s.errlog \n',modelname);
+			fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'cd $PBS_O_WORKDIR\n');
+			fprintf(fid,'export OMP_NUM_THREADS=1\n');
+			fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		end
+		%}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/cloud.m
===================================================================
--- issm/trunk/src/m/classes/clusters/cloud.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/cloud.m	(revision 26744)
@@ -6,5 +6,5 @@
 
 classdef cloud
-	properties (SetAccess=public) 
+	properties (SetAccess=public)
 		% {{{
 		name='';
@@ -20,6 +20,6 @@
 
 			%initialize cluster using user settings if provided
-			if (exist('cloud_settings')==2), 
-				eval('cloud_settings'); 
+			if (exist('cloud_settings')==2),
+				cloud_settings;
 			end
 
@@ -29,5 +29,5 @@
 		%}}}
 		function disp(cluster) % {{{
-			%  display the object
+			%display the object
 			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
 			disp(sprintf('    name: %s',cluster.name));
@@ -53,16 +53,10 @@
 			fid=fopen([modelname '.queue'],'w');
 			fprintf(fid,'#!/bin/bash\n');
-			if cluster.interactive
-				fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh');
-				fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]);
-				fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s %s 2> %s.errlog > /dev/stdout | tee %s.outlog ',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
-			else
-				fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh');
-				fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]);
-				fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s %s 2> %s.errlog > /dev/stdout | tee %s.outlog ',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname,modelname,modelname);
-			end
+			fprintf(fid,'source %s%s\n',cluster.codepath,'/../etc/environment.sh');
+			fprintf(fid,'cd %s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'mpiexec -np %i -f /home/mpich2.hosts %s/issm.exe %s %s/%s %s 2> %s.errlog > /dev/stdout | tee %s.outlog',cluster.np,cluster.codepath,solution,cluster.executionpath,dirname,modelname,modelname,modelname);
 		end
 		%}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
 			%compress the files into one zip.
@@ -80,5 +74,5 @@
 
 		end %}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
 			if cluster.interactive, 
@@ -88,18 +82,18 @@
 				else
 					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz'];
 				end
 			else
 				disp('launching solution sequence on remote cluster');
 				if ~isempty(restart)
-					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub  ' modelname '.queue '];
+					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue'];
 				else
 					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub  ' modelname '.queue '];
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue'];
 				end
 			end
 			issmstssh(cluster.name,cluster.login,launchcommand);
 		end %}}}
-		function Download(cluster,dirname,filelist)% {{{
+		function Download(cluster,dirname,filelist) % {{{
 
 			%copy files from cluster to current directory
Index: issm/trunk/src/m/classes/clusters/cloud.py
===================================================================
--- issm/trunk/src/m/classes/clusters/cloud.py	(revision 26744)
+++ issm/trunk/src/m/classes/clusters/cloud.py	(revision 26744)
@@ -0,0 +1,101 @@
+import subprocess
+
+try:
+    from cloud_settings import cloud_settings
+except ImportError:
+    print('You need cloud_settings.py to proceed, check presence and sys.path')
+
+class cloud(object):
+    """CLOUD cluster class definition
+
+    Usage:
+        cluster = cloud('name', 'astrid', 'np', 3)
+        cluster = cloud('name', oshostname(), 'np', 3, 'login', 'username')
+    """
+
+    def __init__(self, *args):  # {{{
+        self.name = ''
+        self.login = ''
+        self.np = 1
+        self.codepath = ''
+        self.executionpath = ''
+        self.interactive = 0
+
+        # Initialize cluster using user settings if provided
+        try:
+            self = cloud_settings(self)
+        except NameError:
+            print('cloud_settings.py not found, using default settings')
+
+        # OK get other fields
+        options = pairoptions(*args)
+        self = options.AssignObjectFields(self)
+    # }}}
+
+    def __repr__(self):  # {{{
+        # Display the object
+        s = 'class \'{}\' object \'{}\' = \n'.format(type(self), 'self')
+        s += '    name: {}\n'.format(self.name)
+        s += '    login: {}\n'.format(self.login)
+        s += '    np: {}\n'.format(self.np)
+        s += '    codepath: {}\n'.format(self.codepath)
+        s += '    executionpath: {}\n'.format(self.executionpath)
+        s += '    interactive: {}\n'.format(self.interactive)
+        return s
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if self.np < 1:
+            md = md.checkmessage('number of processors should be at least 1')
+
+        if np.isnan(self.np):
+            md = md.checkmessage('number of processors should not be NaN!')
+
+        return self
+    # }}}
+
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
+        # Write queuing script
+        fid = open(modelname + '.queue', 'w')
+
+        fid.write('#/bin/bash\n')
+        fid.write('source {}{}\n'.format(self.codepath, '/../etc/environment.sh'))
+        fid.write('cd {}/{}\n'.format(self.executionpath, dirname))
+        fid.write('mpiexec -np {} -f /home/mpich2.hosts {}/issm.exe {} {}/{} {} 2> {}.errlog > /dev/stdout | tee {}.outlog\n'.format(self.np, self.codepath, solution, self.executionpath, dirname, modelname, modelname, modelname))
+    # }}}
+
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
+        # Compress the files into one zip
+        compressstring = 'tar -zcf {}.tar.gz'.format(dirname)
+        for file in filelist:
+            compressstring += ' {}'.format(file)
+        subprocess.call(compressstring, shell=True)
+
+        if isempty(self.login):
+            raise Exception('cloud BuildQueueScript: login should be supplied!')
+
+        print('uploading input file and queueing script')
+        issmstscpout(self.name, self.executionpath, self.login, '{}.tar.gz'.format(dirname))
+    # }}}
+
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
+        if self.interactive:
+            print('sending files to remote cluster. once done, please log into cluster and launch job')
+            if not isempty(restart):
+                launchcommand = 'cd {} && cd {}'.format(self.executionpath, dirname)
+            else:
+                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname)
+        else:
+            print('launching solution sequence on remote cluster')
+            if not isempty(restart):
+                launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname)
+            else:
+                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
+        issmstssh(self.name, self.login, launchcommand)
+    # }}}
+
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
+        directory = '{}/{}/'.format(self.executionpath, dirname)
+        issmstscpin(self.name, self.login, directory, filelist)
+    # }}}
Index: issm/trunk/src/m/classes/clusters/cosmos.m
===================================================================
--- issm/trunk/src/m/classes/clusters/cosmos.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/cosmos.m	(revision 26744)
@@ -7,101 +7,101 @@
 
 classdef cosmos
-    properties (SetAccess=public) 
-		 % {{{
-		 name='cosmos'
-		 login='username';
-		 np=128;
-		 port=0;
-		 queue='shortq';
-		 time=3*60;
-		 codepath='/work00/edw/issm-2.0/bin';
-		 executionpath='/work00/edw/Execution';
-		 %}}}
-	 end
-	 methods
-		 function cluster=cosmos(varargin) % {{{
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='cosmos'
+		login='username';
+		np=128;
+		port=0;
+		queue='shortq';
+		time=3*60;
+		codepath='/work00/edw/issm-2.0/bin';
+		executionpath='/work00/edw/Execution';
+		%}}}
+	end
+	methods
+		function cluster=cosmos(varargin) % {{{
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'debug','shortq','longq'};
-			 queue_requirements_time=[60*1 60*3 60*17];
-			 queue_requirements_np=[32 128 256];
+			available_queues={'debug','shortq','longq'};
+			queue_requirements_time=[60*1 60*3 60*17];
+			queue_requirements_np=[32 128 256];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);
-			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -q %s\n',queue);
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n',modelname);
-			 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
-			 fprintf(fid,'cd $PBS_O_WORKDIR\n');
-			 fprintf(fid,'export OMP_NUM_THREADS=1\n');
-			 fprintf(fid,'ulimit -s unlimited\n');
-			 fprintf(fid,'ulimit -c 0\n');
-			 fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			%write queuing script
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);
+			fprintf(fid,'#PBS -N %s\n',modelname);
+			fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds.
+			fprintf(fid,'#PBS -q %s\n',queue);
+			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+			fprintf(fid,'#PBS -e %s.errlog \n',modelname);
+			fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'cd $PBS_O_WORKDIR\n');
+			fprintf(fid,'export OMP_NUM_THREADS=1\n');
+			fprintf(fid,'ulimit -s unlimited\n');
+			fprintf(fid,'ulimit -c 0\n');
+			fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		end
+		%}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/cyclone.py
===================================================================
--- issm/trunk/src/m/classes/clusters/cyclone.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/cyclone.py	(revision 26744)
@@ -1,25 +1,28 @@
 import subprocess
-from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
-from issmscpin import issmscpin
-from issmscpout import issmscpout
+
 try:
     from cyclone_settings import cyclone_settings
 except ImportError:
     print('You need cyclone_settings.py to proceed, check presence and sys.path')
+from fielddisplay import fielddisplay
+from helpers import *
+from pairoptions import pairoptions
+from issmscpin import issmscpin
+from issmscpout import issmscpout
+from issmssh import issmssh
 
 
 class cyclone(object):
-    """
-    Be aware that this is not a cluster as we usually know them. There is no scheduling and ressources are pretty low.
-    The Computer have 20 cpus and 512Gb of memory used by a number of person so be respectful with your usage.
-    I putted some restrictive upper limits to avoid over - use. (Basile)
+    """CYCLONE cluster class definition
 
-       Usage:
-          cluster = cyclone()
+    Be aware that this is not a cluster as we usually know them. There is no scheduling and resources are pretty low.
+    The computer has 20 CPUs and 512GB of memory used by a number of persons, so be respectful with your usage.
+    I have put some restrictive upper limits in place to avoid overuse. (Basile)
+
+    Usage:
+        cluster = cyclone()
     """
 
-    def __init__(self, *args):    # {{{
+    def __init__(self, *args):  # {{{
         self.name = 'cyclone'
         self.login = ''
@@ -31,16 +34,15 @@
         self.interactive = 0
 
-    #use provided options to change fields
+        # Use provided options to change fields
         options = pairoptions(*args)
 
-    #initialize cluster using user settings if provided
+        # Initialize cluster using user settings if provided
         self = cyclone_settings(self)
-    #OK get other fields
+        # OK get other fields
         self = options.AssignObjectFields(self)
-
     # }}}
 
-    def __repr__(self):    # {{{
-        #  display the object
+    def __repr__(self):  # {{{
+        # Display the object
         s = "class cyclone object:"
         s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
@@ -53,6 +55,6 @@
     # }}}
 
-    def checkconsistency(self, md, solution, analyses):    # {{{
-        #Miscelaneous
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Miscellaneous
         if not self.login:
             md = md.checkmessage('login empty')
@@ -69,7 +71,7 @@
     # }}}
 
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
         executable = 'issm.exe'
-        #write queuing script
+        # Write queuing script
         fid = open(modelname + '.queue', 'w')
         fid.write('export ISSM_DIR="%s/../ "\n' % self.codepath)
@@ -83,28 +85,25 @@
         fid.write('mpiexec -np %i %s/%s %s %s %s>%s.outlog 2>%s.errlog\n' % (self.np, self.codepath, executable, str(solution), rundir, modelname, runfile, runfile))
         fid.close()
-
     # }}}
-    def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
         #compress the files into one zip.
         compressstring = 'tar -zcf %s.tar.gz ' % dirname
         for file in filelist:
-            compressstring += ' %s' % file
+            compressstring += ' {}'.format(file)
         subprocess.call(compressstring, shell=True)
 
         print('uploading input file and queueing script')
         issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-
     # }}}
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
         print('launching solution sequence on remote cluster')
-        if restart:
+        if not isempty(restart):
             launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname)
         else:
             launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod +x ./%s.queue && ./%s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname, modelname)
         issmssh(self.name, self.login, self.port, launchcommand)
-
     # }}}
-    def Download(self, dirname, filelist):    # {{{
-        #copy files from cluster to current directory
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
         directory = '%s/%s/' % (self.executionpath, dirname)
         issmscpin(self.name, self.login, self.port, directory, filelist)
Index: issm/trunk/src/m/classes/clusters/discover.m
===================================================================
--- issm/trunk/src/m/classes/clusters/discover.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/discover.m	(revision 26744)
@@ -1,3 +1,3 @@
-%PFE class definition
+%DISCOVER cluster class definition
 %
 %   Usage:
@@ -6,221 +6,223 @@
 %      cluster=discover('np',3,'login','username');
 
-classdef discover 
-    properties (SetAccess=public)  
-		 % {{{
-		 name=oshostname();
-		 login='';
-		 modules        = {};
-		 numnodes=20;
-		 cpuspernode=8; 
-		 port=0;
-		 queue='general';
-		 time=12*60*60;
-		 processor='west';
-		 codepath='';
-		 executionpath='';
-		 interactive=0;
-		 bbftp=0;
-		 numstreams=8;
-		 hyperthreading=0;
-		 email='';
-	 end
-	 %}}}
-	 methods
-		 function cluster=discover(varargin) % {{{
-
-			 %initialize cluster using default settings if provided
-			 if (exist('discover_settings')==2), discover_settings; end
-
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    processor: %s',cluster.processor));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    hyperthreading: %i',cluster.hyperthreading));
-			 disp(sprintf('    email: %s',cluster.email));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
-
-			 available_queues={'long','allnccs','debug'};
-			 queue_requirements_time=[24*60*60 12*60*60 1*60*60];
-			 queue_requirements_np=[560 6000 532];
-
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-
-			 %now, check cluster.cpuspernode according to processor type
-			 if ( strcmpi(cluster.processor,'sand')),
-				 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
-					 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''sand'' processors');
-				 end
-			 elseif strcmpi(cluster.processor,'hasw'),
-				 if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)),
-					 md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''hasw'' processors');
-				 end
-			 else
-				 md = checkmessage(md,'unknown processor type, should be ''sand'' or ''hasw'' ');
-			 end
-
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			 executable='issm.exe';
-			 if isdakota,
-				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				 if (version>=6),
-					 executable='issm_dakota.exe';
-				 end
-			 end
-			 if isoceancoupling,
-				 executable='issm_ocean.exe';
-			 end
-
-			 %write queuing script
-			 fid=fopen([modelname '.queue'],'w');
-
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH -J %s \n',modelname);
-			 fprintf(fid,'#SBATCH --qos=%s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
-			 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
-			 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
-			 fprintf(fid,'#SBATCH -A s1690 \n\n');
-			 for i=1:numel(cluster.modules),
-				 fprintf(fid,['module load ' cluster.modules{i} '\n']);
-			 end
-			 if length(find(cluster.email=='@'))>0
-				 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
-				 fprintf(fid,'#SBATCH --mail-type=end \n\n');
-			 end
-			 fprintf(fid,'. /usr/share/modules/init/bash\n\n');
-			 fprintf(fid,'module load comp/intel/20.0.0.166\n');
-			 fprintf(fid,'module load mpi/sgi-mpt/2.17\n');
-			 fprintf(fid,'module load cmake/3.17.0\n');
-			 fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
-			 fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');
-			 fprintf(fid,'export PATH="$PATH:."\n\n');
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-
-			 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 if ~isvalgrind,
-					 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-				 else
-					 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-				 end
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
-
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.run '  modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
-
-			 disp('uploading input file and queueing script');
-			 if cluster.interactive,
-				 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
-			 else 
-				 directory=cluster.executionpath;
-			 end
-
-			 if ~cluster.bbftp,
-				 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
-			 else
-				 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
-			 end
-
-		 end
-		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-
-			 if ~cluster.interactive, 
-				 if ~isempty(restart)
-					 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue '];
-				 else
-					 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && sbatch ' modelname '.queue '];
-				 end
-			 else
-				 if ~isempty(restart)
-					 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
-				 else
-					 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
-				 end
-			 end
-
-			 disp('launching solution sequence on remote cluster');
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end
-		 %}}}
-		 function Download(cluster,dirname,filelist)% {{{
-
-			 %copy files from cluster to current directory
-			 if ~cluster.interactive,
-				 directory=[cluster.executionpath '/' dirname '/'];
-			 else
-				 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
-			 end
-
-			 if ~cluster.bbftp,
-				 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
-			 else
-				 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
-			 end
-
-		 end %}}}
+classdef discover
+	properties (SetAccess=public)
+		% {{{
+		name=oshostname();
+		login='';
+		modules={'comp/intel/20.0.0.166' 'mpi/sgi-mpt/2.17' 'cmake/3.17.0'};
+		numnodes=20;
+		cpuspernode=8;
+		port=0;
+		queue='general';
+		time=12*60*60;
+		processor='west';
+		codepath='';
+		executionpath='';
+		grouplist='';
+		interactive=0;
+		bbftp=0;
+		numstreams=8;
+		hyperthreading=0;
+		email='';
+	end
+	%}}}
+	methods
+		function cluster=discover(varargin) % {{{
+
+			%initialize cluster using default settings if provided
+			if (exist('discover_settings')==2), discover_settings; end
+
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    processor: %s',cluster.processor));
+			disp(sprintf('    srcpath: %s',cluster.srcpath));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    grouplist: %s',cluster.grouplist));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    bbftp: %s',cluster.bbftp));
+			disp(sprintf('    numstreams: %s',cluster.numstreams));
+			disp(sprintf('    hyperthreading: %i',cluster.hyperthreading));
+			disp(sprintf('    email: %s',cluster.email));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
+
+			available_queues={'long','allnccs','debug'};
+			queue_requirements_time=[24*60*60 12*60*60 1*60*60];
+			queue_requirements_np=[560 6000 532];
+
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
+
+			%now, check cluster.cpuspernode according to processor type
+			if ( strcmpi(cluster.processor,'sand')),
+				if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
+					md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''sand'' processors');
+				end
+			elseif strcmpi(cluster.processor,'hasw'),
+				if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)),
+					md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''hasw'' processors');
+				end
+			else
+				md = checkmessage(md,'unknown processor type, should be ''sand'' or ''hasw'' ');
+			end
+
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+			if isoceancoupling,
+				executable='issm_ocean.exe';
+			end
+
+			%write queuing script
+			fid=fopen([modelname '.queue'],'w');
+
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH -J %s \n',modelname);
+			fprintf(fid,'#SBATCH --qos=%s \n',cluster.queue);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
+			fprintf(fid,'#SBATCH -n %i \n',cluster.nprocs());
+			fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
+			fprintf(fid,'#SBATCH -t %02i:%02i:00 \n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
+			fprintf(fid,'#SBATCH -A %s \n\n',cluster.grouplist);
+			if length(find(cluster.email=='@'))>0
+				fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
+				fprintf(fid,'#SBATCH --mail-type=end \n\n');
+			end
+			fprintf(fid,'. /usr/share/modules/init/bash\n\n');
+			for i=1:numel(cluster.modules),
+				fprintf(fid,['module load ' cluster.modules{i} '\n']);
+			end
+			fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
+			fprintf(fid,'export MPI_UNBUFFERED_STDIO=true\n\n');
+			fprintf(fid,'export PATH="$PATH:."\n\n');
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+
+			fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				if ~isvalgrind,
+					fprintf(fid,'mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
+				else
+					fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
+				end
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w'); % TODO: Change this to system call (touch <file>)?
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w'); % TODO: Change this to system call (touch <file>)?
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
+
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz'];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.run '  modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
+
+			disp('uploading input file and queueing script');
+			if cluster.interactive,
+				directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
+			else 
+				directory=cluster.executionpath;
+			end
+
+			if cluster.bbftp,
+				issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
+			else
+				issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			end
+
+		end
+		%}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
+
+			if cluster.interactive,
+				if ~isempty(restart)
+					launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
+				else
+					launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
+				end
+			else
+				if ~isempty(restart)
+					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue '];
+				else
+					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && sbatch ' modelname '.queue '];
+				end
+			end
+
+			disp('launching solution sequence on remote cluster');
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end
+		%}}}
+		function Download(cluster,dirname,filelist) % {{{
+
+			%copy files from cluster to current directory
+			if cluster.interactive,
+				directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
+			else
+				directory=[cluster.executionpath '/' dirname '/'];
+			end
+
+			if cluster.bbftp,
+				issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
+			else
+				issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			end
+
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/discover.py
===================================================================
--- issm/trunk/src/m/classes/clusters/discover.py	(revision 26744)
+++ issm/trunk/src/m/classes/clusters/discover.py	(revision 26744)
@@ -0,0 +1,222 @@
+import subprocess
+
+try:
+    from discover_settings import discover_settings
+except ImportError:
+    print('You need discover_settings.py to proceed, check presence and sys.path')
+from fielddisplay import fielddisplay
+from helpers import *
+from IssmConfig import IssmConfig
+from issmscpin import issmscpin
+from issmscpout import issmscpout
+from issmssh import issmssh
+from MatlabFuncs import *
+from pairoptions import pairoptions
+from QueueRequirements import QueueRequirements
+
+class discover(object):
+    """DISCOVER cluster class definition
+
+    Usage:
+        cluster = discover()
+        cluster = discover('np', 3)
+        cluster = discover('np', 3, 'login', 'username')
+    """
+
+    def __init__(self, *args):  # {{{
+        self.name = oshostname()
+        self.login = ''
+        self.modules = ['comp/intel/20.0.0.166', 'mpi/sgi-mpt/2.17', 'cmake/3.17.0']
+        self.numnodes = 20
+        self.cpuspernode = 8
+        self.port = 0
+        self.queue = 'general'
+        self.time = 12 * 60 * 60
+        self.processor = 'west'
+        self.srcpath = ''
+        self.codepath = ''
+        self.executionpath = ''
+        self.grouplist = ''
+        self.interactive = 0
+        self.bbftp = 0
+        self.numstreams = 8
+        self.hyperthreading = 0
+        self.email = ''
+
+        # Use provided options to change fields
+        options = pairoptions(*args)
+
+        # Initialize cluster using user settings if provided
+        try:
+            self = discover_settings(self)
+        except NameError:
+            print('discover_settings.py not found, using default settings')
+
+        # OK get other fields
+        self = options.AssignObjectFields(self)
+    # }}}
+
+    def __repr__(self):  # {{{
+        # Display the object
+        s = 'class discover object\n'
+        s += '    name: {}\n'.format(self.name)
+        s += '    login: {}\n'.format(self.login)
+        s += '    modules: {}\n'.format(strjoin(self.modules, ', '))
+        s += '    numnodes: {}\n'.format(self.numnodes)
+        s += '    cpuspernode: {}\n'.format(self.cpuspernode)
+        s += '    np: {}\n'.format(self.nprocs())
+        s += '    port: {}\n'.format(self.port)
+        s += '    queue: {}\n'.format(self.queue)
+        s += '    time: {}\n'.format(self.time)
+        s += '    processor: {}\n'.format(self.processor)
+        s += '    srcpath: {}\n'.format(self.srcpath)
+        s += '    codepath: {}\n'.format(self.codepath)
+        s += '    executionpath: {}\n'.format(self.executionpath)
+        s += '    grouplist: {}\n'.format(self.grouplist)
+        s += '    interactive: {}\n'.format(self.interactive)
+        s += '    bbftp: {}\n'.format(self.bbftp)
+        s += '    numstreams: {}\n'.format(self.numstreams)
+        s += '    hyperthreading: {}\n'.format(self.hyperthreading)
+        return s
+    # }}}
+
+    def nprocs(self):  # {{{
+        return self.numnodes * self.cpuspernode
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        queuedict = {'long': [24 * 60 * 60, 560],
+                     'allnccs': [12 * 60 * 60, 6000],
+                     'debug': [1 * 60 * 60, 532]}
+        QueueRequirements(queuedict, self.queue, self.nprocs(), self.time)
+
+        # Now, check cluster.cpuspernode according to processor type
+        if self.processor == 'sand':
+            if self.cpuspernode > 16 or self.cpuspernode < 1:
+                md = md.checkmessage('cpuspernode should be between 1 and 16 for \'sand\' processors in hyperthreading mode')
+        elif self.processor == 'hasw':
+            if self.cpuspernode > 28 or self.cpuspernode < 1:
+                md = md.checkmessage('cpuspernode should be between 1 and 28 for \'hasw\' processors in hyperthreading mode')
+        else:
+            md = md.checkmessage('unknown processor type, should be \'sand\' or \'hasw\'')
+
+        # Miscellaneous
+        if not self.login:
+            md = md.checkmessage('login empty')
+        if not self.codepath:
+            md = md.checkmessage('codepath empty')
+        if not self.executionpath:
+            md = md.checkmessage('executionpath empty')
+
+        return self
+    # }}}
+
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
+        if isgprof:
+            print('gprof not supported by cluster, ignoring...')
+
+        executable = 'issm.exe'
+        if isdakota:
+            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
+            version = float(str(version[0]))
+            if version >= 6:
+                executable = 'issm_dakota.exe'
+        if isoceancoupling:
+            executable = 'issm_ocean.exe'
+
+        # Write queuing script
+        fid = open(modelname + '.queue', 'w')
+
+        fid.write('#!/bin/bash\n')
+        fid.write('#SBATCH -J {} \n'.format(modelname))
+        fid.write('#SBATCH --qos={} \n'.format(self.queue))
+        fid.write('#SBATCH -o {}.outlog \n'.format(modelname))
+        fid.write('#SBATCH -e {}.errlog \n'.format(modelname))
+        fid.write('#SBATCH -n {} \n'.format(self.nprocs()))
+        fid.write('#SBATCH -N {} \n'.format(self.numnodes))
+        fid.write('#SBATCH -t {:02d}:{:02d}:00 \n'.format(int(floor(self.time / 3600)), int(floor(self.time % 3600) / 60)))
+        fid.write('#SBATCH -A {} \n\n'.format(self.grouplist))
+        if (self.email.find('@')>-1):
+            fid.write('#SBATCH --mail-user={} \n'.format(self.email))
+            fid.write('#SBATCH --mail-type=end \n\n')
+        fid.write('. /usr/share/modules/init/bash\n\n')
+        for i in range(len(self.modules)):
+            fid.write('module load {}\n'.format(self.modules[i]))
+        fid.write('export MPI_GROUP_MAX=64\n\n')
+        fid.write('export MPI_UNBUFFERED_STDIO=true\n\n')
+        fid.write('export PATH="$PATH:."\n\n')
+        fid.write('export ISSM_DIR="{}/../"\n'.format(self.codepath)) # FIXME
+        fid.write('source $ISSM_DIR/etc/environment.sh\n') # FIXME
+        fid.write('cd {}/{}\n\n'.format(self.executionpath, dirname))
+
+        fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+
+        if not io_gather: # concatenate the output files
+            fid.write('cat {}.outbin.* > {}.outbin'.format(modelname, modelname))
+        fid.close()
+
+        # In interactive mode, create a run file, and errlog and outlog file
+        if self.interactive:
+            fid = open(modelname + '.run', 'w')
+            if not isvalgrind:
+                fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+            else:
+                fid.write('mpiexec -np {} valgrind --leak-check=full {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+            if not io_gather: # concatenate the output files
+                fid.write('cat {}.outbin.* > {}.outbin'.format(modelname, modelname))
+            fid.close()
+            fid = open(modelname + '.errlog', 'w') # TODO: Change this to system call (touch <file>)?
+            fid.close()
+            fid = open(modelname + '.outlog', 'w') # TODO: Change this to system call (touch <file>)?
+            fid.close()
+    # }}}
+
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
+        # Compress the files into one zip
+        compressstring = 'tar -zcf {}.tar.gz'.format(dirname)
+        for file in filelist:
+            compressstring += ' {}'.format(file)
+        if self.interactive:
+            compressstring += ' {}.run {}.errlog {}.outlog'.format(modelname, modelname, modelname)
+        subprocess.call(compressstring, shell=True)
+
+        print('uploading input file and queueing script')
+        if self.interactive:
+            directory = '{}/Interactive{}'.format(self.executionpath, self.interactive)
+        else:
+            directory = self.executionpath
+
+        if self.bbftp:
+            issmbbftpout(self.name, directory, self.login, self.port, self.numstreams, '{}.tar.gz'.format(dirname))
+        else:
+            issmscpout(self.name, directory, self.login, self.port, ['{}.tar.gz'.format(dirname)])
+    # }}}
+
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
+        if self.interactive:
+            if not isempty(restart):
+                launchcommand = 'cd {}/Interactive{}'.format(self.executionpath, self.interactive)
+            else:
+                launchcommand = 'cd {}/Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname)
+        else:
+            if not isempty(restart):
+                launchcommand = 'cd {} && cd {} && sbatch {}.queue'.format(self.executionpath, dirname, modelname)
+            else:
+                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
+
+        print('launching solution sequence on remote cluster')
+        issmssh(self.name, self.login, self.port, launchcommand)
+    # }}}
+
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
+        if self.interactive:
+            directory = '{}/Interactive{}'.format(self.executionpath, self.interactive)
+        else:
+            directory = '{}/{}/'.format(self.executionpath, dirname)
+
+        if self.bbftp:
+            issmbbftpin(self.name, self.login, self.port, self.numstreams, directory, filelist)
+        else:
+            issmscpin(self.name, self.login, self.port, directory, filelist)
+    # }}}
Index: issm/trunk/src/m/classes/clusters/fram.py
===================================================================
--- issm/trunk/src/m/classes/clusters/fram.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/fram.py	(revision 26744)
@@ -1,35 +1,38 @@
 import subprocess
+
 import numpy as np
+
 from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
-from issmscpin import issmscpin
-from issmscpout import issmscpout
-from QueueRequirements import QueueRequirements
-from IssmConfig import IssmConfig
 try:
     from fram_settings import fram_settings
 except ImportError:
     print('You need fram_settings.py to proceed, check presence and sys.path')
+from helpers import *
+from pairoptions import pairoptions
+from IssmConfig import IssmConfig
+from issmscpin import issmscpin
+from issmscpout import issmscpout
+from issmssh import issmssh
+from QueueRequirements import QueueRequirements
 
 
 class fram(object):
-    """
-    Fram cluster class definition
+    """FRAM cluster class definition
+
     This is a SLURM queue
     The priorities are based on a point system, reservation when reaching 20000 and earning 1 point per min.
-     - Devel queue starts at 19990
-     - Normal starts at 19940
-     - Normal unpri atarts at 19400
+    - Devel queue starts at 19990
+    - Normal starts at 19940
+    - Normal unpri atarts at 19400
 
     Jobs can be:
-     - normal (4 to 30 nodes, more if asked, 48h max walltime, 60Gb per nodes)
-     - bigmem for big memory nodes (8 512Gb nodes and 2 6Tb nodes, shared nodes, 14days max walltime
+    - normal (4 to 30 nodes, more if asked, 48h max walltime, 60Gb per nodes)
+    - bigmem for big memory nodes (8 512Gb nodes and 2 6Tb nodes, shared nodes, 14days max walltime
 
-       Usage:
-          cluster = stallo()
+    Usage:
+        cluster = fram()
     """
 
-    def __init__(self, *args):    # {{{
+    def __init__(self, *args):  # {{{
         self.name = 'fram'
         self.login = ''
@@ -45,17 +48,18 @@
         self.accountname = ''
         self.profiling = 0
-    #use provided options to change fields
+        # Use provided options to change fields
         options = pairoptions(*args)
 
-    #initialize cluster using user settings if provided
+        # Initialize cluster using user settings if provided
         self = fram_settings(self)
-    #OK get other fields
+
+        # OK get other fields
         self = options.AssignObjectFields(self)
         self.np = self.numnodes * self.cpuspernode
     # }}}
 
-    def __repr__(self):    # {{{
-        #  display the object
-        s = "class vilje object:"
+    def __repr__(self):  # {{{
+        # Display the object
+        s = "class fram object:"
         s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
         s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
@@ -74,10 +78,10 @@
 
     def checkconsistency(self, md, solution, analyses):  # {{{
-        #Queue dictionarry  gives queue name as key and max walltime and cpus as var
+        # Queue dictionary gives queue name as key and max walltime and CPUs as var
         queuedict = {'normal': [2 * 24 * 60, 2048],
                      'devel': [4 * 60, 2048]}
         QueueRequirements(queuedict, self.queue, self.np, self.time)
 
-    #Miscelaneous
+        # Miscellaneous
         if not self.login:
             md = md.checkmessage('login empty')
@@ -91,5 +95,5 @@
     # }}}
 
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
         executable = 'issm.exe'
         if isdakota:
@@ -100,5 +104,5 @@
         if isoceancoupling:
             executable = 'issm_ocean.exe'
-    #write queuing script
+        # Write queuing script
         shortname = modelname[0:min(12, len(modelname))]
         fid = open(modelname + '.queue', 'w')
@@ -125,5 +129,5 @@
         fid.write('module load ParMETIS/4.0.3-intel-2017a\n')
         fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname))
-        if self.profiling == 1:
+        if self.profiling:
             fid.write('module load perf-report\n')
             fid.write('perf-report mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
@@ -131,12 +135,11 @@
             fid.write('mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
         fid.close()
-
     # }}}
 
-    def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
-        #compress the files into one zip.
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
+        # Compress the files into one zip
         compressstring = 'tar -zcf %s.tar.gz ' % dirname
         for file in filelist:
-            compressstring += ' %s' % file
+            compressstring += ' {}'.format(file)
         subprocess.call(compressstring, shell=True)
 
@@ -145,15 +148,14 @@
 
     # }}}
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
         print('launching solution sequence on remote cluster')
-        if restart:
+        if not isempty(restart):
             launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname)
         else:
             launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
         issmssh(self.name, self.login, self.port, launchcommand)
-
     # }}}
-    def Download(self, dirname, filelist):    # {{{
-        #copy files from cluster to current directory
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
         directory = '%s/%s/' % (self.executionpath, dirname)
         issmscpin(self.name, self.login, self.port, directory, filelist)
Index: issm/trunk/src/m/classes/clusters/frontera.m
===================================================================
--- issm/trunk/src/m/classes/clusters/frontera.m	(revision 26744)
+++ issm/trunk/src/m/classes/clusters/frontera.m	(revision 26744)
@@ -0,0 +1,202 @@
+%FRONTERA cluster class definition
+%
+%   Usage:
+%      cluster=frontera();
+%      cluster=frontera('np',3);
+%      cluster=frontera('np',3,'login','username');
+
+classdef frontera
+	properties (SetAccess=public)
+		% {{{
+		name          = 'frontera'
+		login         = '';
+		modules        = {'petsc/3.15'};
+		numnodes      = 1;
+		cpuspernode   = 56;
+		port          = 0;
+		queue         = 'normal';
+		codepath      = '';
+		executionpath = '';
+		interactive   = 0;
+		time          = 48*60*60;
+		email         = '';
+	end
+	%}}}
+	methods
+		function cluster=frontera(varargin) % {{{
+
+			%initialize cluster using default settings if provided
+			if (exist('frontera_settings')==2), frontera_settings; end
+
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    email: %s',cluster.email));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
+
+			%https://frontera-portal.tacc.utexas.edu/user-guide/running/
+			available_queues={'small','normal','development'};
+			queue_requirements_time=[48*60*60 48*60*60 2*60*60];
+			queue_requirements_np=[2*56 512*56 40*56];
+
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
+
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -N %s\n',modelname);
+			fprintf(fid,'#$ -q %s \n',cluster.queue);
+			fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+			fprintf(fid,'#$ -R y\n');
+			fprintf(fid,'#$ -m beas\n');
+			fprintf(fid,'#$ -o %s.outlog \n',modelname);
+			fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+			if isoceancoupling,
+				executable='issm_ocean.exe';
+			end
+
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH -J %s \n',modelname);
+			fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
+			fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.nprocs()/cluster.numnodes,56));
+			fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
+			fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
+			for i=1:numel(cluster.modules),
+				fprintf(fid,['module load ' cluster.modules{i} '\n']);
+			end
+
+			if isdakota,
+				fprintf(fid,'export KMP_AFFINITY="granularity=fine,compact,verbose" \n\n');
+			end
+
+			if length(find(cluster.email=='@'))>0
+				fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
+				fprintf(fid,'#SBATCH --mail-type=end \n\n');
+
+				%fprintf(fid,'ssh login1 "mail -s ''SLURM Jobid=${SLURM_JOBID} Name=${SLURM_JOB_NAME} Began on Lonestar 5.'' %s <<< ''Job Started'' " \n\n',cluster.email);
+			end
+
+			fprintf(fid,'export PATH="$PATH:."\n\n');
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+
+			fclose(fid);
+
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
+
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
+
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
+
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
+
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+
+		end %}}}
+	end
+end
Index: issm/trunk/src/m/classes/clusters/gemini.m
===================================================================
--- issm/trunk/src/m/classes/clusters/gemini.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/gemini.m	(revision 26744)
@@ -7,5 +7,5 @@
 
 classdef gemini
-    properties (SetAccess=public) 
+	properties (SetAccess=public)
 	% {{{
 		name='gemini'
@@ -18,91 +18,91 @@
 		executionpath='/workg/edw/Testing/Execution'
 	%}}}
-    end
-    methods
-		 function cluster=gemini(varargin) % {{{
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+	end
+	methods
+		function cluster=gemini(varargin) % {{{
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'debug','shortg','longg'};
-			 queue_requirements_time=[60 180 720];
-			 queue_requirements_np=[50 50 50];
+			available_queues={'debug','shortg','longg'};
+			queue_requirements_time=[60 180 720];
+			queue_requirements_np=[50 50 50];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/sh\n');
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
-			 if ~isempty(queue),
-				 fprintf(fid,'#PBS -q %s\n',cluster.queue);
-			 end
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n',modelname);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/sh\n');
+			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#PBS -N %s\n',modelname);
+			fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
+			if ~isempty(queue),
+				fprintf(fid,'#PBS -q %s\n',cluster.queue);
+			end
+			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+			fprintf(fid,'#PBS -e %s.errlog \n',modelname);
 
-			 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
-			 fprintf(fid,'cd $PBS_O_WORKDIR\n');
-			 fprintf(fid,'export OMP_NUM_THREADS=1\n');
-			 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'cd $PBS_O_WORKDIR\n');
+			fprintf(fid,'export OMP_NUM_THREADS=1\n');
+			fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		end
+		%}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/generic.js
===================================================================
--- issm/trunk/src/m/classes/clusters/generic.js	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/generic.js	(revision 26744)
@@ -115,6 +115,7 @@
 		
 		// Set request properties
-		request.position 	= 0; // Keep track of current parsing position in repsonseText
-		request.timeout 	= 1000 * 60 * 60 * 3; // 3 hrs (in milliseconds); NOTE: This should match FastCgiServer timeout in Apache conf
+		request.position 	 = 0; // Keep track of current parsing position in repsonseText
+		request.timeout 	= 1000 * 60 * 10; // in milliseconds; NOTE: Under current implementation, this should match 'Timeout' option in Apache conf (/etc/apache2/apache2.conf)
+		request.resultBegin = false;
 		
 		request.ontimeout = function(event) { //{{{
@@ -187,5 +188,14 @@
 					}
 				} else if (request.responseText.length >= endIndex) { // Ensure entire chunk is loaded
-					progress = parseInt(request.responseText.slice(startIndex, endIndex));
+					if (request.resultBegin) {
+						return;
+					}
+					chunk = request.responseText.slice(startIndex, endIndex)
+					if (chunk == 'RESULT_BEGIN') {
+						progress = 100;
+						request.resultBegin = true;
+					} else {
+						progress = parseInt(chunk);
+					}
 					if (hasCallout) {
 						callout.setHeader('Computing...');
@@ -221,14 +231,21 @@
 			
 			try {
-/*
-				console.log(request.responseText);
-				console.log('request.position : ' + request.position);
-				console.log('request.responseType : ' + request.responseType);
-				console.log('request.responseText.length : ' + request.responseText.length);
-*/
+				//Scan through buffer until progress updates stop and 'RESULT_BEGIN' string is received
+				let startIndex 	= request.position;
+				let endIndex 	= request.position + 10;
+				let chunkSize = 0;
+				let chunk = 0;
+				while (!request.resultBegin && chunk != 'RESULT_BEGIN') {
+					chunkSize = parseInt(request.responseText.slice(startIndex, endIndex));
+					startIndex 	= endIndex;
+					endIndex 	= startIndex + chunkSize;
+					chunk = request.responseText.slice(startIndex, endIndex);
+					startIndex 	= endIndex;
+					endIndex 	= startIndex + 10;
+					request.position = startIndex;
+				}
+
 				responseText 	= window.atob(request.responseText.slice(request.position + 10).replace(/\s/g, ''));
-// 				console.log('responseText.length : ' + responseText.length);
 				buffer 			= str2ab(responseText);
-// 				console.log('buffer.length : ' + buffer.length);
 /*
 	            bufferInflated 	= UZIP.inflate(buffer);
@@ -248,5 +265,5 @@
 				// Let front end script handle changes to callout
 				if (hasCallout) {
-					callout.set('Success!', '<p>Solve successful</p>');
+					callout.set('Success!', '<p>Request successful</p>');
 				} else {
 					solveButton.text(solveButtonText).prop('disabled', false);
@@ -255,5 +272,5 @@
 			} catch (e) {
 				console.log(e);
-				if (vesl.string.startsWith(responseText, 'Error')) {
+				if (vesl.strings.startsWith(responseText, 'Error')) {
 					if (hasCallout) {
 						callout.set(vesl.ERROR_HEADER_GENERAL, '<p>Something went wrong. ' + vesl.ERROR_CONTENT_TRY_AGAIN + '</p>');
@@ -272,5 +289,5 @@
 		}; //}}}
 		
-		request.responseType = 'application/octet-stream';
+		request.responseType = 'text';
 		
 		/* Construct request */
Index: issm/trunk/src/m/classes/clusters/generic.m
===================================================================
--- issm/trunk/src/m/classes/clusters/generic.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/generic.m	(revision 26744)
@@ -4,4 +4,9 @@
 %      cluster=generic('name','astrid','np',3);
 %      cluster=generic('name',oshostname(),'np',3,'login','username');
+%
+%   TODO:
+%   - Add support for restart to Windows (under MSYS2), then activate tests 125 
+%   and 126 in test suite
+%
 
 classdef generic
@@ -28,5 +33,5 @@
 
 			%Change the defaults if ispc
-			if ispc,
+			if ispc & ~ismingw,
 				cluster.codepath      = [issmdir() '\bin'];
 				cluster.etcpath       = [issmdir() '\etc'];
@@ -65,4 +70,8 @@
 		end
 		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			numprocs=cluster.np;
+		end
+		%}}}
 		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 			if cluster.np<1
@@ -139,13 +148,14 @@
 				fprintf(fid,'@echo off\n');
 
-				if IssmConfig('_HAVE_PETSC_MPI_'),
-					warning('parallel runs not allowed yet in Windows. Defaulting to 1 cpus');
-					cluster.np=1;
-				end
+				% if IssmConfig('_HAVE_PETSC_MPI_'),
+				% 	warning('parallel runs not allowed yet in Windows. Defaulting to 1 cpus');
+				% 	cluster.np=1;
+				% end
 
 				if cluster.np>1,
-					fprintf(fid,'"C:\\Program Files\\MPICH2\\bin\\mpiexec.exe" -n %i "%s/%s" %s ./ %s ',cluster.np,cluster.codepath,executable,solution,modelname);
-				else
-					fprintf(fid,'"%s/%s" %s ./ %s ',cluster.codepath,executable,solution,modelname);
+					% fprintf(fid,'"C:\\Program Files\\MPICH2\\bin\\mpiexec.exe" -n %i "%s/%s" %s ./ %s',cluster.np,cluster.codepath,executable,solution,modelname);
+					fprintf(fid,'"C:\\Program Files\\Microsoft MPI\\Bin\\mpiexec.exe" -n %i "%s/%s" %s ./ %s',cluster.np,cluster.codepath,executable,solution,modelname);
+				else
+					fprintf(fid,'"%s/%s" %s ./ %s',cluster.codepath,executable,solution,modelname);
 				end
 				fclose(fid);
@@ -165,5 +175,5 @@
 
 			%what is the executable being called?
-			executable='issm_slr.exe';
+			executable='issm_slc.exe';
 
 			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
@@ -280,5 +290,5 @@
 		end
 		%}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
 			if ~ispc,
@@ -301,8 +311,7 @@
 			end
 		end %}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
 			if ~ispc,
-
 				%figure out what shell extension we will use:
 				if isempty(strfind(cluster.shell,'csh')),
@@ -318,8 +327,8 @@
 				else
 					if ~batch,
-					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
 						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && source  ' modelname '.queue '];
 					else
-					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
 						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
 					end
@@ -331,5 +340,5 @@
 
 		end %}}}
-		function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
 			if ~ispc,
@@ -360,5 +369,5 @@
 
 		end %}}}
-		function Download(cluster,dirname,filelist)% {{{
+		function Download(cluster,dirname,filelist) % {{{
 
 			if ispc(),
Index: issm/trunk/src/m/classes/clusters/generic.py
===================================================================
--- issm/trunk/src/m/classes/clusters/generic.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/generic.py	(revision 26744)
@@ -1,12 +1,12 @@
-from socket import gethostname
 from subprocess import call
 
-import numpy as np
-
+from fielddisplay import fielddisplay
+from helpers import *
 try:
     from generic_settings import generic_settings
 except ImportError:
-    print('Warning generic_settings.py not found, default will be used')
-from MatlabFuncs import ispc
+    #print('Warning: generic.py: generic_settings.py not found, default will be used')
+    pass
+from MatlabFuncs import *
 from IssmConfig import IssmConfig
 from issmdir import issmdir
@@ -39,36 +39,40 @@
         self.shell = '/bin/sh'
 
-        #use provided options to change fields
+        # Use provided options to change fields
         options = pairoptions(*args)
 
-        #get name
-        self.name = gethostname()
-
-        #initialize cluster using user settings if provided
-
+        # Get name
+        self.name = oshostname()
+
+        # Initialize cluster using user settings if provided
         try:
             self = generic_settings(self)
         except NameError:
-            print("generic_settings.py not found, using default settings")
-
-        #OK get other fields
+            # print('generic_settings.py not found, using default settings')
+            pass
+
+        # OK get other fields
         self = options.AssignObjectFields(self)
     # }}}
 
     def __repr__(self):  # {{{
-        #  display the object
-        s = "class '%s' object '%s' = \n" % (type(self), 'self')
-        s += "    name: %s\n" % self.name
-        s += "    login: %s\n" % self.login
-        s += "    np: %i\n" % self.np
-        s += "    port: %i\n" % self.port
-        s += "    codepath: %s\n" % self.codepath
-        s += "    executionpath: %s\n" % self.executionpath
-        s += "    valgrind: %s\n" % self.valgrind
-        s += "    valgrindlib: %s\n" % self.valgrindlib
-        s += "    valgrindsup: %s\n" % self.valgrindsup
-        s += "    verbose: %s\n" % self.verbose
-        s += "    shell: %s\n" % self.shell
+        # Display the object
+        s = 'class \'{}\' object \'{}\' = \n'.format(type(self), 'self')
+        s += '    name: {}\n'.format(self.name)
+        s += '    login: {}\n'.format(self.login)
+        s += '    np: {}\n'.format(self.np)
+        s += '    port: {}\n'.format(self.port)
+        s += '    codepath: {}\n'.format(self.codepath)
+        s += '    executionpath: {}\n'.format(self.executionpath)
+        s += '    valgrind: {}\n'.format(self.valgrind)
+        s += '    valgrindlib: {}\n'.format(self.valgrindlib)
+        s += '    valgrindsup: {}\n'.format(self.valgrindsup)
+        s += '    verbose: {}\n'.format(self.verbose)
+        s += '    shell: {}\n'.format(self.shell)
         return s
+    # }}}
+
+    def nprocs(self):  # {{{
+        return self.np
     # }}}
 
@@ -179,5 +183,5 @@
             fid.close()
 
-        #in interactive mode, create a run file, and errlog and outlog file
+        # In interactive mode, create a run file, and errlog and outlog file
         if self.interactive:
             fid = open(modelname + '.errlog', 'w')
@@ -188,5 +192,5 @@
 
     def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
-        #compress the files into one zip.
+        # Compress the files into one zip
         compressstring = 'tar -zcf {}.tar.gz '.format(dirname)
         for file in filelist:
@@ -203,5 +207,5 @@
     def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
         print('launching solution sequence on remote cluster')
-        if restart:
+        if not isempty(restart):
             launchcommand = 'cd {} && cd {} chmod 755 {}.queue && ./{}.queue'.format(self.executionpath, dirname, modelname, modelname)
         else:
@@ -215,7 +219,7 @@
     def Download(self, dirname, filelist):  # {{{
         if ispc():
-            #do nothing
+            # Do nothing
             return
-        #copy files from cluster to current directory
+        # Copy files from cluster to current directory
         directory = '{}/{}/'.format(self.executionpath, dirname)
         issmscpin(self.name, self.login, self.port, directory, filelist)
Index: issm/trunk/src/m/classes/clusters/generic_static.m
===================================================================
--- issm/trunk/src/m/classes/clusters/generic_static.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/generic_static.m	(revision 26744)
@@ -36,4 +36,6 @@
 			disp(sprintf('    np: %i',cluster.np));
 			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %s',cluster.interactive));
 			disp(sprintf('    shell: %s',cluster.shell));
 		end
@@ -84,9 +86,9 @@
 		end
 		%}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 			% Do nothing
 			return;
 		end %}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 			if ~ispc,
 				% Figure out which file extension to use
@@ -104,5 +106,5 @@
 			end
 		end %}}}
-		function Download(cluster,dirname,filelist)% {{{
+		function Download(cluster,dirname,filelist) % {{{
 			% Do nothing
 			return;
Index: issm/trunk/src/m/classes/clusters/generic_static.py
===================================================================
--- issm/trunk/src/m/classes/clusters/generic_static.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/generic_static.py	(revision 26744)
@@ -1,9 +1,6 @@
 import math
 import os
-import socket
 import subprocess
-
 import numpy as np
-
 from IssmConfig import IssmConfig
 from issmdir import issmdir
@@ -11,14 +8,13 @@
 from issmscpin import issmscpin
 from issmscpout import issmscpout
-import MatlabFuncs as m
+from MatlabFuncs import *
 from pairoptions import pairoptions
 
 
 class generic_static(object):
-    """
-    GENERIC cluster class definition
+    """GENERIC cluster class definition
 
-       Usage:
-          cluster = generic_static('name', 'astrid', 'np', 3)
+    Usage:
+        cluster = generic_static('name', 'astrid', 'np', 3)
     """
 
@@ -38,5 +34,5 @@
 
         #get name
-        self.name = socket.gethostname()
+        self.name = oshostname()
 
         #initialize cluster using user settings if provided
Index: issm/trunk/src/m/classes/clusters/greenplanet.m
===================================================================
--- issm/trunk/src/m/classes/clusters/greenplanet.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/greenplanet.m	(revision 26744)
@@ -1,3 +1,3 @@
-%PFE class definition
+%GREENPLANET cluster class definition
 %
 %   Usage:
@@ -7,163 +7,171 @@
 
 classdef greenplanet
-    properties (SetAccess=public)  
-		 % {{{
-		 name          = 'greenplanet'
-		 login         = '';
-		 numnodes      = 20;
-		 cpuspernode   = 8;
-		 port          = 8000;
-		 queue         = 'c6145';
-		 codepath      = '';
-		 executionpath = '';
-		 interactive   = 0;
-		 time          = 24*60;
-		 memory        = 2;
-	 end
-	 %}}}
-	 methods
-		 function cluster=greenplanet(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name          = 'greenplanet'
+		login         = '';
+		numnodes      = 20;
+		cpuspernode   = 8;
+		port          = 8000;
+		queue         = 'c6145';
+		codepath      = '';
+		executionpath = '';
+		interactive   = 0;
+		time          = 24*60;
+		memory        = 2;
+	end
+	%}}}
+	methods
+		function cluster=greenplanet(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('greenplanet_settings')==2), greenplanet_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('greenplanet_settings')==2), greenplanet_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    memory: %i',cluster.memory));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    memory: %i',cluster.memory));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'c6145','ilg2.3','default'};
-			 queue_requirements_time=[Inf Inf];
-			 queue_requirements_np=[80 80];
+			available_queues={'brd2.4','has2.5','ilg2.3','m-c1.9','m-c2.2','nes2.8','sib2.9','m2090','default'};
+			queue_requirements_time=[Inf Inf Inf Inf Inf Inf Inf Inf Inf];
+			queue_requirements_np=[80 80 80 80 80 80 80 80 80];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
-			 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
+			fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
+			fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
+			fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
-			 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
+			fprintf(fid,'#SBATCH --partition=%s',cluster.queue{1});
+			for i=2:length(cluster.queue) 
+				fprintf(fid,',%s',cluster.queue{i});
+			end
+			fprintf(fid,'\n');
+			%fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
+			%fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH --nodes=%i\n',cluster.numnodes); % in general, just 1
+			fprintf(fid,'#SBATCH --ntasks=%i\n',cluster.cpuspernode); % in general, just 1
+			fprintf(fid,'#SBATCH --cpus-per-task=%i\n',1); 
+			fprintf(fid,'#SBATCH --mem=%igb\n',cluster.memory); % minimum total node memory required
+			fprintf(fid,'#SBATCH --time=%s\n',datestr(cluster.time/24,'HH:MM:SS')); %walltime is in HH:MM:SS format. cluster.time is in hour
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/hexagon.py
===================================================================
--- issm/trunk/src/m/classes/clusters/hexagon.py	(revision 25994)
+++ 	(revision )
@@ -1,145 +1,0 @@
-import subprocess
-from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
-from issmscpin import issmscpin
-from issmscpout import issmscpout
-from IssmConfig import IssmConfig
-import datetime
-try:
-    from hexagon_settings import hexagon_settings
-except ImportError:
-    print('You need hexagon_settings.py to proceed, check presence and sys.path')
-
-
-class hexagon(object):
-    """
-    Hexagon cluster class definition
-    Hexagon have nodes built of 2 * 16 CPUs. Nodes are dedicated to one job so the best usage is to use 32 procs per nodes (16 per cores) as it is what is billed anyway.
-    You can reduce this number if you run out of memory as the total node memory is divided by the number of procs
-       Usage:
-          cluster = hexagon()
-    """
-
-    def __init__(self, *args):  # {{{
-        self.name = 'hexagon'
-        self.login = ''
-        self.numnodes = 2
-        self.procspernodes = 32
-        self.mem = 32000
-        self.queue = 'batch'
-        self.time = 2 * 60
-        self.codepath = ''
-        self.executionpath = ''
-        self.interactive = 0
-        self.port = []
-        self.accountname = ''
-
-    #use provided options to change fields
-        options = pairoptions(*args)
-
-    #initialize cluster using user settings if provided
-        self = hexagon_settings(self)
-
-    #OK get other fields
-        self = options.AssignObjectFields(self)
-        self.np = self.numnodes * self.procspernodes
-    # }}}
-
-    def __repr__(self):      # {{{
-        #  display the object
-        s = "class hexagon object:"
-        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'numnodes', 'number of nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'procspernodes', 'number of mpi procs per nodes  default and optimal is 32'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mem', 'Total node memory'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested in minutes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'codepath', 'code path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'execution path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'interactive', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'accountname', 'your cluster account'))
-        return s
-    # }}}
-
-    def checkconsistency(self, md, solution, analyses):      # {{{
-        #mem should not be over 32000mb
-        #numprocs should not be over 4096
-        #we have cpupernodes * numberofcpus = mppwidth and mppnppn = cpupernodes,
-        #Miscelaneous
-        if not self.login:
-            md = md.checkmessage('login empty')
-        if not self.codepath:
-            md = md.checkmessage('codepath empty')
-        if not self.executionpath:
-            md = md.checkmessage('executionpath empty')
-        if self.interactive == 1:
-            md = md.checkmessage('interactive mode not implemented')
-        if self.mem > 32000:
-            md = md.checkmessage('asking too much memory max is 32000 per node')
-        return self
-    # }}}
-
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
-        executable = 'issm.exe'
-        if isdakota:
-            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
-            version = float(version)
-            if version >= 6:
-                executable = 'issm_dakota.exe'
-        if isoceancoupling:
-            executable = 'issm_ocean.exe'
-
-    #write queuing script
-        shortname = modelname[0:min(12, len(modelname))]
-        fid = open(modelname + '.queue', 'w')
-        fid.write('  #!/bin/bash\n')
-        fid.write('  #PBS - N %s \n' % shortname)
-        fid.write('  #PBS - l mppwidth=%i, mppnppn=%i\n' % (self.np, self.procspernodes))
-        timeobj = datetime.timedelta(minutes=self.time)
-        m, s = divmod(timeobj.total_seconds(), 60)
-        h, m = divmod(m, 60)
-        timestring = "%02d:%02d:%02d" % (h, m, s)
-        fid.write('#PBS -l walltime=%s\n' % timestring)  #walltime is hh:mm:ss
-        fid.write('#PBS -l mppmem=%imb\n' % int(self.mem / self.procspernodes))
-        fid.write('#PBS -A %s\n' % self.accountname)
-        fid.write('#PBS -o %s/%s/%s.outlog \n' % (self.executionpath, dirname, modelname))
-        fid.write('#PBS -e %s/%s/%s.errlog \n\n' % (self.executionpath, dirname, modelname))
-        fid.write('export ISSM_DIR="%s/../"\n' % self.codepath)
-        fid.write('export CRAY_ROOTFS=DSL\n')
-        fid.write('module swap PrgEnv-cray / 5.2.40 PrgEnv - gnu\n')
-        fid.write('module load cray-petsc\n')
-        fid.write('module load cray-tpsl\n')
-        fid.write('module load cray-mpich\n')
-        fid.write('module load gsl\n')
-        fid.write('cd %s/%s/\n\n' % (self.executionpath, dirname))
-        fid.write('aprun -B %s/%s %s %s/%s %s\n' % (self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
-        fid.close()
-    # }}}
-
-    def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
-        #compress the files into one zip.
-        compressstring = 'tar -zcf %s.tar.gz ' % dirname
-        for file in filelist:
-            compressstring += ' %s' % file
-        subprocess.call(compressstring, shell=True)
-
-        print('uploading input file and queueing script')
-        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-    # }}}
-
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
-        print('launching solution sequence on remote cluster')
-        if restart:
-            launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname)
-        else:
-            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && qsub %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
-        issmssh(self.name, self.login, self.port, launchcommand)
-    # }}}
-
-    def Download(self, dirname, filelist):    # {{{
-        #copy files from cluster to current directory
-        directory = '%s/%s/' % (self.executionpath, dirname)
-        issmscpin(self.name, self.login, self.port, directory, filelist)
-    # }}}
Index: issm/trunk/src/m/classes/clusters/hpc.m
===================================================================
--- issm/trunk/src/m/classes/clusters/hpc.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/hpc.m	(revision 26744)
@@ -1,3 +1,3 @@
-%HPC class definition
+%HPC cluster class definition
 %
 %   Usage:
@@ -7,159 +7,159 @@
 
 classdef hpc
-    properties (SetAccess=public)  
-		 % {{{
-		 name='hpc.oit.uci.edu'
-		 login='';
-		 numnodes=1;
-		 cpuspernode=4; 
-		 port=0;
-		 queue='pub64';
-		 codepath='';
-		 executionpath='';
-		 interactive=0;
-	 end
-	 %}}}
-	 methods
-		 function cluster=hpc(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='hpc.oit.uci.edu'
+		login='';
+		numnodes=1;
+		cpuspernode=4; 
+		port=0;
+		queue='pub64';
+		codepath='';
+		executionpath='';
+		interactive=0;
+	end
+	%}}}
+	methods
+		function cluster=hpc(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('hpc_settings')==2), hpc_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('hpc_settings')==2), hpc_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'pub64','free64','free48','free*,pub64','free*'};
-			 queue_requirements_time=[Inf Inf Inf Inf Inf];
-			 queue_requirements_np=[64 64 48 48 48];
+			available_queues={'pub64','free64','free48','free*,pub64','free*'};
+			queue_requirements_time=[Inf Inf Inf Inf Inf];
+			queue_requirements_np=[64 64 48 48 48];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#$ -N %s\n',modelname);
-			 fprintf(fid,'#$ -q %s \n',cluster.queue);
-			 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
-			 fprintf(fid,'#$ -R y\n');
-			 fprintf(fid,'#$ -m beas\n');
-			 fprintf(fid,'#$ -o %s.outlog \n',modelname);
-			 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
-			 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -N %s\n',modelname);
+			fprintf(fid,'#$ -q %s \n',cluster.queue);
+			fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+			fprintf(fid,'#$ -R y\n');
+			fprintf(fid,'#$ -m beas\n');
+			fprintf(fid,'#$ -o %s.outlog \n',modelname);
+			fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#$ -N %s\n',modelname);
-			 fprintf(fid,'#$ -q %s \n',cluster.queue);
-			 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
-			 fprintf(fid,'#$ -R y\n');
-			 %fprintf(fid,'#$ -m beas\n');
-			 fprintf(fid,'#$ -o %s.outlog \n',modelname);
-			 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -N %s\n',modelname);
+			fprintf(fid,'#$ -q %s \n',cluster.queue);
+			fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+			fprintf(fid,'#$ -R y\n');
+			%fprintf(fid,'#$ -m beas\n');
+			fprintf(fid,'#$ -o %s.outlog \n',modelname);
+			fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/hpc_simba.m
===================================================================
--- issm/trunk/src/m/classes/clusters/hpc_simba.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/hpc_simba.m	(revision 26744)
@@ -1,3 +1,3 @@
-%HPC class definition
+%HPC_SIMBA cluster class definition
 %
 %   Usage:
@@ -7,176 +7,171 @@
 
 classdef hpc_simba
-    properties (SetAccess=public)  
-		 % {{{
-		 name='simba00'
-		 login='inwoo';
-		 numnodes=1;
-		 cpuspernode=36; 
-		 np=4;
-		 port=7777;
-		 queue='pub64';
-		 codepath='/home/DATA/externalpackagesissm/issm/trunk-jpl/bin';
-		 executionpath='/home/DATA/externalpackages/issm/trunk-jpl/execution/';
-		 interactive=0;
-	 end
-	 %}}}
-	 methods
-		 function cluster=hpc_simba(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='simba00'
+		login='inwoo';
+		numnodes=1;
+		cpuspernode=36; 
+		np=4;
+		port=7777;
+		queue='pub64';
+		codepath='/home/DATA/externalpackagesissm/issm/trunk-jpl/bin';
+		executionpath='/home/DATA/externalpackages/issm/trunk-jpl/execution/';
+		interactive=0;
+	end
+	%}}}
+	methods
+		function cluster=hpc_simba(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('hpc_settings')==2), hpc_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('hpc_settings')==2), hpc_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-		 end
-		 %}}}
-		 %function numprocs=np(cluster) % {{{
-		%	 %compute number of processors
-		%	 numprocs=cluster.numnodes*cluster.cpuspernode;
-		% end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'pub64','free64','free48','free*,pub64','free*'};
-			 queue_requirements_time=[Inf Inf Inf Inf Inf];
-			 queue_requirements_np=[64 64 48 48 48];
+			available_queues={'pub64','free64','free48','free*,pub64','free*'};
+			queue_requirements_time=[Inf Inf Inf Inf Inf];
+			queue_requirements_np=[64 64 48 48 48];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#$ -N %s\n',modelname);
-			 fprintf(fid,'#$ -q %s \n',cluster.queue);
-			 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
-			 fprintf(fid,'#$ -R y\n');
-			 fprintf(fid,'#$ -m beas\n');
-			 fprintf(fid,'#$ -o %s.outlog \n',modelname);
-			 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
-			 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -N %s\n',modelname);
+			fprintf(fid,'#$ -q %s \n',cluster.queue);
+			fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+			fprintf(fid,'#$ -R y\n');
+			fprintf(fid,'#$ -m beas\n');
+			fprintf(fid,'#$ -o %s.outlog \n',modelname);
+			fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 if 0
-				 fprintf(fid,'#!/bin/bash\n');
-				 fprintf(fid,'#$ -N %s\n',modelname);
-				 fprintf(fid,'#$ -q %s \n',cluster.queue);
-				 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
-				 fprintf(fid,'#$ -R y\n');
-				 %fprintf(fid,'#$ -m beas\n');
-				 fprintf(fid,'#$ -o %s.outlog \n',modelname);
-				 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
-			 else % FIXME : This script for SIMBA-Kopri 
-				 fprintf(fid,'#!/bin/bash\n');
-				 %fprintf(fid,'#PBS -q workq\n');
-				 fprintf(fid,'#PBS -N %s\n',modelname);
-				 %fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...
-				%	 ceil(cluster.np/cluster.cpuspernode), cluster.np);
-				 fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			if 0
+				fprintf(fid,'#!/bin/bash\n');
+				fprintf(fid,'#$ -N %s\n',modelname);
+				fprintf(fid,'#$ -q %s \n',cluster.queue);
+				fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+				fprintf(fid,'#$ -R y\n');
+				%fprintf(fid,'#$ -m beas\n');
+				fprintf(fid,'#$ -o %s.outlog \n',modelname);
+				fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			else % FIXME : This script for SIMBA-Kopri 
+				fprintf(fid,'#!/bin/bash\n');
+				%fprintf(fid,'#PBS -q workq\n');
+				fprintf(fid,'#PBS -N %s\n',modelname);
+				%fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...
+				%	ceil(cluster.np/cluster.cpuspernode), cluster.np);
+				fprintf(fid,'#PBS -l nodes=simba01:ppn=%d\n',...
 					cluster.np);
-				 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-				 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
-				 fprintf(fid,'\n');
-			 end
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'\n');
-			 fprintf(fid,'module load intel18/impi-18\n');
-			 fprintf(fid,'\n');
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+				fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+				fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
+				fprintf(fid,'\n');
+			end
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'\n');
+			fprintf(fid,'module load intel18/impi-18\n');
+			fprintf(fid,'\n');
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/local.m
===================================================================
--- issm/trunk/src/m/classes/clusters/local.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/local.m	(revision 26744)
@@ -36,6 +36,6 @@
 			disp(sprintf('    np: %i',cluster.np));
 			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    etcpath: %s',cluster.etcpath));
 			disp(sprintf('    executionpath: %s',cluster.executionpath));
-			disp(sprintf('    etcpath: %s',cluster.etcpath));
 			disp(sprintf('    verbose: %s',cluster.verbose));
 			disp(sprintf('    shell: %s',cluster.shell));
Index: issm/trunk/src/m/classes/clusters/localpfe.m
===================================================================
--- issm/trunk/src/m/classes/clusters/localpfe.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/localpfe.m	(revision 26744)
@@ -1,3 +1,3 @@
-%localpfe cluster class definition
+%LOCALPFE cluster class definition
 %
 %   Usage:
@@ -27,6 +27,6 @@
 		function cluster=localpfe(varargin) % {{{
 
-			%Change the defaults if ispc
-			if ispc,
+			%Change the defaults if ispc and not ismingw
+			if ispc & ~ismingw,
 				cluster.codepath      = [issmdir() '\bin'];
 				cluster.etcpath       = [issmdir() '\etc'];
@@ -53,8 +53,10 @@
 			disp(sprintf('    login: %s',cluster.login));
 			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    npocean: %i',cluster.npocean));
 			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    interactive: %i',cluster.interactive));
 			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    etcpath: %s',cluster.etcpath));
 			disp(sprintf('    executionpath: %s',cluster.executionpath));
-			disp(sprintf('    etcpath: %s',cluster.etcpath));
 			disp(sprintf('    valgrind: %s',cluster.valgrind));
 			disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
@@ -104,7 +106,7 @@
 
 			%what is the executable being called? 
-			executable='issm_slr.exe';
-
-			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
+			executable='issm_slc.exe';
+
+			if ispc & ~ismingw, error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
 			
 			%write queuing script 
@@ -170,5 +172,5 @@
 
 			%write queuing script 
-			if ~ispc(),
+			if ~ispc,
 
 				fid=fopen([modelname '.queue'],'w');
@@ -214,5 +216,5 @@
 		%}}}
 		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
-			if ~ispc,
+			if ~ispc | ismingw,
 
 				%compress the files into one zip.
@@ -262,5 +264,5 @@
 		function Download(cluster,dirname,filelist)% {{{
 
-			if ispc(),
+			if ispc && ~ismingw,
 				%do nothing
 				return;
Index: issm/trunk/src/m/classes/clusters/lonestar.m
===================================================================
--- issm/trunk/src/m/classes/clusters/lonestar.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/lonestar.m	(revision 26744)
@@ -1,3 +1,3 @@
-%LONESTAR class definition
+%LONESTAR cluster class definition
 %
 %   Usage:
@@ -7,194 +7,195 @@
 
 classdef lonestar
-    properties (SetAccess=public)  
-		 % {{{
-		 name          = 'ls5.tacc.utexas.edu'
-		 login         = '';
-		 modules        = {'intel/16.0.1'};
-		 numnodes      = 1;
-		 cpuspernode   = 24;
-		 port          = 1099;
-		 queue         = 'normal';
-		 codepath      = '';
-		 executionpath = '';
-		 interactive   = 0;
-		 time          = 48*60*60;
-		 email         = '';
-	 end
-	 %}}}
-	 methods
-		 function cluster=lonestar(varargin) % {{{
-
-			 %initialize cluster using default settings if provided
-			 if (exist('lonestar_settings')==2), lonestar_settings; end
-
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    email: %s',cluster.email));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
-
-			 available_queues={'normal','development'};
-			 queue_requirements_time=[48*60*60 2*60*60];
-			 queue_requirements_np=[4104 264];
-
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
-
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#$ -N %s\n',modelname);
-			 fprintf(fid,'#$ -q %s \n',cluster.queue);
-			 fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
-			 fprintf(fid,'#$ -R y\n');
-			 fprintf(fid,'#$ -m beas\n');
-			 fprintf(fid,'#$ -o %s.outlog \n',modelname);
-			 fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
-			 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			 executable='issm.exe';
-			 if isdakota,
-				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				 if (version>=6),
-					 executable='issm_dakota.exe';
-				 end
-			 end
-			 if isoceancoupling,
-				 executable='issm_ocean.exe';
-			 end
-
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH -J %s \n',modelname);
-			 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
-			 fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.numnodes,24));
-			 fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
-			 fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
-			 for i=1:numel(cluster.modules),
-				 fprintf(fid,['module load ' cluster.modules{i} '\n']);
-			 end
-
-			 if isdakota,
-				 fprintf(fid,'export KMP_AFFINITY="granularity=fine,compact,verbose" \n\n');
-			 end
-
-			 if length(find(cluster.email=='@'))>0
-				 fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
-				 fprintf(fid,'#SBATCH --mail-type=end \n\n');
-
-				 %fprintf(fid,'ssh login1 "mail -s ''SLURM Jobid=${SLURM_JOBID} Name=${SLURM_JOB_NAME} Began on Lonestar 5.'' %s <<< ''Job Started'' " \n\n',cluster.email);
-			 end
-
-			 fprintf(fid,'export PATH="$PATH:."\n\n');
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-
-			 fclose(fid);
-
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.np,executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
-
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
-
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
-
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
-
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
-
-		 end %}}}
+	properties (SetAccess=public)
+		% {{{
+		name          = 'ls5.tacc.utexas.edu'
+		login         = '';
+		modules        = {'intel/18.0.2' 'gsl'};
+		numnodes      = 1;
+		cpuspernode   = 24;
+		port          = 1099;
+		queue         = 'normal';
+		codepath      = '';
+		executionpath = '';
+		interactive   = 0;
+		time          = 48*60*60;
+		email         = '';
+	end
+	%}}}
+	methods
+		function cluster=lonestar(varargin) % {{{
+
+			%initialize cluster using default settings if provided
+			if (exist('lonestar_settings')==2), lonestar_settings; end
+
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    email: %s',cluster.email));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
+
+			available_queues={'normal','development'};
+			queue_requirements_time=[48*60*60 2*60*60];
+			queue_requirements_np=[4104 264];
+
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
+
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#$ -N %s\n',modelname);
+			fprintf(fid,'#$ -q %s \n',cluster.queue);
+			fprintf(fid,'#$ -pe one-node-mpi 2-64\n');
+			fprintf(fid,'#$ -R y\n');
+			fprintf(fid,'#$ -m beas\n');
+			fprintf(fid,'#$ -o %s.outlog \n',modelname);
+			fprintf(fid,'#$ -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+			if isoceancoupling,
+				executable='issm_ocean.exe';
+			end
+
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH -J %s \n',modelname);
+			fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n',modelname);
+			fprintf(fid,'#SBATCH -n %i \n',cluster.numnodes*max(cluster.nprocs()/cluster.numnodes,24));
+			fprintf(fid,'#SBATCH -N %i \n',cluster.numnodes);
+			fprintf(fid,'#SBATCH -t %02i:%02i:00 \n\n',floor(cluster.time/3600),floor(mod(cluster.time,3600)/60));
+			for i=1:numel(cluster.modules),
+				fprintf(fid,['module load ' cluster.modules{i} '\n']);
+			end
+
+			if isdakota,
+				fprintf(fid,'export KMP_AFFINITY="granularity=fine,compact,verbose" \n\n');
+			end
+
+			if length(find(cluster.email=='@'))>0
+				fprintf(fid,'#SBATCH --mail-user=%s \n',cluster.email);
+				fprintf(fid,'#SBATCH --mail-type=end \n\n');
+
+				%fprintf(fid,'ssh login1 "mail -s ''SLURM Jobid=${SLURM_JOBID} Name=${SLURM_JOB_NAME} Began on Lonestar 5.'' %s <<< ''Job Started'' " \n\n',cluster.email);
+			end
+
+			fprintf(fid,'export PATH="$PATH:."\n\n');
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+
+			fclose(fid);
+
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'ibrun -np %i %s/%s %s %s %s\n',cluster.nprocs(),executable,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
+
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
+
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
+
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
+
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/maui.m
===================================================================
--- issm/trunk/src/m/classes/clusters/maui.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/maui.m	(revision 26744)
@@ -1,3 +1,3 @@
-%MAUI class definition
+%MAUI cluster class definition
 %
 %   Usage:
@@ -7,146 +7,146 @@
 
 classdef maui
-    properties (SetAccess=public)  
-		 % {{{
-		 name           = 'maui'
-		 login          = '';
-		 numnodes       = 1;
-		 cpuspernode    = 8;
-		 port           = 0;
-		 projectaccount = '';
-		 partition      = 'nesi_research';
-		 codepath       = '';
-		 executionpath  = '';
-		 interactive    = 0;
-		 time           = 24*60;
-		 memory         = 2;
-	 end
-	 %}}}
-	 methods
-		 function cluster=maui(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name           = 'maui'
+		login          = '';
+		numnodes       = 1;
+		cpuspernode    = 8;
+		port           = 0;
+		projectaccount = '';
+		partition      = 'nesi_research';
+		codepath       = '';
+		executionpath  = '';
+		interactive    = 0;
+		time           = 24*60;
+		memory         = 2;
+	end
+	%}}}
+	methods
+		function cluster=maui(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('maui_settings')==2), maui_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('maui_settings')==2), maui_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    projectaccount: %s',cluster.projectaccount));
-			 disp(sprintf('    partition: %s',cluster.partition));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    memory: %i',cluster.memory));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    projectaccount: %s',cluster.projectaccount));
+			disp(sprintf('    partition: %s',cluster.partition));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    memory: %i',cluster.memory));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_partitions={'nesi_research'}
-			 partition_requirements_time=[24*60];
-			 partition_requirements_np=[80];
+			available_partitions={'nesi_research'}
+			partition_requirements_time=[24*60];
+			partition_requirements_np=[80];
 
-			 QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.np,1)
+			QueueRequirements(available_partitions,partition_requirements_time,partition_requirements_np,cluster.partition,cluster.nprocs(),1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-			 error('not implemented yet');
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			error('not implemented yet');
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
-			 fprintf(fid,'#SBATCH --account=%s \n',cluster.projectaccount);
-			 fprintf(fid,'#SBATCH --partition=%s \n',cluster.partition);
-			 fprintf(fid,'#SBATCH --ntasks=%i  \n',cluster.numnodes);
-			 fprintf(fid,'#SBATCH --cpus-per-task=%i\n',cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time); %walltime is in minutes
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n');
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
+			fprintf(fid,'#SBATCH --account=%s \n',cluster.projectaccount);
+			fprintf(fid,'#SBATCH --partition=%s \n',cluster.partition);
+			fprintf(fid,'#SBATCH --ntasks=%i  \n',cluster.numnodes);
+			fprintf(fid,'#SBATCH --cpus-per-task=%i\n',cluster.cpuspernode);
+			fprintf(fid,'#SBATCH --time=%i\n',cluster.time); %walltime is in minutes
+			fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'module swap PrgEnv-cray PrgEnv-intel\n');
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'srun -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/pfe.m
===================================================================
--- issm/trunk/src/m/classes/clusters/pfe.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/pfe.m	(revision 26744)
@@ -1,3 +1,3 @@
-%PFE class definition
+%PFE cluster class definition
 %
 %   Usage:
@@ -7,9 +7,9 @@
 
 classdef pfe
-	properties (SetAccess=public)  
+	properties (SetAccess=public)
 		% {{{
 		name           = 'pfe'
 		login          = '';
-		modules        = {'comp-intel/2016.2.181' 'mpi-sgi/mpt'};
+		modules        = {'comp-intel/2016.2.181' 'mpt'};
 		numnodes       = 20;
 		cpuspernode    = 8;
@@ -21,5 +21,5 @@
 		codepath       = '';
 		executionpath  = '';
-		grouplist     = 's1690';
+		grouplist      = '';
 		interactive    = 0;
 		bbftp          = 0;
@@ -39,26 +39,27 @@
 		%}}}
 		function disp(cluster) % {{{
-			%  display the object
+			% display the object
 			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
 			disp(sprintf('    name: %s',cluster.name));
 			disp(sprintf('    login: %s',cluster.login));
-			modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1); 
-			disp(sprintf('    modules: %s',modules));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    numnodes: %s',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %s',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
 			disp(sprintf('    port: %i',cluster.port));
-			disp(sprintf('    numnodes: %i',cluster.numnodes));
-			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    queue: %i',cluster.queue));
 			disp(sprintf('    time: %i',cluster.time));
-			disp(sprintf('    processor: %s',cluster.processor));
-			disp(sprintf('    srcpath: %s ($ISSM_DIR on pfe)',cluster.srcpath));
-			disp(sprintf('    codepath: %s  ($ISSM_DIR/bin on pfe)',cluster.codepath));
-			disp(sprintf('    executionpath: %s  (directory containing issm.exe on pfe)',cluster.executionpath));
+			disp(sprintf('    processor: %i',cluster.processor));
+			disp(sprintf('    srcpath: %s',cluster.srcpath));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
 			disp(sprintf('    grouplist: %s',cluster.grouplist));
-			disp(sprintf('    interactive: %i',cluster.interactive));
-			disp(sprintf('    hyperthreading: %i',cluster.hyperthreading));
-		end
-		%}}}
-		function numprocs=np(cluster) % {{{
+			disp(sprintf('    interactive: %s',cluster.interactive));
+			disp(sprintf('    bbftp: %s',cluster.bbftp));
+			disp(sprintf('    numstreams: %s',cluster.numstreams));
+			disp(sprintf('    hyperthreading: %s',cluster.hyperthreading));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
 			%compute number of processors
 			numprocs=cluster.numnodes*cluster.cpuspernode;
@@ -71,5 +72,5 @@
 			queue_requirements_np=[2048 2048 150 150 2048];
 
-			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
 
 			%now, check cluster.cpuspernode according to processor type
@@ -128,5 +129,5 @@
 			
 			else
-				md = checkmessage(md,'unknown processor type, should be ''bro'' or ''has'' or ''ivy'' or ''san'' or ''cas_ait''');
+				md = checkmessage(md,'unknown processor type, should be ''bro'', ''has'', ''ivy'', ''san'', or ''cas_ait''');
 			end
 
@@ -161,9 +162,9 @@
 			fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
 			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			fprintf(fid,'#PBS -q %s \n',cluster.queue);
+			fprintf(fid,'#PBS -q %s\n',cluster.queue);
 			fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
 			fprintf(fid,'#PBS -m e\n');
-			fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
-			fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
+			fprintf(fid,'#PBS -o %s/%s/%s.outlog \n',cluster.executionpath,dirname,modelname);
+			fprintf(fid,'#PBS -e %s/%s/%s.errlog \n\n',cluster.executionpath,dirname,modelname);
 			fprintf(fid,'. /usr/share/modules/init/bash\n\n');
 			for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
@@ -176,7 +177,7 @@
 			fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
 			if ~isvalgrind,
-				fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			else
-				fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+				fprintf(fid,'/u/scicon/tools/bin/toss3/several_tries mpiexec -np %i %s/%s %s %s/%s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
+			else
+				fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
 			end
 			if ~io_gather, %concatenate the output files:
@@ -190,10 +191,10 @@
 				if cluster.interactive==10,
 						fprintf(fid,'module unload mpi-mvapich2/1.4.1/gcc\n');
-						fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[pwd() '/run'],modelname);
+						fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[pwd() '/run'],modelname);
 				else
 					if ~isvalgrind,
-						fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
+						fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
 					else
-						fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
+						fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
 					end
 				end
@@ -214,7 +215,7 @@
 
 			%what is the executable being called? 
-			executable='issm_slr.exe';
-
-			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
+			executable='issm_slc.exe';
+
+			if ispc & ~ismingw, error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
 
 			%write queuing script 
@@ -318,5 +319,5 @@
 			fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
 			fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,modelname);
-			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
 			if ~io_gather, %concatenate the output files:
 				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
@@ -328,7 +329,7 @@
 				fid=fopen([modelname '.run'],'w');
 				if ~isvalgrind,
-					fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-				else
-					fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+					fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+				else
+					fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
 				end
 				if ~io_gather, %concatenate the output files:
@@ -382,8 +383,8 @@
 
 		end %}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
 			%compress the files into one zip.
-			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			compressstring=['tar -zcf ' dirname '.tar.gz'];
 			for i=1:numel(filelist),
 				compressstring = [compressstring ' ' filelist{i}];
@@ -403,23 +404,16 @@
 			end
 
-			if ~cluster.bbftp,
+			if cluster.bbftp,
+				issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
+			else
 				issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
-			else
-				issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
-			end
-
-		end
-		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-
-			%lauch command, to be executed via ssh
-			if ~cluster.interactive, 
-				if ~isempty(restart)
-					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-				else
-					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-				end
-			else
+			end
+
+		end
+		%}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
+
+			%launch command, to be executed via ssh
+			if cluster.interactive,
 				if ~isempty(restart)
 					launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
@@ -431,4 +425,11 @@
 					end
 				end
+			else
+				if ~isempty(restart)
+					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+				else
+					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
+				end
 			end
 
@@ -437,5 +438,5 @@
 		end
 		%}}}
-		function Download(cluster,dirname,filelist)% {{{
+		function Download(cluster,dirname,filelist) % {{{
 
 			%copy files from cluster to current directory
@@ -448,8 +449,8 @@
 			end
 
-			if ~cluster.bbftp,
+			if cluster.bbftp,
+				issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
+			else
 				issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
-			else
-				issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
 			end
 
Index: issm/trunk/src/m/classes/clusters/pfe.py
===================================================================
--- issm/trunk/src/m/classes/clusters/pfe.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/pfe.py	(revision 26744)
@@ -1,29 +1,32 @@
 import subprocess
+
 from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
+from helpers import *
+from IssmConfig import IssmConfig
 from issmscpin import issmscpin
 from issmscpout import issmscpout
-from QueueRequirements import QueueRequirements
-from IssmConfig import IssmConfig
+from issmssh import issmssh
+from MatlabFuncs import *
+from pairoptions import pairoptions
 try:
     from pfe_settings import pfe_settings
 except ImportError:
-    print('You need pfe_settings.py to proceed, check presence and sys.path')
-
+    # print('You need pfe_settings.py to proceed, check presence and sys.path')
+    pass
+from QueueRequirements import QueueRequirements
 
 class pfe(object):
+    """PFE cluster class definition
+
+    Usage:
+        cluster = pfe()
+        cluster = pfe('np', 3)
+        cluster = pfe('np', 3, 'login', 'username')
     """
-    PFE cluster class definition
-
-       Usage:
-          cluster = pfe()
-          cluster = pfe('np', 3)
-          cluster = pfe('np', 3, 'login', 'username')
-    """
-
-    def __init__(self, *args):    # {{{
-        self.name = 'pfe'
+
+    def __init__(self, *args):  # {{{
+        self.name = ''
         self.login = ''
+        self.modules = ['comp-intel/2016.2.181', 'mpt']
         self.numnodes = 20
         self.cpuspernode = 8
@@ -31,9 +34,9 @@
         self.queue = 'long'
         self.time = 12 * 60
-        self.processor = 'bro'
+        self.processor = 'ivy'
         self.srcpath = ''
         self.codepath = ''
         self.executionpath = ''
-        self.grouplist = 's1010'
+        self.grouplist = ''
         self.interactive = 0
         self.bbftp = 0
@@ -41,44 +44,47 @@
         self.hyperthreading = 0
 
-        #use provided options to change fields
+        # Use provided options to change fields
         options = pairoptions(*args)
 
-        #initialize cluster using user settings if provided
-        self = pfe_settings(self)
-        self.np = self.nprocs()
-
-        #OK get other fields
+        # Initialize cluster using user settings if provided
+        try:
+            self = pfe_settings(self)
+        except NameError:
+            #print('pfe_settings.py not found, using default settings')
+            pass
+
+        # OK get other fields
         self = options.AssignObjectFields(self)
-
-    # }}}
-
-    def __repr__(self):    # {{{
-        #  display the object
-        s = "class pfe object:"
-        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'numnodes', 'number of nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'cpuspernode', 'number of nodes per CPUs'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'np', 'number of CPUs'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'port', 'machine access port'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'processor', 'type of processor'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'codepath', '$ISSM_DIR on pfe'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'directory containing issm.exe on pfe'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'grouplist', 'name of the group'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'interactive', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'bbftp', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'numstreams', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'hyperthreading', ''))
+    # }}}
+
+    def __repr__(self):  # {{{
+        # Display the object
+        s = 'class pfe object\n'
+        s += '    name: {}\n'.format(self.name)
+        s += '    login: {}\n'.format(self.login)
+        s += '    modules: {}\n'.format(strjoin(self.modules, ', '))
+        s += '    numnodes: {}\n'.format(self.numnodes)
+        s += '    cpuspernode: {}\n'.format(self.cpuspernode)
+        s += '    np: {}\n'.format(self.nprocs())
+        s += '    port: {}\n'.format(self.port)
+        s += '    queue: {}\n'.format(self.queue)
+        s += '    time: {}\n'.format(self.time)
+        s += '    processor: {}\n'.format(self.processor)
+        s += '    srcpath: {}\n'.format(self.srcpath)
+        s += '    codepath: {}\n'.format(self.codepath)
+        s += '    executionpath: {}\n'.format(self.executionpath)
+        s += '    grouplist: {}\n'.format(self.grouplist)
+        s += '    interactive: {}\n'.format(self.interactive)
+        s += '    bbftp: {}\n'.format(self.bbftp)
+        s += '    numstreams: {}\n'.format(self.numstreams)
+        s += '    hyperthreading: {}\n'.format(self.hyperthreading)
         return s
     # }}}
 
-    def nprocs(self):    # {{{
-        self.np = self.numnodes * self.cpuspernode
-        return self.np
-    # }}}
-
-    def checkconsistency(self, md, solution, analyses):    # {{{
+    def nprocs(self):  # {{{
+        return self.numnodes * self.cpuspernode
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
         queuedict = {'long': [5 * 24 * 60, 2048],
                      'normal': [8 * 60, 2048],
@@ -87,32 +93,44 @@
         QueueRequirements(queuedict, self.queue, self.nprocs(), self.time)
 
-        #now, check cluster.cpuspernode according to processor type
-        if self.processor == 'har' or self.processor == 'neh':
-            if self.hyperthreading:
-                if not 0 < self.cpuspernode < 17:
-                    md = md.checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode')
-            else:
-                if not 0 < self.cpuspernode < 9:
-                    md = md.checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors')
-
+        # Now, check cluster.cpuspernode according to processor type
+        if self.processor == 'ivy':
+            if self.hyperthreading:
+                if self.cpuspernode > 40 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 40 for \'ivy\' processors in hyperthreading mode')
+            else:
+                if self.cpuspernode > 20 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 20 for \'ivy\' processors')
         elif self.processor == 'bro':
             if self.hyperthreading:
-                if not 0 < self.cpuspernode < 57:
-                    md = md.checkmessage('cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode')
-            else:
-                if not 0 < self.cpuspernode < 29:
-                    md = md.checkmessage('cpuspernode should be between 1 and 28 for ''bro'' processors')
-
-        elif self.processor == 'ivy':
-            if self.hyperthreading:
-                if not 0 < self.cpuspernode < 41:
-                    md = md.checkmessage('cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode')
-            else:
-                if not 0 < self.cpuspernode < 21:
-                    md = md.checkmessage('cpuspernode should be between 1 and 20 for ''ivy'' processors')
+                if self.cpuspernode > 56 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 56 for \'bro\' processors in hyperthreading mode')
+            else:
+                if self.cpuspernode > 28 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 28 for \'bro\' processors')
+        elif self.processor == 'has':
+            if self.hyperthreading:
+                if self.cpuspernode > 48 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 48 for \'has\' processors in hyperthreading mode')
+            else:
+                if self.cpuspernode > 24 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 24 for \'has\' processors')
+        elif self.processor == 'san':
+            if self.hyperthreading:
+                if self.cpuspernode > 32 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 32 for \'san\' processors in hyperthreading mode')
+            else:
+                if self.cpuspernode > 16 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 16 for \'san\' processors')
+        elif self.processor == 'cas_ait':
+            if self.hyperthreading:
+                if self.cpuspernode > 80 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 80 for \'cas_ait\' processors in hyperthreading mode')
+            else:
+                if self.cpuspernode > 40 or self.cpuspernode < 1:
+                    md = md.checkmessage('cpuspernode should be between 1 and 40 for \'cas_ait\' processors')
         else:
-            md = md.checkmessage('unknown processor type, should be ''neh'', ''bro'' or ''har'' or ''ivy''')
-
-        #Miscellaneous
+            md = md.checkmessage('unknown processor type, should be \'bro\', \'has\', \'ivy\', \'san\', or \'cas_ait\'')
+
+        # Miscellaneous
         if not self.login:
             md = md.checkmessage('login empty')
@@ -125,11 +143,12 @@
         if not self.grouplist:
             md = md.checkmessage('grouplist empty')
-        if self.interactive == 1:
-            md = md.checkmessage('interactive mode not implemented')
 
         return self
     # }}}
 
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
+        if isgprof:
+            print('gprof not supported by cluster, ignoring...')
+
         executable = 'issm.exe'
         if isdakota:
@@ -141,52 +160,64 @@
             executable = 'issm_ocean.exe'
 
-    #write queuing script
+        # Write queuing script
         fid = open(modelname + '.queue', 'w')
-        fid.write('#PBS -S / bin / bash\n')
-        fid.write('#PBS -l select=%i:ncpus=%i:model=%s\n' % (self.numnodes, self.cpuspernode, self.processor))
-        fid.write('#PBS -l walltime=%i\n' % (self.time * 60))
-        fid.write('#PBS -q %s \n' % self.queue)
-        fid.write('#PBS -W group_list=%s\n' % self.grouplist)
+        fid.write('#PBS -S /bin/bash\n')
+        fid.write('#PBS -l select={}:ncpus={}:model={}\n'.format(self.numnodes, self.cpuspernode, self.processor))
+        fid.write('#PBS -l walltime={}\n'.format(self.time * 60)) # walltime is in seconds
+        fid.write('#PBS -q {} \n'.format(self.queue))
+        fid.write('#PBS -W group_list={}\n'.format(self.grouplist))
         fid.write('#PBS -m e\n')
-        fid.write('#PBS -o %s/%s/%s.outlog \n' % (self.executionpath, dirname, modelname))
-        fid.write('#PBS -e %s/%s/%s.errlog \n\n' % (self.executionpath, dirname, modelname))
-        fid.write('./usr/share/modules/init/bash\n\n')
-        fid.write('module load comp-intel/2015.0.090\n')
-        fid.write('module load mpi-sgi/mpt.2.11r13\n')
+        fid.write('#PBS -o {}/{}/{}.outlog \n'.format(self.executionpath, dirname, modelname))
+        fid.write('#PBS -e {}/{}/{}.errlog \n\n'.format(self.executionpath, dirname, modelname))
+        fid.write('. /usr/share/modules/init/bash\n\n')
+        for i in range(len(self.modules)):
+            fid.write('module load {}\n'.format(self.modules[i]))
         fid.write('export PATH="$PATH:."\n\n')
+        fid.write('export MPI_LAUNCH_TIMEOUT=520\n')
         fid.write('export MPI_GROUP_MAX=64\n\n')
-        fid.write('export ISSM_DIR="%s"\n' % self.srcpath)
-        fid.write('source $ISSM_DIR/etc/environment.sh\n')
+        fid.write('export ISSM_DIR="{}"\n'.format(self.srcpath)) # FIXME
+        fid.write('source $ISSM_DIR/etc/environment.sh\n') # FIXME
         fid.write('export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ISSM_DIR/externalpackages/petsc/install/lib"\n')
-        fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname))
-        fid.write('mpiexec - np %i %s/%s %s %s/%s %s\n' % (self.nprocs(), self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
+        fid.write('cd {}/{}/\n\n'.format(self.executionpath, dirname))
+        fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
 
         fid.close()
-
-    # }}}
-
-    def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
-        #compress the files into one zip.
-        compressstring = 'tar -zcf %s.tar.gz ' % dirname
+    # }}}
+
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
+        # Compress the files into one zip
+        compressstring = 'tar -zcf {}.tar.gz'.format(dirname)
         for file in filelist:
-            compressstring += ' %s' % file
+            compressstring += ' {}'.format(file)
         subprocess.call(compressstring, shell=True)
 
         print('uploading input file and queueing script')
-        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-
-    # }}}
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
+        directory = self.executionpath
+        issmscpout(self.name, directory, self.login, self.port, [dirname + '.tar.gz'])
+
+    # }}}
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
+        # Launch command, to be executed via ssh
+        if self.interactive:
+            if not isempty(restart):
+                launchcommand = 'cd {} /Interactive{}'.format(self.executionpath, self.interactive)
+            else:
+                if self.interactive == 10:
+                    launchcommand = 'cd {}/run && tar -zxf {}.tar.gz'.format(pwd(), dirname)
+                else:
+                    launchcommand = 'cd {} /Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname)
+        else:
+            if not isempty(restart):
+                launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname)
+            else:
+                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz  && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
+
         print('launching solution sequence on remote cluster')
-        if restart:
-            launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname)
-        else:
-            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && qsub %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
         issmssh(self.name, self.login, self.port, launchcommand)
 
     # }}}
-    def Download(self, dirname, filelist):    # {{{
-        #copy files from cluster to current directory
-        directory = '%s/%s/' % (self.executionpath, dirname)
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
+        directory = '{}/{}/'.format(self.executionpath, dirname)
         issmscpin(self.name, self.login, self.port, directory, filelist)
     # }}}
Index: issm/trunk/src/m/classes/clusters/pollux.m
===================================================================
--- issm/trunk/src/m/classes/clusters/pollux.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/pollux.m	(revision 26744)
@@ -7,98 +7,98 @@
 
 classdef pollux
-    properties (SetAccess=public) 
-		 % {{{
-		 name='pollux'
-		 login='username';
-		 np=128;
-		 port=0;
-		 queue='shortp';
-		 time=180;
-		 codepath='/workc/edw/issm-2.0/bin'
-		 executionpath='/workc/edw/Testing/Execution'
-		 %}}}
-	 end
-	 methods
-		 function cluster=pollux(varargin) % {{{
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='pollux'
+		login='username';
+		np=128;
+		port=0;
+		queue='shortp';
+		time=180;
+		codepath='/workc/edw/issm-2.0/bin'
+		executionpath='/workc/edw/Testing/Execution'
+		%}}}
+	end
+	methods
+		function cluster=pollux(varargin) % {{{
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'shortp','longp'};
-			 queue_requirements_time=[180 720];
-			 queue_requirements_np=[128 128];
+			available_queues={'shortp','longp'};
+			queue_requirements_time=[180 720];
+			queue_requirements_np=[128 128];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/sh\n');
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
-			 if ~isempty(queue),
-				 fprintf(fid,'#PBS -q %s\n',cluster.queue);
-			 end
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n',modelname);
-			 fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
-			 fprintf(fid,'cd $PBS_O_WORKDIR\n');
-			 fprintf(fid,'export OMP_NUM_THREADS=1\n');
-			 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/sh\n');
+			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#PBS -N %s\n',modelname);
+			fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
+			if ~isempty(queue),
+				fprintf(fid,'#PBS -q %s\n',cluster.queue);
+			end
+			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
+			fprintf(fid,'#PBS -e %s.errlog \n',modelname);
+			fprintf(fid,'export PBS_O_WORKDIR=%s\n',[cluster.executionpath '/' dirname]);
+			fprintf(fid,'cd $PBS_O_WORKDIR\n');
+			fprintf(fid,'export OMP_NUM_THREADS=1\n');
+			fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end
-		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		end
+		%}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/raijin.m
===================================================================
--- issm/trunk/src/m/classes/clusters/raijin.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/raijin.m	(revision 26744)
@@ -7,119 +7,121 @@
 
 classdef raijin
-    properties (SetAccess=public)  
-		 % {{{
-		 name='';
-		 login='';
-		 np=0;
-                 mem=0;
-                 time=0;
-                 project='';
-                 email='';
-		 port=0;
-		 queue='';
-		 codepath='';
-		 executionpath='';
-                 modules={};
-	 end
-	 %}}}
-	 methods
-		 function cluster=raijin(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name='';
+		login='';
+		np=0;
+		mem=0;
+		time=0;
+		project='';
+		email='';
+		port=0;
+		queue='';
+		codepath='';
+		executionpath='';
+		modules={};
+	end
+	%}}}
+	methods
+		function cluster=raijin(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('raijin_settings')==2), raijin_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('raijin_settings')==2), raijin_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    mem: %i',cluster.mem));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    np: %i',cluster.np));
-			 disp(sprintf('    queue: %s',cluster.queue));
-                         disp(sprintf('    project: %s',cluster.project));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    np: %i',cluster.np));
+			disp(sprintf('    mem: %i',cluster.mem));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    project: %s',cluster.project));
+			disp(sprintf('    email: %s',cluster.email));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'express', 'normal'};
-			 queue_requirements_time=[5*60 40*60];
-			 queue_requirements_np=[256 1024];
+			available_queues={'express', 'normal'};
+			queue_requirements_time=[5*60 40*60];
+			queue_requirements_np=[256 1024];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-                     
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-                         fprintf(fid,'#PBS -S /bin/bash\n');
-                         fprintf(fid,'#PBS -P %s\n', cluster.project);
-                         fprintf(fid,'#PBS -q %s\n',cluster.queue);
-                         fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
-                         fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds
-                         fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem);
-                         fprintf(fid,'#PBS -M %s\n', cluster.email);
-                         fprintf(fid,'#PBS -o %s.outlog\n',(modelname));
-                         fprintf(fid,'#PBS -e %s.errlog\n',(modelname));
-                         fprintf(fid,'#PBS -l wd\n\n');
-                         fprintf(fid,'source ~/.bashrc\n');
-                         fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
-                         for i=1:numel(cluster.modules)
-                             fprintf(fid,'module load %s\n', cluster.modules{i});
-                         end
-			 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 system(compressstring);
+			%write queuing script
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#PBS -S /bin/bash\n');
+			fprintf(fid,'#PBS -P %s\n', cluster.project);
+			fprintf(fid,'#PBS -q %s\n',cluster.queue);
+			fprintf(fid,'#PBS -l ncpus=%i\n',cluster.np);
+			fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); % walltime is in seconds
+			fprintf(fid,'#PBS -l mem=%igb\n', cluster.mem);
+			fprintf(fid,'#PBS -M %s\n', cluster.email);
+			fprintf(fid,'#PBS -o %s.outlog\n',(modelname));
+			fprintf(fid,'#PBS -e %s.errlog\n',(modelname));
+			fprintf(fid,'#PBS -l wd\n\n');
+			fprintf(fid,'source ~/.bashrc\n');
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');
+			for i=1:numel(cluster.modules)
+				fprintf(fid,'module load %s\n', cluster.modules{i});
+			end
+			fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			system(compressstring);
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-                         
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
+			
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-		 end %}}}
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/saga.py
===================================================================
--- issm/trunk/src/m/classes/clusters/saga.py	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/saga.py	(revision 26744)
@@ -1,11 +1,13 @@
+import datetime
 import subprocess
+
 from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
+from helpers import *
+from IssmConfig import IssmConfig
 from issmscpin import issmscpin
 from issmscpout import issmscpout
+from issmssh import issmssh
+from pairoptions import pairoptions
 from QueueRequirements import QueueRequirements
-from IssmConfig import IssmConfig
-import datetime
 try:
     from saga_settings import saga_settings
@@ -15,10 +17,10 @@
 
 class saga(object):
-    """
-    Saga cluster class definition
+    """SAGA cluster class definition
+
     This is a SLURM queue
 
-       Usage:
-          cluster = saga()
+    Usage:
+        cluster = saga()
     """
 
@@ -44,9 +46,9 @@
         self.valgrind = '/cluster/software/Valgrind/3.16.1-gompi-2019b/bin/valgrind'
 
-    #use provided options to change fields
+        # Use provided options to change fields
         options = pairoptions(*args)
-    #initialize cluster using user settings if provided
+        # Initialize cluster using user settings if provided
         self = saga_settings(self)
-    #OK get other fields
+        # OK get other fields
         self = options.AssignObjectFields(self)
         self.np = self.numnodes * self.cpuspernode
@@ -54,5 +56,5 @@
 
     def __repr__(self):  # {{{
-        #  display the object
+        # Display the object
         s = "class vilje object:"
         s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
@@ -72,5 +74,5 @@
 
     def checkconsistency(self, md, solution, analyses):  # {{{
-        #Queue dictionarry  gives queue name as key and max walltime, cpus and memory (GB) as var
+        # Queue dictionarry  gives queue name as key and max walltime, CPUs, and memory (GB) as var
         queuedict = {'normal': [7 * 24 * 60, 256, 8],
                      'bigmem': [14 * 24 * 60, 256, 10],
@@ -78,5 +80,5 @@
         QueueRequirements(queuedict, self.queue, self.np, self.time)
 
-    #Miscelaneous
+        # Miscellaneous
         if not self.login:
             md = md.checkmessage('login empty')
@@ -91,5 +93,4 @@
 
     def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
-
         executable = 'issm.exe'
         if isdakota:
@@ -100,5 +101,5 @@
         if isoceancoupling:
             executable = 'issm_ocean.exe'
-    #write queuing script
+        # Write queuing script
         shortname = modelname[0:min(12, len(modelname))]
         timeobj = datetime.timedelta(minutes=self.time)
@@ -146,29 +147,29 @@
     # }}}
     def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
-        #compress the files into one zip.
+        # Compress the files into one zip
         compressstring = 'tar -zcf %s.tar.gz ' % dirname
         for file in filelist:
-            compressstring += ' %s' % file
+            compressstring += ' {}'.format(file)
         subprocess.call(compressstring, shell=True)
 
         print('uploading input file and queueing script')
         issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-
     # }}}
 
     def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
-
         print('launching solution sequence on remote cluster')
-        if restart:
+        if not isempty(restart):
             launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname)
         else:
             launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
         issmssh(self.name, self.login, self.port, launchcommand)
-
     # }}}
 
     def Download(self, dirname, filelist):  # {{{
-        #copy files from cluster to current directory
+        # Copy files from cluster to current directory
         directory = '%s/%s/' % (self.executionpath, dirname)
-        issmscpin(self.name, self.login, self.port, directory, filelist)
-    # }}}
+        try:
+            issmscpin(self.name, self.login, self.port, directory, filelist)
+        except OSError:
+            print("File does not exsit, skiping")
+            # }}}
Index: issm/trunk/src/m/classes/clusters/sherlock.m
===================================================================
--- issm/trunk/src/m/classes/clusters/sherlock.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/sherlock.m	(revision 26744)
@@ -1,3 +1,3 @@
-%PFE class definition
+%SHERLOCK cluster class definition
 %
 %   Usage:
@@ -7,154 +7,154 @@
 
 classdef sherlock
-    properties (SetAccess=public)  
-		 % {{{
-		 name          = 'sherlock'
-		 login         = '';
-		 numnodes      = 1;
-		 cpuspernode   = 24;
-		 port          = 0;
-		 codepath      = '';
-		 executionpath = '';
-		 interactive   = 0;
-		 time          = 30;
-		 memory        = 2;
-	 end
-	 %}}}
-	 methods
-		 function cluster=sherlock(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name          = 'sherlock'
+		login         = '';
+		numnodes      = 1;
+		cpuspernode   = 24;
+		port          = 0;
+		codepath      = '';
+		executionpath = '';
+		interactive   = 0;
+		time          = 30;
+		memory        = 2;
+	end
+	%}}}
+	methods
+		function cluster=sherlock(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('sherlock_settings')==2), sherlock_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('sherlock_settings')==2), sherlock_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    memory: %i',cluster.memory));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    interactive: %i',cluster.interactive));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    memory: %i',cluster.memory));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
-		 end
-		 %}}}
-		 function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+		end
+		%}}}
+		function BuildKrigingQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',mdelname);
-			 fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',mdelname);
+			fprintf(fid,'#SBATCH -p %s \n',cluster.queue);
+			fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
+			fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.nprocs(),cluster.codepath,[cluster.executionpath '/' modelname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
+			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
+			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash\n');
-			 fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
-			 fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
-			 fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
-			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
-			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/bash\n');
+			fprintf(fid,'#SBATCH --job-name=%s\n',modelname);
+			fprintf(fid,'#SBATCH -N %i -n %i\n',cluster.numnodes,cluster.cpuspernode);
+			fprintf(fid,'#SBATCH --time=%i\n',cluster.time*60); %walltime is in seconds.
+			fprintf(fid,'#SBATCH --mem-per-cpu=%igb\n',cluster.memory);
+			fprintf(fid,'#SBATCH -o %s.outlog \n',modelname);
+			fprintf(fid,'#SBATCH -e %s.errlog \n\n',modelname);
+			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
+			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
+			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-				 fid=fopen([modelname '.run'],'w');
-				 fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				 if ~io_gather, %concatenate the output files:
-					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				 end
-				 fclose(fid);
-				 fid=fopen([modelname '.errlog'],'w');
-				 fclose(fid);
-				 fid=fopen([modelname '.outlog'],'w');
-				 fclose(fid);
-			 end
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				fprintf(fid,'mpiexec -n %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				if ~io_gather, %concatenate the output files:
+					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+				end
+				fclose(fid);
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			end
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			if cluster.interactive,
+				compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog '];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			disp('uploading input file and queueing script');
+			issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 disp('launching solution sequence on remote cluster');
-			 if ~isempty(restart)
-				 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
-			 else
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
-			 end
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			if ~isempty(restart)
+				launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue '];
+			else
+				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && sbatch ' modelname '.queue '];
+			end
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end %}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/clusters/smce_eis.py
===================================================================
--- issm/trunk/src/m/classes/clusters/smce_eis.py	(revision 26744)
+++ issm/trunk/src/m/classes/clusters/smce_eis.py	(revision 26744)
@@ -0,0 +1,216 @@
+import os
+import shutil
+import subprocess
+
+try:
+    from smce_eis_settings import smce_eis_settings
+except ImportError:
+    print('You need smce_eis_settings.py to proceed, check presence and sys.path')
+from fielddisplay import fielddisplay
+from helpers import *
+from IssmConfig import IssmConfig
+from issmssh import issmssh
+from MatlabFuncs import *
+from pairoptions import pairoptions
+
+class smce_eis(object):
+    """SMCE_EIS cluster class definition
+
+    Usage:
+        cluster = smce_eis()
+        cluster = smce_eis('np', 3)
+        cluster = smce_eis('np', 3, 'login', 'username')
+    """
+
+    def __init__(self, *args):  # {{{
+        self.name = '52.54.75.45'
+        self.login = 'jdquinn1'
+        self.idfile = '~/.ssh/smce-aws-eis-pilot'
+        self.modules = []
+        self.numnodes = 8
+        self.cpuspernode = 1
+        self.port = 0
+        self.time = 12 * 60 * 60
+        self.processor = 'skylake'
+        self.srcpath = '/shared/issm/issm/trunk-jpl'
+        self.codepath = '/shared/issm/issm/trunk-jpl/bin'
+        self.executionpath = '/home/jdquinn1/issm-exec'
+        self.interactive = 0
+        self.numstreams = 1
+        self.hyperthreading = 0
+        self.email = ''
+
+        # Use provided options to change fields
+        options = pairoptions(*args)
+
+        # Initialize cluster using user settings if provided
+        try:
+            self = smce_eis_settings(self)
+        except NameError:
+            print('smce_eis_settings.py not found, using default settings')
+
+        # OK get other fields
+        self = options.AssignObjectFields(self)
+    # }}}
+
+    def __repr__(self):  # {{{
+        # Display the object
+        s = 'class smce_eis object\n'
+        s += '    name: {}\n'.format(self.name)
+        s += '    login: {}\n'.format(self.login)
+        s += '    idfile: {}\n'.format(self.idfile)
+        s += '    modules: {}\n'.format(strjoin(self.modules, ', '))
+        s += '    numnodes: {}\n'.format(self.numnodes)
+        s += '    cpuspernode: {}\n'.format(self.cpuspernode)
+        s += '    np: {}\n'.format(self.nprocs())
+        s += '    port: {}\n'.format(self.port)
+        s += '    time: {}\n'.format(self.time)
+        s += '    processor: {}\n'.format(self.processor)
+        s += '    srcpath: {}\n'.format(self.srcpath)
+        s += '    codepath: {}\n'.format(self.codepath)
+        s += '    executionpath: {}\n'.format(self.executionpath)
+        s += '    interactive: {}\n'.format(self.interactive)
+        s += '    numstreams: {}\n'.format(self.numstreams)
+        s += '    hyperthreading: {}\n'.format(self.hyperthreading)
+        return s
+    # }}}
+
+    def nprocs(self):  # {{{
+        return self.numnodes * self.cpuspernode
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Now, check cluster.cpuspernode according to processor type
+        if self.processor == 'skylake':
+            if self.cpuspernode > 14 or self.cpuspernode < 1:
+                md = md.checkmessage('cpuspernode should be between 1 and 14 for \'skyw\' processors in hyperthreading mode')
+        else:
+            md = md.checkmessage('unknown processor type, should be \'skylake\'')
+
+        # Miscellaneous
+        if not self.login:
+            md = md.checkmessage('login empty')
+        if self.port:
+            md = md.checkmessage('port must be set to 0 as we do not have an SSH tunnel')
+        if not self.codepath:
+            md = md.checkmessage('codepath empty')
+        if not self.executionpath:
+            md = md.checkmessage('executionpath empty')
+
+        return self
+    # }}}
+
+    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
+        if isgprof:
+            print('gprof not supported by cluster, ignoring...')
+
+        executable = 'issm.exe'
+        if isdakota:
+            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
+            version = float(str(version[0]))
+            if version >= 6:
+                executable = 'issm_dakota.exe'
+        if isoceancoupling:
+            executable = 'issm_ocean.exe'
+
+        # Write queuing script
+        fid = open(modelname + '.queue', 'w')
+
+        fid.write('#!/bin/bash\n')
+        fid.write('#SBATCH --partition=hpc-spot \n')
+        fid.write('#SBATCH -J {} \n'.format(modelname))
+        fid.write('#SBATCH -o {}.outlog \n'.format(modelname))
+        fid.write('#SBATCH -e {}.errlog \n'.format(modelname))
+        fid.write('#SBATCH --nodes={} \n'.format(self.numnodes))
+        fid.write('#SBATCH --ntasks-per-node={} \n'.format(self.cpuspernode))
+        fid.write('#SBATCH --cpus-per-task={} \n'.format(self.numstreams))
+        fid.write('#SBATCH -t {:02d}:{:02d}:00 \n'.format(int(floor(self.time / 3600)), int(floor(self.time % 3600) / 60)))
+        if (self.email.find('@')>-1):
+            fid.write('#SBATCH --mail-user={} \n'.format(self.email))
+            fid.write('#SBATCH --mail-type=BEGIN,END,FAIL \n\n')
+        # for i in range(len(self.modules)):
+        #     fid.write('module load {}\n'.format(self.modules[i]))
+        fid.write('export MPI_GROUP_MAX=64\n\n')
+        fid.write('export MPI_UNBUFFERED_STDIO=true\n\n')
+        fid.write('export PATH="$PATH:/opt/slurm/bin"\n') # TODO: Figure out how to add this to PATH by sourcing environment script
+        fid.write('export PATH="$PATH:."\n\n')
+        fid.write('export ISSM_DIR="{}"\n'.format(self.srcpath)) # FIXME
+        fid.write('export HYDRA_HOST_FILE={}/{}/'.format(self.executionpath, dirname))
+        fid.write('${USER}-hydranodes-sj:${SLURM_JOB_ID}\n')
+        #fid.write('source /usr/share/modules/init/bash\n')
+        #fid.write('source /efs/spack-justin/share/spack/setup-env.sh\n')
+        #fid.write('module load gcc-9.3.0-gcc-9.3.0-ug2hqa3\n')
+        fid.write('touch ${HYDRA_HOST_FILE}\n')
+        fid.write('/efs/mrilee/snodelist/build/snodelist -m -f "%h%[:]c" >> ${HYDRA_HOST_FILE}\n')
+        fid.write('source $ISSM_DIR/etc/environment.sh\n') # FIXME
+        fid.write('cd {}/{}/\n\n'.format(self.executionpath, dirname))
+
+        fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+
+        if not io_gather: # concatenate the output files
+            fid.write('cat {}.outbin.* > {}.outbin'.format(modelname, modelname))
+        fid.close()
+
+        # In interactive mode, create a run file, and errlog and outlog file
+        if self.interactive:
+            fid = open(modelname + '.run', 'w')
+            if not isvalgrind:
+                fid.write('mpiexec -np {} {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+            else:
+                fid.write('mpiexec -np {} valgrind --leak-check=full {}/{} {} {}/{} {}\n'.format(self.nprocs(), self.codepath, executable, solution, self.executionpath, dirname, modelname))
+            if not io_gather: # concatenate the output files
+                fid.write('cat {}.outbin.* > {}.outbin'.format(modelname, modelname))
+            fid.close()
+            fid = open(modelname + '.errlog', 'w') # TODO: Change this to system call (touch <file>)?
+            fid.close()
+            fid = open(modelname + '.outlog', 'w') # TODO: Change this to system call (touch <file>)?
+            fid.close()
+    # }}}
+
+    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
+        # Compress the files into one zip
+        compressstring = 'tar -zcf {}.tar.gz'.format(dirname)
+        for file in filelist:
+            compressstring += ' {}'.format(file)
+        if self.interactive:
+            compressstring += ' {}.run {}.errlog {}.outlog'.format(modelname, modelname, modelname)
+        subprocess.call(compressstring, shell=True)
+
+        print('uploading input file and queueing script')
+        if self.interactive:
+            directory = '{}/Interactive{}'.format(self.executionpath, self.interactive)
+        else:
+            directory = self.executionpath
+
+        # NOTE: Replacement for issmscpout(self.name, directory, self.login, self.port, ['{}.tar.gz'.format(dirname)])
+        copystring = 'cp {}.tar.gz /efs/issm-tmp/'.format(dirname, dirname)
+        subprocess.call(copystring, shell=True)
+    # }}}
+
+    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
+        if self.interactive:
+            if not isempty(restart):
+                launchcommand = 'cd {}/Interactive{}'.format(self.executionpath, self.interactive)
+            else:
+                launchcommand = 'cd {}/Interactive{} && tar -zxf {}.tar.gz'.format(self.executionpath, self.interactive, dirname)
+        else:
+            if not isempty(restart):
+                launchcommand = 'cd {} && cd {} && /opt/slurm/bin/sbatch {}.queue'.format(self.executionpath, dirname, modelname)
+            else:
+                launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && cp /efs/issm-tmp/{}.tar.gz ./ && tar -zxf {}.tar.gz && /opt/slurm/bin/sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
+
+        print('launching solution sequence on remote cluster')
+
+        # NOTE: Replacement for issmssh(self.name, self.login, self.port, launchcommand)
+        subprocess.call('ssh -l {} -i {} {} "{}"'.format(self.login, self.idfile, self.name, launchcommand), shell=True)
+    # }}}
+
+    def Download(self, dirname, filelist):  # {{{
+        # Copy files from cluster to current directory
+    
+        # NOTE: Replacement for issmscpin(self.name, self.login, self.port, directory, filelist)
+        directory = '{}/{}/'.format(self.executionpath, dirname)
+        fileliststr = "'{" + ','.join([str(x) for x in filelist]) + "}'"
+        downloadcommand = 'scp -T -i {} {}@{}:{} {}/.'.format(self.idfile, self.login, self.name, os.path.join(directory, fileliststr), os.getcwd())
+        subprocess.call(downloadcommand, shell=True) 
+    # }}}
Index: issm/trunk/src/m/classes/clusters/stallo.m
===================================================================
--- issm/trunk/src/m/classes/clusters/stallo.m	(revision 25994)
+++ 	(revision )
@@ -1,216 +1,0 @@
-%        Stallo cluster class definition
-%	        This is a SLURM queue
-%	        The priorities are given to:
-%	           - Large jobs
-%	           - Short jobs
-%	           - small number of job per user
-%
-%	        There are some 20cpu nodes and 16cpu nodes, with 32GB (a few with 128GB) mem per node, you can ask for part of a node if you need more memory.(1 node, 2 CPUS and 10GB per cpu for example)
-
-%   Usage:
-%      cluster=stallo();
-%      cluster=stallo('np',3);
-%      cluster=stallo('np',3,'login','username');
-
-%node task and cpu must be defined, ask andreas for his stallo.py?
-
-classdef stallo
-    properties (SetAccess=public)
-		 % {{{
-		 name           = 'stallo';
-		 login          = '';
-		 numnodes       = 2;
-		 cpuspernode    = 10;
-		 mem            = 1.5;
-		 queue          = 'normal';
-		 time           = 2*60;
-		 codepath       = '';
-		 executionpath  = '';
-		 interactive    = 0;
-		 port           = [];
-		 accountname    = '';
-		 profiling	= 0;
-		 bbftp          = 0;
-		 % }}}
-	 end
-	 methods
-		 function cluster=stallo(varargin) % {{{
-
-			 %initialize cluster using default settings if provided
-			 if (exist('stallo_settings')==2), stallo_settings; end
-
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 disp(sprintf('    accountname: %s',cluster.accountname));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i, cpu per nodes',cluster.cpuspernode));
-			 disp(sprintf('    queue: %s, name of the queue (normal (D), short,singlenode,multinode,devel)',cluster.queue));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    interactive: %i',cluster.interactive));
-			 disp(sprintf('    time: %i, walltime requested in minutes',cluster.time));
-			 disp(sprintf('    memory: %i, memory per CPU',cluster.mem));
-			 disp(sprintf('    profiling: %i, enable profiling if 1 default is 0',cluster.profiling));
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
-
-			 available_queues={'short','normal','singlenode','multinode','devel'};
-			 queue_requirements_time=[60 2*24*60 28*24*60 28*24*60 4*60];
-			 queue_requirements_np=[2048 2048 20 2048 2048];
-
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
-
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.accountname), md = checkmessage(md,'accountname empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-
-			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			 executable='issm.exe';
-			 if isdakota,
-				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				 if (version>=6),
-					 executable='issm_dakota.exe';
-				 end
-			 end
-			 if isoceancoupling,
-				 executable='issm_ocean.exe';
-			 end
-
-			 days=floor(cluster.time/(60*24));
-			 hours=floor((cluster.time-(days*60*24))/60);
-			 minutes=floor(mod((cluster.time-(days*60*24)-(hours*60)),60));
-
-			 %write queuing script
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/bash -l\n');
-			 fprintf(fid,'#SBATCH --job-name=%s \n',modelname);
-			 fprintf(fid,'#SBATCH --qos=%s \n',cluster.queue);
-			 fprintf(fid,'#SBATCH --nodes=%i \n',cluster.numnodes);
-			 fprintf(fid,'#SBATCH --ntasks-per-node=%i \n',cluster.cpuspernode);
-			 fprintf(fid,'#SBATCH --time=%02i-%02i:%02i:00 \n',days,hours,minutes);
-			 fprintf(fid,'#SBATCH --mem-per-cpu=%iMB\n',1000*cluster.mem); % mem in MB
-			 if (mod(cluster.np,16)+mod(cluster.np,20))==0,
-			 	fprintf(fid,'#SBATCH --ntask=%i\n',cluster.np);
-			 end
-			 fprintf(fid,'#SBATCH --account=%s\n',cluster.accountname);
- 			 fprintf(fid,'#SBATCH -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
- 			 fprintf(fid,'#SBATCH -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
-
- 			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath);%FIXME
- 			 fprintf(fid,'module purge\n');
- 			 fprintf(fid,'module load CMake/3.8.0-GCCcore-6.3.0\n');
- 			 fprintf(fid,'module load Automake/1.15.1-GCCcore-6.3.0\n');
- 			 fprintf(fid,'module load libtool/2.4.6\n');
- 			 fprintf(fid,'module load OpenSSL/1.1.0e-intel-2017a\n');
- 			 fprintf(fid,'module load PETSc/3.7.5-intel-2017a-downloaded-deps\n');
-
- 			 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
-			 if cluster.profiling==1,
-			 	fprintf(fid,'module load perf-report\n');
-			 	fprintf(fid,'perf-report mpirun -np %i %s/%s %s %s/%s %s\n',cluster.np,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
-			 else
-			 	fprintf(fid,'mpirun -np %i %s/%s %s %s/%s %s\n',cluster.np,cluster.codepath,executable,solution,cluster.executionpath,dirname,modelname);
-			 end
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
-
-			 %in interactive mode, create a run file, and errlog and outlog file
-			 if cluster.interactive,
-			 	 fid=fopen([modelname '.run'],'w');
-			 	 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-		 	 	 if ~io_gather, %concatenate the output files:
-			 		 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 	 end
-			 	 fclose(fid);
-			 	 fid=fopen([modelname '.errlog'],'w');
-			 	 fclose(fid);
-			 	 fid=fopen([modelname '.outlog'],'w');
-			 	 fclose(fid);
-			 end
-		 end
-		 %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
-
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 if cluster.interactive,
-				 compressstring = [compressstring ' ' modelname '.run '  modelname '.errlog ' modelname '.outlog '];
-			 end
-			 system(compressstring);
-			 disp('uploading input file and queueing script');
-			 if cluster.interactive==10,
-				 directory=[pwd() '/run/'];
-			 elseif cluster.interactive,
-				 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
-			 else
-				 directory=cluster.executionpath;
-			 end
-
-			 if ~cluster.bbftp,
-				 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
-			 else
-				 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
-
-			 end
-		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-
-			 %lauch command, to be executed via ssh
-			 if ~cluster.interactive,
-				 if ~isempty(restart)
-					 launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue '];
-				 else
-					 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && sbatch ' modelname '.queue '];
-				 end
-			 else
-				 if ~isempty(restart)
-					 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
-				 else
-					 if cluster.interactive==10,
-						 launchcommand=['cd ' pwd() '/run && tar -zxf ' dirname '.tar.gz'];
-					 else
-						 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
-					 end
-				 end
-			 end
-
-			 disp('launching solution sequence on remote cluster');
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end
-		 %}}}
-		 function Download(cluster,dirname,filelist)% {{{
-
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
-
-		 end %}}}
-	end
-end
Index: issm/trunk/src/m/classes/clusters/stallo.py
===================================================================
--- issm/trunk/src/m/classes/clusters/stallo.py	(revision 25994)
+++ 	(revision )
@@ -1,179 +1,0 @@
-import subprocess
-import numpy as np
-from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
-from issmscpin import issmscpin
-from issmscpout import issmscpout
-from QueueRequirements import QueueRequirements
-from IssmConfig import IssmConfig
-import datetime
-try:
-    from stallo_settings import stallo_settings
-except ImportError:
-    print('You need stallo_settings.py to proceed, check presence and sys.path')
-
-
-class stallo(object):
-    """
-    Stallo cluster class definition
-    This is a SLURM queue
-    The priorities are given to:
- - Large jobs
- - Short jobs
- - small number of job per user
-
-    There are some 20cpu nodes and 16cpu nodes, with 32GB (a few with 128GB) mem per node, you can ask for part of a node if you need more memory.(1 node, 2 CPUS and 10GB per cpu for example)
-
-
-       Usage:
-          cluster = stallo()
-    """
-
-    def __init__(self, *args):  # {{{
-        self.name = 'stallo'
-        self.login = ''
-        self.numnodes = 2
-        self.cpuspernode = 20
-        self.mem = 1.6
-        self.queue = 'normal'
-        self.time = 2 * 60
-        self.codepath = ''
-        self.executionpath = ''
-        self.interactive = 0
-        self.port = []
-        self.accountname = ''
-        self.profiling = 0
-        self.exclusive = False
-    #use provided options to change fields
-        options = pairoptions(*args)
-    #initialize cluster using user settings if provided
-        self = stallo_settings(self)
-    #OK get other fields
-        self = options.AssignObjectFields(self)
-        self.np = self.numnodes * self.cpuspernode
-    # }}}
-
-    def __repr__(self):  # {{{
-        #  display the object
-        s = "class vilje object:"
-        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'numnodes', 'number of nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'cpuspernode', 'number of CPUs per nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mem', 'memory per CPU'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue (normal (D), short, singlenode, multinode, devel)'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested in minutes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'codepath', 'code path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'execution path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'interactive', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'accountname', 'your cluster account'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'profiling', 'enable profiling if 1 default is 0'))
-        return s
-    # }}}
-
-    def checkconsistency(self, md, solution, analyses):  # {{{
-        #Queue dictionarry  gives queue name as key and max walltime and cpus as var
-        queuedict = {'short': [2 * 24 * 60, 2048],
-                     'normal': [5 * 24 * 60, 2048],
-                     'singlenode': [28 * 24 * 60, 20],
-                     'multinode': [28 * 24 * 60, 2048],
-                     'devel': [4 * 60, 2048]}
-        QueueRequirements(queuedict, self.queue, self.np, self.time)
-
-    #Miscelaneous
-        if not self.login:
-            md = md.checkmessage('login empty')
-        if not self.codepath:
-            md = md.checkmessage('codepath empty')
-        if not self.executionpath:
-            md = md.checkmessage('executionpath empty')
-        if self.interactive == 1:
-            md = md.checkmessage('interactive mode not implemented')
-        return self
-    # }}}
-
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):  # {{{
-
-        executable = 'issm.exe'
-        if isdakota:
-            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
-            version = float(version)
-            if version >= 6:
-                executable = 'issm_dakota.exe'
-        if isoceancoupling:
-            executable = 'issm_ocean.exe'
-    #write queuing script
-        shortname = modelname[0:min(12, len(modelname))]
-        timeobj = datetime.timedelta(minutes=self.time)
-        m, s = divmod(timeobj.total_seconds(), 60)
-        h, m = divmod(m, 60)
-        d, h = divmod(h, 24)
-        timestring = "%02d-%02d:%02d:%02d" % (d, h, m, s)
-        print('timestring')
-        fid = open(modelname + '.queue', 'w')
-        fid.write('#!/bin/bash -l\n')
-        fid.write('#SBATCH --job-name=%s \n' % shortname)
-        if self.queue in ['devel', 'short']:
-            fid.write('#SBATCH --qos=%s \n' % self.queue)
-        else:
-            fid.write('#SBATCH --partition=%s \n' % self.queue)
-            if self.time < 2 * 24 * 60:
-                fid.write('#SBATCH --qos=short \n')
-        fid.write('#SBATCH --nodes=%i \n' % self.numnodes)
-        fid.write('#SBATCH --ntasks-per-node=%i \n' % self.cpuspernode)
-        fid.write('#SBATCH --time={}\n'.format(timestring))  #walltime is minutes
-        fid.write('#SBATCH --mem-per-cpu={}MB\n'.format(int(1000 * self.mem)))  # mem is in MB
-        if (np.mod(self.np, 16) + np.mod(self.np, 20)) == 0:
-            fid.write('  #SBATCH --ntask=%i\n' % self.np)
-        fid.write('#SBATCH --account=%s\n' % self.accountname)
-        fid.write('#SBATCH --output %s/%s/%s.outlog \n' % (self.executionpath, dirname, modelname))
-        fid.write('#SBATCH --error %s/%s/%s.errlog \n\n' % (self.executionpath, dirname, modelname))
-        if self.exclusive:
-            fid.write('#SBATCH --exclusive \n')
-
-        fid.write('export ISSM_DIR="%s/../"\n' % self.codepath)
-        fid.write('module purge\n')
-        fid.write('module load CMake/3.8.0-GCCcore-6.3.0\n')
-        fid.write('module load Automake/1.15.1-GCCcore-6.3.0\n')
-        fid.write('module load libtool/2.4.6\n')
-        fid.write('module load OpenSSL/1.1.0e-intel-2017a\n')
-        fid.write('module load PETSc/3.7.5-intel-2017a-downloaded-deps\n')
-
-        fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname))
-        if self.profiling == 1:
-            fid.write('module load perf-report\n')
-            fid.write('perf-report mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
-        else:
-            fid.write('mpirun -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
-        fid.close()
-
-    # }}}
-    def UploadQueueJob(self, modelname, dirname, filelist):  # {{{
-        #compress the files into one zip.
-        compressstring = 'tar -zcf %s.tar.gz ' % dirname
-        for file in filelist:
-            compressstring += ' %s' % file
-        subprocess.call(compressstring, shell=True)
-
-        print('uploading input file and queueing script')
-        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-
-    # }}}
-
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):  # {{{
-
-        print('launching solution sequence on remote cluster')
-        if restart:
-            launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname)
-        else:
-            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && sbatch %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
-        issmssh(self.name, self.login, self.port, launchcommand)
-
-    # }}}
-
-    def Download(self, dirname, filelist):  # {{{
-        #copy files from cluster to current directory
-        directory = '%s/%s/' % (self.executionpath, dirname)
-        issmscpin(self.name, self.login, self.port, directory, filelist)
-    # }}}
Index: issm/trunk/src/m/classes/clusters/tetralith.m
===================================================================
--- issm/trunk/src/m/classes/clusters/tetralith.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/tetralith.m	(revision 26744)
@@ -1,3 +1,3 @@
-%teralith class definition
+%TERALITH cluster class definition
 %
 %   Usage:
@@ -7,5 +7,5 @@
 
 classdef tetralith
-	properties (SetAccess=public)  
+	properties (SetAccess=public)
 		% {{{
 		name           = 'tetralith';
@@ -38,14 +38,15 @@
 			disp(sprintf('    name: %s',cluster.name));
 			disp(sprintf('    login: %s',cluster.login));
-			disp(sprintf('    accountname: %s',cluster.accountname));
 			disp(sprintf('    numnodes: %i',cluster.numnodes));
 			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			disp(sprintf('    np: %i', cluster.cpuspernode*cluster.numnodes));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    memory: %i',cluster.mem));
 			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
 			disp(sprintf('    codepath: %s',cluster.codepath));
 			disp(sprintf('    executionpath: %s',cluster.executionpath));
 			disp(sprintf('    interactive: %i',cluster.interactive));
-			disp(sprintf('    time: %i',cluster.time));
-			disp(sprintf('    memory: %i',cluster.mem));
+			disp(sprintf('    port: %s',cluster.port));
+			disp(sprintf('    accountname: %s',cluster.accountname));
 		end
 		%}}}
@@ -56,7 +57,7 @@
 			queue_requirements_np=[1024 2*32];
 
-			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
-
-			%Miscelaneous
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),1)
+
+			%Miscellaneous
 			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
 			if isempty(cluster.accountname), md = checkmessage(md,'accountname empty'); end
@@ -66,5 +67,5 @@
 		end
 		%}}}
-		function numprocs=np(self) % {{{
+		function numprocs=nprocs(self) % {{{
 			%compute number of processors
 			numprocs=self.numnodes*self.cpuspernode;
@@ -78,5 +79,5 @@
 			%compute number of processors
 % 			cluster.np=cluster.numnodes*cluster.cpuspernode;
-			np(cluster);%=cluster.numnodes*cluster.cpuspernode;
+%			nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode;
 
 			%write queuing script 
@@ -104,12 +105,12 @@
 			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
 			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-% 			fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+% 			fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
 % 			fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-% 			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-			 if ~io_gather, %concatenate the output files:
-				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			 end
-			 fclose(fid);
+			fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+% 			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+			if ~io_gather, %concatenate the output files:
+				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
+			end
+			fclose(fid);
 		end
 		%}}}
@@ -132,5 +133,5 @@
 			%compute number of processors
 % 			cluster.np=cluster.numnodes*cluster.cpuspernode;
-			np(cluster);%=cluster.numnodes*cluster.cpuspernode;                     
+			nprocs(cluster);%=cluster.numnodes*cluster.cpuspernode;
 % 			shortname = substring(modelname,1,min(12,length(modelname)));
 
@@ -159,8 +160,8 @@
 			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
 			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-% 			fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-% 			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-% 			fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+% 			fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+			fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+% 			fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+% 			fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.nprocs(),cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
 
 			if ~io_gather, %concatenate the output files:
@@ -172,5 +173,5 @@
 			if cluster.interactive,
 				fid=fopen([modelname '.run'],'w');
-				fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
+				fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.nprocs(),cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
 				if ~io_gather, %concatenate the output files:
 					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
@@ -183,5 +184,5 @@
 			end
 		end %}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
 			%compress the files into one zip.
@@ -198,5 +199,5 @@
 		end
 		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
 			disp('launching solution sequence on remote cluster');
@@ -206,5 +207,5 @@
 			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
 		end %}}}
-		function Download(cluster,dirname,filelist)% {{{
+		function Download(cluster,dirname,filelist) % {{{
 
 			%copy files from cluster to current directory
Index: issm/trunk/src/m/classes/clusters/vilje.m
===================================================================
--- issm/trunk/src/m/classes/clusters/vilje.m	(revision 25994)
+++ 	(revision )
@@ -1,209 +1,0 @@
-%vilje class definition
-%
-%   Usage:
-%      cluster=greenplanet();
-%      cluster=greenplanet('np',3);
-%      cluster=greenplanet('np',3,'login','username');
-
-classdef vilje
-	properties (SetAccess=public)  
-		% {{{
-		name           = 'vilje';
-		login          = '';
-		numnodes       = 2;
-		cpuspernode    = 32;
-		procspernodes  = 16;
-		mem            = 28;
-		numstreams		= 8; %Henning added
-		queue          = 'workq';
-		time           = 2*60;
-		codepath       = '';
-		executionpath  = '';
-		interactive    = 0;
-		port           = [];
-		accountname    = '';
-		% }}}
-	end
-	methods
-		function cluster=vilje(varargin) % {{{
-
-			%initialize cluster using default settings if provided
-			if (exist('vilje_settings')==2), vilje_settings; end
-
-			%use provided options to change fields
-			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		end
-		%}}}
-		function disp(cluster) % {{{
-			%  display the object
-			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			disp(sprintf('    name: %s',cluster.name));
-			disp(sprintf('    login: %s',cluster.login));
-			disp(sprintf('    accountname: %s',cluster.accountname));
-			disp(sprintf('    numnodes: %i',cluster.numnodes));
-			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			disp(sprintf('    np: %i', cluster.cpuspernode*cluster.numnodes));
-			disp(sprintf('    procspernodes: %i',cluster.procspernodes));
-			disp(sprintf('    queue: %s',cluster.queue));
-			disp(sprintf('    codepath: %s',cluster.codepath));
-			disp(sprintf('    executionpath: %s',cluster.executionpath));
-			disp(sprintf('    interactive: %i',cluster.interactive));
-			disp(sprintf('    time: %i',cluster.time));
-			disp(sprintf('    memory: %i',cluster.mem));
-		end
-		%}}}
-		function md = checkconsistency(cluster,md,solution,analyses) % {{{
-
-			available_queues={'workq'};
-			queue_requirements_time=[5*24*60];
-			queue_requirements_np=[30];
-
-			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,1)
-
-			%Miscelaneous
-			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			if isempty(cluster.accountname), md = checkmessage(md,'accountname empty'); end
-			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-
-		end
-		%}}}
-		function numprocs=np(self) % {{{
-			%compute number of processors
-			numprocs=self.numnodes*self.procspernodes;
-		end
-		%}}}
-		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
-
-			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			%compute number of processors
-% 			cluster.np=cluster.numnodes*cluster.cpuspernode;
-			np(cluster);%=cluster.numnodes*cluster.cpuspernode;
-
-			%write queuing script 
-			fid=fopen([modelname '.queue'],'w');
-			fprintf(fid,'#PBS -S /bin/bash\n');
-			fprintf(fid,'#PBS -N %s\n',modelname);
-			fprintf(fid,'#PBS -l select=%i:ncpus=%i:mpiprocs=%i\n',cluster.numnodes,cluster.cpuspernode,16);
-			
-			%calculate walltime in hh:mm:ss format
-			walltime=datestr(cluster.time/(60*24),'HH:MM:SS');
-			fprintf(fid,'#PBS -l walltime=%s\n',walltime); %walltime should be in hh:mm:ss
-			fprintf(fid,'#PBS -A %s\n',cluster.accountname);
-			fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
-			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			fprintf(fid,'module load intelcomp/17.0.0\n') 
-			fprintf(fid,'module load mpt/2.14\n')
-			fprintf(fid,'module load petsc/3.7.4d\n')
-			fprintf(fid,'module load parmetis/4.0.3\n') 
-			fprintf(fid,'module load mumps/5.0.2\n')
-			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,modelname);
-			fprintf(fid,'mpiexec_mpt -n %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
-			if ~io_gather, %concatenate the output files:
-				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			end
-			fclose(fid);
-		end
-		%}}}
-		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
-
-			if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
-			if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
-
-			executable='issm.exe';
-			if isdakota,
-				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				if (version>=6),
-					executable='issm_dakota.exe';
-				end
-			end
-			if isoceancoupling,
-				executable='issm_ocean.exe';
-			end
-
-			%compute number of processors
-% 			cluster.np=cluster.numnodes*cluster.cpuspernode;
-			np(cluster);%=cluster.numnodes*cluster.cpuspernode;                     
-% 			shortname = substring(modelname,1,min(12,length(modelname)));
-
-			%write queuing script 
-			fid=fopen([modelname '.queue'],'w');
-			fprintf(fid,'#PBS -S /bin/bash\n');
-% 			fprintf(fid,'#PBS -N %s\n',shortname);
-			fprintf(fid,'#PBS -N %s\n',modelname);
-			fprintf(fid,'#PBS -q %s \n',cluster.queue);
-			fprintf(fid,'#PBS -l select=%i:ncpus=%i:mpiprocs=%i\n',cluster.numnodes,cluster.cpuspernode,cluster.procspernodes);
-
-			%calculate walltime in hh:mm:ss format
-			walltime=datestr(cluster.time/(60*24),'HH:MM:SS');
-% 			fprintf(fid,'#PBS -l walltime=%s\n',duration(0,cluster.time,0)); %walltime is in minutes.
-% 			fprintf(fid,'#PBS -l walltime=%s\n',10); %walltime is in minutes.
-			fprintf(fid,'#PBS -l walltime=%s\n',walltime); %walltime should be in hh:mm:ss
-% 			fprintf(fid,'#PBS -l walltime=%i\n',walltime); %walltime is in hh:mm:ss
-			fprintf(fid,'#PBS -A %s\n',cluster.accountname);
-			fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
-			fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
-			fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
-			fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
-			fprintf(fid,'module load intelcomp/17.0.0\n') 
-			fprintf(fid,'module load mpt/2.14\n')
-			fprintf(fid,'module load petsc/3.7.4d\n')
-			fprintf(fid,'module load parmetis/4.0.3\n') 
-			fprintf(fid,'module load mumps/5.0.2\n')
-			fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,dirname);
-			fprintf(fid,'mpiexec_mpt -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-
-			if ~io_gather, %concatenate the output files:
-				fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-			end
-			fclose(fid);
-
-			%in interactive mode, create a run file, and errlog and outlog file
-			if cluster.interactive,
-				fid=fopen([modelname '.run'],'w');
-				fprintf(fid,'mpiexec_mpt -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,solution,[cluster.executionpath '/' dirname],modelname);
-				if ~io_gather, %concatenate the output files:
-					fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
-				end
-				fclose(fid);
-				fid=fopen([modelname '.errlog'],'w');
-				fclose(fid);
-				fid=fopen([modelname '.outlog'],'w');
-				fclose(fid);
-			end
-		end %}}}
-		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
-
-			%compress the files into one zip.
-			compressstring=['tar -zcf ' dirname '.tar.gz '];
-			for i=1:numel(filelist),
-				compressstring = [compressstring ' ' filelist{i}];
-			end
-			system(compressstring);
-			disp('uploading input file and queueing script');
-			directory=cluster.executionpath;
-% 			issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
-			issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
-
-		end
-		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
-
-			disp('launching solution sequence on remote cluster');
-			launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-				' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && hostname && qsub ' modelname '.queue '];
-			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		end %}}}
-		function Download(cluster,dirname,filelist)% {{{
-
-			%copy files from cluster to current directory
-			directory=[cluster.executionpath '/' dirname '/'];
-			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
-
-		end %}}}
-	end
-end
Index: issm/trunk/src/m/classes/clusters/vilje.py
===================================================================
--- issm/trunk/src/m/classes/clusters/vilje.py	(revision 25994)
+++ 	(revision )
@@ -1,145 +1,0 @@
-import subprocess
-from fielddisplay import fielddisplay
-from pairoptions import pairoptions
-from issmssh import issmssh
-from issmscpin import issmscpin
-from issmscpout import issmscpout
-from QueueRequirements import QueueRequirements
-from IssmConfig import IssmConfig
-import datetime
-try:
-    from vilje_settings import vilje_settings
-except ImportError:
-    print('You need vilje_settings.py to proceed, check presence and sys.path')
-
-
-class vilje(object):
-    """
-    Vilje cluster class definition
-
-       Usage:
-          cluster = vilje()
-    """
-
-    def __init__(self, *args):    # {{{
-        self.name = 'vilje'
-        self.login = ''
-        self.numnodes = 2
-        self.cpuspernode = 32
-        self.procspernodes = 16
-        self.mem = 28
-        self.queue = 'workq'
-        self.time = 2 * 60
-        self.codepath = ''
-        self.executionpath = ''
-        self.interactive = 0
-        self.port = []
-        self.accountname = ''
-
-    #use provided options to change fields
-        options = pairoptions(*args)
-
-    #initialize cluster using user settings if provided
-        self = vilje_settings(self)
-    #OK get other fields
-        self = options.AssignObjectFields(self)
-        self.np = self.numnodes * self.procspernodes
-    # }}}
-
-    def __repr__(self):    # {{{
-        #  display the object
-        s = "class vilje object:"
-        s = "%s\n%s" % (s, fielddisplay(self, 'name', 'name of the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'login', 'login'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'numnodes', 'number of nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'cpuspernode', 'number of nodes per CPUs (32)'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'procspernodes', 'number of mpi procs per nodes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mem', 'node memory'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue (test is an option, workq the default)'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested in minutes'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'codepath', 'code path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'execution path on the cluster'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'interactive', ''))
-        s = "%s\n%s" % (s, fielddisplay(self, 'accountname', 'your cluster account'))
-        return s
-    # }}}
-
-    def checkconsistency(self, md, solution, analyses):    # {{{
-        #Queue dictionarry  gives queu name as key and max walltime and cpus as var
-        queuedict = {'workq': [5 * 24 * 60, 30],
-                     'test': [30, 4]}
-        QueueRequirements(queuedict, self.queue, self.np, self.time)
-
-    #Miscelaneous
-        if not self.login:
-            md = md.checkmessage('login empty')
-        if not self.codepath:
-            md = md.checkmessage('codepath empty')
-        if not self.executionpath:
-            md = md.checkmessage('executionpath empty')
-        if self.interactive == 1:
-            md = md.checkmessage('interactive mode not implemented')
-        return self
-    # }}}
-
-    def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, isgprof, isdakota, isoceancoupling):    # {{{
-        executable = 'issm.exe'
-        if isdakota:
-            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
-            version = float(version)
-            if version >= 6:
-                executable = 'issm_dakota.exe'
-        if isoceancoupling:
-            executable = 'issm_ocean.exe'
-
-    #write queuing script
-        shortname = modelname[0:min(12, len(modelname))]
-        fid = open(modelname + '.queue', 'w')
-        fid.write('#PBS -S / bin / bash\n')
-        fid.write('#PBS -N %s \n' % shortname)
-        fid.write('#PBS -q %s \n' % self.queue)
-        fid.write('#PBS -l select=%i:ncpus=%i:mpiprocs=%s\n' % (self.numnodes, self.cpuspernode, self.procspernodes))
-        timeobj = datetime.timedelta(minutes=self.time)
-        m, s = divmod(timeobj.total_seconds(), 60)
-        h, m = divmod(m, 60)
-        timestring = "%02d:%02d:%02d" % (h, m, s)
-        fid.write('#PBS -l walltime=%s\n' % timestring)  #walltime is hh:mm:ss
-        fid.write('#PBS -A %s\n' % self.accountname)
-        fid.write('#PBS -o %s/%s/%s.outlog \n' % (self.executionpath, dirname, modelname))
-        fid.write('#PBS -e %s/%s/%s.errlog \n\n' % (self.executionpath, dirname, modelname))
-        fid.write('export ISSM_DIR="%s/../ "\n' % self.codepath)
-        fid.write('module load intelcomp/17.0.0\n')
-        fid.write('module load mpt/2.14\n')
-        fid.write('module load petsc/3.7.4d\n')
-        fid.write('module load parmetis/4.0.3\n')
-        fid.write('module load mumps/5.0.2\n')
-        fid.write('cd %s/%s/\n\n' % (self.executionpath, dirname))
-        fid.write('mpiexec_mpt -np %i %s/%s %s %s/%s %s\n' % (self.np, self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
-        fid.close()
-    # }}}
-
-    def UploadQueueJob(self, modelname, dirname, filelist):    # {{{
-        #compress the files into one zip.
-        compressstring = 'tar -zcf %s.tar.gz ' % dirname
-        for file in filelist:
-            compressstring += ' %s' % file
-        subprocess.call(compressstring, shell=True)
-
-        print('uploading input file and queueing script')
-        issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz'])
-    # }}}
-
-    def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch):    # {{{
-        print('launching solution sequence on remote cluster')
-        if restart:
-            launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname)
-        else:
-            launchcommand = 'cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && qsub %s.queue' % (self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname)
-        issmssh(self.name, self.login, self.port, launchcommand)
-    # }}}
-
-    def Download(self, dirname, filelist):    # {{{
-        #copy files from cluster to current directory
-        directory = '%s/%s/' % (self.executionpath, dirname)
-        issmscpin(self.name, self.login, self.port, directory, filelist)
-    # }}}
Index: issm/trunk/src/m/classes/clusters/yellowstone.m
===================================================================
--- issm/trunk/src/m/classes/clusters/yellowstone.m	(revision 25994)
+++ issm/trunk/src/m/classes/clusters/yellowstone.m	(revision 26744)
@@ -1,3 +1,3 @@
-%YELLOWSTONE class definition
+%YELLOWSTONE cluster class definition
 %
 %   Usage:
@@ -7,150 +7,149 @@
 
 classdef yellowstone
-    properties (SetAccess=public)  
-		 % {{{
-		 name           = 'yellowstone.ucar.edu'
-		 login          = '';
-		 modules        = {'ncarenv/1.0' 'ncarbinlibs/1.1' 'perlmods/5.0' 'gmake/4.1' 'python/2.7.7' 'all-python-libs' 'git/2.3.0' 'intel/15.0.3' 'mkl/11.1.2' 'esmf' 'esmf-6.3.0rp1-defio-mpi-O' 'netcdf-mpi/4.3.3.1' 'pnetcdf/1.6.1' 'ncarcompilers/1.0' 'cmake/3.0.2' 'matlab/R2015b' 'issm'};
-		 numnodes       = 1;
-		 cpuspernode    = 8;
-		 port           = 0;
-		 queue          = 'premium';
-		 time           = 12*60;
-		 processor      = 'sandy';
-		 codepath       = '';
-		 executionpath  = '';
-		 grouplist     = 'P93300301';
-	 end
-	 %}}}
-	 methods
-		 function cluster=yellowstone(varargin) % {{{
+	properties (SetAccess=public)
+		% {{{
+		name           = 'yellowstone.ucar.edu'
+		login          = '';
+		modules        = {'ncarenv/1.0' 'ncarbinlibs/1.1' 'perlmods/5.0' 'gmake/4.1' 'python/2.7.7' 'all-python-libs' 'git/2.3.0' 'intel/15.0.3' 'mkl/11.1.2' 'esmf' 'esmf-6.3.0rp1-defio-mpi-O' 'netcdf-mpi/4.3.3.1' 'pnetcdf/1.6.1' 'ncarcompilers/1.0' 'cmake/3.0.2' 'matlab/R2015b' 'issm'};
+		numnodes       = 1;
+		cpuspernode    = 8;
+		port           = 0;
+		queue          = 'premium';
+		time           = 12*60;
+		processor      = 'sandy';
+		codepath       = '';
+		executionpath  = '';
+		grouplist     = 'P93300301';
+	end
+	%}}}
+	methods
+		function cluster=yellowstone(varargin) % {{{
 
-			 %initialize cluster using default settings if provided
-			 if (exist('yellowstone_settings')==2), yellowstone_settings; end
+			%initialize cluster using default settings if provided
+			if (exist('yellowstone_settings')==2), yellowstone_settings; end
 
-			 %use provided options to change fields
-			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
-		 end
-		 %}}}
-		 function disp(cluster) % {{{
-			 %  display the object
-			 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
-			 disp(sprintf('    name: %s',cluster.name));
-			 disp(sprintf('    login: %s',cluster.login));
-			 modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1); 
-			 disp(sprintf('    modules: %s',modules));
-			 disp(sprintf('    port: %i',cluster.port));
-			 disp(sprintf('    numnodes: %i',cluster.numnodes));
-			 disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
-			 disp(sprintf('    np: %i',cluster.cpuspernode*cluster.numnodes));
-			 disp(sprintf('    queue: %s',cluster.queue));
-			 disp(sprintf('    time: %i',cluster.time));
-			 disp(sprintf('    processor: %s',cluster.processor));
-			 disp(sprintf('    codepath: %s',cluster.codepath));
-			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-			 disp(sprintf('    grouplist: %s',cluster.grouplist));
-		 end
-		 %}}}
-		 function numprocs=np(cluster) % {{{
-			 %compute number of processors
-			 numprocs=cluster.numnodes*cluster.cpuspernode;
-		 end
-		 %}}}
-		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
+			%use provided options to change fields
+			cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
+		end
+		%}}}
+		function disp(cluster) % {{{
+			%  display the object
+			disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
+			disp(sprintf('    name: %s',cluster.name));
+			disp(sprintf('    login: %s',cluster.login));
+			disp(sprintf('    modules: %s',strjoin(cluster.modules,', ')));
+			disp(sprintf('    numnodes: %i',cluster.numnodes));
+			disp(sprintf('    cpuspernode: %i',cluster.cpuspernode));
+			disp(sprintf('    np: %i',cluster.nprocs()));
+			disp(sprintf('    port: %i',cluster.port));
+			disp(sprintf('    queue: %s',cluster.queue));
+			disp(sprintf('    time: %i',cluster.time));
+			disp(sprintf('    processor: %s',cluster.processor));
+			disp(sprintf('    codepath: %s',cluster.codepath));
+			disp(sprintf('    executionpath: %s',cluster.executionpath));
+			disp(sprintf('    grouplist: %s',cluster.grouplist));
+		end
+		%}}}
+		function numprocs=nprocs(cluster) % {{{
+			%compute number of processors
+			numprocs=cluster.numnodes*cluster.cpuspernode;
+		end
+		%}}}
+		function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
-			 available_queues={'premium','regular'};
-			 queue_requirements_time=[12*60 12*650];
-			 queue_requirements_np=[16384 16384];
+			available_queues={'premium','regular'};
+			queue_requirements_time=[12*60 12*650];
+			queue_requirements_np=[16384 16384];
 
-			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
+			QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.nprocs(),cluster.time)
 
-			 %Miscelaneous
-			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
-			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
-			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
-			 if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end
+			%Miscellaneous
+			if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
+			if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end
 
-		 end
-		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
+		end
+		%}}}
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
 
-			 executable='issm.exe';
-			 if isdakota,
-				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
-				 if (version>=6),
-					 executable='issm_dakota.exe';
-				 end
-			 end
-			 if isoceancoupling,
-				 executable='issm_ocean.exe';
-			 end
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+			if isoceancoupling,
+				executable='issm_ocean.exe';
+			end
 
 
-			 %write queuing script 
-			 fid=fopen([modelname '.queue'],'w');
-			 fprintf(fid,'#!/bin/tcsh\n');
-			 fprintf(fid,'#BSUB -P %s\n',cluster.grouplist);
-			 fprintf(fid,'#BSUB -W %i:%i\n',floor(cluster.time/60),cluster.time-floor(cluster.time/60)*60);
-			 fprintf(fid,'#BSUB -n %i\n',cluster.np);
-			 fprintf(fid,'#BSUB -J %s\n',modelname);
-			 fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
-			 fprintf(fid,'#BSUB -e %s.errlog \n',[cluster.executionpath '/' dirname '/' modelname]);
-			 fprintf(fid,'#BSUB -q %s\n',cluster.queue);
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			fprintf(fid,'#!/bin/tcsh\n');
+			fprintf(fid,'#BSUB -P %s\n',cluster.grouplist);
+			fprintf(fid,'#BSUB -W %i:%i\n',floor(cluster.time/60),cluster.time-floor(cluster.time/60)*60);
+			fprintf(fid,'#BSUB -n %i\n',cluster.nprocs());
+			fprintf(fid,'#BSUB -J %s\n',modelname);
+			fprintf(fid,'#BSUB -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
+			fprintf(fid,'#BSUB -e %s.errlog \n',[cluster.executionpath '/' dirname '/' modelname]);
+			fprintf(fid,'#BSUB -q %s\n',cluster.queue);
 
-			 fprintf(fid,'module purge\n');
-			 for i=1:length(cluster.modules),
-				 fprintf(fid,'module load %s\n',cluster.modules{i});
-			 end
+			fprintf(fid,'module purge\n');
+			for i=1:length(cluster.modules),
+				fprintf(fid,'module load %s\n',cluster.modules{i});
+			end
 
-			 fprintf(fid,'setenv OMP_STACKSIZE 256M\n');
-			 fprintf(fid,'setenv MP_LABELIO yes\n');
-			 fprintf(fid,'setenv MP_INFOLEVEL 2\n');
-			 fprintf(fid,'setenv MP_SHARED_MEMORY yes\n');
-			 fprintf(fid,'setenv MP_EUILIB us\n');
-			 fprintf(fid,'setenv MP_STDOUTMODE unordered\n');
-			 fprintf(fid,'setenv MP_RC_USE_LMC yes\n');
-			 fprintf(fid,'setenv MP_MPILIB mpich2\n');
-			 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/ibmhpc/pecurrent/mpich2/intel/lib64/\n');
-			 fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/ncar/opt/intel/psxe-2015_update3/impi/5.0.3.048/lib64/\n');
+			fprintf(fid,'setenv OMP_STACKSIZE 256M\n');
+			fprintf(fid,'setenv MP_LABELIO yes\n');
+			fprintf(fid,'setenv MP_INFOLEVEL 2\n');
+			fprintf(fid,'setenv MP_SHARED_MEMORY yes\n');
+			fprintf(fid,'setenv MP_EUILIB us\n');
+			fprintf(fid,'setenv MP_STDOUTMODE unordered\n');
+			fprintf(fid,'setenv MP_RC_USE_LMC yes\n');
+			fprintf(fid,'setenv MP_MPILIB mpich2\n');
+			fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/ibmhpc/pecurrent/mpich2/intel/lib64/\n');
+			fprintf(fid,'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/ncar/opt/intel/psxe-2015_update3/impi/5.0.3.048/lib64/\n');
 
-			 fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
+			fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
 
-			 fprintf(fid,'mpirun.lsf %s/%s %s %s %s\n',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
-			 fclose(fid);
+			fprintf(fid,'mpirun.lsf %s/%s %s %s %s\n',cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
+			fclose(fid);
 
-		 end %}}}
-		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
+		end %}}}
+		function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{
 
-			 %compress the files into one zip.
-			 compressstring=['tar -zcf ' dirname '.tar.gz '];
-			 for i=1:numel(filelist),
-				 compressstring = [compressstring ' ' filelist{i}];
-			 end
-			 system(compressstring);
+			%compress the files into one zip.
+			compressstring=['tar -zcf ' dirname '.tar.gz '];
+			for i=1:numel(filelist),
+				compressstring = [compressstring ' ' filelist{i}];
+			end
+			system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 directory=cluster.executionpath;
+			disp('uploading input file and queueing script');
+			directory=cluster.executionpath;
 
-			 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
 
-		 end
-		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+		end
+		%}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{
 
-			 %lauch command, to be executed via ssh
-			 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-						 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && bsub < ' modelname '.queue '];
+			%launch command, to be executed via ssh
+			launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && bsub < ' modelname '.queue '];
 
-			 disp('launching solution sequence on remote cluster');
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
-		 end
-		 %}}}
-		 function Download(cluster,dirname,filelist)% {{{
+			disp('launching solution sequence on remote cluster');
+			issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+		end
+		%}}}
+		function Download(cluster,dirname,filelist) % {{{
 
-			 %copy files from cluster to current directory
-			 directory=[cluster.executionpath '/' dirname '/'];
-			 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
+			%copy files from cluster to current directory
+			directory=[cluster.executionpath '/' dirname '/'];
+			issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
 
-		 end %}}}
+		end %}}}
 	end
 end
Index: issm/trunk/src/m/classes/constants.js
===================================================================
--- issm/trunk/src/m/classes/constants.js	(revision 25994)
+++ issm/trunk/src/m/classes/constants.js	(revision 26744)
@@ -19,4 +19,7 @@
 			//the reference temperature for enthalpy model (cf Aschwanden)
 			this.referencetemperature=223.15;
+
+			//gravitational constant: 
+			this.gravitational_constant = 6.67259e-11;
 		}// }}}
 		this.disp = function () { //{{{
@@ -27,4 +30,5 @@
 			fielddisplay(this,'yts','number of seconds in a year [s/yr]');
 			fielddisplay(this,'referencetemperature','reference temperature used in the enthalpy model [K]');
+			fielddisplay(this,'gravitational_constant','Newtonian constant of gravitation [m^3/kg/s^2]');
 
 		} //}}}
@@ -39,4 +43,5 @@
 			checkfield(md,'fieldname','constants.yts','>',0,'size',[1,1]);
 			checkfield(md,'fieldname','constants.referencetemperature','size',[1,1]);
+			checkfield(md,'fieldname','constants.gravitational_constant','size',[1,1]);
 
 		} // }}}
@@ -45,4 +50,5 @@
 			WriteData(fid,prefix,'object',this,'fieldname','yts','format','Double');
 			WriteData(fid,prefix,'object',this,'fieldname','referencetemperature','format','Double');
+			WriteData(fid,prefix,'object',this,'fieldname','gravitational_constant','format','Double');
 		}//}}}
 		this.fix=function() { //{{{
@@ -50,8 +56,9 @@
 	//properties 
 	// {{{
-		this.g                    = 0.;
-		this.omega                = 0.;
-		this.yts                  = 0.;
-		this.referencetemperature = 0.;
+		this.g						  = 0.;
+		this.omega					  = 0.;
+		this.yts					  = 0.;
+		this.referencetemperature	  = 0.;
+		this.gravitational_constant   = 0.;
 		this.setdefaultparameters();
 		//}}}
Index: issm/trunk/src/m/classes/constants.m
===================================================================
--- issm/trunk/src/m/classes/constants.m	(revision 25994)
+++ issm/trunk/src/m/classes/constants.m	(revision 26744)
@@ -6,8 +6,9 @@
 classdef constants
 	properties (SetAccess=public) 
-		g                    = 0.;
-		omega                = 0.;
-		yts                  = 0.;
-		referencetemperature = 0.;
+		g                      = 0.;
+		omega                  = 0.;
+		yts                    = 0.;
+		referencetemperature   = 0.;
+		gravitational_constant = 0.;
 	end
 	methods
@@ -33,4 +34,7 @@
 			%the reference temperature for enthalpy model (cf Aschwanden)
 			self.referencetemperature=223.15;
+		
+			%gravitational constant: 
+			self.gravitational_constant = 6.67259e-11;
 
 		end % }}}
@@ -41,4 +45,5 @@
 			md = checkfield(md,'fieldname','constants.yts','>',0,'size',[1 1]);
 			md = checkfield(md,'fieldname','constants.referencetemperature','size',[1 1]);
+			md = checkfield(md,'fieldname','constants.gravitational_constant','size',[1 1]);
 
 		end % }}}
@@ -50,4 +55,5 @@
 			fielddisplay(self,'yts','number of seconds in a year [s/yr]');
 			fielddisplay(self,'referencetemperature','reference temperature used in the enthalpy model [K]');
+			fielddisplay(self,'gravitational_constant','Newtonian constant of gravitation [m^3/kg/s^2]');
 
 		end % }}}
@@ -56,4 +62,5 @@
 			WriteData(fid,prefix,'object',self,'fieldname','yts','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','referencetemperature','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','gravitational_constant','format','Double');
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
@@ -63,4 +70,5 @@
 			writejsdouble(fid,[modelname '.constants.yts'],self.yts);
 			writejsdouble(fid,[modelname '.constants.referencetemperature'],self.referencetemperature);
+			writejsdouble(fid,[modelname '.constants.gravitational_constant'],self.gravitational_constant);
 
 		end % }}}
Index: issm/trunk/src/m/classes/constants.py
===================================================================
--- issm/trunk/src/m/classes/constants.py	(revision 25994)
+++ issm/trunk/src/m/classes/constants.py	(revision 26744)
@@ -1,10 +1,9 @@
+from checkfield import checkfield
 from fielddisplay import fielddisplay
-from checkfield import checkfield
 from WriteData import WriteData
 
 
 class constants(object):
-    """
-    CONSTANTS class definition
+    """CONSTANTS class definition
 
        Usage:
@@ -13,52 +12,53 @@
 
     def __init__(self):  # {{{
-        self.g = 0.
-        self.omega = 0.
-        self.yts = 0.
-        self.referencetemperature = 0.
+        self.g                      = 0.
+        self.omega                  = 0.
+        self.yts                    = 0.
+        self.referencetemperature   = 0.
+        self.gravitational_constant = 0.;
 
-    #set defaults
+        #set defaults
         self.setdefaultparameters()
-
     #}}}
     def __repr__(self):  # {{{
-        string = "   constants parameters:"
-
-        string = "%s\n%s" % (string, fielddisplay(self, "g", "gravitational acceleration [m / s^2]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "omega", "angular velocity of Earth [rad / s]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "yts", "number of seconds in a year [s / yr]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "referencetemperature", "reference temperature used in the enthalpy model [K]"))
-
-        return string
+        s = '   constants parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'g', 'gravitational acceleration [m/s^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'omega', 'angular velocity of Earth [rad/s]'))
+        s += '{}\n'.format(fielddisplay(self, 'yts', 'number of seconds in a year [s/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'referencetemperature', 'reference temperature used in the enthalpy model [K]'))
+        s += '{}\n'.format(fielddisplay(self, 'gravitational_constant', 'Newtonian constant of gravitation [m^3/kg/s^2]'))
+        return s
     #}}}
-
     def setdefaultparameters(self):  # {{{
-        #acceleration due to gravity (m / s^2)
+        # Acceleration due to gravity (m / s^2)
         self.g = 9.81
 
-        #Earth's rotation speed
+        # Earth's rotation speed
         self.omega = 7.292 * 1e-5
 
-        #converstion from year to seconds
-        self.yts = 365. * 24. * 3600.
+        # Converstion from year to seconds
+        self.yts = 365.0 * 24.0 * 3600.0
 
-        #the reference temperature for enthalpy model (cf Aschwanden)
+        # The reference temperature for enthalpy model (cf Aschwanden)
         self.referencetemperature = 223.15
+
+        # Gravitational constant:
+        self.gravitational_constant = 6.67259e-11
 
         return self
     #}}}
-
     def checkconsistency(self, md, solution, analyses):  # {{{
-        md = checkfield(md, 'fieldname', 'constants.g', '>=', 0, 'size', [1])
+        md = checkfield(md, 'fieldname', 'constants.g', '>=', 0, 'size', [1]) # We allow 0 for validation tests
         md = checkfield(md, 'fieldname', 'constants.omega', '>=', 0, 'size', [1])
         md = checkfield(md, 'fieldname', 'constants.yts', '>', 0, 'size', [1])
         md = checkfield(md, 'fieldname', 'constants.referencetemperature', 'size', [1])
+        md = checkfield(md, 'fieldname', 'constants.gravitational_constant','size',[1]);
 
         return md
     # }}}
-
     def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'object', self, 'fieldname', 'g', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'yts', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'referencetemperature', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'gravitational_constant', 'format', 'Double');
     # }}}
Index: issm/trunk/src/m/classes/damage.js
===================================================================
--- issm/trunk/src/m/classes/damage.js	(revision 25994)
+++ issm/trunk/src/m/classes/damage.js	(revision 26744)
@@ -48,5 +48,5 @@
 			fielddisplay(this,'max_damage','maximum possible damage (0<=max_damage<1)');
 
-			fielddisplay(this,'stabilization','0: no, 1: artificial_diffusivity, 2: SUPG (not working), 4: flux corrected transport');
+			fielddisplay(this,'stabilization','0: no stabilization, 1: artificial diffusion, 2: SUPG (not working), 4: flux corrected transport');
 			fielddisplay(this,'maxiter','maximum number of non linear iterations');
 			fielddisplay(this,'elementinterp',"interpolation scheme for finite elements {'P1','P2'}");
Index: issm/trunk/src/m/classes/damage.m
===================================================================
--- issm/trunk/src/m/classes/damage.m	(revision 25994)
+++ issm/trunk/src/m/classes/damage.m	(revision 26744)
@@ -130,5 +130,5 @@
 				fielddisplay(self,'max_damage','maximum possible damage (0<=max_damage<1)');
 				
-				fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: SUPG (not working), 4: flux corrected transport');
+				fielddisplay(self,'stabilization','0: no stabilization, 1: artificial diffusion, 2: SUPG (not working), 4: flux corrected transport');
 				fielddisplay(self,'maxiter','maximum number of non linear iterations');
 				fielddisplay(self,'elementinterp','interpolation scheme for finite elements {''P1'',''P2''}');
Index: issm/trunk/src/m/classes/damage.py
===================================================================
--- issm/trunk/src/m/classes/damage.py	(revision 25994)
+++ issm/trunk/src/m/classes/damage.py	(revision 26744)
@@ -52,5 +52,5 @@
             s += "%s\n" % fielddisplay(self, "spcdamage", "damage constraints (NaN means no constraint)")
             s += "%s\n" % fielddisplay(self, "max_damage", "maximum possible damage (0 <=max_damage < 1)")
-            s += "%s\n" % fielddisplay(self, "stabilization", "0: no, 1: artificial_diffusivity, 2: SUPG (not working), 4: Flux corrected transport")
+            s += "%s\n" % fielddisplay(self, "stabilization", "0: no stabilization, 1: artificial diffusion, 2: SUPG (not working), 4: flux corrected transport")
             s += "%s\n" % fielddisplay(self, "maxiter", "maximum number of non linear iterations")
             s += "%s\n" % fielddisplay(self, "elementinterp", "interpolation scheme for finite elements [''P1'', ''P2'']")
@@ -70,7 +70,8 @@
 
     def extrude(self, md):  # {{{
-        self.D = project3d(md, 'vector', self.D, 'type', 'node')
-        self.spcdamage = project3d(md, 'vector', self.spcdamage, 'type', 'node')
-        return self
+        if self.isdamage:
+            self.D = project3d(md, 'vector', self.D, 'type', 'node')
+            self.spcdamage = project3d(md, 'vector', self.spcdamage, 'type', 'node')
+            return self
     #}}}
 
Index: issm/trunk/src/m/classes/dsl.js
===================================================================
--- issm/trunk/src/m/classes/dsl.js	(revision 25994)
+++ issm/trunk/src/m/classes/dsl.js	(revision 26744)
@@ -1,55 +1,61 @@
-//dsl Class definition
-//
-//   Usage:
-//      dsl=dsl();
+class dsl {//{{{
+	/**
+	 * DSL class definition
+	 *
+	 * Usage:
+	 *     dsl=dsl();
+	 * 
+	 * TODO:
+	 * - Implement from struct constructor (see dsl.m)?
+	 */
+	constructor() {//{{{
+		this.global_average_thermosteric_sea_level; // Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m)
+		this.sea_surface_height_above_geoid; // Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m)
+		this.sea_water_pressure_at_sea_floor; // Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!)
 
-function dsl(){
-	//methods
-	this.setdefaultparameters = function(){// {{{
-		this.requested_outputs=['default'];
-	} // }}}
-	this.disp = function(){ // {{{
-		console.log(sprintf('   dsl parameters:'));
-		fielddisplay(this,'global_average_thermosteric_sea_level_change','corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)');
-		fielddisplay(this,'sea_surface_height_change_above_geoid','corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)');
-		fielddisplay(this,'sea_water_pressure_change_at_sea_floor','corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)');
+		let nargs = arguments.length;
+		if (nargs == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
 
+	setdefaultparameters() {//{{{
+		this.global_average_thermosteric_sea_level = NaN;
+		this.sea_surface_height_above_geoid = NaN;
+		this.sea_water_pressure_at_sea_floor = NaN;
+	} //}}}
 
-	} // }}}
-	this.defaultoutputs = function(){ // {{{
-		return '';
-	}//}}}
-    this.classname = function(){ // {{{
-        return "dsl";
-    } // }}}
-    this.extrude = function(md) {//{{{
-        this.sea_surface_height_change_above_geoid=project3d(md,'vector',this.sea_surface_height_change_above_geoid,'type','node');
-        this.sea_water_pressure_change_at_sea_floor=project3d(md,'vector',this.sea_water_pressure_change_at_sea_floor,'type','node');
-        return this;
-    }//}}}
-    this.checkconsistency = function(md,solution,analyses) { //{{{
+	checkconsistency(md, solution, analyses) {//{{{
+		if (!analyses.includes('SealevelchangeAnalysis') || (solution === 'TransientSolution' && !md.transient.isslc) || !md.transient.isoceantransport) {
+			return md;
+		}
 
-        if(ArrayAnyEqual(ArrayIsMember('SealevelriseAnalysis',analyses),1)){
-            checkfield(md,'fieldname','dsl.sea_surface_height_change_above_geoid','timeseries',1,'NaN',1,'Inf',1);
-            checkfield(md,'fieldname','dsl.sea_water_pressure_change_at_sea_floor','timeseries',1,'NaN',1,'Inf',1);
-        }
+		md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level', 'NaN', 1, 'Inf', 1);
+		md = checkfield(md, 'fieldname', 'dsl.sea_surface_height_above_geoid', 'NaN', 1, 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'NaN', 1, 'Inf', 1, 'timeseries', 1);
 
-    } // }}}
-    this.marshall=function(md,prefix,fid) { //{{{
+		if (md.solidearth.settings.compute_bp_grd) {
+			md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'empty', 1);
+		}
 
-        var yts=md.constants.yts;
+		return md;
+	} //}}}
 
-		WriteData(fid,prefix,'name','md.dsl.model','data',1,'format','Integer');
-		WriteData(fid,prefix,'object',this,'class','dsl','fieldname','global_average_thermosteric_sea_level_change','format','DoubleMat','mattype',1,'timeserieslength',1+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
-			WriteData(fid,prefix,'object',this,'class','dsl','fieldname','sea_water_pressure_change_at_sea_floor','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
-			WriteData(fid,prefix,'object',this,'class',dsl,'fieldname','sea_surface_height_change_above_geoid','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-    }//}}}
-    this.fix=function() { //{{{
-    }//}}}
-	//properties 
-    // {{{
-	this.global_average_thermosteric_sea_level_change = NaN;
-	this.sea_surface_height_change_above_geoid = NaN;
-	this.sea_water_pressure_change_at_sea_floor = NaN;
-    // }}}
-}
+	disp() {//{{{
+		console.log('WARNING: dsl::disp is not yet implemented');
+	} //}}}
+
+	marshall(md, prefix, fid) {//{{{
+		WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 1, 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'timeserieslength', 2, 'yts', md.constants.yts); // mattype 2, because we are sending a GMSL value identical everywhere on each element
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts); // mattype 1 because we specify DSL at vertex locations
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts); // mattype 1 because we specify bottom pressure at vertex locations
+	} //}}}
+
+	extrude(md) {//{{{
+		this.sea_surface_height_above_geoid = project3d(md, 'vector', this.sea_surface_height_above_geoid, 'type', 'node', 'layer', 1);
+		this.sea_water_pressure_at_sea_floor = project3d(md, 'vector', this.sea_water_pressure_at_sea_floor, 'type', 'node', 'layer', 1);
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/dsl.m
===================================================================
--- issm/trunk/src/m/classes/dsl.m	(revision 25994)
+++ issm/trunk/src/m/classes/dsl.m	(revision 26744)
@@ -7,15 +7,10 @@
 	properties (SetAccess=public) 
 
-		global_average_thermosteric_sea_level_change; %corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)
-		sea_surface_height_change_above_geoid; %corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)
-		sea_water_pressure_change_at_sea_floor; %corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr equivalent, not in Pa/yr!) for each ensemble
-		compute_fingerprints; %do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid
+		global_average_thermosteric_sea_level; %Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).
+		sea_surface_height_above_geoid; %Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).
+		sea_water_pressure_at_sea_floor; %Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).
 
 	end
 	methods
-		function self = extrude(self,md) % {{{
-			self.sea_surface_height_change_above_geoid=project3d(md,'vector',self.sea_surface_height_change_above_geoid,'type','node','layer',1);
-			self.sea_water_pressure_change_at_sea_floor=project3d(md,'vector',self.sea_water_pressure_change_at_sea_floor,'type','node','layer',1);
-		end % }}}
 		function self = dsl(varargin) % {{{
 			switch nargin
@@ -30,8 +25,15 @@
 		function self = setdefaultparameters(self) % {{{
 
-			self.global_average_thermosteric_sea_level_change=0;
-			self.sea_surface_height_change_above_geoid=NaN;
-			self.sea_water_pressure_change_at_sea_floor=NaN;
-			self.compute_fingerprints=0;
+			self.global_average_thermosteric_sea_level=NaN;
+			self.sea_surface_height_above_geoid=NaN;
+			self.sea_water_pressure_at_sea_floor=NaN;
+
+		end % }}}
+		function disp(self) % {{{
+
+			disp(sprintf('   dsl parameters:'));
+			fielddisplay(self,'global_average_thermosteric_sea_level','Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).');
+			fielddisplay(self,'sea_surface_height_above_geoid','Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).');
+			fielddisplay(self,'sea_water_pressure_at_sea_floor','Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).');
 
 		end % }}}
@@ -39,42 +41,48 @@
 
 			%Early return
-			if ~ismember('SealevelriseAnalysis',analyses), return; end
-			if (strcmp(solution,'TransientSolution') & md.transient.isslr == 0), return; end
-			md = checkfield(md,'fieldname','dsl.global_average_thermosteric_sea_level_change','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','dsl.sea_surface_height_change_above_geoid','NaN',1,'Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','dsl.sea_water_pressure_change_at_sea_floor','NaN',1,'Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','dsl.compute_fingerprints','NaN',1,'Inf',1,'values',[0,1]);
-			if self.compute_fingerprints,
-				%check geodetic flag of slr is on: 
-				if md.slr.geodetic==0,
-					error('DSL checkconsistency error message: if bottom pressure fingerprints computations are requested, slr class should have geodetic flag on');
-				end
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc == 0) | (md.transient.isoceantransport==0),
+				return;
 			end
+			md = checkfield(md,'fieldname','dsl.global_average_thermosteric_sea_level','NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','dsl.sea_surface_height_above_geoid','NaN',1,'Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','dsl.sea_water_pressure_at_sea_floor','NaN',1,'Inf',1,'timeseries',1);
+			
+			if md.solidearth.settings.compute_bp_grd==1, 
+				md = checkfield(md,'fieldname','dsl.sea_water_pressure_at_sea_floor','empty',1);
+			end
+			
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			yts=md.constants.yts;
+			WriteData(fid,prefix,'name','md.dsl.model','data',1,'format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','global_average_thermosteric_sea_level','format','DoubleMat','mattype',2,'timeseries',1,'timeserieslength',2,'yts',yts); %mattype 2, because we are sending a GMSL value identical everywhere on each element. 
+			WriteData(fid,prefix,'object',self,'fieldname','sea_surface_height_above_geoid','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts); %mattype 1 because we specify DSL at vertex locations.
+			WriteData(fid,prefix,'object',self,'fieldname','sea_water_pressure_at_sea_floor','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts); %mattype 1 because we specify bottom pressure at vertex locations.
 
 		end % }}}
-		function disp(self) % {{{
+		function self = extrude(self,md) % {{{
+			self.sea_surface_height_above_geoid=project3d(md,'vector',self.sea_surface_height_above_geoid,'type','node','layer',1);
+			self.sea_water_pressure_at_sea_floor=project3d(md,'vector',self.sea_water_pressure_at_sea_floor,'type','node','layer',1);
+		end % }}}
+		function self = initialize(self,md) % {{{
 
-			disp(sprintf('   dsl parameters:'));
-			fielddisplay(self,'global_average_thermosteric_sea_level_change','corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)');
-			fielddisplay(self,'sea_surface_height_change_above_geoid','corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)');
-			fielddisplay(self,'sea_water_pressure_change_at_sea_floor','corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)');
-			fielddisplay(self,'compute_fingerprints','%do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid');
-
-		end % }}}
-		function marshall(self,prefix,md,fid) % {{{
-
-			WriteData(fid,prefix,'name','md.dsl.model','data',1,'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','compute_fingerprints','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','global_average_thermosteric_sea_level_change','format','DoubleMat','mattype',1,'timeseries',1,'timeserieslength',2,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','sea_water_pressure_change_at_sea_floor','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','sea_surface_height_change_above_geoid','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-
+			if isnan(self.global_average_thermosteric_sea_level)
+				self.global_average_thermosteric_sea_level=[0;0];
+				disp('      no dsl.global_average_thermosteric_sea_level specified: transient values set at zero');
+			end
+			if isnan(self.sea_surface_height_above_geoid)
+				self.sea_surface_height_above_geoid=[zeros(md.mesh.numberofvertices,1);0];
+				disp('      no dsl.sea_surface_height_above_geoid specified: transient values set at zero');
+			end
+			if isnan(self.sea_water_pressure_at_sea_floor)
+				self.sea_water_pressure_at_sea_floor=[zeros(md.mesh.numberofvertices,1);0];
+				disp('      no dsl.sea_water_pressure_at_sea_floor specified: transient values set at zero');
+			end
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
-		
-			writejs1Darray(fid,[modelname '.dsl.global_average_thermosteric_sea_level_change'],self.global_average_thermosteric_sea_level_change);
-			writejs1Darray(fid,[modelname '.dsl.compute_fingerprints'],self.compute_fingerprints);
-			writejs1Darray(fid,[modelname '.dsl.sea_surface_height_change_above_geoid'],self.sea_surface_height_change_above_geoid);
-			writejs1Darray(fid,[modelname '.dsl.sea_water_pressure_change_at_sea_floor'],self.sea_water_pressure_change_at_sea_floor);
+
+			writejs1Darray(fid,[modelname '.dsl.global_average_thermosteric_sea_level'],self.global_average_thermosteric_sea_level);
+			writejs1Darray(fid,[modelname '.dsl.sea_surface_height_above_geoid'],self.sea_surface_height_above_geoid);
+			writejs1Darray(fid,[modelname '.dsl.sea_water_pressure_at_sea_floor'],self.sea_water_pressure_at_sea_floor);
 
 		end % }}}
Index: issm/trunk/src/m/classes/dsl.py
===================================================================
--- issm/trunk/src/m/classes/dsl.py	(revision 25994)
+++ issm/trunk/src/m/classes/dsl.py	(revision 26744)
@@ -8,50 +8,46 @@
 
 class dsl(object):
-    """DSL - slass definition
+    """DSL - class definition
 
     Usage:
-        dsl = dsl()
+        dsl = dsl() # dynamic sea level class, based on CMIP5 outputs
     """
 
-    def __init__(self): #{{{
-        self.global_average_thermosteric_sea_level_change = 0 #corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)
-        self.sea_surface_height_change_above_geoid = float('NaN') #corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)
-        self.sea_water_pressure_change_at_sea_floor = float('NaN') #corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)
-        self.compute_fingerprints = 0; #do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid
+    def __init__(self, *args):  #{{{
+        self.global_average_thermosteric_sea_level = np.nan  # Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).
+        self.sea_surface_height_above_geoid = np.nan  # Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).
+        self.sea_water_pressure_at_sea_floor = np.nan  #  Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise Exception('constructor not supported')
     #}}}
 
-    def __repr__(self): #{{{
+    def __repr__(self):  #{{{
         s = '   dsl parameters:\n'
-        s += '{}\n'.format(fielddisplay(self, 'global_average_thermosteric_sea_level_change', 'corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)'))
-        s += '{}\n'.format(fielddisplay(self, 'sea_surface_height_change_above_geoid', 'corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)'))
-        s += '{}\n'.format(fielddisplay(self, 'sea_water_pressure_change_at_sea_floor', 'corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)'))
-        s += '{}\n'.format(fielddisplay(self, 'compute_fingerprints', 'do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid'))
+        s += '{}\n'.format(fielddisplay(self, 'global_average_thermosteric_sea_level', 'Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m).'))
+        s += '{}\n'.format(fielddisplay(self, 'sea_surface_height_above_geoid', 'Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m).'))
+        s += '{}\n'.format(fielddisplay(self, 'sea_water_pressure_at_sea_floor', 'Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!).'))
         return s
     #}}}
 
-    def extrude(self, md): #{{{
-        self.sea_surface_height_change_above_geoid = project3d(md, 'vector', self.sea_surface_height_change_above_geoid, 'type', 'node')
-        self.sea_water_pressure_change_at_sea_floor = project3d(md, 'vector', self.sea_water_pressure_change_at_sea_floor, 'type', 'node')
-        return self
+    def setdefaultparameters(self):  #{{{
+        self.global_average_thermosteric_sea_level = np.nan
+        self.sea_surface_height_above_geoid = np.nan
+        self.sea_water_pressure_at_sea_floor = np.nan
     #}}}
 
-    def defaultoutputs(self, md): #{{{
-        return []
-    #}}}
+    def checkconsistency(self, md, solution, analyses):  #{{{
+        # Early return
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or (not md.transient.isoceantransport):
+            return md
+        md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level', 'NaN', 1, 'Inf', 1)
+        md = checkfield(md, 'fieldname', 'dsl.sea_surface_height_above_geoid', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
 
-    def checkconsistency(self, md, solution, analyses): #{{{
-        # Early return
-        if 'SealevelriseAnalysis' not in analyses:
-            return md
-        if solution == 'TransientSolution' and md.transient.isslr == 0:
-            return md
-        md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level_change', 'NaN', 1, 'Inf', 1)
-        md = checkfield(md, 'fieldname', 'dsl.sea_surface_height_change_above_geoid', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
-        md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_change_at_sea_floor', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
-        md = checkfield(md, 'fieldname', 'dsl.compute_fingerprints', 'NaN', 1, 'Inf', 1, 'values', [0, 1])
-        if self.compute_fingerprints:
-            # Check if geodetic flag of slr is on
-            if not md.slr.geodetic:
-                raise RuntimeError('DSL checkconsistency error message: if bottom pressure fingerprints computations are requested, slr class should have geodetic flag on')
+        if md.solidearth.settings.compute_bp_grd:
+            md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'empty', 1)
+
         return md
     # }}}
@@ -60,7 +56,26 @@
         yts = md.constants.yts
         WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 1, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'class', 'dsl', 'fieldname', 'compute_fingerprints', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'class', 'dsl', 'fieldname', 'global_average_thermosteric_sea_level_change', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', 1+1, 'yts', md.constants.yts, 'scale', 1e-3/md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'dsl', 'fieldname', 'sea_water_pressure_change_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices+1, 'yts', md.constants.yts, 'scale', 1e-3/md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'class', 'dsl', 'fieldname', 'sea_surface_height_change_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices+1, 'yts', md.constants.yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'timeserieslength', 2, 'yts', yts) # mattype 2, because we are sending a GMSL value identical everywhere on each element.
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)  # mattype 1 because we specify DSL at vertex locations.
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)  # mattype 1 because we specify bottom pressure at vertex locations.
     # }}}
+
+    def extrude(self, md):  #{{{
+        self.sea_surface_height_above_geoid = project3d(md, 'vector', self.sea_surface_height_above_geoid, 'type', 'node', 'layer', 1)
+        self.sea_water_pressure_at_sea_floor = project3d(md, 'vector', self.sea_water_pressure_at_sea_floor, 'type', 'node', 'layer', 1)
+        return self
+    #}}}
+
+    def initialize(self, md):  #{{{
+        if np.isnan(self.global_average_thermosteric_sea_level):
+            self.global_average_thermosteric_sea_level = np.array([0, 0]).reshape(-1, 1)
+            print('      no dsl.global_average_thermosteric_sea_level specified: transient values set at zero')
+
+        if np.isnan(self.sea_surface_height_above_geoid):
+            self.sea_surface_height_above_geoid = np.append(np.zeros((md.mesh.numberofvertices, 1)), 0).reshape(-1, 1)
+            print('      no dsl.sea_surface_height_above_geoid specified: transient values set at zero')
+
+        if np.isnan(self.sea_water_pressure_at_sea_floor):
+            self.sea_water_pressure_at_sea_floor = np.append(np.zeros((md.mesh.numberofvertices, 1)), 0).reshape(-1, 1)
+            print('      no dsl.sea_water_pressure_at_sea_floor specified: transient values set at zero')
+    #}}}
Index: issm/trunk/src/m/classes/dslmme.m
===================================================================
--- issm/trunk/src/m/classes/dslmme.m	(revision 25994)
+++ issm/trunk/src/m/classes/dslmme.m	(revision 26744)
@@ -8,8 +8,7 @@
 
 		modelid; %index into the multi-model ensemble, determine which field will be used.
-		global_average_thermosteric_sea_level_change; %corresponds to zostoga fields in CMIP5 archives. Specified as a temporally variable global rate (mm/yr) for each ensemble.
-		sea_surface_height_change_above_geoid; %corresponds to zos fields in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) for each ensemble
-		sea_water_pressure_change_at_sea_floor; %corresponds to bpo fields in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr equivalent, not in Pa/yr!) for each ensemble
-		compute_fingerprints; %do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid
+		global_average_thermosteric_sea_level; %Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m) for each ensemble.
+		sea_surface_height_above_geoid; %Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m) for each ensemble.
+		sea_water_pressure_at_sea_floor; %Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!) for each ensemble.
 
 	end
@@ -28,8 +27,7 @@
 
 			self.modelid=0;
-			self.global_average_thermosteric_sea_level_change={};
-			self.sea_surface_height_change_above_geoid={};
-			self.sea_water_pressure_change_at_sea_floor={};
-			self.compute_fingerprints=0;
+			self.global_average_thermosteric_sea_level={};
+			self.sea_surface_height_above_geoid={};
+			self.sea_water_pressure_at_sea_floor={};
 
 		end % }}}
@@ -37,19 +35,17 @@
 
 			%Early return
-			if ~ismember('SealevelriseAnalysis',analyses), return; end
-			if (strcmp(solution,'TransientSolution') & md.transient.isslr == 0), return; end
-			for i=1:length(self.global_average_thermosteric_sea_level_change),
-				md = checkfield(md,'field',self.global_average_thermosteric_sea_level_change{i},'NaN',1,'Inf',1);
-				md = checkfield(md,'field',self.sea_surface_height_change_above_geoid{i},'NaN',1,'Inf',1,'timeseries',1);
-				md = checkfield(md,'field',self.sea_water_pressure_change_at_sea_floor{i},'NaN',1,'Inf',1,'timeseries',1);
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc == 0) | (md.transient.isoceantransport==0),
+				return;
 			end
-			md = checkfield(md,'field',self.modelid,'NaN',1,'Inf',1,'>=',1,'<=',length(self.global_average_thermosteric_sea_level_change));
-			if self.compute_fingerprints,
-				%check geodetic flag of slr is on: 
-				if md.solidearth.settings.computesealevelchange==0,
-					error('DSL checkconsistency error message: if bottom pressure fingerprints computations are requested, slr class should have geodetic flag on');
-				end
+			for i=1:length(self.global_average_thermosteric_sea_level),
+				md = checkfield(md,'field',self.global_average_thermosteric_sea_level{i},'NaN',1,'Inf',1);
+				md = checkfield(md,'field',self.sea_surface_height_above_geoid{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.sea_water_pressure_at_sea_floor{i},'NaN',1,'Inf',1,'timeseries',1);
 			end
+			md = checkfield(md,'field',self.modelid,'NaN',1,'Inf',1,'>=',1,'<=',length(self.global_average_thermosteric_sea_level));
 
+			if md.solidearth.settings.compute_bp_grd==1, 
+				md = checkfield(md,'fieldname','dsl.sea_water_pressure_at_sea_floor','empty',1);
+			end
 
 		end % }}}
@@ -58,24 +54,22 @@
 			disp(sprintf('   dsl mme parameters:'));
 			fielddisplay(self,'modelid','index into the multi-model ensemble, determine which field will be used.');
-			fielddisplay(self,'global_average_thermosteric_sea_level_change','corresponds to zostoga fields in CMIP5 archives. Specified as a temporally variable global rate (mm/yr) for each ensemble.');
-			fielddisplay(self,'sea_surface_height_change_above_geoid','corresponds to zos fields in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) for each ensemble.');
-			fielddisplay(self,'sea_water_pressure_change_at_sea_floor','corresponds to bpo fields in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr) for each ensemble.');
-			fielddisplay(self,'compute_fingerprints','%do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid');
+			fielddisplay(self,'global_average_thermosteric_sea_level','Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m) for each ensemble.');
+			fielddisplay(self,'sea_surface_height_above_geoid','Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m) for each ensemble.');
+			fielddisplay(self,'sea_water_pressure_at_sea_floor','Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!) for each ensemble.');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
 
 			WriteData(fid,prefix,'name','md.dsl.model','data',2,'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','compute_fingerprints','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','modelid','format','Double');
-			WriteData(fid,prefix,'name','md.dsl.nummodels','data',length(self.global_average_thermosteric_sea_level_change),'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','global_average_thermosteric_sea_level_change','format','MatArray','timeseries',1,'timeserieslength',2,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','sea_water_pressure_change_at_sea_floor','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3);
-			WriteData(fid,prefix,'object',self,'fieldname','sea_surface_height_change_above_geoid','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
+			WriteData(fid,prefix,'name','md.dsl.nummodels','data',length(self.global_average_thermosteric_sea_level),'format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','global_average_thermosteric_sea_level','format','MatArray','timeseries',1,'timeserieslength',2);
+			WriteData(fid,prefix,'object',self,'fieldname','sea_water_pressure_at_sea_floor','format','MatArray','timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,prefix,'object',self,'fieldname','sea_surface_height_above_geoid','format','MatArray','timeserieslength',md.mesh.numberofvertices+1);
 
 		end % }}}
 		function self = extrude(self,md) % {{{
-			for i=1:length(self.global_average_thermosteric_sea_level_change),
-				self.sea_surface_height_change_above_geoid{i}=project3d(md,'vector',self.sea_surface_height_change_above_geoid{i},'type','node','layer',1);
-				self.sea_water_pressure_change_at_sea_floor{i}=project3d(md,'vector',self.sea_water_pressure_change_at_sea_floor{i},'type','node','layer',1);
+			for i=1:length(self.global_average_thermosteric_sea_level),
+				self.sea_surface_height_above_geoid{i}=project3d(md,'vector',self.sea_surface_height_above_geoid{i},'type','node','layer',1);
+				self.sea_water_pressure_at_sea_floor{i}=project3d(md,'vector',self.sea_water_pressure_at_sea_floor{i},'type','node','layer',1);
 			end
 		end % }}}
@@ -83,8 +77,8 @@
 			
 			writejsdouble(fid,[modelname '.dsl.modelid'],self.modelid);
-			writejscellarray(fid,[modelname '.dsl.global_average_thermosteric_sea_level_change'],self.global_average_thermosteric_sea_level_change);
-			writejscellarray(fid,[modelname '.dsl.sea_surface_height_change_above_geoid'],self.sea_surface_height_change_above_geoid);
+			writejscellarray(fid,[modelname '.dsl.global_average_thermosteric_sea_level'],self.global_average_thermosteric_sea_level);
+			writejscellarray(fid,[modelname '.dsl.sea_surface_height_above_geoid'],self.sea_surface_height_above_geoid);
 			writejs1Darray(fid,[modelname '.dsl.compute_fingerprints'],self.compute_fingerprints);
-			writejscellarray(fid,[modelname '.dsl.sea_water_pressure_change_at_sea_floor'],self.sea_water_pressure_change_at_sea_floor);
+			writejscellarray(fid,[modelname '.dsl.sea_water_pressure_at_sea_floor'],self.sea_water_pressure_at_sea_floor);
 
 		end % }}}
Index: issm/trunk/src/m/classes/dslmme.py
===================================================================
--- issm/trunk/src/m/classes/dslmme.py	(revision 25994)
+++ issm/trunk/src/m/classes/dslmme.py	(revision 26744)
@@ -1,4 +1,2 @@
-import numpy as np
-
 from checkfield import checkfield
 from fielddisplay import fielddisplay
@@ -14,14 +12,13 @@
     """
 
-    def __init__(self, *args): #{{{
-        self.modelid                                        = 0 #index into the multi-model ensemble
-        self.global_average_thermosteric_sea_level_change   = [] #corresponds to zostoga fields in CMIP5 archives. Specified as a temporally variable global rate (mm/yr) for each ensemble.
-        self.sea_surface_height_change_above_geoid          = [] #corresponds to zos fields in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) for each ensemble
-        self.sea_water_pressure_change_at_sea_floor         = [] #corresponds to bpo fields in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr equivalent, not in Pa/yr!) for each ensemble
-        self.compute_fingerprints                           = 0 #corresponds to zos fields in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) for each ensemble
-        
-        nargin = len(args)
+    def __init__(self, *args):  #{{{
+        self.modelid = 0  # Index into the multi-model ensemble, determine which field will be used
+        self.global_average_thermosteric_sea_level = [] # Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m) for each ensemble.
+        self.sea_surface_height_above_geoid = [] # Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m) for each ensemble.
+        self.sea_water_pressure_at_sea_floor = [] #Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!) for each ensemble.
 
-        if nargin == 0:
+        nargs = len(args)
+
+        if nargs == 0:
             self.setdefaultparameters()
         else:
@@ -29,47 +26,47 @@
     #}}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  # {{{
         s = '   dsl mme parameters:\n'
         s += '{}\n'.format(fielddisplay(self, 'modelid', 'index into the multi-model ensemble, determines which field will be used.'))
-        s += '{}\n'.format(fielddisplay(self, 'global_average_thermosteric_sea_level_change', 'corresponds to zostoga fields in CMIP5 archives. Specified as a temporally variable global rate (mm/yr) for each ensemble.'))
-        s += '{}\n'.format(fielddisplay(self, 'sea_surface_height_change_above_geoid', 'corresponds to zos fields in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr) for each ensemble.'))
-        s += '{}\n'.format(fielddisplay(self, 'sea_water_pressure_change_at_sea_floor', 'corresponds to bpo fields in CMIP5 archives. Specified as a spatio-temporally variable rate (in mm/yr) for each ensemble.'))
-        s += '{}\n'.format(fielddisplay(self, 'compute_fingerprints', 'do we use the sea water pressure change to compute fingerprints and correct sea_surface_height_change_above_geoid'))
+        s += '{}\n'.format(fielddisplay(self, 'global_average_thermosteric_sea_level', 'Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m) for each ensemble.'))
+        s += '{}\n'.format(fielddisplay(self, 'sea_surface_height_above_geoid', 'Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m) for each ensemble.'))
+        s += '{}\n'.format(fielddisplay(self, 'sea_water_pressure_at_sea_floor', 'Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!) for each ensemble.'))
         return s
     #}}}
 
-    def setdefaultparameters(self): #{{{
+    def setdefaultparameters(self):  #{{{
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Early return
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or (not md.transient.isoceantransport):
             return md
-        for i in range(len(self.global_average_thermosteric_sea_level_change)):
-            md = checkfield(md, 'field', self.global_average_thermosteric_sea_level_change[i], 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'field', self.sea_surface_height_change_above_geoid[i], 'NaN', 1, 'Inf', 1, 'timeseries', 1)
-            md = checkfield(md, 'field', self.sea_water_pressure_change_at_sea_floor[i], 'NaN', 1, 'Inf', 1, 'timeseries', 1)
-        md = checkfield(md, 'field', self.modelid, 'NaN', 1, 'Inf', 1, '>=', 1, '<=',len(self.global_average_thermosteric_sea_level_change))
-        if self.compute_fingerprints:
-            #check geodetic flag of slr is on
-            if not md.solidearth.settings.computesealevelchange:
-                raise Exception('DSL checkconsistency error message: if bottom pressure fingerprints computations are requested, slr class should have geodetic flag on')
+
+        for i in range(len(self.global_average_thermosteric_sea_level)):
+            md = checkfield(md, 'field', self.global_average_thermosteric_sea_level[i], 'NaN', 1, 'Inf', 1)
+            md = checkfield(md, 'field', self.sea_surface_height_above_geoid[i], 'NaN', 1, 'Inf', 1, 'timeseries', 1)
+            md = checkfield(md, 'field', self.sea_water_pressure_at_sea_floor[i], 'NaN', 1, 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'field', self.modelid, 'NaN', 1, 'Inf', 1, '>=', 1, '<=', len(self.global_average_thermosteric_sea_level))
+
+        if self.solidearth.settings.compute_bp_grd:
+            md = checkfield(md, 'field', self.sea_water_pressure_at_sea_floor, 'empty', 1)
+
         return md
     #}}}
 
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  #{{{
         WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 2, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'compute_fingerprints', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'modelid', 'format', 'Double')
-        WriteData(fid, prefix, 'name', 'md.dsl.nummodels', 'data', len(self.global_average_thermosteric_sea_level_change), 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level_change', 'format', 'MatArray', 'timeseries', 1, 'timeserieslength', 2, 'yts', md.constants.yts, 'scale', 1e-3 / md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_change_at_sea_floor', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts, 'scale', 1e-3)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_change_above_geoid', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts, 'scale', 1e-3 / md.constants.yts)
+        WriteData(fid, prefix, 'name', 'md.dsl.nummodels', 'data', len(self.global_average_thermosteric_sea_level), 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'MatArray', 'timeseries', 1, 'timeserieslength', 2)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1)
     #}}}
 
-    def extrude(self, md): #{{{
-        for i in range(len(self.global_average_thermosteric_sea_level_change)):
-            self.sea_surface_height_change_above_geoid[i] = project3d(md, 'vector', self.self.sea_surface_height_change_above_geoid[i], 'type', 'node', 'layer', 1)
-            self.sea_water_pressure_change_at_sea_floor[i] = project3d(md, 'vector', self.sea_water_pressure_change_at_sea_floor[i], 'type', 'node', 'layer', 1)
+    def extrude(self, md):  #{{{
+        for i in range(len(self.global_average_thermosteric_sea_level)):
+            self.sea_surface_height_above_geoid[i] = project3d(md, 'vector', self.self.sea_surface_height_above_geoid[i], 'type', 'node', 'layer', 1)
+            self.sea_water_pressure_at_sea_floor[i] = project3d(md, 'vector', self.sea_water_pressure_at_sea_floor[i], 'type', 'node', 'layer', 1)
 
         return self
Index: issm/trunk/src/m/classes/flowequation.js
===================================================================
--- issm/trunk/src/m/classes/flowequation.js	(revision 25994)
+++ issm/trunk/src/m/classes/flowequation.js	(revision 26744)
@@ -22,7 +22,9 @@
 		fielddisplay(this,'isSSA','is the Shelfy-Stream Approximation (SSA) used ?');
 		fielddisplay(this,'isL1L2','is the L1L2 approximation used ?');
-		fielddisplay(this,'isMLHO','is the MLHO approximation used ?');
+		fielddisplay(this,'isMLHO','is the Mono-Layer Higher-Order approximation used?');
 		fielddisplay(this,'isHO','is the Higher-Order (HO) approximation used ?');
 		fielddisplay(this,'isFS','are the Full-FS (FS) equations used ?');
+		fielddisplay(this,'isNitscheBC','is weakly imposed condition used?');
+		fielddisplay(this,'FSNitscheGamma','Gamma value for the Nitsche term (default: 1e6)');
 		fielddisplay(this,'fe_SSA',"Finite Element for SSA  'P1', 'P1bubble' 'P1bubblecondensed' 'P2'");
 		fielddisplay(this,'fe_HO', "Finite Element for HO   'P1' 'P1bubble' 'P1bubblecondensed' 'P1xP2' 'P2xP1' 'P2'");
@@ -60,4 +62,6 @@
 			checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0, 1]);
 			checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','flowequation.isNitscheBC','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','flowequation.FSNitscheGamma','numel',[1], '>=', 0);
 			checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2','P2bubble']);
 			checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P2bubble','P1xP3','P2xP4']);
@@ -80,19 +84,19 @@
 			}
 			else if (md.mesh.domaintype() =='2Dvertical'){
-				checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[2,5,6]);
-				checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[2,5,6]);
+				checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[2,4,5]);
+				checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[2,4,5]);
 			}
 			else if (md.mesh.domaintype() =='3D'){
-				checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[0,1,2,3,4,5,6,7,8,9]);
-				checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[0,1,2,3,4,5,6,7,8,9]);
+				checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[0,1,2,3,4,5,6,7,8]);
+				checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[0,1,2,3,4,5,6,7,8]);
 			}
 			else throw Error('Case not supported yet');
 			
 			if (!(this.isSIA | this.isSSA | this.isL1L2 | this.isMLHO | this.isHO | this.isFS)){
-				md = checkmessage(md,['no element types set for this model']);
+				checkmessage(md,['no element types set for this model']);
 			}
 			if(ArrayAnyEqual(ArrayIsMember('StressbalanceSIAAnalysis', analyses),1)){
 				if (ArrayAnyEqual(this.element_equation,1)){
-					if(this.vertex_equation & ArrayAnyBelowStrict(md.mask.ocean_levelset)){
+					if(this.vertex_equation & ArrayAnyBelowStrict(md.mask.groundedice_levelset)){
 						console.log(sprintf("\n !!! Warning: SIA's model is not consistent on ice shelves !!!\n"));
 					}
@@ -107,4 +111,6 @@
 			WriteData(fid,prefix,'object',this,'fieldname','isHO','format','Boolean');
 			WriteData(fid,prefix,'object',this,'fieldname','isFS','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isNitscheBC','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','FSNitscheGamma','format','Double');
 			WriteData(fid,prefix,'object',this,'fieldname','fe_SSA','data',this.fe_SSA,'format','String');
 			WriteData(fid,prefix,'object',this,'fieldname','fe_HO','data',this.fe_HO,'format','String');
@@ -135,4 +141,6 @@
 	this.isHO                           = 0;
 	this.isFS                           = 0;
+	this.isNitscheBC                    = 0;
+	this.FSNitscheGamma                 = 1e6;
 	this.fe_SSA                         = '';
 	this.fe_HO                          = '';
Index: issm/trunk/src/m/classes/flowequation.m
===================================================================
--- issm/trunk/src/m/classes/flowequation.m	(revision 25994)
+++ issm/trunk/src/m/classes/flowequation.m	(revision 26744)
@@ -62,8 +62,7 @@
 			end
 
-			%Oct 8 2020
-			%Warning if MLHO
+			%Nov 6 2021
 			if any(self.vertex_equation==4)
-				warning(['Monolayer Higher-Order (MLHO) detected in md.flowequation, this is probably a mistake, you need to run setflowequation again']);
+				disp(['Monolayer Higher-Order (MLHO) detected in md.flowequation, this is still under development. Please double check your settings.']);
 			end
 
@@ -122,6 +121,6 @@
 			md = checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 			if strcmp(domaintype(md.mesh),'2Dhorizontal')
-				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
-				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1,2,4]);
+				md = checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1,2,4]);
 			elseif strcmp(domaintype(md.mesh),'3Dsurface')
 				md = checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
Index: issm/trunk/src/m/classes/flowequation.py
===================================================================
--- issm/trunk/src/m/classes/flowequation.py	(revision 25994)
+++ issm/trunk/src/m/classes/flowequation.py	(revision 26744)
@@ -27,9 +27,9 @@
         self.fe_HO = ''
         self.fe_FS = ''
-        self.augmented_lagrangian_r = 1.
-        self.augmented_lagrangian_rhop = 1.
-        self.augmented_lagrangian_rlambda = 1.
-        self.augmented_lagrangian_rholambda = 1.
-        self.XTH_theta = 0.
+        self.augmented_lagrangian_r = 1
+        self.augmented_lagrangian_rhop = 1
+        self.augmented_lagrangian_rlambda = 1
+        self.augmented_lagrangian_rholambda = 1
+        self.XTH_theta = 0
         self.vertex_equation = np.nan
         self.element_equation = np.nan
@@ -107,6 +107,9 @@
         md = checkfield(md, 'fieldname', 'flowequation.XTH_theta', 'numel', [1], '>=', 0., '<', .5)
         if m.strcmp(md.mesh.domaintype(), '2Dhorizontal'):
-            md = checkfield(md, 'fieldname', 'flowequation.vertex_equation', 'size', [md.mesh.numberofvertices], 'values', [1, 2])
-            md = checkfield(md, 'fieldname', 'flowequation.element_equation', 'size', [md.mesh.numberofelements], 'values', [1, 2])
+            md = checkfield(md, 'fieldname', 'flowequation.vertex_equation', 'size', [md.mesh.numberofvertices], 'values', [1, 2, 4])
+            md = checkfield(md, 'fieldname', 'flowequation.element_equation', 'size', [md.mesh.numberofelements], 'values', [1, 2, 4])
+        elif m.strcmp(md.mesh.domaintype(), '3Dsurface'):
+            md = checkfield(md, 'fieldname', 'flowequation.vertex_equation', 'size', [md.mesh.numberofvertices], 'values', np.arange(1, 2 + 1))
+            md = checkfield(md, 'fieldname', 'flowequation.element_equation', 'size', [md.mesh.numberofelements], 'values', np.arange(1, 2 + 1))
         elif m.strcmp(md.mesh.domaintype(), '2Dvertical'):
             md = checkfield(md, 'fieldname', 'flowequation.vertex_equation', 'size', [md.mesh.numberofvertices], 'values', [2, 5, 6])
@@ -117,4 +120,5 @@
         else:
             raise RuntimeError('Case not supported yet')
+
         if not (self.isSIA or self.isSSA or self.isL1L2 or self.isMLHO or self.isHO or self.isFS):
             md.checkmessage("no element types set for this model")
Index: issm/trunk/src/m/classes/fourierlove.js
===================================================================
--- issm/trunk/src/m/classes/fourierlove.js	(revision 25994)
+++ issm/trunk/src/m/classes/fourierlove.js	(revision 26744)
@@ -11,14 +11,24 @@
 	this.setdefaultparameters = function() { // {{{
 		//we setup an elastic love number computation by default.
-		this.nfreq=1; 
-		this.frequencies=[0]; //Hz
-		this.sh_nmax=256; // .35 degree, 40 km at the equator.
-		this.sh_nmin=1; 
-		this.g0=10; // m/s^2; 
-		this.r0=6378*1e3; //m;
-		this.mu0=10**11; // Pa
-		this.allow_layer_deletion=1; 
-		this.love_kernels=0; 
-		this.forcing_type = 11; 
+			this.nfreq=1; 
+			this.frequencies=[0]; //Hz
+			this.sh_nmax=256; // .35 degree, 40 km at the equator.
+			this.sh_nmin=1;
+			// work on matlab script for computing g0 for given Earth's structure. 
+			this.g0=9.81; // m/s^2; 
+			this.r0=6371*1e3; //m;
+			this.mu0=1e11; // Pa
+			this.Gravitational_Constant=6.67259e-11; // m^3 kg^-1 s^-2
+			this.allow_layer_deletion=1;
+			this.underflow_tol=1e-16; //threshold of deep to surface love number ratio to trigger the deletion of layer 
+			this.integration_steps_per_layer=100;
+			this.istemporal=0;
+			this.n_temporal_iterations=8;
+			this.time=[0]; //s
+			this.love_kernels=0; 
+			this.forcing_type = 11; // surface loading
+			this.inner_core_boundary=1;
+			this.core_mantle_boundary=2;
+			this.complex_computation=0;
 	} // }}}
 	this.disp = function() { // {{{
@@ -28,26 +38,61 @@
 		fielddisplay(this,'sh_nmin','minimum spherical harmonic degree (default 1)');
 		fielddisplay(this,'g0','adimensioning constant for gravity (default 10) [m/s^2]');
-		fielddisplay(this,'r0','adimensioning constant for radius (default 6378*10^3) [m]');
+		fielddisplay(this,'r0','adimensioning constant for radius (default 6371*10^3) [m]');
 		fielddisplay(this,'mu0','adimensioning constant for stress (default 10^11) [Pa]');
+		fielddisplay(this,'Gravitational_Constant','Newtonian constant of gravitation (default 6.67259e-11 [m^3 kg^-1 s^-2])');
 		fielddisplay(this,'allow_layer_deletion','allow for migration of the integration boundary with increasing spherical harmonics degree (default 1)');
+		fielddisplay(this,'underflow_tol','threshold of deep to surface love number ratio to trigger the deletion of layers (default 2.2204460492503131E-016)');
+		fielddisplay(this,'integration_steps_per_layer','number of radial steps to propagate the yi system from the bottom to the top of each layer (default 100)');
+		fielddisplay(this,'istemporal','1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency');
+		fielddisplay(this,'n_temporal_iterations','max number of iterations in the inverse Laplace transform. Also the number of spectral samples per time step requested (default 8)');
+		fielddisplay(this,'time','time vector for deformation if istemporal (default 0) [s]');
 		fielddisplay(this,'love_kernels','compute love numbers at depth? (default 0)');
-		fielddisplay(this,'forcing_type',['integer indicating the nature and depth of the forcing for the Love number calculation (default 11) :','1:  Inner core boundary -- Volumic Potential','2:  Inner core boundary -- Pressure','3:  Inner core boundary -- Loading','4:  Inner core boundary -- Tangential traction','5:  Core mantle boundary -- Volumic Potential','6:  Core mantle boundary -- Pressure','7:  Core mantle boundary -- Loading','8:  Core mantle boundary -- Tangential traction','9:  Surface -- Volumic Potential','10: Surface -- Pressure','11: Surface -- Loading','12: Surface -- Tangential traction ']); 
+		fielddisplay(this,'forcing_type','integer indicating the nature and depth of the forcing for the Love number calculation (default 11) :','1:  Inner core boundary -- Volumic Potential','2:  Inner core boundary -- Pressure','3:  Inner core boundary -- Loading','4:  Inner core boundary -- Tangential traction','5:  Core mantle boundary -- Volumic Potential','6:  Core mantle boundary -- Pressure','7:  Core mantle boundary -- Loading','8:  Core mantle boundary -- Tangential traction','9:  Surface -- Volumic Potential','10: Surface -- Pressure','11: Surface -- Loading','12: Surface -- Tangential traction ');
+		fielddisplay(this,'inner_core_boundary','interface index in materials.radius locating forcing. Only used for forcing_type 1--4 (default 1)');
+		fielddisplay(this,'core_mantle_boundary','interface index in materials.radius locating forcing. Only used for forcing_type 5--8 (default 2)'); 
 
 	} // }}}
 	this.checkconsistency = function(md,solution,analyses) { // {{{
 
-		md = checkfield(md,'fieldname','love.nfreq','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.frequencies','NaN',1,'Inf',1,'numel',md.love.nfreq);
-		md = checkfield(md,'fieldname','love.sh_nmax','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.sh_nmin','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.g0','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.r0','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.mu0','NaN',1,'Inf',1,'numel',1,'>',0);
-		md = checkfield(md,'fieldname','love.allow_layer_deletion','values',[0, 1]);
-		md = checkfield(md,'fieldname','love.love_kernels','values',[0, 1]);
-		md = checkfield(md,'fieldname','love.forcing_type','NaN',1,'Inf',1,'numel',1,'>',0, '<=', 12);
-		if (md.love.sh_nmin<=1 && md.love.forcing_type==9) {
+		if (ArrayAnyEqual(ArrayIsMember('LoveAnalysis',analyses),1)) return; 
+
+		checkfield(md,'fieldname','love.nfreq','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.frequencies','NaN',1,'Inf',1,'numel',md.love.nfreq);
+		checkfield(md,'fieldname','love.sh_nmax','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.sh_nmin','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.g0','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.r0','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.mu0','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.Gravitational_Constant','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.allow_layer_deletion','values',[0, 1]);
+		checkfield(md,'fieldname','love.underflow_tol','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.integration_steps_per_layer','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','love.love_kernels','values',[0, 1]);
+		checkfield(md,'fieldname','love.forcing_type','NaN',1,'Inf',1,'numel',1,'>',0, '<=', 12);
+		checkfield(md,'fieldname','love.complex_computation','NaN',1,'Inf',1,'numel',1,'values',[0, 1]);
+
+		checkfield(md,'fieldname','love.istemporal','values',[0, 1]);
+
+		if (md.love.istemporal==1){
+			checkfield(md,'fieldname','love.n_temporal_iterations','NaN',1,'Inf',1,'numel',1,'>',0);
+			checkfield(md,'fieldname','love.time','NaN',1,'Inf',1,'numel',md.love.nfreq/2/md.love.n_temporal_iterations);
+		}
+		if (md.love.sh_nmin<=1 && md.love.forcing_type==9 || md.love.forcing_type==5 || md.love.forcing_type==1) {
 			throw 'Degree 1 not supported for Volumetric Potential forcing. Use sh_min>=2 for this kind of calculation.';
 		}
+
+		//need 'litho' material: 
+		console.log('md.fourierlove check consistency only paritally implemented for litho material');
+		/*
+		if ~isa(md.materials,'materials') | ~sum(strcmpi(md.materials.nature,'litho'))
+			error('Need a "litho" material to run a Fourier Love number analysis');
+		end
+
+		mat=find(strcmpi(md.materials.nature,'litho'));
+		if (md.love.forcing_type<=4) {
+			checkfield(md,'fieldname','love.inner_core_boundary','NaN',1,'Inf',1,'numel',1,'>',0, '<=', md.materials(mat).numlayers);
+		} else if (md.love.forcing_type<=8) {
+			checkfield(md,'fieldname','love.core_mantle_boundary','NaN',1,'Inf',1,'numel',1,'>',0, '<=', md.materials(mat).numlayers);
+		} */
 	} // }}}
 	this.marshall = function(md,prefix,fid) { // {{{
@@ -60,22 +105,39 @@
 		WriteData(fid,prefix,'object',this,'fieldname','r0','format','Double');
 		WriteData(fid,prefix,'object',this,'fieldname','mu0','format','Double');
+		WriteData(fid,prefix,'object',this,'fieldname','Gravitational_Constant','format','Double');
 		WriteData(fid,prefix,'object',this,'fieldname','allow_layer_deletion','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','underflow_tol','format','Double');
+		WriteData(fid,prefix,'object',this,'fieldname','integration_steps_per_layer','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','istemporal','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','n_temporal_iterations','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','complex_computation','format','Boolean');
+		//note: no need to marshall the time vector, we have frequencies
 		WriteData(fid,prefix,'object',this,'fieldname','love_kernels','format','Boolean');
 		WriteData(fid,prefix,'object',this,'fieldname','forcing_type','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','inner_core_boundary','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','core_mantle_boundary','format','Integer');
 
 	} // }}}
 	//properties 
 	// {{{
-		
-	this.nfreq                =  NaN;
-	this.frequencies          =  NaN;
-	this.sh_nmax              =  NaN;
-	this.sh_nmin              =  NaN;
-	this.g0                   =  NaN; 
-	this.r0                   =  NaN; 
-	this.mu0                  =  NaN;
-	this.allow_layer_deletion =  NaN;
-	this.love_kernels =  NaN;
-	this.forcing_type         =  NaN;
+	this.nfreq                		= NaN;
+	this.frequencies          		= NaN;
+	this.sh_nmax              		= NaN;
+	this.sh_nmin              		= NaN;
+	this.g0                   		= NaN; 
+	this.r0                   		= NaN; 
+	this.mu0                  		= NaN;
+	this.Gravitational_Constant 	= 0;
+	this.allow_layer_deletion 		= NaN;
+	this.underflow_tol              = 0;
+	this.integration_steps_per_layer= 0;
+	this.istemporal		   			= 0;
+	this.n_temporal_iterations	  	= 0;
+	this.time			            = 0;
+	this.love_kernels 				= NaN;
+	this.forcing_type         		= NaN;
+	this.inner_core_boundary	    = 0;
+	this.core_mantle_boundary	    = 0;
+	this.complex_computation        = 0;
 	
 	//set defaults
Index: issm/trunk/src/m/classes/fourierlove.m
===================================================================
--- issm/trunk/src/m/classes/fourierlove.m	(revision 25994)
+++ issm/trunk/src/m/classes/fourierlove.m	(revision 26744)
@@ -6,14 +6,24 @@
 classdef fourierlove
 	properties (SetAccess=public) 
-		nfreq                = 0;
-		frequencies          = 0;
-		sh_nmax              = 0;
-		sh_nmin              = 0;
-		g0                   = 0;
-		r0                   = 0;
-		mu0                  = 0;
-		allow_layer_deletion = 0;
-		love_kernels         = 0;
-		forcing_type         = 0;
+		nfreq                       = 0;
+		frequencies                 = 0;
+		sh_nmax                     = 0;
+		sh_nmin                     = 0;
+		g0                          = 0;
+		r0                          = 0;
+		mu0                         = 0;
+		Gravitational_Constant      = 0;
+		allow_layer_deletion        = 0;
+		underflow_tol               = 0;
+		integration_steps_per_layer = 0;
+		istemporal                  = 0;
+		n_temporal_iterations       = 0;
+		time                        = 0;
+		love_kernels                = 0;
+		forcing_type                = 0;
+		inner_core_boundary         = 0;
+		core_mantle_boundary        = 0;
+		complex_computation         = 0;
+
 	end
 	methods (Static)
@@ -24,6 +34,4 @@
 	end
 	methods
-		function self = extrude(self,md) % {{{
-		end % }}}
 		function self = fourierlove(varargin) % {{{
 			switch nargin
@@ -43,23 +51,42 @@
 			self.g0=9.81; % m/s^2; 
 			self.r0=6371*1e3; %m;
-			self.mu0=10^11; % Pa
-			self.allow_layer_deletion=1; 
+			self.mu0=1e11; % Pa
+			self.Gravitational_Constant=6.67259e-11; % m^3 kg^-1 s^-2
+			self.allow_layer_deletion=1;
+			self.underflow_tol=1e-16; %threshold of deep to surface love number ratio to trigger the deletion of layer 
+			self.integration_steps_per_layer=100;
+			self.istemporal=0;
+			self.n_temporal_iterations=8;
+			self.time=[0]; %s
 			self.love_kernels=0; 
-			self.forcing_type = 11; 
+			self.forcing_type = 11; % surface loading
+			self.inner_core_boundary=1;
+			self.core_mantle_boundary=2;
+			self.complex_computation=0;
 		end % }}}
 		function disp(self) % {{{
-			fielddisplay(self,'nfreq','number of frequencies sampled (default 1, elastic) [Hz]');
+			fielddisplay(self,'nfreq','number of frequencies sampled (default: 1, elastic) [Hz]');
 			fielddisplay(self,'frequencies','frequencies sampled (convention defaults to 0 for the elastic case) [Hz]');
-			fielddisplay(self,'sh_nmax','maximum spherical harmonic degree (default 256, .35 deg, or 40 km at equator)');
-			fielddisplay(self,'sh_nmin','minimum spherical harmonic degree (default 1)');
-			fielddisplay(self,'g0','adimensioning constant for gravity (default 10) [m/s^2]');
-			fielddisplay(self,'r0','adimensioning constant for radius (default 6378*10^3) [m]');
-			fielddisplay(self,'mu0','adimensioning constant for stress (default 10^11) [Pa]');
-			fielddisplay(self,'allow_layer_deletion','allow for migration of the integration boundary with increasing spherical harmonics degree (default 1)');
-			fielddisplay(self,'love_kernels','compute love numbers at depth? (default 0)');
-			fielddisplay(self,'forcing_type',{'integer indicating the nature and depth of the forcing for the Love number calculation (default 11) :','1:  Inner core boundary -- Volumic Potential','2:  Inner core boundary -- Pressure','3:  Inner core boundary -- Loading','4:  Inner core boundary -- Tangential traction','5:  Core mantle boundary -- Volumic Potential','6:  Core mantle boundary -- Pressure','7:  Core mantle boundary -- Loading','8:  Core mantle boundary -- Tangential traction','9:  Surface -- Volumic Potential','10: Surface -- Pressure','11: Surface -- Loading','12: Surface -- Tangential traction '}); 
+			fielddisplay(self,'sh_nmax','maximum spherical harmonic degree (default: 256, .35 deg, or 40 km at equator)');
+			fielddisplay(self,'sh_nmin','minimum spherical harmonic degree (default: 1)');
+			fielddisplay(self,'g0','adimensioning constant for gravity (default: 10) [m/s^2]');
+			fielddisplay(self,'r0','adimensioning constant for radius (default: 6371*10^3) [m]');
+			fielddisplay(self,'mu0','adimensioning constant for stress (default: 10^11) [Pa]');
+			fielddisplay(self,'Gravitational_Constant','Newtonian constant of gravitation (default: 6.67259e-11 [m^3 kg^-1 s^-2])');
+			fielddisplay(self,'allow_layer_deletion','allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)');
+			fielddisplay(self,'underflow_tol','threshold of deep to surface love number ratio to trigger the deletion of layers (default: 1e-16)');
+			fielddisplay(self,'integration_steps_per_layer','number of radial steps to propagate the yi system from the bottom to the top of each layer (default: 100)');
+			fielddisplay(self,'istemporal',{'1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default: 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency'});
+			fielddisplay(self,'n_temporal_iterations','max number of iterations in the inverse Laplace transform. Also the number of spectral samples per time step requested (default: 8)');
+			fielddisplay(self,'time','time vector for deformation if istemporal (default: 0) [s]');
+			fielddisplay(self,'love_kernels','compute love numbers at depth? (default: 0)');
+			fielddisplay(self,'forcing_type',{'integer indicating the nature and depth of the forcing for the Love number calculation (default: 11):','1:  Inner core boundary -- Volumic Potential','2:  Inner core boundary -- Pressure','3:  Inner core boundary -- Loading','4:  Inner core boundary -- Tangential traction','5:  Core mantle boundary -- Volumic Potential','6:  Core mantle boundary -- Pressure','7:  Core mantle boundary -- Loading','8:  Core mantle boundary -- Tangential traction','9:  Surface -- Volumic Potential','10: Surface -- Pressure','11: Surface -- Loading','12: Surface -- Tangential traction '});
+			fielddisplay(self,'inner_core_boundary','interface index in materials.radius locating forcing. Only used for forcing_type 1--4 (default: 1)');
+			fielddisplay(self,'core_mantle_boundary','interface index in materials.radius locating forcing. Only used for forcing_type 5--8 (default: 2)'); 
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('LoveAnalysis',analyses), return; end
 
 			md = checkfield(md,'fieldname','love.nfreq','NaN',1,'Inf',1,'numel',1,'>',0);
@@ -70,13 +97,36 @@
 			md = checkfield(md,'fieldname','love.r0','NaN',1,'Inf',1,'numel',1,'>',0);
 			md = checkfield(md,'fieldname','love.mu0','NaN',1,'Inf',1,'numel',1,'>',0);
+			md = checkfield(md,'fieldname','love.Gravitational_Constant','NaN',1,'Inf',1,'numel',1,'>',0);
 			md = checkfield(md,'fieldname','love.allow_layer_deletion','values',[0 1]);
+			md = checkfield(md,'fieldname','love.underflow_tol','NaN',1,'Inf',1,'numel',1,'>',0);
+			md = checkfield(md,'fieldname','love.integration_steps_per_layer','NaN',1,'Inf',1,'numel',1,'>',0);
 			md = checkfield(md,'fieldname','love.love_kernels','values',[0 1]);
 			md = checkfield(md,'fieldname','love.forcing_type','NaN',1,'Inf',1,'numel',1,'>',0, '<=', 12);
-			if md.love.sh_nmin<=1 & md.love.forcing_type==9
-				error('Degree 1 not supported for Volumetric Potential forcing. Use sh_min>=2 for this kind of calculation.')
+			md = checkfield(md,'fieldname','love.complex_computation','NaN',1,'Inf',1,'numel',1,'values',[0 1]);
+
+			md = checkfield(md,'fieldname','love.istemporal','values',[0 1]);
+			if md.love.istemporal==1
+				md = checkfield(md,'fieldname','love.n_temporal_iterations','NaN',1,'Inf',1,'numel',1,'>',0);
+				md = checkfield(md,'fieldname','love.time','NaN',1,'Inf',1,'numel',md.love.nfreq/2/md.love.n_temporal_iterations);
 			end
+			if md.love.sh_nmin<=1 & (md.love.forcing_type==1 || md.love.forcing_type==5 || md.love.forcing_type==9)
+				error(['Degree 1 not supported for forcing type ' num2str(md.love.forcing_type) '. Use sh_min>=2 for this kind of calculation.'])
+			end
+
+			%need 'litho' material: 
+			if ~isa(md.materials,'materials') | ~sum(strcmpi(md.materials.nature,'litho'))
+				error('Need a ''litho'' material to run a Fourier Love number analysis');
+			end
+
+			mat=find(strcmpi(md.materials.nature,'litho'));
+			if md.love.forcing_type<=4
+				md = checkfield(md,'fieldname','love.inner_core_boundary','NaN',1,'Inf',1,'numel',1,'>',0, '<=', md.materials(mat).numlayers);
+			elseif md.love.forcing_type<=8
+				md = checkfield(md,'fieldname','love.core_mantle_boundary','NaN',1,'Inf',1,'numel',1,'>',0, '<=', md.materials(mat).numlayers);
+			end
+
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
-		
+
 			WriteData(fid,prefix,'object',self,'fieldname','nfreq','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','frequencies','format','DoubleMat','mattype',3);
@@ -86,12 +136,36 @@
 			WriteData(fid,prefix,'object',self,'fieldname','r0','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','mu0','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','Gravitational_Constant','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','allow_layer_deletion','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','underflow_tol','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','integration_steps_per_layer','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','istemporal','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','n_temporal_iterations','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','complex_computation','format','Boolean');
+			%note: no need to marshall the time vector, we have frequencies
 			WriteData(fid,prefix,'object',self,'fieldname','love_kernels','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','forcing_type','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','inner_core_boundary','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','core_mantle_boundary','format','Integer');
 
+		end % }}}
+		function self = extrude(self,md) % {{{
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
 			error('not implemented yet!');
 		end % }}}
+		function self=build_frequencies_from_time(self) % {{{
+			if ~self.istemporal
+				error('cannot build frequencies for temporal love numbers if love.istemporal==0')
+			end
+			disp('Temporal love numbers: Overriding md.love.nfreq and md.love.frequencies');
+			self.nfreq=length(self.time)*2*self.n_temporal_iterations;
+			self.frequencies=zeros(self.nfreq,1);
+			for i=1:length(self.time)
+				for j=1:2*self.n_temporal_iterations
+					self.frequencies((i-1)*2*self.n_temporal_iterations +j) = j*log(2)/self.time(i)/2/pi;
+				end
+			end
+		end % }}}
 	end
 end
Index: issm/trunk/src/m/classes/fourierlove.py
===================================================================
--- issm/trunk/src/m/classes/fourierlove.py	(revision 25994)
+++ issm/trunk/src/m/classes/fourierlove.py	(revision 26744)
@@ -1,2 +1,4 @@
+import numpy as np
+
 from fielddisplay import fielddisplay
 from checkfield import checkfield
@@ -5,11 +7,11 @@
 
 class fourierlove(object):
+    """FOURIERLOVE - class definition
+
+    Usage:
+        md.love = fourierlove()
     """
-    Fourier Love Number class definition
 
-       Usage:
-          fourierlove = fourierlove()
-    """
-    def __init__(self):  # {{{
+    def __init__(self): #{{{
         self.nfreq = 0
         self.frequencies = 0
@@ -19,80 +21,126 @@
         self.r0 = 0
         self.mu0 = 0
+        self.Gravitational_Constant = 0
         self.allow_layer_deletion = 0
+        self.underflow_tol = 0
+        self.integration_steps_per_layer = 0
+        self.istemporal = 0
+        self.n_temporal_iterations = 0
+        self.time = 0
         self.love_kernels = 0
         self.forcing_type = 0
+        self.inner_core_boundary = 0
+        self.core_mantle_boundary = 0
+        self.complex_computation = 0
 
-    #set defaults
         self.setdefaultparameters()
     #}}}
 
-    def __repr__(self):  # {{{
-        string = '   Fourier Love class:'
-        string = "%s\n%s" % (string, fielddisplay(self, 'nfreq', 'number of frequencies sampled (default 1, elastic) [Hz]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'frequencies', 'frequencies sampled (convention defaults to 0 for the elastic case) [Hz]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'sh_nmax', 'maximum spherical harmonic degree (default 256, .35 deg, or 40 km at equator)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'sh_nmin', 'minimum spherical harmonic degree (default 1)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'g0', 'adimensioning constant for gravity (default 10) [m / s^2]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'r0', 'adimensioning constant for radius (default 6378e3) [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'mu0', 'adimensioning constant for stress (default 1.0e11) [Pa]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default 1)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'love_kernels', 'compute love numbers at depth? (default 0)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'forcing_type', 'integer indicating the nature and depth of the forcing for the Love number calculation (default 11) :'))
-        string = "%s\n%s" % (string, '                                                     1:  Inner core boundary -- Volumic Potential')
-        string = "%s\n%s" % (string, '                                                     2:  Inner core boundary --  Pressure')
-        string = "%s\n%s" % (string, '                                                     3:  Inner core boundary --  Loading')
-        string = "%s\n%s" % (string, '                                                     4:  Inner core boundary --  Tangential traction')
-        string = "%s\n%s" % (string, '                                                     5:  Core mantle boundary --  Volumic Potential')
-        string = "%s\n%s" % (string, '                                                     6:  Core mantle boundary --  Pressure')
-        string = "%s\n%s" % (string, '                                                     7:  Core mantle boundary --  Loading')
-        string = "%s\n%s" % (string, '                                                     8:  Core mantle boundary --  Tangential traction')
-        string = "%s\n%s" % (string, '                                                     9:  Surface--  Volumic Potential')
-        string = "%s\n%s" % (string, '                                                     10: Surface--  Pressure')
-        string = "%s\n%s" % (string, '                                                     11: Surface--  Loading')
-        string = "%s\n%s" % (string, '                                                     12: Surface--  Tangential traction ')
+    def __repr__(self): #{{{
+        # TODO:
+        # - Correct display to match MATLAB
+        #
+        s = '   Fourier Love class:\n'
+        s += '{}\n'.format(fielddisplay(self, 'nfreq', 'number of frequencies sampled (default: 1, elastic) [Hz]'))
+        s += '{}\n'.format(fielddisplay(self, 'frequencies', 'frequencies sampled (convention defaults to 0 for the elastic case) [Hz]'))
+        s += '{}\n'.format(fielddisplay(self, 'sh_nmax', 'maximum spherical harmonic degree (default: 256, .35 deg, or 40 km at equator)'))
+        s += '{}\n'.format(fielddisplay(self, 'sh_nmin', 'minimum spherical harmonic degree (default: 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'g0', 'adimensioning constant for gravity (default: 10) [m/s^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'r0', 'adimensioning constant for radius (default: 6371*10^3) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'mu0', 'adimensioning constant for stress (default: 10^11) [Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'Gravitational_Constant', 'Newtonian constant of gravitation (default: 6.67259e-11 [m^3 kg^-1 s^-2])'))
+        s += '{}\n'.format(fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'underflow_tol', 'threshold of deep to surface love number ratio to trigger the deletion of layers (default: 1e-16)'))
+        s += '{}\n'.format(fielddisplay(self, 'integration_steps_per_layer', 'number of radial steps to propagate the yi system from the bottom to the top of each layer (default: 100)'))
+        s += '{}\n'.format(fielddisplay(self, 'istemporal', ['1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default: 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency']))
+        s += '{}\n'.format(fielddisplay(self, 'n_temporal_iterations', 'max number of iterations in the inverse Laplace transform. Also the number of spectral samples per time step requested (default: 8)'))
+        s += '{}\n'.format(fielddisplay(self, 'time', 'time vector for deformation if istemporal (default: 0) [s]'))
+        s += '{}\n'.format(fielddisplay(self, 'love_kernels', 'compute love numbers at depth? (default: 0)'))
+        s += '{}\n'.format(fielddisplay(self, 'forcing_type', 'integer indicating the nature and depth of the forcing for the Love number calculation (default: 11):'))
+        s += '{}\n'.format('                                                     1:  Inner core boundary -- Volumic Potential')
+        s += '{}\n'.format('                                                     2:  Inner core boundary --  Pressure')
+        s += '{}\n'.format('                                                     3:  Inner core boundary --  Loading')
+        s += '{}\n'.format('                                                     4:  Inner core boundary --  Tangential traction')
+        s += '{}\n'.format('                                                     5:  Core mantle boundary --  Volumic Potential')
+        s += '{}\n'.format('                                                     6:  Core mantle boundary --  Pressure')
+        s += '{}\n'.format('                                                     7:  Core mantle boundary --  Loading')
+        s += '{}\n'.format('                                                     8:  Core mantle boundary --  Tangential traction')
+        s += '{}\n'.format('                                                     9:  Surface--  Volumic Potential')
+        s += '{}\n'.format('                                                     10: Surface--  Pressure')
+        s += '{}\n'.format('                                                     11: Surface--  Loading')
+        s += '{}\n'.format('                                                     12: Surface--  Tangential traction ')
+        s += '{}\n'.format(fielddisplay(self, 'inner_core_boundary', 'interface index in materials.radius locating forcing. Only used for forcing_type 1--4 (default: 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'core_mantle_boundary', 'interface index in materials.radius locating forcing. Only used for forcing_type 5--8 (default: 2)'))
 
-        return string
+        return s
     #}}}
 
-    def extrude(self, md):  # {{{
-        return self
+    def setdefaultparameters(self): #{{{
+        # We setup an elastic love number computation by default
+        self.nfreq = 1
+        self.frequencies = [0] # Hz
+        self.sh_nmax = 256 # .35 degree, 40 km at the equator
+        self.sh_nmin = 1
+        # Work on matlab script for computing g0 for given Earth's structure
+        self.g0 = 9.81 # m/s^2
+        self.r0 = 6371 * 1e3 # m
+        self.mu0 = 1e11 # Pa
+        self.Gravitational_Constant = 6.67259e-11 # m^3 kg^-1 s^-2
+        self.allow_layer_deletion = 1
+        self.underflow_tol = 1e-16 # Threshold of deep to surface love number ratio to trigger the deletion of layer
+        self.integration_steps_per_layer = 100
+        self.istemporal = 0
+        self.n_temporal_iterations = 8
+        self.time = [0] # s
+        self.love_kernels = 0
+        self.forcing_type = 11 # Surface loading
+        self.inner_core_boundary = 1
+        self.core_mantle_boundary = 2
+        self.complex_computation = 0
     #}}}
 
-    def setdefaultparameters(self):  # {{{
-        #we setup an elastic love number computation by default.
-        self.nfreq = 1
-        self.frequencies = [0]  #Hz
-        self.sh_nmax = 256  # .35 degree, 40 km at the equator.
-        self.sh_nmin = 1
-        self.g0 = 9.81 # m/s^2
-        self.r0 = 6371e3 #m
-        self.mu0 = 1e11 # Pa
-        self.allow_layer_deletion = 1
-        self.love_kernels = 0
-        self.forcing_type = 11
+    def checkconsistency(self, md, solution, analyses): #{{{
+        if 'LoveAnalysis' not in analyses:
+            return md
 
-        return self
+        md = checkfield(md, 'fieldname', 'love.nfreq', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.frequencies', 'NaN', 1, 'Inf', 1, 'numel', md.love.nfreq)
+        md = checkfield(md, 'fieldname', 'love.sh_nmax', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.sh_nmin', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.g0', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.r0', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.mu0', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.Gravitational_Constant', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.allow_layer_deletion', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'love.underflow_tol', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.integration_steps_per_layer', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'love.love_kernels', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'love.forcing_type', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0, '<=', 12)
+        md = checkfield(md, 'fieldname', 'love.complex_computation', 'NaN', 1, 'Inf', 1, 'numel', 1, 'values', [0, 1])
+
+        md = checkfield(md, 'fieldname', 'love.istemporal', 'values', [0, 1])
+        if md.love.istemporal:
+            md = checkfield(md, 'fieldname', 'love.n_temporal_iterations', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+            md = checkfield(md, 'fieldname', 'love.time', 'NaN', 1, 'Inf', 1, 'numel', md.love.nfreq / 2 / md.love.n_temporal_iterations)
+        if md.love.sh_nmin <= 1 and (md.love.forcing_type == 9 or md.love.forcing_type == 5 or md.love.forcing_type == 1):
+            raise RuntimeError('Degree 1 not supported for forcing type {}. Use sh_min >= 2 for this kind of calculation.'.format(md.love.forcing_type))
+
+        # Need 'litho' material
+        if not hasattr(md.materials, 'materials') or 'litho' not in md.materials.nature:
+            raise RuntimeError('Need a \'litho\' material to run a Fourier Love number analysis')
+
+        mat = np.where(np.array(nature) == 'litho')[0]
+        if md.love.forcing_type <= 4:
+            md = checkfield(md, 'fieldname', 'love.inner_core_boundary', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0, '<=', md.materials[mat].numlayers)
+        elif md.love.forcing_type <= 8:
+            md = checkfield(md, 'fieldname', 'love.core_mantle_boundary', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0, '<=', md.materials[mat].numlayers)
+
+        return md
     #}}}
 
-    def checkconsistency(self, md, solution, analyses):  # {{{
-        md = checkfield(md, 'fieldname', 'love.nfreq', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.frequencies', 'NaN', 1, 'Inf', 1, 'numel', [md.love.nfreq])
-        md = checkfield(md, 'fieldname', 'love.sh_nmax', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.sh_nmin', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.g0', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.r0', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.mu0', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0)
-        md = checkfield(md, 'fieldname', 'love.allow_layer_deletion', 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'love.love_kernels', 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'love.forcing_type', 'NaN', 1, 'Inf', 1, 'numel', [1], '>', 0, '<=', 12)
-        if md.love.sh_nmin <= 1 and md.love.forcing_type == 9:
-            raise RuntimeError("Degree 1 not supported for Volumetric Potential forcing. Use sh_min >= 2 for this kind of calculation.")
-
-        return md
-    # }}}
-
-    def marshall(self, prefix, md, fid):  # {{{
+    def marshall(self, prefix, md, fid): #{{{
         WriteData(fid, prefix, 'object', self, 'fieldname', 'nfreq', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'frequencies', 'format', 'DoubleMat', 'mattype', 3)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'frequencies', 'format', 'DoubleMat', 'mattype',3)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'sh_nmax', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'sh_nmin', 'format', 'Integer')
@@ -100,6 +148,30 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'r0', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'mu0', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'Gravitational_Constant', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'allow_layer_deletion', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'underflow_tol', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'integration_steps_per_layer', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'istemporal', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'n_temporal_iterations', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'complex_computation', 'format', 'Boolean')
+        # Note: no need to marshall the time vector, we have frequencies
         WriteData(fid, prefix, 'object', self, 'fieldname', 'love_kernels', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'forcing_type', 'format', 'Integer')
-    # }}}
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'inner_core_boundary', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'core_mantle_boundary', 'format', 'Integer')
+    #}}}
+
+    def extrude(self, md): #{{{
+        return self
+    #}}}
+
+    def build_frequencies_from_time(self): #{{{
+        if not self.istemporal:
+            raise RuntimeError('cannot build frequencies for temporal love numbers if love.istemporal==0')
+        print('Temporal love numbers: Overriding md.love.nfreq and md.love.frequencies')
+        self.nfreq = len(self.time) * 2 * self.n_temporal_iterations
+        self.frequencies = np.zeros((self.nfreq, 1))
+        for i in range(len(self.time)):
+            for j in range(2 * self.n_temporal_iterations):
+                self.frequencies[(i - 1) * 2 * self.n_temporal_iterations + j] = j * np.log(2) / self.time[i] / 2 / np.pi
+    #}}}
Index: issm/trunk/src/m/classes/friction.js
===================================================================
--- issm/trunk/src/m/classes/friction.js	(revision 25994)
+++ issm/trunk/src/m/classes/friction.js	(revision 26744)
@@ -14,5 +14,7 @@
 		fielddisplay(this,'p','p exponent');
 		fielddisplay(this,'q','q exponent');
+		fielddisplay(this,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');
 		fielddisplay(this,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure)  and 2 for coupled(not implemented yet)');
+		fielddisplay(this,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');
 	} // }}}
 	this.extrude = function(md) {//{{{
@@ -42,12 +44,13 @@
 				return; 
 			}
-			md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements ,1]);
-			md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements ,1]);
-			md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0, 1, 2]);
+			checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1,'Inf',1);
+			checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements ,1]);
+			checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements ,1]);
+			checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0, 1, 2]);
+			checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);
 			switch (this.coupling) {
 				case 0:
 				case 1:
-					md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
+					checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
 					break;
 				case 2:
@@ -63,11 +66,20 @@
 
 			WriteData(fid,prefix,'name','md.friction.law','data',1,'format','Integer');
-			WriteData(fid,prefix,'object',this,'fieldname','coefficient','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			//WriteData(fid,prefix,'object',this,'fieldname','coefficient','format','DoubleMat','mattype',1);
+			let mattype,tsl;
+			if ((size(this.coefficient,0)==md.mesh.numberofvertices | size(this.coefficient,1)==md.mesh.numberofvertices+1)) {
+				mattype=1;
+				tsl = md.mesh.numberofvertices;
+			} else {
+				mattype=2;
+				tsl = md.mesh.numberofelements;
+			}
+			WriteData(fid,prefix,'object',this,'fieldname','coefficient','format','DoubleMat','mattype',mattype,'timeserieslength',tsl+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',this,'fieldname','p','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'object',this,'fieldname','q','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'class','friction','object',this,'fieldname','coupling','format','Integer');
+			WriteData(fid,prefix,'object',this,'class','friction','fieldname','effective_pressure_limit','format','Double');
 			switch (this.coupling) {
 				case 0:
+					break;
 				case 1:
 					WriteData(fid,prefix,'class','friction','object',this,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
@@ -79,6 +91,4 @@
 					console.error('not supported yet');		
 			}
-			
-
 		}//}}}
 		this.fix=function() { //{{{
@@ -86,9 +96,10 @@
 	//properties 
 	//{{{
-	this.coefficient = NaN;
-	this.p           = NaN;
-	this.q           = NaN;
-	this.coupling    = 0;
-	this.effective_pressure = NaN;
+	this.coefficient			  = NaN;
+	this.p						  = NaN;
+	this.q						  = NaN;
+	this.coupling				  = 0;
+	this.effective_pressure 	  = NaN;
+	this.effective_pressure_limit = 0;
 	this.setdefaultparameters();
 	//}}}
Index: issm/trunk/src/m/classes/friction.m
===================================================================
--- issm/trunk/src/m/classes/friction.m	(revision 25994)
+++ issm/trunk/src/m/classes/friction.m	(revision 26744)
@@ -6,9 +6,9 @@
 classdef friction
 	properties (SetAccess=public) 
-		coefficient = NaN;
-		p           = NaN;
-		q           = NaN;
-		coupling    = 0;
-		effective_pressure = NaN;
+		coefficient              = NaN;
+		p                        = NaN;
+		q                        = NaN;
+		coupling                 = 0;
+		effective_pressure       = NaN;
 		effective_pressure_limit = 0;
 	end
@@ -18,14 +18,6 @@
 			self.p=project3d(md,'vector',self.p,'type','element');
 			self.q=project3d(md,'vector',self.q,'type','element');
-			switch self.coupling
-				case 0
-				case 1
-				case 2
-				case 3
-					self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
-				case 4
-					self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
-				otherwise
-					error('not supported yet');		
+			if self.coupling==3 || self.coupling==4
+				self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
 			end
 		end % }}}
@@ -57,14 +49,6 @@
 			md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0:4]);
 			md = checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);
-			switch self.coupling
-				case 0
-				case 1
-				case 2
-				case 3
-					md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
-				case 4
-				
-				otherwise
-					error('not supported yet');
+         if self.coupling==3
+            md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
 			end
 		end % }}}
@@ -92,14 +76,6 @@
 			WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer');
 			WriteData(fid,prefix,'object',self,'class','friction','fieldname','effective_pressure_limit','format','Double');
-			switch self.coupling
-				case 0
-				case 1
-				case 2
-				case 3
-					WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-				case 4
-					WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-				otherwise
-					error('not supported yet');		
+			if self.coupling==3 || self.coupling==4
+				WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			end
 		end % }}}
Index: issm/trunk/src/m/classes/friction.py
===================================================================
--- issm/trunk/src/m/classes/friction.py	(revision 25994)
+++ issm/trunk/src/m/classes/friction.py	(revision 26744)
@@ -23,5 +23,4 @@
         self.setdefaultparameters()
     #}}}
-
     def __repr__(self):  # {{{
         s = 'Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s - 1) * u_b,\n'
@@ -35,27 +34,20 @@
         return s
     #}}}
-
     def setdefaultparameters(self):  # {{{
         self.effective_pressure_limit = 0
         return self
     #}}}
-
     def extrude(self, md):  # {{{
         self.coefficient = project3d(md, 'vector', self.coefficient, 'type', 'node', 'layer', 1)
         self.p = project3d(md, 'vector', self.p, 'type', 'element')
         self.q = project3d(md, 'vector', self.q, 'type', 'element')
-        # If self.coupling == 0:  #doesnt work with empty loop, so just skip it?
         if self.coupling in[3, 4]:
             self.effective_pressure = project3d(md, 'vector', self.effective_pressure, 'type', 'node', 'layer', 1)
-        elif self.coupling > 4:
-            raise ValueError('md.friction.coupling larger than 4, not supported yet')
         return self
     #}}}
-
     def defaultoutputs(self, md):  # {{{
         list = []
         return list
     #}}}
-
     def checkconsistency(self, md, solution, analyses):  # {{{
         # Early return
@@ -71,9 +63,6 @@
         if self.coupling == 3:
             md = checkfield(md, 'fieldname', 'friction.effective_pressure', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
-        elif self.coupling > 4:
-            raise ValueError('not supported yet')
         return md
     # }}}
-
     def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 1, 'format', 'Integer')
@@ -89,9 +78,5 @@
         WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coupling', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'friction', 'fieldname', 'effective_pressure_limit', 'format', 'Double')
-        if self.coupling == 3:
+        if self.coupling == 3 or self.coupling == 4:
             WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
-        elif self.coupling == 4:
-            WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
-        elif self.coupling > 4:
-            raise ValueError('not supported yet')
     # }}}
Index: issm/trunk/src/m/classes/frictioncoulomb2.m
===================================================================
--- issm/trunk/src/m/classes/frictioncoulomb2.m	(revision 26744)
+++ issm/trunk/src/m/classes/frictioncoulomb2.m	(revision 26744)
@@ -0,0 +1,102 @@
+%FRICTIONCOULOMB2 class definition
+%
+%   Usage:
+%      frictioncoulomb=frictioncoulomb2();
+
+classdef frictioncoulomb2
+	properties (SetAccess=public) 
+		C                        = NaN;
+		m                        = NaN;
+		coupling                 = 0;
+		effective_pressure       = NaN;
+		effective_pressure_limit = 0;
+	end
+	methods (Static)
+		function self = loadobj(self) % {{{
+			if isstruct(self)
+				disp('Recovering frictioncoulomb2 from older version');
+				if isfield(self,'coefficient')
+					self.C = self.coefficient;
+				end
+				self = structtoobj(frictioncoulomb2(),self);
+			end
+		end% }}}
+	end
+	methods
+		function self = extrude(self,md) % {{{
+			self.C=project3d(md,'vector',self.C,'type','node','layer',1);
+			self.m=project3d(md,'vector',self.m,'type','element');
+			switch self.coupling
+				case 0
+				case 1
+					self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
+				case 2
+					error('not implemented yet');
+				otherwise
+					error('not supported yet');		
+			end
+		end % }}}
+		function self = frictioncoulomb(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+
+			self.effective_pressure_limit = 0;
+
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			%Early return
+			if ~ismember('StressbalanceAnalysis',analyses) & ~ismember('ThermalAnalysis',analyses), return; end
+			md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','friction.m','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0 1 2]);
+			md = checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);			
+			switch self.coupling
+				case 0
+				case 1
+					md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
+				case 2
+					error('not implemented yet');
+				otherwise
+					error('not supported yet');		
+			end
+		end % }}}
+		function disp(self) % {{{
+         disp('Coulomb limited sliding law parameters:');
+         disp(' ');
+         disp('                     C^2 |u_b|^(m-1) * (.5*N)           ');
+         disp('      tau_b = - _________________________________   u_b ');
+         disp('                (C^(2/m) |u_b| + (0.5*N)^(1/m) )^m      ');
+         disp(' ');
+			fielddisplay(self,'C','friction coefficient [SI]');
+			fielddisplay(self,'m','m exponent (Weertman would be 1/3)');
+			fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');
+			fielddisplay(self,'coupling','Coupling flag: 0 for default, 1 for forcing(provide md.friction.effective_pressure)  and 2 for coupled (not implemented yet)');
+			fielddisplay(self,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');	
+			end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+
+			WriteData(fid,prefix,'name','md.friction.law','data',13,'format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','C','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'fieldname','m','format','DoubleMat','mattype',2);
+			WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer');
+			WriteData(fid,prefix,'object',self,'class','friction','fieldname','effective_pressure_limit','format','Double');
+			switch self.coupling
+				case 0
+				case 1
+					WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+				case 2
+					error('not implemented yet');
+				otherwise
+					error('not supported yet');		
+			end
+
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/frictionschoof.m
===================================================================
--- issm/trunk/src/m/classes/frictionschoof.m	(revision 25994)
+++ issm/trunk/src/m/classes/frictionschoof.m	(revision 26744)
@@ -6,7 +6,9 @@
 classdef frictionschoof
 	properties (SetAccess=public) 
-		C    = NaN;
-		Cmax = NaN;
-		m    = NaN;
+		C                        = NaN;
+		Cmax                     = NaN;
+		m                        = NaN;
+		coupling                 = 0;
+		effective_pressure       = NaN;
 		effective_pressure_limit = 0;
 	end
@@ -26,7 +28,11 @@
 			self.Cmax = project3d(md,'vector',self.Cmax,'type','node');
 			self.m    = project3d(md,'vector',self.m,'type','element');
+			if self.coupling==3 || self.coupling==4
+				self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
+			end
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
+         self.coupling = 0;
 			self.effective_pressure_limit = 0;
 
@@ -36,8 +42,12 @@
 			%Early return
 			if ~ismember('StressbalanceAnalysis',analyses) & ~ismember('ThermalAnalysis',analyses), return; end
-			md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1,'Inf',1,'>',0.);
+			md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1,'Inf',1,'>=',0.);
 			md = checkfield(md,'fieldname','friction.Cmax','timeseries',1,'NaN',1,'Inf',1,'>',0.);
 			md = checkfield(md,'fieldname','friction.m','NaN',1,'Inf',1,'>',0.,'size',[md.mesh.numberofelements,1]);
 			md = checkfield(md,'fieldname','friction.effective_pressure_limit','numel',[1],'>=',0);
+         md = checkfield(md,'fieldname','friction.coupling','numel',[1],'values',[0:4]);
+         if self.coupling==3
+            md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
+         end
 		end % }}}
 		function disp(self) % {{{
@@ -52,4 +62,6 @@
 			fielddisplay(self,'Cmax','Iken''s bound (typically between 0.17 and 0.84) [SI]');
 			fielddisplay(self,'m','m exponent (generally taken as m = 1/n = 1/3)');
+			fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');
+         fielddisplay(self,'coupling','Coupling flag 0: uniform sheet (negative pressure ok, default), 1: ice pressure only, 2: water pressure assuming uniform sheet (no negative pressure), 3: use provided effective_pressure, 4: use coupled model (not implemented yet)');
 			fielddisplay(self,'effective_pressure_limit','Neff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)');
 		end % }}}
@@ -62,4 +74,8 @@
 			WriteData(fid,prefix,'class','friction','object',self,'fieldname','m','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'object',self,'class','friction','fieldname','effective_pressure_limit','format','Double');
+         WriteData(fid,prefix,'class','friction','object',self,'fieldname','coupling','format','Integer');
+         if self.coupling==3 || self.coupling==4
+            WriteData(fid,prefix,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+         end
 		end % }}}
 	end
Index: issm/trunk/src/m/classes/frictionschoof.py
===================================================================
--- issm/trunk/src/m/classes/frictionschoof.py	(revision 25994)
+++ issm/trunk/src/m/classes/frictionschoof.py	(revision 26744)
@@ -16,8 +16,10 @@
 
     def __init__(self, *args):  # {{{
-        self.C                          = np.nan
-        self.Cmax                       = np.nan
-        self.m                          = np.nan
-        self.effective_pressure_limit   = 0
+        self.C                        = np.nan
+        self.Cmax                     = np.nan
+        self.m                        = np.nan
+        self.coupling                 = 0
+        self.effective_pressure       = np.nan
+        self.effective_pressure_limit = 0
         
         nargs = len(args)
@@ -29,5 +31,4 @@
             raise Exception('constructor not supported')
     #}}}
-
     def __repr__(self):  # {{{
         # See Brondex et al. 2019 https://www.the-cryosphere.net/13/177/2019/
@@ -41,20 +42,21 @@
         s += "{}\n".format(fielddisplay(self, 'Cmax', 'Iken\'s bound (typically between 0.17 and 0.84) [SI]'))
         s += "{}\n".format(fielddisplay(self, 'm', 'm exponent (generally taken as m = 1/n = 1/3)'))
+        s += '{}\n'.format(fielddisplay(self, 'coupling', 'Coupling flag 0: uniform sheet (negative pressure ok, default), 1: ice pressure only, 2: water pressure assuming uniform sheet (no negative pressure), 3: use provided effective_pressure, 4: used coupled model (not implemented yet)'))
+        s += '{}\n'.format(fielddisplay(self, 'effective_pressure', 'Effective Pressure for the forcing if not coupled [Pa]'))
         s += "{}\n".format(fielddisplay(self, 'effective_pressure_limit', 'fNeff do not allow to fall below a certain limit: effective_pressure_limit*rho_ice*g*thickness (default 0)'))
         return s
     #}}}
-
     def setdefaultparameters(self):  # {{{
         self.effective_pressure_limit = 0
         return self
     #}}}
-
     def extrude(self, md):  # {{{
         self.C = project3d(md, 'vector', self.C, 'type', 'node')
         self.Cmax = project3d(md, 'vector', self.Cmax, 'type', 'node')
         self.m = project3d(md, 'vector', self.m, 'type', 'element')
+        if self.coupling in[3, 4]:
+            self.effective_pressure = project3d(md, 'vector', self.effective_pressure, 'type', 'node', 'layer', 1)
         return self
     #}}}
-
     def checkconsistency(self, md, solution, analyses):  # {{{
         # Early return
@@ -65,7 +67,9 @@
         md = checkfield(md, 'fieldname', 'friction.m', 'NaN', 1, 'Inf', 1, '>', 0., 'size', [md.mesh.numberofelements, 1])
         md = checkfield(md, 'fieldname', 'friction.effective_pressure_limit', 'numel', [1], '>=', 0)
+        md = checkfield(md, 'fieldname', 'friction.coupling', 'numel', [1], 'values', [0, 1, 2, 3, 4])
+        if self.coupling == 3:
+            md = checkfield(md, 'fieldname', 'friction.effective_pressure', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
         return md
     # }}}
-
     def marshall(self, prefix, md, fid):  # {{{
         yts = md.constants.yts
@@ -75,5 +79,7 @@
         WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'Cmax', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
         WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'm', 'format', 'DoubleMat', 'mattype', 2)
+        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coupling', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'friction', 'fieldname', 'effective_pressure_limit', 'format', 'Double')
+        if self.coupling == 3 or self.coupling == 4:
+            WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'effective_pressure', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     # }}}
-
Index: issm/trunk/src/m/classes/frictionweertman.m
===================================================================
--- issm/trunk/src/m/classes/frictionweertman.m	(revision 25994)
+++ issm/trunk/src/m/classes/frictionweertman.m	(revision 26744)
@@ -37,5 +37,5 @@
 			md = checkfield(md,'fieldname','friction.m','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
 		end % }}}
-		function disp(self) % {{{z
+		function disp(self) % {{{
 			disp('Weertman sliding law parameters:');
 			disp('   Weertman''s sliding law reads:');
Index: issm/trunk/src/m/classes/frontalforcings.js
===================================================================
--- issm/trunk/src/m/classes/frontalforcings.js	(revision 26744)
+++ issm/trunk/src/m/classes/frontalforcings.js	(revision 26744)
@@ -0,0 +1,41 @@
+//FRONTAL FORCINGS Class definition
+//
+//   Usage:
+//      frontalforcings=frontalforcings();
+
+function frontalforcings(){
+	//methods
+    this.classname = function(){ // {{{
+        return "frontalforcings";
+    } // }}}
+    this.extrude = function(md) {//{{{
+		this.meltingrate=project3d(md,'vector',this.meltingrate,'type','node');
+        return this;
+    }//}}}
+	this.setdefaultparameters = function(){// {{{
+		this.meltingrate   = NaN;
+	} // }}}
+    this.checkconsistency = function(md,solution,analyses) { //{{{
+		//Early return
+		if (!solution=='TransientSolution' || md.transient.ismovingfront == 0) return;
+
+		md = checkfield(md,'fieldname','frontalforcings.meltingrate','NaN',1,'Inf',1,'timeseries',1,'>=',0);
+
+    } // }}}
+	this.disp = function(){ // {{{
+		console.log(sprintf('   Frontalforcings parameters:'));
+		fielddisplay(this,'meltingrate','melting rate at given location [m/a]');
+	} // }}}
+    this.marshall=function(md,prefix,fid) { //{{{
+		let yts=md.constants.yts;
+		WriteData(fid,prefix,'name','md.frontalforcings.parameterization','data',1,'format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1./yts);
+    }//}}}
+    this.fix=function() { //{{{
+    }//}}}
+	//properties 
+    // {{{
+	this.meltingrate   = NaN;
+	this.setdefaultparameters();
+    // }}}
+}
Index: issm/trunk/src/m/classes/frontalforcingsrignot.m
===================================================================
--- issm/trunk/src/m/classes/frontalforcingsrignot.m	(revision 25994)
+++ issm/trunk/src/m/classes/frontalforcingsrignot.m	(revision 26744)
@@ -6,8 +6,8 @@
 classdef frontalforcingsrignot
 	properties (SetAccess=public) 
-		basin= NaN;
-		numberofbasins=0;
-		subglacial_discharge= NaN;
-		thermalforcing=NaN;
+		basin_id             = NaN;
+		num_basins           = 0;
+		subglacial_discharge = NaN;
+		thermalforcing       = NaN;
 	end
 	methods
@@ -35,8 +35,8 @@
 		function self = setdefaultparameters(self) % {{{
 
-			basin=NaN;
-			numberofbasins=0;
-			subglacial_discharge=NaN;
-			thermalforcing=NaN;
+			basin_id             = NaN;
+			num_basins           = 0;
+			subglacial_discharge = NaN;
+			thermalforcing       = NaN;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -44,14 +44,14 @@
 			if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','frontalforcings.basin','>',0,'nan',1,'Inf',1);
-			md = checkfield(md,'fieldname','frontalforcings.numberofbasins','numel',[1]);
-			md = checkfield(md,'fieldname','frontalforcings.subglacial_discharge','>=',0,'nan',1,'Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','frontalforcings.thermalforcing','nan',1,'Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','frontalforcings.num_basins','numel',1,'NaN',1,'Inf',1,'>',0);
+			md = checkfield(md,'fieldname','frontalforcings.basin_id','Inf',1,'>=',0,'<=',md.frontalforcings.num_basins,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','frontalforcings.subglacial_discharge','>=',0,'NaN',1,'Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','frontalforcings.thermalforcing','NaN',1,'Inf',1,'timeseries',1);
 
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Frontalforcings parameters:'));
-			fielddisplay(self,'basin','basin ID for vertices');
-			fielddisplay(self,'numberofbasins', 'number of basins');
+			fielddisplay(self,'basin_id','basin ID for elements');
+			fielddisplay(self,'num_basins', 'number of basins');
 			fielddisplay(self,'subglacial_discharge','sum of subglacial discharge for each basin [m/d]');
 			fielddisplay(self,'thermalforcing','thermal forcing [∘C]');
@@ -59,6 +59,6 @@
 		function marshall(self,prefix,md,fid) % {{{
 			WriteData(fid,prefix,'name','md.frontalforcings.parameterization','data',2,'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','basin','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','numberofbasins','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','basin_id','data',self.basin_id-1,'name','md.frontalforcings.basin_id','format','IntMat','mattype',2); %0-indexed
+			WriteData(fid,prefix,'object',self,'fieldname','num_basins','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','subglacial_discharge','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'fieldname','thermalforcing','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
Index: issm/trunk/src/m/classes/frontalforcingsrignot.py
===================================================================
--- issm/trunk/src/m/classes/frontalforcingsrignot.py	(revision 25994)
+++ issm/trunk/src/m/classes/frontalforcingsrignot.py	(revision 26744)
@@ -1,2 +1,6 @@
+# -*- coding: utf-8 -*-
+
+import numpy as np
+
 from checkfield import checkfield
 from WriteData import WriteData
@@ -5,30 +9,39 @@
 
 class frontalforcingsrignot(object):
-    """
-    FRONTAL FORCINGS Rignot class definition
+    """FRONTALFORCINGSRIGNOT class definition
 
-       Usage:
-          frontalforcingsrignot = frontalforcingsrignot()
+    Usage:
+        frontalforcingsrignot = frontalforcingsrignot()
     """
 
-    def __init__(self):  # {{{
-        self.basin = float('NaN')
-        self.numberofbasins = 0.
-        self.subglacial_discharge = float('NaN')
-        self.thermalforcing = float('NaN')
+    def __init__(self, *args):  # {{{
+        self.basin_id = np.nan
+        self.num_basins = 0
+        self.subglacial_discharge = np.nan
+        self.thermalforcing = np.nan
 
-    #set defaults
-        self.setdefaultparameters()
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            error('constructor not supported')
 
     #}}}
 
     def __repr__(self):  # {{{
-        string = '   Frontalforcings parameters:'
-        string = "%s\n%s" % (string, fielddisplay(self, 'basin', 'basin ID for vertices'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'numberofbasins', 'number of basins'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'subglacial_discharge', 'sum of subglacial discharge for each basin [m / d]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'thermalforcing', 'thermal forcing [C]'))
+        s = '   Frontalforcings parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'basin_id', 'basin ID for elements'))
+        s += '{}\n'.format(fielddisplay(self, 'num_basins', 'number of basins'))
+        s += '{}\n'.format(fielddisplay(self, 'subglacial_discharge', 'sum of subglacial discharge for each basin [m/d]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermalforcing', 'thermal forcing [∘C]'))
+        return s
+    #}}}
 
-        return string
+    def setdefaultparameters(self): # {{{
+        self.basin_id = np.nan
+        self.num_basins = 0
+        self.subglacial_discharge = np.nan
+        self.thermalforcing = np.nan
+
+        return self
     #}}}
 
@@ -37,18 +50,13 @@
     #}}}
 
-    def setdefaultparameters(self):  # {{{
-
-        return self
-    #}}}
-
     def checkconsistency(self, md, solution, analyses):  # {{{
-        #Early return
+        # Early return
         if (solution != 'TransientSolution') or (not md.transient.ismovingfront):
             return md
 
-        md = checkfield(md, 'fieldname', 'frontalforcings.basin', '>', 0, 'nan', 1, 'Inf', 1)
-        md = checkfield(md, 'fieldname', 'frontalforcings.numberofbasins', 'numel', [1])
-        md = checkfield(md, 'fieldname', 'frontalforcings.subglacial_discharge', '>=', 0, 'nan', 1, 'Inf', 1, 'timeseries', 1)
-        md = checkfield(md, 'fieldname', 'frontalforcings.thermalforcing', 'nan', 1, 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'frontalforcings.num_basins', 'numel', [1], 'NaN', 1, 'Inf', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'frontalforcings.basin_id', 'Inf', 1, '>=', 0, '<=', md.frontalforcings.num_basins, 'size', [md.mesh.numberofelements])
+        md = checkfield(md, 'fieldname', 'frontalforcings.subglacial_discharge', '>=', 0, 'NaN', 1, 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'frontalforcings.thermalforcing', 'NaN', 1, 'Inf', 1, 'timeseries', 1)
         return md
     # }}}
@@ -56,8 +64,7 @@
     def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'name', 'md.frontalforcings.parameterization', 'data', 2, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'basin', 'format', 'DoubleMat', 'mattype', 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'numberofbasins', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'subglacial_discharge', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'thermalforcing', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1)
-
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'basin_id', 'data', self.basin_id, 'name', 'md.frontalforcings.basin_id', 'format', 'IntMat', 'mattype', 2) # 0-indexed
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'num_basins', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'subglacial_discharge', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'thermalforcing', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
     # }}}
Index: issm/trunk/src/m/classes/frontalforcingsrignotautoregression.m
===================================================================
--- issm/trunk/src/m/classes/frontalforcingsrignotautoregression.m	(revision 26744)
+++ issm/trunk/src/m/classes/frontalforcingsrignotautoregression.m	(revision 26744)
@@ -0,0 +1,89 @@
+%FRONTAL FORCINGS rignot autoregression class definition
+%
+%   Usage:
+%      frontalforcingsrignotautoregression=frontalforcingsrignotautoregression();
+
+classdef frontalforcingsrignotautoregression
+	properties (SetAccess=public) 
+		num_basins           = 0;
+		beta0                = NaN;
+		beta1                = NaN;
+		ar_order             = 0;
+		ar_initialtime       = 0;
+		ar_timestep          = 0;
+		phi                  = NaN;
+		basin_id             = NaN;
+		subglacial_discharge = NaN;
+	end
+	methods
+		function self = frontalforcingsrignot(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				case 1
+					inputstruct=varargin{1};
+					list1 = properties('frontalforcingsrignotautoregression');
+					list2 = fieldnames(inputstruct);
+					for i=1:length(list1)
+						fieldname = list1{i};
+						if ismember(fieldname,list2),
+							self.(fieldname) = inputstruct.(fieldname);
+						end
+					end
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = extrude(self,md) % {{{
+		    % nothing for now
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+
+			self.basin_id             = NaN;
+			self.num_basins           = 0;
+			self.subglacial_discharge = NaN;
+			self.ar_order             = 0.0; %autoregression model of order 0
+
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+			%Early return
+			if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
+
+			md = checkfield(md,'fieldname','frontalforcings.num_basins','numel',1,'NaN',1,'Inf',1,'>',0);
+         md = checkfield(md,'fieldname','frontalforcings.basin_id','Inf',1,'>=',0,'<=',md.frontalforcings.num_basins,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','frontalforcings.subglacial_discharge','>=',0,'NaN',1,'Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','frontalforcings.beta0','NaN',1,'Inf',1,'size',[1,md.frontalforcings.num_basins],'numel',md.frontalforcings.num_basins); 
+         md = checkfield(md,'fieldname','frontalforcings.beta1','NaN',1,'Inf',1,'size',[1,md.frontalforcings.num_basins],'numel',md.frontalforcings.num_basins); 
+         md = checkfield(md,'fieldname','frontalforcings.ar_order','numel',1,'NaN',1,'Inf',1,'>=',0);
+         md = checkfield(md,'fieldname','frontalforcings.ar_initialtime','numel',1,'NaN',1,'Inf',1);
+         md = checkfield(md,'fieldname','frontalforcings.ar_timestep','numel',1,'NaN',1,'Inf',1,'>=',md.timestepping.time_step); %autoregression time step cannot be finer than ISSM timestep
+			md = checkfield(md,'fieldname','frontalforcings.phi','NaN',1,'Inf',1,'size',[md.frontalforcings.num_basins,md.frontalforcings.ar_order]);
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   Frontalforcings parameters:'));
+			fielddisplay(self,'num_basins','number of different basins [unitless]');
+         fielddisplay(self,'basin_id','basin number assigned to each element [unitless]');
+         fielddisplay(self,'subglacial_discharge','sum of subglacial discharge for each basin [m/d]');
+         fielddisplay(self,'beta0','basin-specific intercept values [∘C]');
+         fielddisplay(self,'beta1','basin-specific trend values [∘C yr^(-1)]');
+         fielddisplay(self,'ar_order','order of the autoregressive model [unitless]');
+         fielddisplay(self,'ar_initialtime','initial time assumed in the autoregressive model parameterization [yr]');
+         fielddisplay(self,'ar_timestep','time resolution of the autoregressive model [yr]');
+         fielddisplay(self,'phi','basin-specific vectors of lag coefficients [unitless]');
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			yts=md.constants.yts;
+			WriteData(fid,prefix,'name','md.frontalforcings.parameterization','data',55,'format','Integer');
+			WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','num_basins','format','Integer');
+			WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','subglacial_discharge','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','ar_order','format','Integer');
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','ar_initialtime','format','Double','scale',yts);
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','ar_timestep','format','Double','scale',yts);
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','basin_id','data',self.basin_id-1,'name','md.frontalforcings.basin_id','format','IntMat','mattype',2); %0-indexed
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','beta0','format','DoubleMat','name','md.frontalforcings.beta0');
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','beta1','format','DoubleMat','name','md.frontalforcings.beta1','scale',1./yts,'yts',yts);
+         WriteData(fid,prefix,'object',self,'class','frontalforcings','fieldname','phi','format','DoubleMat','name','md.frontalforcings.phi','yts',yts);
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/frontalforcingsrignotautoregression.py
===================================================================
--- issm/trunk/src/m/classes/frontalforcingsrignotautoregression.py	(revision 26744)
+++ issm/trunk/src/m/classes/frontalforcingsrignotautoregression.py	(revision 26744)
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+
+import numpy as np
+
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+from MatlabFuncs import *
+from WriteData import WriteData
+
+class frontalforcingsrignotautoregression(object):
+    """FRONTALFORCINGSRIGNOTAUTOREGRESSION class definition
+
+    Usage:
+        frontalforcingsrignotautoregression = frontalforcingsrignotautoregression()
+    """
+
+    def __init__(self, *args):  # {{{
+        self.num_basins = 0
+        self.beta0 = np.nan
+        self.beta1 = np.nan
+        self.ar_order = 0
+        self.ar_initialtime = 0
+        self.ar_timestep = 0
+        self.phi = np.nan
+        self.basin_id = np.nan
+        self.subglacial_discharge = np.nan
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            error('constructor not supported')
+
+    def __repr__(self):  # {{{
+        s = '   Frontalforcings parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'num_basins', 'number of different basins [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'basin_id', 'basin number assigned to each element [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'subglacial_discharge', 'sum of subglacial discharge for each basin [m/d]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta0', 'basin-specific intercept values [°C]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta1', 'basin-specific trend values [°C yr^(-1)]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_order', 'order of the autoregressive model [unitless]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_initialtime', 'initial time assumed in the autoregressive model parameterization [yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'ar_timestep', 'time resolution of the autoregressive model [yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'phi', 'basin-specific vectors of lag coefficients [unitless]'))
+        return s
+    #}}}
+
+    def setdefaultparameters(self):  # {{{
+        self.basin_id = np.nan
+        self.num_basins = 0
+        self.subglacial_discharge = np.nan
+        self.ar_order = 0.0 # Autoregression model of order 0
+        return self
+    #}}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Early return
+        if not (solution == 'TransientSolution') or not md.transient.ismovingfront:
+            return md
+
+        md = checkfield(md, 'fieldname', 'frontalforcings.num_basins', 'numel', 1, 'NaN', 1, 'Inf', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'frontalforcings.basin_id', 'Inf', 1, '>=', 0, '<=', md.frontalforcings.num_basins, 'size', [md.mesh.numberofelements])
+        md = checkfield(md, 'fieldname', 'frontalforcings.subglacial_discharge', '>=', 0, 'NaN', 1, 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'frontalforcings.beta0', 'NaN', 1, 'Inf', 1, 'size', [1, md.frontalforcings.num_basins], 'numel', md.frontalforcings.num_basins)
+        md = checkfield(md, 'fieldname', 'frontalforcings.beta1', 'NaN', 1, 'Inf', 1, 'size', [1, md.frontalforcings.num_basins], 'numel', md.frontalforcings.num_basins)
+        md = checkfield(md, 'fieldname', 'frontalforcings.ar_order', 'numel', 1, 'NaN', 1, 'Inf', 1, '>=', 0)
+        md = checkfield(md, 'fieldname', 'frontalforcings.ar_initialtime', 'numel', 1, 'NaN', 1, 'Inf', 1)
+        md = checkfield(md, 'fieldname', 'frontalforcings.ar_timestep', 'numel', 1, 'NaN', 1, 'Inf', 1, '>=', md.timestepping.time_step) # Autoregression time step cannot be finer than ISSM timestep
+        md = checkfield(md, 'fieldname', 'frontalforcings.phi', 'NaN', 1, 'Inf', 1, 'size', [md.frontalforcings.num_basins, md.frontalforcings.ar_order])
+        return md
+    # }}}
+
+    def extrude(self, md):  # {{{
+        # Nothing for now
+        return self
+    # }}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        yts = md.constants.yts
+        WriteData(fid, prefix, 'name', 'md.frontalforcings.parameterization', 'data', 55, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'num_basins', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'subglacial_discharge', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'ar_order', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'ar_initialtime', 'format', 'Double', 'scale', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'ar_timestep', 'format', 'Double', 'scale', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'basin_id', 'data', self.basin_id, 'name', 'md.frontalforcings.basin_id', 'format', 'IntMat', 'mattype', 2) # 0-indexed
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'beta0', 'format', 'DoubleMat', 'name', 'md.frontalforcings.beta0')
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'beta1', 'format', 'DoubleMat', 'name', 'md.frontalforcings.beta1', 'scale', 1 / yts, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'class', 'frontalforcings', 'fieldname', 'phi', 'format', 'DoubleMat', 'name', 'md.frontalforcings.phi', 'yts', yts)
+    # }}}
Index: issm/trunk/src/m/classes/geometry.js
===================================================================
--- issm/trunk/src/m/classes/geometry.js	(revision 25994)
+++ issm/trunk/src/m/classes/geometry.js	(revision 26744)
@@ -30,5 +30,5 @@
 
 			if ((solution=='TransientSolution' & md.trans.isgia) | (solution=='GiaSolution')){
-				checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'Inf',1);
+				checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'Inf',1,'>=',0);
 			}
 			else{
@@ -38,5 +38,5 @@
 				for(var i=0;i<md.mesh.numberofvertices;i++){
 					if (Math.abs(md.geometry.thickness[i]-md.geometry.surface[i]+md.geometry.base[i])>Math.pow(10,9)){
-						md = checkmessage(md,'equality thickness=surface-base violated');
+						checkmessage(md,'equality thickness=surface-base violated');
 						break;
 					}
@@ -48,6 +48,13 @@
 		} // }}}
 		this.marshall=function(md,prefix,fid) { //{{{
+			let length_thickness=size(this.thickness,0);
+			if (length_thickness==md.mesh.numberofvertices || length_thickness==md.mesh.numberofvertices+1) {
+				WriteData(fid,prefix,'object',this,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			} else if (length_thickness==md.mesh.numberofelements || length_thickness==md.mesh.numberofelements+1) {
+				WriteData(fid,prefix,'object',this,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			} else {
+				error('geometry thickness time series should be a vertex or element time series');
+			}
 			WriteData(fid,prefix,'object',this,'fieldname','surface','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',this,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',this,'fieldname','base','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','bed','format','DoubleMat','mattype',1);
Index: issm/trunk/src/m/classes/geometry.m
===================================================================
--- issm/trunk/src/m/classes/geometry.m	(revision 25994)
+++ issm/trunk/src/m/classes/geometry.m	(revision 26744)
@@ -33,11 +33,4 @@
 	end
 	methods
-		function self = extrude(self,md) % {{{
-			self.surface=project3d(md,'vector',self.surface,'type','node');
-			self.thickness=project3d(md,'vector',self.thickness,'type','node');
-			self.hydrostatic_ratio=project3d(md,'vector',self.hydrostatic_ratio,'type','node');
-			self.base=project3d(md,'vector',self.base,'type','node');
-			self.bed=project3d(md,'vector',self.bed,'type','node');
-		end % }}}
 		function self = geometry(varargin) % {{{
 			switch nargin
@@ -53,10 +46,5 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if (strcmp(solution,'TransientSolution') & md.transient.isgia) | strcmp(solution,'GiaSolution'),
-				md = checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'Inf',1);
-			elseif strcmpi(solution,'SealevelriseSolution'),
-				md = checkfield(md,'fieldname','geometry.bed','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
-				return;
-			elseif strcmpi(solution,'LoveSolution'),
+			if strcmpi(solution,'LoveSolution'),
 				return; 
 			else
@@ -90,9 +78,24 @@
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
+			length_thickness=size(self.thickness,1);
+			if length_thickness==md.mesh.numberofvertices | length_thickness==md.mesh.numberofvertices+1,
+				WriteData(fid,prefix,'object',self,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			elseif length_thickness==md.mesh.numberofelements | length_thickness==md.mesh.numberofelements+1,
+				WriteData(fid,prefix,'object',self,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			else
+				error('geometry thickness time series should be a vertex or element time series');
+			end
+
 			WriteData(fid,prefix,'object',self,'fieldname','surface','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'fieldname','base','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',self,'fieldname','bed','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1);
+		end % }}}
+		function self = extrude(self,md) % {{{
+			self.surface=project3d(md,'vector',self.surface,'type','node');
+			self.thickness=project3d(md,'vector',self.thickness,'type','node');
+			self.hydrostatic_ratio=project3d(md,'vector',self.hydrostatic_ratio,'type','node');
+			self.base=project3d(md,'vector',self.base,'type','node');
+			self.bed=project3d(md,'vector',self.bed,'type','node');
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
Index: issm/trunk/src/m/classes/geometry.py
===================================================================
--- issm/trunk/src/m/classes/geometry.py	(revision 25994)
+++ issm/trunk/src/m/classes/geometry.py	(revision 26744)
@@ -14,5 +14,5 @@
     """
 
-    def __init__(self, *args): #{{{
+    def __init__(self, *args):  # {{{
         self.surface = np.nan
         self.thickness = np.nan
@@ -21,12 +21,11 @@
         self.hydrostatic_ratio = np.nan
 
-        nargs = len(args)
-        if nargs == 0:
+        if len(args) == 0:
             self.setdefaultparameters()
         else:
             raise Exception('constructor not supported')
-    #}}}
+    # }}}
 
-    def __repr__(self): #{{{
+    def __repr__(self):  # {{{
         s = '   geometry parameters:\n'
         s += '{}\n'.format(fielddisplay(self, 'surface', 'ice upper surface elevation [m]'))
@@ -35,7 +34,46 @@
         s += '{}\n'.format(fielddisplay(self, 'bed', 'bed elevation [m]'))
         return s
-    #}}}
+    # }}}
 
-    def extrude(self, md): #{{{
+    def setdefaultparameters(self):  # {{{
+        return
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if solution == 'LoveSolution':
+            return md
+        else:
+            md = checkfield(md, 'fieldname', 'geometry.surface', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+            md = checkfield(md, 'fieldname', 'geometry.base', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+            md = checkfield(md, 'fieldname', 'geometry.thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>=', 0)
+            if any(abs(self.thickness - self.surface + self.base) > 1e-9):
+                md.checkmessage('equality thickness = surface-base violated')
+            if solution == 'TransientSolution' and md.transient.isgroundingline:
+                md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+                if np.any(self.bed - self.base > 1e-12):
+                    md.checkmessage('base < bed on one or more vertex')
+                pos = np.where(md.mask.ocean_levelset > 0)
+                if np.any(np.abs(self.bed[pos] - self.base[pos]) > 1e-9):
+                    md.checkmessage('equality base = bed on grounded ice violated')
+                md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+        return md
+    # }}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        length_thickness = len(self.thickness)
+        if (length_thickness == md.mesh.numberofvertices) or (length_thickness == md.mesh.numberofvertices + 1):
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+        elif (length_thickness == md.mesh.numberofelements) or (length_thickness == md.mesh.numberofelements + 1):
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts)
+        else:
+            raise RuntimeError('geometry thickness time series should be a vertex or element time series')
+
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'surface', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'base', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'bed', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'hydrostatic_ratio', 'format', 'DoubleMat', 'mattype', 1)
+    # }}}
+
+    def extrude(self, md):  # {{{
         self.surface = project3d(md, 'vector', self.surface, 'type', 'node')
         self.thickness = project3d(md, 'vector', self.thickness, 'type', 'node')
@@ -44,40 +82,3 @@
         self.bed = project3d(md, 'vector', self.bed, 'type', 'node')
         return self
-    #}}}
-
-    def setdefaultparameters(self): #{{{
-        return self
-    #}}}
-
-    def checkconsistency(self, md, solution, analyses): #{{{
-        if (solution == 'TransientSolution' and md.transient.isgia) or (solution == 'GiaSolution'):
-            md = checkfield(md, 'fieldname', 'geometry.thickness', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
-        elif solution == 'SealevelriseSolution':
-            md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-        elif solution == 'LoveSolution':
-            return
-        else:
-            md = checkfield(md, 'fieldname', 'geometry.surface', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-            md = checkfield(md, 'fieldname', 'geometry.base', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-            md = checkfield(md, 'fieldname', 'geometry.thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>', 0, 'timeseries', 1)
-            if any(abs(self.thickness - self.surface + self.base) > 10**-9):
-                md.checkmessage("equality thickness = surface-base violated")
-            if solution == 'TransientSolution' and md.transient.isgroundingline:
-                md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-                if np.any(self.bed - self.base > 10**-12):
-                    md.checkmessage('base < bed on one or more vertex')
-                pos = np.where(md.mask.ocean_levelset > 0)
-                if np.any(np.abs(self.bed[pos] - self.base[pos]) > 10**-9):
-                    md.checkmessage('equality base = bed on grounded ice violated')
-                md = checkfield(md, 'fieldname', 'geometry.bed', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-
-        return md
     # }}}
-
-    def marshall(self, prefix, md, fid): #{{{
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'surface', 'format', 'DoubleMat', 'mattype', 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'base', 'format', 'DoubleMat', 'mattype', 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'bed', 'format', 'DoubleMat', 'mattype', 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'hydrostatic_ratio', 'format', 'DoubleMat', 'mattype', 1)
-    # }}}
Index: issm/trunk/src/m/classes/giaivins.js
===================================================================
--- issm/trunk/src/m/classes/giaivins.js	(revision 25994)
+++ 	(revision )
@@ -1,64 +1,0 @@
-//GIA class definition for Ivins and James model 
-//
-//   Usage:
-//      giaivins=new giaivins();
-
-function giaivins (){
-	//methods
-	this.setdefaultparameters = function(){// {{{
-
-		this.cross_section_shape=1; //square as default (see iedge in GiaDeflectionCorex)
-	
-	}// }}}
-	this.disp= function(){// {{{
-
-		console.log(sprintf('   giaivins parameters:'));
-
-		fielddisplay(this,'mantle_viscosity','mantle viscosity[Pa s]');
-		fielddisplay(this,'lithosphere_thickness','lithosphere thickness (km)');
-		fielddisplay(this,'cross_section_shape','1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore');
-
-	}// }}}
-	this.classname= function(){// {{{
-		return "giaivins";
-	}// }}}
-	this.checkconsistency = function(md,solution,analyses) { // {{{
-
-		if(!ArrayAnyEqual(ArrayIsMember('GiaAnalysis',analyses),1))return;
-
-		checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1],'>',0);
-		checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1],'>',0);
-		checkfield(md,'fieldname','gia.cross_section_shape','numel',[1],'values',[1,2]);
-
-		//be sure that if we are running a masstransport ice flow model coupled with giaivins, that thickness forcings 
-		//are not provided into the future.
-		if (solution=='TransientSolution' & md.trans.ismasstransport & md.trans.isgia){
-			//figure out if thickness is a transient forcing: 
-			if (md.geometry.thickness.length == (md.mesh.numberofvertices+1)){
-				//recover the furthest time "in time": 
-				t=md.geometry.thickness[0].length;
-				if(md.geometry.thickness[md.geometry.thickness.length-1][t-1]!=md.timestepping.start_time){
-					md.checkmessage('if ismasstransport is on, transient thickness forcing for the giaivins model should not be provided in the future. Synchronize your start_time to correspond to the most recent transient thickness forcing timestep');
-				}
-			}
-		}
-	} // }}}
-		this.marshall=function(md,prefix,fid) { //{{{
-			WriteData(fid,prefix,'object',this,'fieldname','mantle_viscosity','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',this,'fieldname','lithosphere_thickness','format','DoubleMat','mattype',1,'scale',Math.pow(10,3)); //from km to m
-			WriteData(fid,prefix,'object',this,'fieldname','cross_section_shape','format','Integer');
-		}//}}}
-		this.fix=function() { //{{{
-			this.mantle_viscosity=NullFix(this.mantle_viscosity,NaN);
-			this.lithosphere_thickness=NullFix(this.lithosphere_thickness,NaN);
-		}//}}}
-	//properties 
-	// {{{
-
-	this.mantle_viscosity              = NaN;
-	this.lithosphere_thickness         = NaN;
-	this.cross_section_shape           = 0;
-
-	this.setdefaultparameters();
-	//}}}
-}
Index: issm/trunk/src/m/classes/giaivins.m
===================================================================
--- issm/trunk/src/m/classes/giaivins.m	(revision 25994)
+++ 	(revision )
@@ -1,73 +1,0 @@
-%GIA class definition for Ivins and James model 
-%
-%   Usage:
-%      giaivins=giaivins();
-
-classdef giaivins
-	properties (SetAccess=public) 
-		mantle_viscosity              = NaN;
-		lithosphere_thickness         = NaN;
-		cross_section_shape           = 0;
-	end
-	methods
-		function self = giaivins(varargin) % {{{
-			switch nargin
-				case 0
-					self=setdefaultparameters(self);
-				otherwise
-					error('constructor not supported');
-			end
-		end % }}}
-		function self = setdefaultparameters(self) % {{{
-		self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex)
-		end % }}}
-		function md = checkconsistency(self,md,solution,analyses) % {{{
-
-			if ~ismember('GiaAnalysis',analyses), return; end
-			md = checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
-			md = checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
-			md = checkfield(md,'fieldname','gia.cross_section_shape','numel',[1],'values',[1,2]);
-
-			%be sure that if we are running a masstransport ice flow model coupled with giaivins, that thickness forcings 
-			%are not provided into the future.
-			if strcmp(solution,'TransientSolution') & md.transient.ismasstransport & md.transient.isgia,
-				%figure out if thickness is a transient forcing: 
-				if size(md.geometry.thickness,1)==md.mesh.numberofvertices+1,
-					%recover the furthest time "in time": 
-					if(md.geometry.thickness(end,end)~=md.timestepping.start_time),
-						md = checkmessage(md,['if ismasstransport is on, transient thickness forcing'...
-							' for the giaivins model should not be provided in the future.'...
-							' Synchronize your start_time to correspond to the most recent transient'...
-							' thickness forcing timestep']);
-					end
-				end
-			end
-
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   giaivins parameters:'));
-
-			fielddisplay(self,'mantle_viscosity','mantle viscosity[Pa s]');
-			fielddisplay(self,'lithosphere_thickness','lithosphere thickness (km)');
-			fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore');
-
-		end % }}}
-		function marshall(self,prefix,md,fid) % {{{
-			WriteData(fid,prefix,'name','md.gia.model','data',1,'format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','mantle_viscosity','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','lithosphere_thickness','format','DoubleMat','mattype',1,'scale',10^3); %from km to m
-			WriteData(fid,prefix,'object',self,'fieldname','cross_section_shape','format','Integer');
-		end % }}}
-		function savemodeljs(self,fid,modelname) % {{{
-		
-			writejsdouble(fid,[modelname '.gia.mantle_viscosity'],self.mantle_viscosity);
-			writejsdouble(fid,[modelname '.gia.lithosphere_thickness'],self.lithosphere_thickness);
-			writejsdouble(fid,[modelname '.gia.cross_section_shape'],self.cross_section_shape);
-
-		end % }}}
-		function self = extrude(self,md) % {{{
-			self.mantle_viscosity=project3d(md,'vector',self.mantle_viscosity,'type','node');
-			self.lithosphere_thickness=project3d(md,'vector',self.lithosphere_thickness,'type','node');
-		end % }}}
-	end
-end
Index: issm/trunk/src/m/classes/giaivins.py
===================================================================
--- issm/trunk/src/m/classes/giaivins.py	(revision 25994)
+++ 	(revision )
@@ -1,72 +1,0 @@
-import numpy as np
-
-from checkfield import checkfield
-from fielddisplay import fielddisplay
-from project3d import project3d
-from WriteData import WriteData
-
-
-class giaivins(object):
-    """GIA class definition for Ivins and James model
-
-    Usage:
-        giaivins = giaivins()
-    """
-
-    def __init__(self, *args): #{{{
-        self.mantle_viscosity       = np.nan
-        self.lithosphere_thickness  = np.nan
-        self.cross_section_shape    = 0
-
-        nargin = len(args)
-        if nargin == 0:
-            self.setdefaultparameters()
-        else:
-            raise Exception('constructor not supported')
-    #}}}
-
-    def __repr__(self): #{{{
-        s = '   giaivins parameters:\n'
-        s += '{}\n'.format(fielddisplay(self, 'mantle_viscosity', 'mantle viscosity [Pa s]'))
-        s += '{}\n'.format(fielddisplay(self, 'lithosphere_thickness', 'lithosphere thickness (km)'))
-        s += '{}\n'.format(fielddisplay(self, 'cross_section_shape', "1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore"))
-        return s
-    #}}}
-
-    def setdefaultparameters(self): #{{{
-        self.cross_section_shape = 1
-        return self
-    #}}}
-
-    def checkconsistency(self, md, solution, analyses): #{{{
-        if 'GiaAnalysis' not in analyses:
-            return md
-
-        md = checkfield(md, 'fieldname', 'gia.mantle_viscosity', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>', 0)
-        md = checkfield(md, 'fieldname', 'gia.lithosphere_thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>', 0)
-        md = checkfield(md, 'fieldname', 'gia.cross_section_shape', 'numel', [1], 'values', [1, 2])
-
-        # Be sure that if we are running a masstransport ice flow model coupled 
-        # with giaivins, that thickness forcings are not provided into the 
-        # future.
-        if solution == 'TransientSolution' and md.transient.ismasstransport and md.transient.isgia:
-            # Figure out if thickness is a transient forcing
-            if md.geometry.thickness.shape[0] == md.mesh.numberofvertices + 1:
-                # Recover the furthest time "in time"
-                if md.geometry.thickness[-1, -1] != md.timestepping.start_time:
-                    md.checkmessage('if masstransport is on, transient thickness forcing for the giaivins model should not be provided in the future. Synchronize your start_time to correspond to the most recent transient thickness forcing timestep')
-        return md
-    #}}}
-
-    def marshall(self, prefix, md, fid): #{{{
-        WriteData(fid, prefix, 'name', 'md.gia.model', 'data', 1, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'mantle_viscosity', 'format', 'DoubleMat', 'mattype', 1)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'lithosphere_thickness', 'format', 'DoubleMat', 'mattype', 1, 'scale', 10.**3.)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'cross_section_shape', 'format', 'Integer')
-    #}}}
-
-    def extrude(self, md): #{{{
-        self.mantle_viscosity = project3d(md, 'vector', self.mantle_viscosity, 'type', 'node')
-        self.lithosphere_thickness = project3d(md, 'vector', self.lithosphere_thickness, 'type', 'node')
-        return self
-    #}}}
Index: issm/trunk/src/m/classes/giamme.m
===================================================================
--- issm/trunk/src/m/classes/giamme.m	(revision 25994)
+++ 	(revision )
@@ -1,77 +1,0 @@
-%GIAMME class definition
-%
-%   Usage:
-%      gia=giamme(); %gia class based on a multi-model 
-%                     ensemble  (ex: Caron et al 2017 statistics)
-
-classdef giamme
-	properties (SetAccess=public) 
-
-		modelid; %index into the multi-model ensemble
-		Ngia;  %geoid ensemble
-		Ugia;  %uplift ensemble
-
-	end
-	methods
-		function self = giamme(varargin) % {{{
-			switch nargin
-				case 0
-					self=setdefaultparameters(self);
-				case 1
-					self=structtoobj(gia(),varargin{1});
-				otherwise
-					error('constructor not supported');
-			end
-		end % }}}
-		function self = setdefaultparameters(self) % {{{
-
-			self.modelid=0;
-			self.Ngia=[];
-			self.Ugia=[];
-
-		end % }}}
-		function md = checkconsistency(self,md,solution,analyses) % {{{
-
-			%Early return
-			if ~ismember('SealevelriseAnalysis',analyses), return; end
-			if (strcmp(solution,'TransientSolution') & md.transient.isslr == 0), return; end
-			md = checkfield(md,'field',self.Ngia,'NaN',1,'Inf',1);
-			md = checkfield(md,'field',self.Ugia,'NaN',1,'Inf',1);
-			md = checkfield(md,'field',self.modelid,'NaN',1,'Inf',1,'>=',0,'<=',length(self.Ngia));
-		end % }}}
-		function disp(self) % {{{
-
-			disp(sprintf('   gia mme parameters:'));
-			fielddisplay(self,'modelid','index into the multi-model ensemble, determines which field will be used.');
-			fielddisplay(self,'Ngia','geoid (mm/yr).');
-			fielddisplay(self,'Ugia','uplift (mm/yr).');
-		end % }}}
-		function marshall(self,prefix,md,fid) % {{{
-			WriteData(fid,prefix,'name','md.gia.model','data',3,'format','Integer');
-			if size(self.Ngia,2)==0,
-				WriteData(fid,prefix,'data',zeros(md.mesh.numberofvertices,1),'format','DoubleMat','mattype',1,'name','md.gia.Ngia');
-				WriteData(fid,prefix,'data',zeros(md.mesh.numberofvertices,1),'format','DoubleMat','mattype',1,'name','md.gia.Ugia');
-				WriteData(fid,prefix,'data',1,'name','md.gia.modelid','format','Double');
-				WriteData(fid,prefix,'name','md.gia.nummodels','data',1,'format','Integer');
-			else
-				WriteData(fid,prefix,'object',self,'fieldname','Ngia','format','DoubleMat','scale',1/1000/md.constants.yts);
-				WriteData(fid,prefix,'object',self,'fieldname','Ugia','format','DoubleMat','scale',1/1000/md.constants.yts);
-				WriteData(fid,prefix,'object',self,'fieldname','modelid','format','Double');
-				WriteData(fid,prefix,'name','md.gia.nummodels','data',size(self.Ngia,2),'format','Integer');
-			end
-		end % }}}
-		function savemodeljs(self,fid,modelname) % {{{
-			
-			writejsdouble(fid,[modelname '.gia.modelid'],self.modelid);
-			writejscellarray(fid,[modelname '.gia.Ngia'],self.Ngia);
-			writejscellarray(fid,[modelname '.gia.Ugia'],self.Ugia);
-
-		end % }}}
-		function self = extrude(self,md) % {{{
-			for i=1:length(self.Ngia),
-				self.Ngia{i}=project3d(md,'vector',self.Ngia{i},'type','node','layer',1);
-				self.Ugia{i}=project3d(md,'vector',self.Ugia{i},'type','node','layer',1);
-			end
-		end % }}}
-	end
-end
Index: issm/trunk/src/m/classes/giamme.py
===================================================================
--- issm/trunk/src/m/classes/giamme.py	(revision 25994)
+++ 	(revision )
@@ -1,72 +1,0 @@
-import numpy as np
-
-from checkfield import checkfield
-from fielddisplay import fielddisplay
-from project3d import project3d
-from WriteData import WriteData
-
-
-class giamme(object):
-    """GIAMME class definition
-
-    Usage:
-        gia = giamme() #gia class based on a multi-model ensemble (ex: Caron et al 2017 statistics)
-    """
-
-    def __init__(self, *args): #{{{
-        self.modelid    = 0 #index into the multi-model ensemble
-        self.Ngia       = [] #geoid ensemble
-        self.Ugia       = [] #uplift ensemble
-        
-        nargin = len(args)
-
-        if nargin == 0:
-            self.setdefaultparameters()
-        else:
-            raise Exception('constructor not supported')
-    #}}}
-
-    def __repr__(self): # {{{
-        s = '   gia mme parameters:\n'
-        s += '{}\n'.format(fielddisplay(self, 'modelid', 'index into the multi-model ensemble, determines which field will be used.'))
-        s += '{}\n'.format(fielddisplay(self, 'Ngia', 'geoid (mm/yr).'))
-        s += '{}\n'.format(fielddisplay(self, 'Ugia', 'uplift (mm/yr).'))
-        return s
-    #}}}
-
-    def setdefaultparameters(self): # {{{
-        return self
-    #}}}
-
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if 'SealevelriseAnalysis' not in analyses:
-            return md
-        if solution == 'TransientSolution' and not md.transient.isslr:
-            return md
-        md = checkfield(md, 'field', self.Ngia, 'NaN', 1, 'Inf', 1)
-        md = checkfield(md, 'field', self.Ugia, 'NaN', 1, 'Inf', 1)
-        md = checkfield(md, 'field', self.modelid, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', len(self.Ngia))
-        return md
-    #}}}
-
-    def marshall(self, prefix, md, fid): #{{{
-        WriteData(fid, prefix, 'name', 'md.gia.model', 'data', 3, 'format', 'Integer')
-
-        if isinstance(self.Ngia, list) or self.Ngia.ndim == 1: #list or 1D numpy.ndarray
-            WriteData(fid, prefix, 'data', np.zeros((md.mesh.numberofvertices, 1)), 'format', 'DoubleMat', 'mattype', 1, 'name', 'md.gia.Ngia')
-            WriteData(fid, prefix, 'data', np.zeros((md.mesh.numberofvertices, 1)), 'format', 'DoubleMat', 'mattype', 1, 'name', 'md.gia.Ugia')
-            WriteData(fid, prefix, 'data', 1, 'name', 'md.gia.modelid', 'format', 'Double')
-            WriteData(fid, prefix, 'name', 'md.gia.nummodels', 'data', 1, 'format', 'Integer')
-        else: #2D numpy.ndarray
-            WriteData(fid, prefix, 'object ', self, 'fieldname', 'Ngia', 'format', 'DoubleMat', 'scale', 1 / 1000 / md.constants.yts)
-            WriteData(fid, prefix, 'object ', self, 'fieldname', 'Ugia', 'format', 'DoubleMat', 'scale', 1 / 1000 / md.constants.yts)
-            WriteData(fid, prefix, 'object ', self, 'fieldname', 'modelid', 'format', 'Double')
-            WriteData(fid, prefix, 'name', 'md.gia.nummodels', 'data', self.Ngia.shape[1],'format', 'Integer') #NOTE: <<numpy.ndarray>>.shape[1] gives length of second dimension
-    #}}}
-
-    def extrude(self, md): #{{{
-        for i in range(len(self.Ngia)):
-            self.Ngia[i] = project3d(md, 'vector', self.Ngia[i], 'type', 'node', 'layer', 1)
-            self.Ugia[i] = project3d(md, 'vector', self.Ugia[i], 'type', 'node', 'layer', 1)
-        return self
-    #}}}
Index: issm/trunk/src/m/classes/groundingline.js
===================================================================
--- issm/trunk/src/m/classes/groundingline.js	(revision 25994)
+++ issm/trunk/src/m/classes/groundingline.js	(revision 26744)
@@ -8,7 +8,7 @@
 	this.setdefaultparameters = function(){// {{{
 		//Type of migration
-		this.migration='AggressiveMigration';
-		this.friction_interpolation='SubelementFriction1';
-		this.melt_interpolation='NoMeltOnPartiallyFloating';
+		this.migration				= 'SubelementMigration';
+		this.friction_interpolation	= 'SubelementFriction1';
+		this.melt_interpolation		= 'NoMeltOnPartiallyFloating';
 
 	}// }}}
@@ -29,15 +29,15 @@
 			checkfield(md,'fieldname','groundingline.melt_interpolation','values',['NoMeltOnPartiallyFloating', 'SubelementMelt1', 'SubelementMelt2', 'FullMeltOnPartiallyFloating']);
 
-			if(this.migration !='None' & md.trans.isgroundingline==1 & solution == 'TransientSolution'){
+			if (this.migration !='None'){
 				if (isNaN(md.geometry.bed)){
 					md.checkmessage('requesting grounding line migration, but bathymetry is absent!');
 				}
 				for (var i=0;i<md.mesh.numberofvertices;i++){
-					if(md.mask.ocean_levelset[i]>0){
+					if(md.mask.groundedice_levelset[i]>0){
 						md.checkmessage('base not equal to bed on grounded ice!');
 						break;
 					}
 					if(md.geometry.bed[i] - md.geometry.base[i] > Math.pow(10,-9)){
-						md = checkmessage(md,'bed superior to base on floating ice!');
+						checkmessage(md,'bed superior to base on floating ice!');
 						break;
 					}
@@ -47,6 +47,6 @@
 		this.marshall=function(md,prefix,fid) { //{{{
 			WriteData(fid,prefix,'data',this.migration,'name','md.groundingline.migration','format','String');
-			WriteData(fid,prefix,'data',this.migration,'name','md.groundingline.friction_interpolation','format','String');
-			WriteData(fid,prefix,'data',this.migration,'name','md.groundingline.melt_interpolation','format','String');
+			WriteData(fid,prefix,'data',this.friction_interpolation,'name','md.groundingline.friction_interpolation','format','String');
+			WriteData(fid,prefix,'data',this.melt_interpolation,'name','md.groundingline.melt_interpolation','format','String');
 		}//}}}
 		this.fix=function() { //{{{
Index: issm/trunk/src/m/classes/groundingline.py
===================================================================
--- issm/trunk/src/m/classes/groundingline.py	(revision 25994)
+++ issm/trunk/src/m/classes/groundingline.py	(revision 26744)
@@ -1,7 +1,7 @@
 import numpy as np
+from checkfield import checkfield
 from fielddisplay import fielddisplay
-from checkfield import checkfield
+import MatlabFuncs as m
 from WriteData import WriteData
-import MatlabFuncs as m
 
 
@@ -19,21 +19,19 @@
         self.melt_interpolation = ''
 
-    #set defaults
+        # Set defaults
         self.setdefaultparameters()
 
-    #}}}
+    # }}}
 
     def __repr__(self):  # {{{
-        string = '   grounding line migration parameters:'
-
-        string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of grounding line migration: ''SoftMigration'', ''SubelementMigration'', ''AggressiveMigration'', ''Contact'', ''None'''))
-        string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of friction interpolation on partially floating elements: ''SubelementFriction1'', ''SubelementFriction2'', ''NoFrictionOnPartiallyFloating'''))
-        string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of melt interpolation on partially floating elements: ''SubelementMelt1'', ''SubelementMelt2'', ''NoMeltOnPartiallyFloating'', ''FullMeltOnPartiallyFloating'''))
-        return string
-    #}}}
+        s = '   grounding line migration parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'migration', 'type of grounding line migration: \'SoftMigration\', \'SubelementMigration\', \'AggressiveMigration\', \'Contact\', \'None\''))
+        s += '{}\n'.format(fielddisplay(self, 'migration', 'type of friction interpolation on partially floating elements: ''SubelementFriction1'', ''SubelementFriction2'', ''NoFrictionOnPartiallyFloating'''))
+        s += '{}\n'.format(fielddisplay(self, 'migration', 'type of melt interpolation on partially floating elements: \'SubelementMelt1\', \'SubelementMelt2\', \'NoMeltOnPartiallyFloating\', \'FullMeltOnPartiallyFloating\''))
+        return s
+    # }}}
 
     def setdefaultparameters(self):  # {{{
-
-        #Type of migration
+        # Type of migration
         self.migration = 'SubelementMigration'
         self.friction_interpolation = 'SubelementFriction1'
@@ -41,8 +39,7 @@
 
         return self
-    #}}}
+    # }}}
 
     def checkconsistency(self, md, solution, analyses):  # {{{
-
         md = checkfield(md, 'fieldname', 'groundingline.migration', 'values', ['None', 'SubelementMigration', 'AggressiveMigration', 'SoftMigration', 'Contact', 'GroundingOnly'])
         md = checkfield(md, 'fieldname', 'groundingline.friction_interpolation', 'values', ['SubelementFriction1', 'SubelementFriction2', 'NoFrictionOnPartiallyFloating'])
@@ -53,7 +50,7 @@
                 md.checkmessage("requesting grounding line migration, but bathymetry is absent!")
             pos = np.nonzero(md.mask.ocean_levelset > 0.)[0]
-            if any(np.abs(md.geometry.base[pos] - md.geometry.bed[pos]) > 10**-10):
+            if any(np.abs(md.geometry.base[pos] - md.geometry.bed[pos]) > pow(10, -10)):
                 md.checkmessage("base not equal to bed on grounded ice!")
-            if any(md.geometry.bed - md.geometry.base > 10**-9):
+            if any(md.geometry.bed - md.geometry.base > pow(10, -9)):
                 md.checkmessage("bed superior to base on floating ice!")
 
Index: issm/trunk/src/m/classes/hydrologydc.py
===================================================================
--- issm/trunk/src/m/classes/hydrologydc.py	(revision 25994)
+++ issm/trunk/src/m/classes/hydrologydc.py	(revision 26744)
@@ -7,9 +7,8 @@
 
 class hydrologydc(object):
-    """
-    Hydrologydc class definition
+    """HYDROLOGYDC class definition
 
     Usage:
-            hydrologydc = hydrologydc()
+        hydrologydc = hydrologydc()
     """
 
@@ -49,9 +48,12 @@
         self.eplflip_lock = 0
 
-    #set defaults
         self.setdefaultparameters()
     # }}}
 
     def __repr__(self):  # {{{
+        # TODO:
+        # - Convert all formatting to calls to <string>.format (see any 
+        #   already converted <class>.__repr__ method for examples)
+        #
         string = '   hydrology Dual Porous Continuum Equivalent parameters:'
         string = ' - general parameters'
Index: issm/trunk/src/m/classes/hydrologyshreve.js
===================================================================
--- issm/trunk/src/m/classes/hydrologyshreve.js	(revision 25994)
+++ issm/trunk/src/m/classes/hydrologyshreve.js	(revision 26744)
@@ -1,73 +1,74 @@
-//HYDROLOGYSHREVE class definition
-//
-//   Usage:
-//      hydrologyshreve=new hydrologyshreve();
+class hydrologyshreve {//{{{
+	/**
+	 * HYDROLOGYSHREVE class definition
+	 *
+	 * Usage:
+	 *     hydrologyshreve = hydrologyshreve();
+	 */
+	constructor() {//{{{
+		this.spcwatercolumn = NaN;
+		this.stabilization = 0;
+		this.requested_outputs = [];
 
-function hydrologyshreve (){
-	//methods
-	this.setdefaultparameters = function(){// {{{
+		if (arguments.length == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
 
-		//Type of stabilization to use 0:nothing 1:artificial_diffusivity
-		this.stabilization=1;
+	disp() {//{{{
+		console.log(sprintf('   hydrologyshreve solution parameters:'));
+		fielddisplay(this, 'spcwatercolumn', 'water thickness constraints (NaN means no constraint) [m]');
+		fielddisplay(this, 'stabilization', 'artificial diffusivity (default: 1). can be more than 1 to increase diffusivity.');
+		fielddisplay(this, 'requested_outputs', 'additional outputs requested');
+	} //}}}
 
-		//default output
-		this.requested_outputs=['default'];
+	setdefaultparameters() {//{{{
+		// Type of stabilization to use 0:nothing 1:artificial_diffusivity
+		this.stabilization = 1;
+		this.requested_outputs = ['default'];
+	} //}}}
 
-	}// }}}
-		this.disp= function(){// {{{
+	checkconsistency(md, solution, analyses) {//{{{
+		// Early return
+		if (!analyses.contains('HydrologyShreveAnalysis') || (solution == 'TransientSolution' && !md.transient.ishydrology)) {
+			return md;
+		}
+		md = checkfield(md, 'fieldname', 'hydrology.spcwatercolumn', 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'hydrology.stabilization', '>=', 0);
+		return md;
+	} //}}}
 
-		console.log(sprintf('   hydrologyshreve solution parameters:'));
-		fielddisplay(this,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
-		fielddisplay(this,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
-		fielddisplay(this,'requested_outputs','additional outputs requested');
+	defaultoutputs(md) {//{{{
+		return ['Watercolumn', 'HydrologyWaterVx', 'HydrologyWaterVy'];
+	} //}}}
 
-	}// }}}
-    this.extrude = function(md) {//{{{
-        return this;
-    };//}}}
-		this.classname= function(){// {{{
-			return "hydrologyshreve";
+	marshall(md, prefix, fid) {//{{{
+		WriteData(fid, prefix, 'name', 'md.hydrology.model', 'data', 2, 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'spcwatercolumn', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'stabilization', 'format', 'Double');
 
-		}// }}}
-	this.type= function(){// {{{
+		// Process requested outputs
+		let outputs = this.requested_outputs;
+		let pos = find(ismember(outputs, 'default'));
+		if (pos.length) {
+			/*
+			NOTE: In order to handle case where user has added 'default' more 
+			than once to this.requested_outputs, need to remove elements by 
+			index in reverse order.
+			*/
+			for (let i = (pos.length - 1); i >= 0; --i) {
+				outputs.splice(pos[i], 1);
+			}
+			let default_outputs = this.defaultoutputs(md);
+			for (let i = 0; i < default_outputs.length; ++i) {
+				outputs.push(default_outputs[i]);
+			}
+		}
+		WriteData(fid, prefix, 'data', outputs, 'name', 'md.hydrology.requested_outputs', 'format', 'StringArray');
+	} //}}}
 
-		return "hydrologyshreve";
-	}// }}}
-		this.checkconsistency = function(md,solution,analyses) { //{{{
-
-			//Early return
-			if(!ArrayAnyEqual(ArrayIsMember('HydrologyShreveAnalysis',analyses),1)) return;
-
-			checkfield(md,'fieldname','hydrology.spcwatercolumn','Inf',1,'timeseries',1);
-			checkfield(md,'fieldname','hydrology.stabilization','>=',0);
-			checkfield(md,'fieldname','hydrology.requested_outputs','stringrow',1);
-
-		} // }}}
-		this.marshall=function(md,prefix,fid) { //{{{
-			WriteData(fid,prefix,'name','md.hydrology.model','data',2,'format','Integer');
-			WriteData(fid,prefix,'object',this,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',this,'fieldname','stabilization','format','Double');
-			var outputs = this.requested_outputs;
-			for (var i=0;i<outputs.length;i++){
-				if (outputs[i] == 'default') {
-					outputs.splice(i,1);
-					var newoutputs=this.defaultoutputs(md);
-					for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
-				}
-			}
-			WriteData(fid,prefix,'data',outputs,'name','md.hydrology.requested_outputs','format','StringArray');
-		}//}}}
-		this.defaultoutputs = function(md) { //{{{
-				return ['Watercolumn','HydrologyWaterVx','HydrologyWaterVy'];
-		}//}}}
-		this.fix=function() { //{{{
-			this.spcwatercolumn=NullFix(this.spcwatercolumn,NaN);
-		}//}}}
-	//properties 
-	// {{{
-	this.spcwatercolumn = NaN;
-	this.stabilization  = 0;
-	this.requested_outputs = [];
-	this.setdefaultparameters();
-	//}}}
-}
+	extrude(md) {//{{{
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/hydrologyshreve.m
===================================================================
--- issm/trunk/src/m/classes/hydrologyshreve.m	(revision 25994)
+++ issm/trunk/src/m/classes/hydrologyshreve.m	(revision 26744)
@@ -11,6 +11,4 @@
 	end
 	methods
-		function self = extrude(self,md) % {{{
-		end % }}}
 		function self = hydrologyshreve(varargin) % {{{
 			switch nargin
@@ -23,30 +21,27 @@
 			end
 		end % }}}
-		function list = defaultoutputs(self,md) % {{{
-			list = {'Watercolumn','HydrologyWaterVx','HydrologyWaterVy'};
-		end % }}}    
+		function disp(self) % {{{
+			disp(sprintf('   hydrologyshreve solution parameters:'));
+			fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
+			fielddisplay(self,'stabilization','artificial diffusivity (default: 1). can be more than 1 to increase diffusivity.');
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 
+		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
 			%Type of stabilization to use 0:nothing 1:artificial_diffusivity
 			self.stabilization     = 1;
-      self.requested_outputs = {'default'};
+			self.requested_outputs = {'default'};
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			%Early return
-			if ~ismember('HydrologyShreveAnalysis',analyses)
-				return;
-			end
+			if ~ismember('HydrologyShreveAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.ishydrology==0), return; end
 
 			md = checkfield(md,'fieldname','hydrology.spcwatercolumn','Inf',1,'timeseries',1);
 			md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
 		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   hydrologyshreve solution parameters:'));
-			fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
-			fielddisplay(self,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
-      fielddisplay(self,'requested_outputs','additional outputs requested');
-
+		function list = defaultoutputs(self,md) % {{{
+			list = {'Watercolumn','HydrologyWaterVx','HydrologyWaterVy'};
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -54,11 +49,13 @@
 			WriteData(fid,prefix,'object',self,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'fieldname','stabilization','format','Double');
-      outputs = self.requested_outputs;
-      pos  = find(ismember(outputs,'default'));
-      if ~isempty(pos),
-        outputs(pos) = [];  %remove 'default' from outputs
-        outputs      = [outputs defaultoutputs(self,md)]; %add defaults
-      end
-      WriteData(fid,prefix,'data',outputs,'name','md.hydrology.requested_outputs','format','StringArray');
+			outputs = self.requested_outputs;
+			pos = find(ismember(outputs,'default'));
+			if ~isempty(pos),
+				outputs(pos) = []; %remove 'default' from outputs
+				outputs      = [outputs defaultoutputs(self,md)]; %add defaults
+			end
+			WriteData(fid,prefix,'data',outputs,'name','md.hydrology.requested_outputs','format','StringArray');
+		end % }}}
+		function self = extrude(self,md) % {{{
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
Index: issm/trunk/src/m/classes/hydrologyshreve.py
===================================================================
--- issm/trunk/src/m/classes/hydrologyshreve.py	(revision 25994)
+++ issm/trunk/src/m/classes/hydrologyshreve.py	(revision 26744)
@@ -1,2 +1,4 @@
+import numpy as np
+
 from fielddisplay import fielddisplay
 from checkfield import checkfield
@@ -5,67 +7,65 @@
 
 class hydrologyshreve(object):
-    """
-    HYDROLOGYSHREVE class definition
+    """HYDROLOGYSHREVE class definition
 
-       Usage:
-          hydrologyshreve = hydrologyshreve()
+    Usage:
+        hydrologyshreve = hydrologyshreve()
     """
 
-    def __init__(self):  # {{{
-        self.spcwatercolumn = float('NaN')
+    def __init__(self, *args): #{{{
+        self.spcwatercolumn = np.nan
         self.stabilization = 0
         self.requested_outputs = []
-    #set defaults
-        self.setdefaultparameters()
 
+        nargs = len(args)
+        if nargs == 0:
+            self.setdefaultparameters()
+        elif nargs == 1:
+            self.setdefaultparameters(args)
+        else:
+            raise RuntimeError('constructor not supported')
     #}}}
 
-    def __repr__(self):  # {{{
-
-        string = '   hydrologyshreve solution parameters:'
-        string = "%s\n%s" % (string, fielddisplay(self, 'spcwatercolumn', 'water thickness constraints (NaN means no constraint) [m]'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'stabilization', 'artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
-        return string
+    def __repr__(self): #{{{
+        s = '   hydrologyshreve solution parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'spcwatercolumn', 'water thickness constraints (NaN means no constraint) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'stabilization', 'artificial diffusivity (default: 1). can be more than 1 to increase diffusivity.'))
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
+        return s
     #}}}
 
-    def extrude(self, md):  # {{{
-        return self
+    def setdefaultparameters(self): #{{{
+        # Type of stabilization to use 0:nothing 1:artificial_diffusivity
+        self.stabilization = 1
+        self.requested_outputs = ['default']
     #}}}
 
-    def setdefaultparameters(self):  # {{{
-        #Type of stabilization to use 0:nothing 1:artificial_diffusivity
-        self.stabilization = 1
-        self.requested_outputs = ['default']
-        return self
-    #}}}
-
-    def defaultoutputs(self, md):  # {{{
-        list = ['Watercolumn', 'HydrologyWaterVx', 'HydrologyWaterVy']
-        return list
-    #}}}
-
-    def checkconsistency(self, md, solution, analyses):  # {{{
+    def checkconsistency(self, md, solution, analyses): #{{{
         #Early return
-        if 'HydrologyShreveAnalysis' not in analyses:
+        if 'HydrologyShreveAnalysis' not in analyses or (solution == 'TransientSolution' and not md.transient.ishydrology):
             return md
 
         md = checkfield(md, 'fieldname', 'hydrology.spcwatercolumn', 'Inf', 1, 'timeseries', 1)
         md = checkfield(md, 'fieldname', 'hydrology.stabilization', '>=', 0)
-        md = checkfield(md, 'fieldname', 'hydrology.requested_outputs', 'stringrow', 1)
         return md
     # }}}
 
-    def marshall(self, prefix, md, fid):  # {{{
+    def defaultoutputs(self, md): #{{{
+        return ['Watercolumn', 'HydrologyWaterVx', 'HydrologyWaterVy']
+    #}}}
+
+    def marshall(self, prefix, md, fid): #{{{
         WriteData(fid, prefix, 'name', 'md.hydrology.model', 'data', 2, 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'spcwatercolumn', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'stabilization', 'format', 'Double')
-    #process requested outputs
         outputs = self.requested_outputs
         indices = [i for i, x in enumerate(outputs) if x == 'default']
-        if len(indices) > 0:
+        if len(indices):
             outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:]
             outputs = outputscopy
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.hydrology.requested_outputs', 'format', 'StringArray')
+    # }}}
 
-    # }}}
+    def extrude(self, md): #{{{
+        return self
+    #}}}
Index: issm/trunk/src/m/classes/hydrologytws.m
===================================================================
--- issm/trunk/src/m/classes/hydrologytws.m	(revision 26744)
+++ issm/trunk/src/m/classes/hydrologytws.m	(revision 26744)
@@ -0,0 +1,63 @@
+%HYDROLOGYTWS class definition
+%
+%   Usage:
+%      hydrologytws=hydrologytws();
+
+classdef hydrologytws
+	properties (SetAccess=public) 
+		spcwatercolumn     = NaN;
+		requested_outputs  = {};
+	end
+	methods
+		function self = extrude(self,md) % {{{
+		end % }}}
+		function self = hydrologytws(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				case 1
+					self=structtoobj(self,varargin{1});
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
+
+		function self = setdefaultparameters(self) % {{{
+			self.requested_outputs = {'default'};
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			%Early return
+			if ~ismember('HydrologyTwsAnalysis',analyses)
+				return;
+			end
+			md = checkfield(md,'fieldname','hydrology.spcwatercolumn','Inf',1,'timeseries',1);
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   hydrologytws solution parameters:'));
+			fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
+			fielddisplay(self,'requested_outputs','additional outputs requested');
+
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			WriteData(fid,prefix,'name','md.hydrology.model','data',2,'format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			outputs = self.requested_outputs;
+			pos  = find(ismember(outputs,'default'));
+			if ~isempty(pos),
+				outputs(pos) = [];  %remove 'default' from outputs
+				outputs      = [outputs defaultoutputs(self,md)]; %add defaults
+			end
+			WriteData(fid,prefix,'data',outputs,'name','md.hydrology.requested_outputs','format','StringArray');
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+
+			writejs1Darray(fid,[modelname '.hydrology.spcwatercolumn'],self.spcwatercolumn);
+
+		end % }}}
+	end
+end
+
Index: issm/trunk/src/m/classes/hydrologytws.py
===================================================================
--- issm/trunk/src/m/classes/hydrologytws.py	(revision 26744)
+++ issm/trunk/src/m/classes/hydrologytws.py	(revision 26744)
@@ -0,0 +1,64 @@
+import numpy as np
+
+from structtoobj import structtoobj
+
+class hydrologytws(object):
+    """HYDROLOGYTWS class definition
+
+    Usage:
+        hydrologytws = hydrologytws()
+    """
+
+    def __init__(self):  # {{{
+        self.spcwatercolumn = np.nan
+        self.requested_outputs = np.nan
+
+        nargs = len(args)
+        if nargs == 0:
+            self.setdefaultparameters()
+        elif nargs == 1:
+            self = structtoobj(self, args[0])
+        else:
+            raise RuntimeError('constructor not supported')
+    #}}}
+
+    def __repr__(self):  # {{{
+        s = '   hydrologytws solution parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'spcwatercolumn', 'water thickness constraints (NaN means no constraint) [m]'))
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
+        return s
+    #}}}
+
+    def defaultoutputs(self, md): # {{{
+        return ['']
+    #}}}
+
+    def setdefaultparameters(self):  # {{{
+        self.requested_outputs = ['defualt']
+        return self
+    #}}}
+
+    def extrude(self, md):  # {{{
+        return self
+    #}}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Early return
+        if 'HydrologyTwsAnalysis' not in analyses:
+            return
+        md = checkfield(md, 'fieldname', 'hydrology.spcwatercolumn', 'Inf', 1, 'timeseries', 1)
+    #}}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        WriteData(fid, prefix, 'name', 'md.hydrology.model', 'data', 2, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'spcwatercolumn', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+        outputs = self.requested_outputs
+        pos  = find(ismember(outputs,'default'))
+        if not len(pos),
+            outputs[pos] = [];  # remove 'default' from outputs
+            outputs.extend(defaultoutputs(self, md)) # add defaults
+        end
+        WriteData(fid, prefix, 'data', outputs, 'name', 'md.hydrology.requested_outputs', 'format', 'StringArray')
+    # }}}
+
+
Index: issm/trunk/src/m/classes/initialization.js
===================================================================
--- issm/trunk/src/m/classes/initialization.js	(revision 25994)
+++ issm/trunk/src/m/classes/initialization.js	(revision 26744)
@@ -17,9 +17,16 @@
 		fielddisplay(this,'pressure','pressure field [Pa]');
 		fielddisplay(this,'temperature','temperature [K]');
+		fielddisplay(this,'enthalpy','enthalpy [J]');
 		fielddisplay(this,'waterfraction','fraction of water in the ice');
 		fielddisplay(this,'sediment_head','sediment water head of subglacial system [m]');
 		fielddisplay(this,'epl_head','epl water head of subglacial system [m]');
 		fielddisplay(this,'epl_thickness','epl layer thickness [m]');
-		fielddisplay(this,'watercolumn','thickness of subglacial water [m]');
+		fielddisplay(this,'watercolumn','subglacial water sheet thickness (for Shreve and GlaDS) [m]');
+		fielddisplay(this,'hydraulic_potential','Hydraulic potential (for GlaDS) [Pa]');
+		fielddisplay(this,'channelarea','subglacial water channel area (for GlaDS) [m2]');
+		fielddisplay(this,'sample','Realization of a Gaussian random field');
+		fielddisplay(this,'bottompressure','Bottom pressures');
+		fielddisplay(this,'dsl','Dynamic sea level.');
+		fielddisplay(this,'str','Steric sea level.');
 
 	}// }}}
@@ -51,4 +58,11 @@
 				checkfield(md,'fieldname','initialization.vy','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
 			}
+			if(ArrayAnyEqual(ArrayIsMember('OceantransportAnalysis',analyses),1)){
+				if (strcmp(solution,'TransientSolution') && md.transient.isslc && md.transient.isoceantransport) {
+					checkfield(md,'fieldname','initialization.bottompressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+					checkfield(md,'fieldname','initialization.dsl','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+					checkfield(md,'fieldname','initialization.str','NaN',1,'Inf',1,'size',[1, 1]);
+				}
+			}
 			if(ArrayAnyEqual(ArrayIsMember('BalancethicknessSolution',analyses),1) & (solution=='BalancethicknessSolution')){
 				checkfield(md,'fieldname','initialization.vx','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
@@ -65,28 +79,45 @@
 				}
 			}
-			if(ArrayAnyEqual(ArrayIsMember('ThermalAnalysis',analyses),1)){
+			if ((ArrayAnyEqual(ArrayIsMember('ThermalAnalysis',analyses),1)) && !strcmp(solution,'TransientSolution') && md.transient.isthermal == 0){
 				checkfield(md,'fieldname','initialization.vx','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
 				checkfield(md,'fieldname','initialization.vy','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
-				if (md.mesh.dimension() == 3){
-					checkfield(md,'fieldname','initialization.vz','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices ,1]);
-				}
-				checkfield(md,'fieldname','initialization.pressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices ,1]);
-				checkfield(md,'fieldname','initialization.temperature','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices ,1]);
-			}
-			if( ArrayAnyEqual(ArrayIsMember('EnthalpyAnalysis',analyses),1) & md.thermal.isenthalpy){
-				checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices, 1]);
-				checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices, 1]);
-			}
-			if(ArrayAnyEqual(ArrayIsMember('HydrologyShreveAnalysis',analyses),1)){
+				if (md.mesh.dimension()==3) {
+					checkfield(md,'fieldname','initialization.vz','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+				}
+				checkfield(md,'fieldname','initialization.pressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+				checkfield(md,'fieldname','initialization.temperature','NaN',1,'Inf',1,'size','universal');
+			}
+			if (ArrayAnyEqual(ArrayIsMember('EnthalpyAnalysis',analyses),1) && md.thermal.isenthalpy){
+				checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size','universal');
+				checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size','universal');
+			}
+			if (ArrayAnyEqual(ArrayIsMember('HydrologyShreveAnalysis',analyses),1)){
 				if (md.hydrology.type() == 'hydrologyshreve'){
 					checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices ,1]);
 				}
 			}
-			if(ArrayAnyEqual(ArrayIsMember('HydrologyDCInefficientAnalysis',analyses),1)){
+			if (ArrayAnyEqual(ArrayIsMember('HydrologyTwsAnalysis',analyses),1)){
+				if (md.hydrology.type() == 'hydrologytws'){
+					checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices ,1]);
+				}
+			}
+			if (ArrayAnyEqual(ArrayIsMember('SealevelchangeAnalysis',analyses),1)){
+				if (strcmp(solution,'TransientSolution') && md.transient.isslc) {
+					checkfield(md,'fieldname','initialization.sealevel','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+				}
+			}
+			if (ArrayAnyEqual(ArrayIsMember('HydrologyGlaDSAnalysis',analyses),1)){
+				if (md.hydrology.type() == 'hydrologyglads'){
+					checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+					checkfield(md,'fieldname','initialization.hydraulic_potential','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+					checkfield(md,'fieldname','initialization.channelarea','NaN',1,'Inf',1,'>=',0,'size',[md.mesh.numberofedges, 1]);
+				}
+			}
+			if (ArrayAnyEqual(ArrayIsMember('HydrologyDCInefficientAnalysis',analyses),1)){
 				if (md.hydrology.type() == 'hydrologydc'){
 					checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
 				}
 			}
-			if(ArrayAnyEqual(ArrayIsMember('HydrologyDCEfficientAnalysis',analyses),1)){
+			if (ArrayAnyEqual(ArrayIsMember('HydrologyDCEfficientAnalysis',analyses),1)){
 				if (md.hydrology.type() == 'hydrologydc'){
 					if (md.hydrology.isefficientlayer==1){
@@ -96,4 +127,9 @@
 				}
 			}
+			if (ArrayAnyEqual(ArrayIsMember('SamplingAnalysis',analyses),1) && !strcmp(solution,'TransientSolution')&& md.transient.issampling == 0){
+				if (!isNaN(md.initialization.sample)) {
+					checkfield(md,'fieldname','initialization.sample','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
+				}
+			}
 		} //}}}
 		this.marshall=function(md,prefix,fid) { //{{{
@@ -105,4 +141,8 @@
 			WriteData(fid,prefix,'object',this,'fieldname','vz','format','DoubleMat','mattype',1,'scale',1./yts);
 			WriteData(fid,prefix,'object',this,'fieldname','pressure','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','sealevel','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',this,'fieldname','bottompressure','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','str','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','dsl','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','temperature','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','waterfraction','format','DoubleMat','mattype',1);
@@ -111,13 +151,20 @@
 			WriteData(fid,prefix,'object',this,'fieldname','epl_thickness','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','watercolumn','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','channelarea','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','hydraulic_potential','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',this,'fieldname','sample','format','DoubleMat','mattype',1);
 
 			if (md.thermal.isenthalpy){
-				tpmp=NewArrayFill(md.mesh.numberofvertices,0);
-				for (var i=0;i<md.mesh.numberofvertices;i++) tpmp[i]= md.materials.meltingpoint - md.materials.beta*md.initialization.pressure[i];
-				enthalpy=NewArrayFill(md.mesh.numberofvertices,0); 
-				for (var i=0;i<md.mesh.numberofvertices;i++)enthalpy[i] = md.materials.heatcapacity*(md.initialization.temperature[i]-md.constants.referencetemperature);
-				
-				for (var i=0;i<md.mesh.numberofvertices;i++)if(md.initialization.temperature[i]>=tpmp[i]){
-					enthalpy[i] = md.materials.heatcapacity*(tpmp[i] - md.constants.referencetemperature) + md.materials.latentheat*md.initialization.waterfraction[i];
+				let enthalpy;
+				if (isNaN(self.enthalpy) && this.enthalpy.length <= 1) {
+					tpmp=NewArrayFill(md.mesh.numberofvertices,0);
+					for (var i=0;i<md.mesh.numberofvertices;i++) tpmp[i]= md.materials.meltingpoint - md.materials.beta*md.initialization.pressure[i];
+					enthalpy=NewArrayFill(md.mesh.numberofvertices,0); 
+					for (var i=0;i<md.mesh.numberofvertices;i++)enthalpy[i] = md.materials.heatcapacity*(md.initialization.temperature[i]-md.constants.referencetemperature);
+					for (var i=0;i<md.mesh.numberofvertices;i++)if(md.initialization.temperature[i]>=tpmp[i]){
+						enthalpy[i] = md.materials.heatcapacity*(tpmp[i] - md.constants.referencetemperature) + md.materials.latentheat*md.initialization.waterfraction[i];
+					}
+				} else {
+					enthalpy = this.enthalpy;
 				}
 				WriteData(fid,prefix,'data',enthalpy,'format','DoubleMat','mattype',1,'name','md.initialization.enthalpy');
@@ -136,15 +183,23 @@
 	//properties 
 	// {{{
-	this.vx            = NaN;
-	this.vy            = NaN;
-	this.vz            = NaN;
-	this.vel           = NaN;
-	this.pressure      = NaN;
-	this.temperature   = NaN;
-	this.waterfraction = NaN;
-	this.sediment_head = NaN;
-	this.epl_head      = NaN;
-	this.epl_thickness = NaN;
-	this.watercolumn   = NaN;
+	this.vx                  = NaN;
+	this.vy                  = NaN;
+	this.vz                  = NaN;
+	this.vel                 = NaN;
+	this.pressure            = NaN;
+	this.temperature         = NaN;
+	this.enthalpy            = NaN;
+	this.waterfraction       = NaN;
+	this.sediment_head       = NaN;
+	this.epl_head            = NaN;
+	this.epl_thickness       = NaN;
+	this.watercolumn         = NaN;
+	this.hydraulic_potential = NaN;
+	this.channelarea         = NaN;
+	this.sealevel            = NaN;
+	this.bottompressure      = NaN;
+	this.dsl                 = NaN;
+	this.str                 = NaN;
+	this.sample              = NaN;
 	this.setdefaultparameters();
 
Index: issm/trunk/src/m/classes/initialization.m
===================================================================
--- issm/trunk/src/m/classes/initialization.m	(revision 25994)
+++ issm/trunk/src/m/classes/initialization.m	(revision 26744)
@@ -20,22 +20,11 @@
 		hydraulic_potential = NaN;
 		channelarea         = NaN;
+		sealevel            = NaN;
+		bottompressure      = NaN;
+		dsl                 = NaN;
+		str                 = NaN;
+		sample              = NaN;
 	end
 	methods
-		function self = extrude(self,md) % {{{
-			self.vx=project3d(md,'vector',self.vx,'type','node');
-			self.vy=project3d(md,'vector',self.vy,'type','node');
-			self.vz=project3d(md,'vector',self.vz,'type','node');
-			self.vel=project3d(md,'vector',self.vel,'type','node');
-			self.temperature=project3d(md,'vector',self.temperature,'type','node');
-			self.enthalpy=project3d(md,'vector',self.enthalpy,'type','node');
-			self.waterfraction=project3d(md,'vector',self.waterfraction,'type','node');
-			self.watercolumn=project3d(md,'vector',self.watercolumn,'type','node','layer',1);
-			self.sediment_head=project3d(md,'vector',self.sediment_head,'type','node','layer',1);
-			self.epl_head=project3d(md,'vector',self.epl_head,'type','node','layer',1);
-			self.epl_thickness=project3d(md,'vector',self.epl_thickness,'type','node','layer',1);
-
-			%Lithostatic pressure by default
-			self.pressure=md.constants.g*md.materials.rho_ice*(md.geometry.surface-md.mesh.z);
-		end % }}}
 		function self = initialization(varargin) % {{{
 			switch nargin
@@ -47,5 +36,4 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
-
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -59,4 +47,11 @@
 				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			end
+			if ismember('OceantransportAnalysis',analyses) 
+				if strcmp(solution,'TransientSolution') & md.transient.isslc & md.transient.isoceantransport,
+					md = checkfield(md,'fieldname','initialization.bottompressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','initialization.dsl','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','initialization.str','NaN',1,'Inf',1,'size',[1 1]);
+				end
 			end
 			if ismember('BalancethicknessAnalysis',analyses) & strcmp(solution,'BalancethicknessSolution'),
@@ -88,5 +83,17 @@
 			if ismember('HydrologyShreveAnalysis',analyses),
 				if isa(md.hydrology,'hydrologyshreve'),
+					if (strcmp(solution,'TransientSolution') & md.transient.ishydrology) | strcmp(solution,'HydrologySolution'),
+						md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+					end
+				end
+			end
+			if ismember('HydrologyTwsAnalysis',analyses),
+				if isa(md.hydrology,'hydrologytws'),
 					md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				end
+			end
+			if ismember('SealevelchangeAnalysis',analyses),
+				if strcmp(solution,'TransientSolution') & md.transient.isslc,
+					md = checkfield(md,'fieldname','initialization.sealevel','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
@@ -109,4 +116,9 @@
 						md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 					end
+				end
+			end
+			if ismember('SamplingAnalysis',analyses) & ~(strcmp(solution,'TransientSolution') & md.transient.issampling == 0),
+				if ~isnan(md.initialization.sample)
+					md = checkfield(md,'fieldname','initialization.sample','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
@@ -129,5 +141,8 @@
 			fielddisplay(self,'hydraulic_potential','Hydraulic potential (for GlaDS) [Pa]');
 			fielddisplay(self,'channelarea','subglacial water channel area (for GlaDS) [m2]');
-
+			fielddisplay(self,'sample','Realization of a Gaussian random field');
+			fielddisplay(self,'bottompressure','Bottom pressures');
+			fielddisplay(self,'dsl','Dynamic sea level.');
+			fielddisplay(self,'str','Steric sea level.');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -139,4 +154,8 @@
 			WriteData(fid,prefix,'object',self,'fieldname','vz','format','DoubleMat','mattype',1,'scale',1./yts);
 			WriteData(fid,prefix,'object',self,'fieldname','pressure','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','sealevel','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'fieldname','bottompressure','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','str','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','dsl','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',self,'fieldname','temperature','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',self,'fieldname','waterfraction','format','DoubleMat','mattype',1);
@@ -147,4 +166,5 @@
 			WriteData(fid,prefix,'object',self,'fieldname','channelarea','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',self,'fieldname','hydraulic_potential','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','sample','format','DoubleMat','mattype',1);
 
 			if md.thermal.isenthalpy,
@@ -161,6 +181,26 @@
 			end
 		end % }}}
+		function self = extrude(self,md) % {{{
+			self.vx=project3d(md,'vector',self.vx,'type','node');
+			self.vy=project3d(md,'vector',self.vy,'type','node');
+			self.vz=project3d(md,'vector',self.vz,'type','node');
+			self.vel=project3d(md,'vector',self.vel,'type','node');
+			self.temperature=project3d(md,'vector',self.temperature,'type','node');
+			self.enthalpy=project3d(md,'vector',self.enthalpy,'type','node');
+			self.waterfraction=project3d(md,'vector',self.waterfraction,'type','node');
+			self.watercolumn=project3d(md,'vector',self.watercolumn,'type','node','layer',1);
+			self.sediment_head=project3d(md,'vector',self.sediment_head,'type','node','layer',1);
+			self.epl_head=project3d(md,'vector',self.epl_head,'type','node','layer',1);
+			self.epl_thickness=project3d(md,'vector',self.epl_thickness,'type','node','layer',1);
+			self.sealevel=project3d(md,'vector',self.sealevel,'type','node','layer',1);
+			self.bottompressure=project3d(md,'vector',self.bottompressure,'type','node','layer',1);
+			self.dsl=project3d(md,'vector',self.dsl,'type','node','layer',1);
+			self.str=project3d(md,'vector',self.str,'type','node','layer',1);
+
+			%Lithostatic pressure by default
+			self.pressure=md.constants.g*md.materials.rho_ice*(md.geometry.surface-md.mesh.z);
+		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
-		
+
 			writejs1Darray(fid,[modelname '.initialization.vx'],self.vx);
 			writejs1Darray(fid,[modelname '.initialization.vy'],self.vy);
@@ -177,4 +217,5 @@
 			writejs1Darray(fid,[modelname '.initialization.hydraulic_potential'],self.hydraulic_potential);
 			writejs1Darray(fid,[modelname '.initialization.channel'],self.channelarea);
+			writejs1Darray(fid,[modelname '.initialization.sample'],self.sample);
 
 		end % }}}
Index: issm/trunk/src/m/classes/initialization.py
===================================================================
--- issm/trunk/src/m/classes/initialization.py	(revision 25994)
+++ issm/trunk/src/m/classes/initialization.py	(revision 26744)
@@ -11,33 +11,36 @@
 
     Usage:
-    initialization = initialization()
+        initialization = initialization()
     """
 
-    def __init__(self):  # {{{
+    def __init__(self): #{{{
         self.vx = np.nan
         self.vy = np.nan
         self.vz = np.nan
         self.vel = np.nan
-        self.enthalpy = np.nan
         self.pressure = np.nan
         self.temperature = np.nan
+        self.enthalpy = np.nan
         self.waterfraction = np.nan
-        self.watercolumn = np.nan
         self.sediment_head = np.nan
         self.epl_head = np.nan
         self.epl_thickness = np.nan
+        self.watercolumn = np.nan
         self.hydraulic_potential = np.nan
         self.channelarea = np.nan
+        self.sealevel = np.nan
+        self.bottompressure = np.nan
+        self.dsl = np.nan
+        self.str = np.nan
+        self.sample = np.nan
 
-        #set defaults
         self.setdefaultparameters()
     #}}}
-
-    def __repr__(self):  # {{{
+    def __repr__(self): #{{{
         s = '   initial field values:\n'
-        s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'vy', 'y component of velocity [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'vz', 'z component of velocity [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'vel', 'velocity norm [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'vy', 'y component of velocity [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'vz', 'z component of velocity [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'vel', 'velocity norm [m/yr]'))
         s += '{}\n'.format(fielddisplay(self, 'pressure', 'pressure [Pa]'))
         s += '{}\n'.format(fielddisplay(self, 'temperature', 'temperature [K]'))
@@ -50,35 +53,11 @@
         s += '{}\n'.format(fielddisplay(self, 'hydraulic_potential', 'Hydraulic potential (for GlaDS) [Pa]'))
         s += '{}\n'.format(fielddisplay(self, 'channelarea', 'subglaciale water channel area (for GlaDS) [m2]'))
+        s += '{}\n'.format(fielddisplay(self,'sample', 'Realization of a Gaussian random field'))
         return s
     #}}}
-
-    def extrude(self, md):  # {{{
-        self.vx = project3d(md, 'vector', self.vx, 'type', 'node')
-        self.vy = project3d(md, 'vector', self.vy, 'type', 'node')
-        self.vz = project3d(md, 'vector', self.vz, 'type', 'node')
-        self.vel = project3d(md, 'vector', self.vel, 'type', 'node')
-        self.temperature = project3d(md, 'vector', self.temperature, 'type', 'node')
-        self.enthalpy = project3d(md, 'vector', self.enthalpy, 'type', 'node')
-        self.waterfraction = project3d(md, 'vector', self.waterfraction, 'type', 'node')
-        self.watercolumn = project3d(md, 'vector', self.watercolumn, 'type', 'node')
-        self.sediment_head = project3d(md, 'vector', self.sediment_head, 'type', 'node', 'layer', 1)
-        self.epl_head = project3d(md, 'vector', self.epl_head, 'type', 'node', 'layer', 1)
-        self.epl_thickness = project3d(md, 'vector', self.epl_thickness, 'type', 'node', 'layer', 1)
-
-        #Lithostatic pressure by default
-        if np.ndim(md.geometry.surface) == 2:
-            print('Reshaping md.geometry.surface for your convenience but you should fix it in your model set up')
-            self.pressure = md.constants.g * md.materials.rho_ice * (md.geometry.surface.reshape(-1, ) - md.mesh.z)
-        else:
-            self.pressure = md.constants.g * md.materials.rho_ice * (md.geometry.surface - md.mesh.z)
-
-        return self
+    def setdefaultparameters(self): #{{{
+        return
     #}}}
-
-    def setdefaultparameters(self):  # {{{
-        return self
-    #}}}
-
-    def checkconsistency(self, md, solution, analyses):  # {{{
+    def checkconsistency(self, md, solution, analyses): #{{{
         if 'StressbalanceAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.isstressbalance:
             if not np.any(np.logical_or(np.isnan(md.initialization.vx), np.isnan(md.initialization.vy))):
@@ -88,4 +67,9 @@
             md = checkfield(md, 'fieldname', 'initialization.vx', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
             md = checkfield(md, 'fieldname', 'initialization.vy', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+        if 'OceantransportAnalysis' in analyses:
+            if solution == 'TransientSolution' and md.transient.isslc and md.transient.isoceantransport:
+                md = checkfield(md, 'fieldname', 'initialization.bottompressure', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+                md = checkfield(md, 'fieldname', 'initialization.dsl', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+                md = checkfield(md, 'fieldname', 'initialization.str', 'NaN', 1, 'Inf', 1, 'size', [1])
         if 'BalancethicknessAnalysis' in analyses and solution == 'BalancethicknessSolution':
             md = checkfield(md, 'fieldname', 'initialization.vx', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
@@ -110,13 +94,12 @@
         if 'HydrologyShreveAnalysis' in analyses:
             if hasattr(md.hydrology, 'hydrologyshreve'):
+                if (solution == 'TransientSolution' and md.transient.ishydrology) or solution == 'HydrologySolution':
+                    md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+        if 'HydrologyTwsAnalysis' in analyses:
+            if hasattr(md.hydrology, 'hydrologytws'):
                 md = checkfield(md, 'fieldname', 'initialization.watercolumn', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-        if 'HydrologyDCInefficientAnalysis' in analyses:
-            if hasattr(md.hydrology, 'hydrologydc'):
-                md = checkfield(md, 'fieldname', 'initialization.sediment_head', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-        if 'HydrologyDCEfficientAnalysis' in analyses:
-            if hasattr(md.hydrology, 'hydrologydc'):
-                if md.hydrology.isefficientlayer == 1:
-                    md = checkfield(md, 'fieldname', 'initialization.epl_head', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
-                    md = checkfield(md, 'fieldname', 'initialization.epl_thickness', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
+        if 'SealevelchangeAnalysis' in analyses:
+            if solution == 'TransientSolution' and md.transient.isslc:
+                md = checkfield(md, 'fieldname', 'initialization.sealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
         if 'HydrologyGlaDSAnalysis' in analyses:
             if hasattr(md.hydrology, 'hydrologyglads'):
@@ -124,13 +107,20 @@
                 md = checkfield(md, 'fieldname', 'initialization.hydraulic_potential', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
                 md = checkfield(md, 'fieldname', 'initialization.channelarea', 'NaN', 1, 'Inf', 1, '>=', 0, 'size', [md.mesh.numberofelements])
+        if 'SamplingAnalysis' in analyses and not solution == 'TransientSolution' and not md.transient.issampling:
+            if np.any(np.isnan(md.initialization.sample)):
+                md = checkfield(md, 'fieldname', 'initialization.sample', 'NaN', 1,'Inf', 1, 'size', [md.mesh.numberofvertices])
         return md
-    # }}}
+    #}}}
+    def marshall(self, prefix, md, fid): #{{{
+        yts = md.constants.yts
 
-    def marshall(self, prefix, md, fid):  # {{{
-        yts = md.constants.yts
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'vx', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'vy', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'vz', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'vx', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'vy', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'vz', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'pressure', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevel', 'format', 'DoubleMat', 'mattype', 1,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'bottompressure', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'str', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'dsl', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'temperature', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'waterfraction', 'format', 'DoubleMat', 'mattype', 1)
@@ -141,11 +131,40 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'channelarea', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'hydraulic_potential', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sample', 'format', 'DoubleMat', 'mattype', 1)
+
         if md.thermal.isenthalpy:
             if (np.size(self.enthalpy) <= 1):
+                # Reconstruct enthalpy
                 tpmp = md.materials.meltingpoint - md.materials.beta * md.initialization.pressure
-                pos = np.nonzero(md.initialization.waterfraction > 0.)[0]
+                pos = np.where(md.initialization.waterfraction > 0)[0]
                 self.enthalpy = md.materials.heatcapacity * (md.initialization.temperature - md.constants.referencetemperature)
-                self.enthalpy[pos] = md.materials.heatcapacity * (tpmp[pos].reshape(-1, ) - md.constants.referencetemperature) + md.materials.latentheat * md.initialization.waterfraction[pos].reshape(-1, )
+                self.enthalpy[pos] = md.materials.heatcapacity * (tpmp[pos].reshape(-1,) - md.constants.referencetemperature) + md.materials.latentheat * md.initialization.waterfraction[pos].reshape(-1,)
 
             WriteData(fid, prefix, 'data', self.enthalpy, 'format', 'DoubleMat', 'mattype', 1, 'name', 'md.initialization.enthalpy')
-    # }}}
+    #}}}
+    def extrude(self, md): #{{{
+        self.vx = project3d(md, 'vector', self.vx, 'type', 'node')
+        self.vy = project3d(md, 'vector', self.vy, 'type', 'node')
+        self.vz = project3d(md, 'vector', self.vz, 'type', 'node')
+        self.vel = project3d(md, 'vector', self.vel, 'type', 'node')
+        self.temperature = project3d(md, 'vector', self.temperature, 'type', 'node')
+        self.enthalpy = project3d(md, 'vector', self.enthalpy, 'type', 'node')
+        self.waterfraction = project3d(md, 'vector', self.waterfraction, 'type', 'node')
+        self.watercolumn = project3d(md, 'vector', self.watercolumn, 'type', 'node')
+        self.sediment_head = project3d(md, 'vector', self.sediment_head, 'type', 'node', 'layer', 1)
+        self.epl_head = project3d(md, 'vector', self.epl_head, 'type', 'node', 'layer', 1)
+        self.epl_thickness = project3d(md, 'vector', self.epl_thickness, 'type', 'node', 'layer', 1)
+        self.sealevel = project3d(md, 'vector', self.sealevel, 'type', 'node', 'layer', 1)
+        self.bottompressure = project3d(md, 'vector', self.bottompressure, 'type', 'node', 'layer', 1)
+        self.dsl = project3d(md, 'vector', self.dsl, 'type', 'node', 'layer', 1)
+        self.str = project3d(md, 'vector', self.str, 'type', 'node', 'layer', 1)
+
+        # Lithostatic pressure by default
+        if np.ndim(md.geometry.surface) == 2:
+            print('Reshaping md.geometry.surface for your convenience but you should fix it in your model set up')
+            self.pressure = md.constants.g * md.materials.rho_ice * (md.geometry.surface.reshape(-1, 1) - md.mesh.z)
+        else:
+            self.pressure = md.constants.g * md.materials.rho_ice * (md.geometry.surface - md.mesh.z)
+
+        return self
+    #}}}
Index: issm/trunk/src/m/classes/inversion.js
===================================================================
--- issm/trunk/src/m/classes/inversion.js	(revision 25994)
+++ issm/trunk/src/m/classes/inversion.js	(revision 26744)
@@ -140,4 +140,5 @@
 			WriteData(fid,prefix,'object',this,'fieldname','iscontrol','format','Boolean');
 			WriteData(fid,prefix,'object',this,'fieldname','incomplete_adjoint','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','vel_obs','format','DoubleMat','mattype',1,'scale',1/yts);
 			if (!this.iscontrol) return;
 			WriteData(fid,prefix,'object',this,'fieldname','nsteps','format','Integer');
Index: issm/trunk/src/m/classes/inversion.m
===================================================================
--- issm/trunk/src/m/classes/inversion.m	(revision 25994)
+++ issm/trunk/src/m/classes/inversion.m	(revision 26744)
@@ -99,11 +99,11 @@
 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
 			md = checkfield(md,'fieldname','inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);
-			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
-			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
+			md = checkfield(md,'fieldname','inversion.min_parameters','size',[NaN num_controls]);
+			md = checkfield(md,'fieldname','inversion.max_parameters','size',[NaN num_controls]);
 
 			%Only SSA, HO and FS are supported right now
 			if strcmp(solution,'StressbalanceSolution')
-				if ~(md.flowequation.isSSA || md.flowequation.isHO || md.flowequation.isFS || md.flowequation.isL1L2),
-					md = checkmessage(md,['inversion can only be performed for SSA, HO or FS ice flow models']);
+				if ~(md.flowequation.isSSA || md.flowequation.isMLHO || md.flowequation.isHO || md.flowequation.isFS || md.flowequation.isL1L2),
+					md = checkmessage(md,['inversion can only be performed for SSA, MLHO, HO or FS ice flow models']);
 				end
 			end
Index: issm/trunk/src/m/classes/inversion.py
===================================================================
--- issm/trunk/src/m/classes/inversion.py	(revision 25994)
+++ issm/trunk/src/m/classes/inversion.py	(revision 26744)
@@ -138,6 +138,6 @@
         # Only SSA, HO and FS are supported right now
         if solution == 'StressbalanceSolution':
-            if not (md.flowequation.isSSA or md.flowequation.isHO or md.flowequation.isFS or md.flowequation.isL1L2):
-                md.checkmessage("'inversion can only be performed for SSA, HO or FS ice flow models")
+            if not (md.flowequation.isSSA or md.flowequation.isMLHO or md.flowequation.isHO or md.flowequation.isFS or md.flowequation.isL1L2):
+                md.checkmessage("'inversion can only be performed for SSA, MLHO, HO or FS ice flow models")
         if solution == 'BalancethicknessSolution':
             md = checkfield(md, 'fieldname', 'inversion.thickness_obs', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)
Index: issm/trunk/src/m/classes/issmsettings.js
===================================================================
--- issm/trunk/src/m/classes/issmsettings.js	(revision 25994)
+++ issm/trunk/src/m/classes/issmsettings.js	(revision 26744)
@@ -5,90 +5,95 @@
 
 function issmsettings (){
-	//methods
-	this.setdefaultparameters = function(){// {{{
-		//are we short in memory ? (0 faster but requires more memory)
-		this.lowmem=0;
+    //methods
+    this.setdefaultparameters = function(){// {{{
+        //are we short in memory ? (0 faster but requires more memory)
+        this.lowmem=0;
 
-		//i/o:
-		this.io_gather=1;
+        //i/o:
+        this.io_gather=1;
 
-		//results frequency by default every step
-		this.output_frequency=1;
+        //results frequency by default every step
+        this.output_frequency=1;
 
-		//checkpoints frequency, by default never: 
-		this.checkpoint_frequency=0;
+        //coupling frequency of the stress balance solver by default every step
+        this.sb_coupling_frequency=1;
 
-		//this option can be activated to load automatically the results
-		//onto the model after a parallel run by waiting for the lock file
-		//N minutes that is generated once the solution has converged
-		//0 to deactivate
-		this.waitonlock=Infinity;
+        //checkpoints frequency, by default never:
+        this.checkpoint_frequency=0;
 
-		//upload options: 
-		upload_port         = 0;
-		
-		//throw an error if solver residue exceeds this value
-		this.solver_residue_threshold=1e-6;
+        //this option can be activated to load automatically the results
+        //onto the model after a parallel run by waiting for the lock file
+        //N minutes that is generated once the solution has converged
+        //0 to deactivate
+        this.waitonlock=Infinity;
 
-	}// }}}
-	this.disp= function(){// {{{
-		console.log(sprintf('   issmsettings class echo:'));
-		
-		fielddisplay(this,'results_on_nodes','results are output for all the nodes of each element');
-		fielddisplay(this,'io_gather','I/O gathering strategy for result outputs (default 1)');
-		fielddisplay(this,'lowmem','is the memory limited ? (0 or 1)');
-		fielddisplay(this,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
-		fielddisplay(this,'checkpoint_frequency','frequency at which the runs are being recorded, allowing for a restart');
-		fielddisplay(this,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
-		fielddisplay(this,'upload_server','server hostname where model should be uploaded');
-		fielddisplay(this,'upload_path','path on server where model should be uploaded');
-		fielddisplay(this,'upload_login','server login');
-		fielddisplay(this,'upload_port','port login (default is 0)');
-		fielddisplay(this,'upload_filename','unique id generated when uploading the file to server');
-		fielddisplay(this,'solver_residue_threshold','throw an error if solver residue exceeds this value');
+        //upload options:
+        this.upload_port         = 0;
+
+        //throw an error if solver residue exceeds this value
+        this.solver_residue_threshold=1e-6;
+
+    }// }}}
+    this.disp= function(){// {{{
+        console.log(sprintf('   issmsettings class echo:'));
+
+        fielddisplay(this,'results_on_nodes','results are output for all the nodes of each element');
+        fielddisplay(this,'io_gather','I/O gathering strategy for result outputs (default 1)');
+        fielddisplay(this,'lowmem','is the memory limited ? (0 or 1)');
+        fielddisplay(this,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
+        fielddisplay(this,'checkpoint_frequency','frequency at which the runs are being recorded, allowing for a restart');
+        fielddisplay(this,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
+        fielddisplay(this,'upload_server','server hostname where model should be uploaded');
+        fielddisplay(this,'upload_path','path on server where model should be uploaded');
+        fielddisplay(this,'upload_login','server login');
+        fielddisplay(this,'upload_port','port login (default is 0)');
+        fielddisplay(this,'upload_filename','unique id generated when uploading the file to server');
+        fielddisplay(this,'solver_residue_threshold','throw an error if solver residue exceeds this value');
 
 
-	}// }}}
-	this.classname= function(){// {{{
-		return "issmsettings";
+    }// }}}
+    this.classname= function(){// {{{
+        return "issmsettings";
 
-	}// }}}
-		this.checkconsistency = function(md,solution,analyses) { // {{{
+    }// }}}
+	this.checkconsistency = function(md,solution,analyses) { // {{{
 
-			checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
-			checkfield(md,'fieldname','settings.checkpoint_frequency','numel',[1],'>=',0);
-			checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
-			checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
-		} // }}}
-		this.marshall=function(md,prefix,fid) { //{{{
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','results_on_nodes','format','Boolean');
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','io_gather','format','Boolean');
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','lowmem','format','Boolean');
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','output_frequency','format','Integer');
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','checkpoint_frequency','format','Integer');
-			WriteData(fid,prefix,'object',this,'class','settings','fieldname','solver_residue_threshold','format','Double');
-			if (this.waitonlock>0) WriteData(fid,prefix,'name','md.settings.waitonlock','data',true,'format','Boolean');
-			else WriteData(fid,prefix,'name','md.settings.waitonlock','data',false,'format','Boolean');
-		}//}}}
-		this.fix=function() { //{{{
-		}//}}}
-	//properties 
-	// {{{
-	this.results_on_nodes    = 0;
-	this.io_gather           = 0;
-	this.lowmem              = 0;
-	this.output_frequency    = 0;
-	this.checkpoint_frequency   = 0;
-	this.waitonlock          = 0;
-	this.upload_server       = '';
-	this.upload_path         = '';
-	this.upload_login        = '';
-	this.upload_port         = 0;
-	this.upload_filename     = '';
-	this.solver_residue_threshold = 0;
-	this.setdefaultparameters();
-	//}}}
+		checkfield(md,'fieldname','settings.results_on_nodes','stringrow',1);
+		checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0, 1]);
+		checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0, 1]);
+		checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
+		checkfield(md,'fieldname','settings.sb_coupling_frequency','numel',[1],'>=',1);
+		checkfield(md,'fieldname','settings.checkpoint_frequency','numel',[1],'>=',0);
+		checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
+		checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
+	} // }}}
+	this.marshall=function(md,prefix,fid) { //{{{
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','results_on_nodes','format','StringArray');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','io_gather','format','Boolean');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','lowmem','format','Boolean');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','output_frequency','format','Integer');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','sb_coupling_frequency','format','Integer');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','checkpoint_frequency','format','Integer');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','waitonlock','data',this.waitonlock>0,'format','Boolean');
+		WriteData(fid,prefix,'object',this,'class','settings','fieldname','solver_residue_threshold','format','Double');
+	}//}}}
+	this.fix=function() { //{{{
+	}//}}}
+	//properties
+    // {{{
+    this.results_on_nodes        = '';
+    this.io_gather               = 0;
+    this.lowmem                  = 0;
+    this.output_frequency        = 0;
+    this.sb_coupling_frequency   = 0;
+    this.checkpoint_frequency    = 0;
+    this.waitonlock              = 0;
+    this.upload_server           = '';
+    this.upload_path             = '';
+    this.upload_login            = '';
+    this.upload_port             = 0;
+    this.upload_filename         = '';
+    this.solver_residue_threshold = 0;
+    this.setdefaultparameters();
+    //}}}
 }
Index: issm/trunk/src/m/classes/issmsettings.py
===================================================================
--- issm/trunk/src/m/classes/issmsettings.py	(revision 25994)
+++ issm/trunk/src/m/classes/issmsettings.py	(revision 26744)
@@ -21,40 +21,38 @@
         self.solver_residue_threshold = 0
 
-    #set defaults
+        # Set defaults
         self.setdefaultparameters()
-
     #}}}
 
     def __repr__(self):  # {{{
-        string = "   general issmsettings parameters:"
-
-        string = "%s\n%s" % (string, fielddisplay(self, "results_on_nodes", "list of output for which results will be output for all the nodes of each element, Use 'all' for all output on nodes."))
-        string = "%s\n%s" % (string, fielddisplay(self, "io_gather", "I / O gathering strategy for result outputs (default 1)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "lowmem", "is the memory limited ? (0 or 1)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "output_frequency", "frequency at which results are saved in all solutions with multiple time_steps"))
-        string = "%s\n%s" % (string, fielddisplay(self, "sb_coupling_frequency", "frequency at which StressBalance solver is coupled (default 1)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "checkpoint_frequency", "frequency at which the runs are being recorded, allowing for a restart"))
-        string = "%s\n%s" % (string, fielddisplay(self, "waitonlock", "maximum number of minutes to wait for batch results, or return 0"))
-        string = "%s\n%s" % (string, fielddisplay(self, "solver_residue_threshold", "throw an error if solver residue exceeds this value (NaN to deactivate)"))
-        return string
+        s = "   general issmsettings parameters:\n"
+        s += '{}\n'.format(fielddisplay(self, "results_on_nodes", "list of output for which results will be output for all the nodes of each element, Use 'all' for all output on nodes."))
+        s += '{}\n'.format(fielddisplay(self, "io_gather", "I / O gathering strategy for result outputs (default 1)"))
+        s += '{}\n'.format(fielddisplay(self, "lowmem", "is the memory limited ? (0 or 1)"))
+        s += '{}\n'.format(fielddisplay(self, "output_frequency", "frequency at which results are saved in all solutions with multiple time_steps"))
+        s += '{}\n'.format(fielddisplay(self, "sb_coupling_frequency", "frequency at which StressBalance solver is coupled (default 1)"))
+        s += '{}\n'.format(fielddisplay(self, "checkpoint_frequency", "frequency at which the runs are being recorded, allowing for a restart"))
+        s += '{}\n'.format(fielddisplay(self, "waitonlock", "maximum number of minutes to wait for batch results, or return 0"))
+        s += '{}\n'.format(fielddisplay(self, "solver_residue_threshold", "throw an error if solver residue exceeds this value (NaN to deactivate)"))
+        return s
     #}}}
 
     def setdefaultparameters(self):  # {{{
-        #are we short in memory ? (0 faster but requires more memory)
+        # Are we short in memory? (0 faster but requires more memory)
         self.lowmem = 0
-        #i / o:
+        # I/O:
         self.io_gather = 1
-        #results frequency by default every step
+        # Results frequency by default every step
         self.output_frequency = 1
-        #coupling frequency of the stress balance solver by default every step
+        # Coupling frequency of the stress balance solver by default every step
         self.sb_coupling_frequency = 1
-        #checkpoints frequency, by default never:
+        # Checkpoints frequency, by default never:
         self.checkpoint_frequency = 0
-        #this option can be activated to load automatically the results
-        #onto the model after a parallel run by waiting for the lock file
-        #N minutes that is generated once the solution has converged
-        #0 to deactivate
-        self.waitonlock = 2**31 - 1
-        #throw an error if solver residue exceeds this value
+        # This option can be activated to load automatically the results onto 
+        # the model after a parallel run by waiting for the lock file N minutes 
+        # that is generated once the solution has converged
+        # Set to 0 to deactivate
+        self.waitonlock = pow(2, 31) - 1
+        # Throw an error if solver residue exceeds this value
         self.solver_residue_threshold = 1e-6
 
Index: issm/trunk/src/m/classes/levelset.js
===================================================================
--- issm/trunk/src/m/classes/levelset.js	(revision 25994)
+++ issm/trunk/src/m/classes/levelset.js	(revision 26744)
@@ -8,7 +8,12 @@
 	this.setdefaultparameters = function(){// {{{
 
-		//stabilization = 2 by default
-		this.stabilization		= 2;
+		//stabilization = 1 by default
+		this.stabilization		= 1;
 		this.reinit_frequency	= 5;
+		this.kill_icebergs      = 1;
+		this.migration_max      = 1e12; //No need for general cases, unless specified
+
+		//Linear elements by default
+		this.fe='P1';
 	
 	}// }}}
@@ -19,10 +24,13 @@
 		fielddisplay(this,'spclevelset','Levelset constraints (NaN means no constraint)');
 		fielddisplay(this,'reinit_frequency','Amount of time steps after which the levelset function in re-initialized (NaN: no re-initialization).');
+		fielddisplay(this,'kill_icebergs','remove floating icebergs to prevent rigid body motions (1: true, 0: false)');
+		fielddisplay(this,'migration_max','maximum allowed migration rate (m/a)');
+		fielddisplay(this,'fe','Finite Element type: "P1" (default), or "P2"');
 
 	}// }}}
-	this.extrude = function(md) {//{{{
-		this.spclevelset=project3d(md,'vector',this.spclevelset,'type','node');
-		return this;
-	}//}}}
+    this.extrude = function(md) {//{{{
+        this.spclevelset=project3d(md,'vector',this.spclevelset,'type','node');
+        return this;
+    }//}}}
 	this.classname= function(){// {{{
 		return "levelset";
@@ -33,21 +41,32 @@
 
 		checkfield(md,'fieldname','levelset.spclevelset','Inf',1,'timeseries',1);
-		checkfield(md,'fieldname','levelset.stabilization','values',[0,1,2]);
+		checkfield(md,'fieldname','levelset.stabilization','values',[0,1,2,5]);
+		checkfield(md,'fieldname','levelset.kill_icebergs','numel',1,'values',[0, 1]);
+		checkfield(md,'fieldname','levelset.migration_max','numel',1,'NaN',1,'Inf',1,'>',0);
+		checkfield(md,'fieldname','levelset.fe','values',['P1','P2']);
 	} //}}}
 	this.marshall=function(md,prefix,fid) { //{{{
+
+		let yts=md.constants.yts;
+
 		WriteData(fid,prefix,'object',this,'fieldname','stabilization','format','Integer');
 		WriteData(fid,prefix,'object',this,'fieldname','spclevelset','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 		WriteData(fid,prefix,'object',this,'fieldname','reinit_frequency','format','Integer');
-
+		WriteData(fid,prefix,'object',this,'fieldname','kill_icebergs','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','migration_max','format','Double','scale',1/yts);
+		WriteData(fid,prefix,'object',this,'fieldname','fe','format','String');
 	}//}}}
-	this.fix=function() { //{{{
-		this.spclevelset=NullFix(this.spclevelset,NaN);
-	}//}}}
+		this.fix=function() { //{{{
+			this.spclevelset=NullFix(this.spclevelset,NaN);
+		}//}}}
 	//properties 
 	// {{{
 
 	this.stabilization		= 0;
-	this.spclevelset			= NaN;
+	this.spclevelset		= NaN;
 	this.reinit_frequency	= NaN;
+	this.kill_icebergs     	= 0;
+	this.migration_max      = 0.;
+	this.fe              	= 'P1';
 
 	this.setdefaultparameters();
Index: issm/trunk/src/m/classes/levelset.m
===================================================================
--- issm/trunk/src/m/classes/levelset.m	(revision 25994)
+++ issm/trunk/src/m/classes/levelset.m	(revision 26744)
@@ -9,7 +9,7 @@
 		spclevelset			= NaN;
 		reinit_frequency	= 5;
-		kill_icebergs     = 0;
-		migration_max       = 0.;
-		fe                = 'P1';
+		kill_icebergs		= 0;
+		migration_max		= 0.;
+		fe					= 'P1';
 	end
 	methods
@@ -32,4 +32,13 @@
 			end
 		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   Level-set parameters:'));
+			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
+			fielddisplay(self,'spclevelset','Levelset constraints (NaN means no constraint)');
+			fielddisplay(self,'reinit_frequency','Amount of time steps after which the levelset function in re-initialized');
+			fielddisplay(self,'kill_icebergs','remove floating icebergs to prevent rigid body motions (1: true, 0: false)');
+			fielddisplay(self,'migration_max','maximum allowed migration rate (m/a)');
+			fielddisplay(self,'fe','Finite Element type: ''P1'' (default), or ''P2''');
+		end % }}}
 		function self = extrude(self,md) % {{{
 
@@ -42,5 +51,5 @@
 			self.reinit_frequency = 5;
 			self.kill_icebergs    = 1;
-			self.migration_max      = 3000.;
+			self.migration_max    = 1e12; % No need for general cases, unless specified
 
 			%Linear elements by default
@@ -53,17 +62,8 @@
 
 			md = checkfield(md,'fieldname','levelset.spclevelset','Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','levelset.stabilization','values',[0 1 2]);
+			md = checkfield(md,'fieldname','levelset.stabilization','values',[0 1 2 5]);
 			md = checkfield(md,'fieldname','levelset.kill_icebergs','numel',1,'values',[0 1]);
 			md = checkfield(md,'fieldname','levelset.migration_max','numel',1,'NaN',1,'Inf',1,'>',0);
 			md = checkfield(md,'fieldname','levelset.fe','values',{'P1','P2'});
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   Level-set parameters:'));
-			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
-			fielddisplay(self,'spclevelset','Levelset constraints (NaN means no constraint)');
-			fielddisplay(self,'reinit_frequency','Amount of time steps after which the levelset function in re-initialized');
-			fielddisplay(self,'kill_icebergs','remove floating icebergs to prevent rigid body motions (1: true, 0: false)');
-			fielddisplay(self,'migration_max','maximum allowed migration rate (m/a)');
-			fielddisplay(self,'fe','Finite Element type: ''P1'' (default), or ''P2''');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -72,5 +72,5 @@
 
 			WriteData(fid,prefix,'object',self,'fieldname','stabilization','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','spclevelset','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			WriteData(fid,prefix,'object',self,'fieldname','spclevelset','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
 			WriteData(fid,prefix,'object',self,'fieldname','reinit_frequency','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','kill_icebergs','format','Boolean');
Index: issm/trunk/src/m/classes/levelset.py
===================================================================
--- issm/trunk/src/m/classes/levelset.py	(revision 25994)
+++ issm/trunk/src/m/classes/levelset.py	(revision 26744)
@@ -1,54 +1,48 @@
+import numpy as np
+
+from checkfield import checkfield
 from fielddisplay import fielddisplay
 from project3d import project3d
-from checkfield import checkfield
 from WriteData import WriteData
 
 
 class levelset(object):
-    """
-    LEVELSET class definition
+    """LEVELSET class definition
 
-       Usage:
-          levelset = levelset()
+    Usage:
+        levelset = levelset()
     """
 
     def __init__(self):  # {{{
-
         self.stabilization = 0
-        self.spclevelset = float('NaN')
-        self.reinit_frequency = 0
+        self.spclevelset = np.nan
+        self.reinit_frequency = 5
         self.kill_icebergs = 0
-        self.migration_max = 0.
+        self.migration_max = 0
         self.fe = 'P1'
 
-    #set defaults
+        # Set defaults
         self.setdefaultparameters()
-
     #}}}
     def __repr__(self):  # {{{
-        string = '   Level - set parameters:'
-        string = "%s\n%s" % (string, fielddisplay(self, 'stabilization', '0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'spclevelset', 'levelset constraints (NaN means no constraint)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'reinit_frequency', 'Amount of time steps after which the levelset function in re-initialized'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'kill_icebergs', 'remove floating icebergs to prevent rigid body motions (1: true, 0: false)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'migration_max', 'maximum allowed migration rate (m / a)'))
-        string = "%s\n%s" % (string, fielddisplay(self, 'fe', 'Finite Element type: ''P1'' (default), or ''P2'''))
+        s = '   Level-set parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'stabilization', '0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
+        s += '{}\n'.format(fielddisplay(self, 'spclevelset', 'Levelset constraints (NaN means no constraint)'))
+        s += '{}\n'.format(fielddisplay(self, 'reinit_frequency', 'Amount of time steps after which the levelset function in re-initialized'))
+        s += '{}\n'.format(fielddisplay(self, 'kill_icebergs', 'remove floating icebergs to prevent rigid body motions (1: true, 0: false)'))
+        s += '{}\n'.format(fielddisplay(self, 'migration_max', 'maximum allowed migration rate (m/a)'))
+        s += '{}\n'.format(fielddisplay(self, 'fe', 'Finite Element type: \'P1\' (default), or \'P2\''))
 
-        return string
-    #}}}
-
-    def extrude(self, md):  # {{{
-        self.spclevelset = project3d(md, 'vector', self.spclevelset, 'type', 'node')
-        return self
+        return s
     #}}}
 
     def setdefaultparameters(self):  # {{{
-        #stabilization = 1 by default
+        # Stabilization = 1 by default
         self.stabilization = 1
         self.reinit_frequency = 5
         self.kill_icebergs = 1
-        self.migration_max = 3000.
+        self.migration_max = 1e12 # No need for general cases, unless specified
 
-    #Linear elements by default
+        # Linear elements by default
         self.fe = 'P1'
 
@@ -57,10 +51,10 @@
 
     def checkconsistency(self, md, solution, analyses):  # {{{
-        #Early return
+        # Early return
         if (solution != 'TransientSolution') or (not md.transient.ismovingfront):
             return md
 
         md = checkfield(md, 'fieldname', 'levelset.spclevelset', 'Inf', 1, 'timeseries', 1)
-        md = checkfield(md, 'fieldname', 'levelset.stabilization', 'numel', [1], 'values', [0, 1, 2])
+        md = checkfield(md, 'fieldname', 'levelset.stabilization', 'numel', [1], 'values', [0, 1, 2, 5])
         md = checkfield(md, 'fieldname', 'levelset.kill_icebergs', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'levelset.migration_max', 'numel', [1], 'NaN', 1, 'Inf', 1, '>', 0)
@@ -69,4 +63,9 @@
         return md
     # }}}
+
+    def extrude(self, md):  # {{{
+        self.spclevelset = project3d(md, 'vector', self.spclevelset, 'type', 'node')
+        return self
+    #}}}
 
     def marshall(self, prefix, md, fid):  # {{{
@@ -77,5 +76,5 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'reinit_frequency', 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'kill_icebergs', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'migration_max', 'format', 'Double', 'scale', 1. / yts)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'migration_max', 'format', 'Double', 'scale', 1 / yts)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'fe', 'format', 'String')
     # }}}
Index: issm/trunk/src/m/classes/lovenumbers.m
===================================================================
--- issm/trunk/src/m/classes/lovenumbers.m	(revision 25994)
+++ issm/trunk/src/m/classes/lovenumbers.m	(revision 26744)
@@ -9,5 +9,5 @@
 classdef lovenumbers
 	properties (SetAccess=public) 
-		
+
 		%regular love numbers:
 		h           = []; %provided by PREM model
@@ -16,8 +16,12 @@
 		
 		%tidal love numbers for computing rotational feedback:
-		th          = []; 
-		tk          = []; 
-		tl          = []; 
-		tk2secular  = 0;  %deg 2 secular number.
+		th          = [];
+		tk          = [];
+		tl          = [];
+		tk2secular  = 0; %deg 2 secular number.
+
+		%time/frequency for visco-elastic love numbers
+		timefreq    = [];
+		istime      = 1;
 
 	end
@@ -29,6 +33,22 @@
 			self=setdefaultparameters(self,maxdeg,referenceframe);
 		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   lovenumbers parameters:'));
+
+			fielddisplay(self,'h','load Love number for radial displacement');
+			fielddisplay(self,'k','load Love number for gravitational potential perturbation');
+			fielddisplay(self,'l','load Love number for horizontal displacements');
+
+			fielddisplay(self,'th','tidal load Love number (deg 2)');
+			fielddisplay(self,'tk','tidal load Love number (deg 2)');
+			fielddisplay(self,'tl','tidal load Love number (deg 2)');
+			fielddisplay(self,'tk2secular','secular fluid Love number');
+
+			fielddisplay(self,'istime','time (default: 1) or frequency love numbers (0)');
+			fielddisplay(self,'timefreq','time/frequency vector (yr or 1/yr)');
+
+		end % }}}
 		function self = setdefaultparameters(self,maxdeg,referenceframe) % {{{
-		
+
 			%initialize love numbers:
 			self.h=getlovenumbers('type','loadingverticaldisplacement','referenceframe',referenceframe,'maxdeg',maxdeg);
@@ -42,9 +62,12 @@
 			self.tk2secular=0.942; 
 
+			%time: 
+			self.istime=1; %temporal love numbers by default
+			self.timefreq=0; %elastic case by default.
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0), 
 				return; 
 			end
@@ -57,5 +80,8 @@
 			md = checkfield(md,'fieldname','solidearth.lovenumbers.th','NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','solidearth.lovenumbers.tk','NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','solidearth.lovenumbers.tl','NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','solidearth.lovenumbers.tk2secular','NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','solidearth.lovenumbers.timefreq','NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','solidearth.lovenumbers.istime','NaN',1,'Inf',1,'values',[0 1]);
 
 			%check that love numbers are provided at the same level of accuracy: 
@@ -64,20 +90,12 @@
 			end
 
+			ntf=length(self.timefreq);
+			if( size(self.h,2) ~= ntf | size(self.k,2) ~= ntf | size(self.l,2) ~= ntf | size(self.th,2) ~= ntf | size(self.tk,2) ~= ntf | size(self.tl,2) ~= ntf ),
+				error('lovenumbers error message: love numbers should have as many time/frequency steps as the time/frequency vector');
+			end
 
 		end % }}}
 		function list=defaultoutputs(self,md) % {{{
 			list = {};
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   lovenumbers parameters:'));
-
-			fielddisplay(self,'h','load Love number for radial displacement');
-			fielddisplay(self,'k','load Love number for gravitational potential perturbation');
-			fielddisplay(self,'l','load Love number for horizontal displacements');
-
-			fielddisplay(self,'th','tidal load Love number (deg 2)');
-			fielddisplay(self,'tk','tidal load Love number (deg 2)');
-			fielddisplay(self,'tk2secular','secular fluid Love number');
-
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -92,4 +110,12 @@
 			WriteData(fid,prefix,'object',self,'data',self.tk2secular,'fieldname','lovenumbers.tk2secular','format','Double');
 
+			if self.istime,
+				scale=md.constants.yts; 
+			else
+				scale=1.0/md.constants.yts;
+			end
+			WriteData(fid,prefix,'object',self,'fieldname','istime','name','md.solidearth.lovenumbers.istime','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','timefreq','name','md.solidearth.lovenumbers.timefreq','format','DoubleMat','mattype',1,'scale',scale);
+
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
@@ -97,4 +123,6 @@
 			writejs1Darray(fid,[modelname '.lovenumbers.k'],self.k);
 			writejs1Darray(fid,[modelname '.lovenumbers.l'],self.l);
+			writejs1Darray(fid,[modelname '.lovenumbers.istime'],self.istime);
+			writejs1Darray(fid,[modelname '.lovenumbers.time'],self.time);
 		end % }}}
 		function self = extrude(self,md) % {{{
Index: issm/trunk/src/m/classes/lovenumbers.py
===================================================================
--- issm/trunk/src/m/classes/lovenumbers.py	(revision 25994)
+++ issm/trunk/src/m/classes/lovenumbers.py	(revision 26744)
@@ -1,4 +1,3 @@
 import numpy as np
-
 from checkfield import checkfield
 from fielddisplay import fielddisplay
@@ -8,17 +7,20 @@
 
 
-class lovenumbers(object): #{{{
+class lovenumbers(object):  #{{{
     """LOVENUMBERS class definition
 
     Usage:
-        lovenumbers = lovenumbers() #will setup love numbers deg 1001 by default
-        lovenumbers = lovenumbers('maxdeg', 10001);  #supply numbers of degrees required (here, 10001)
+        lovenumbers = lovenumbers()
+        lovenumbers = lovenumbers('maxdeg', 10000, 'referenceframe', 'CF');
+
+    Choose numbers of degrees required (1000 by default) and reference frame 
+    (between CF and CM; CM by default)
     """
 
-    def __init__(self, *args): #{{{
+    def __init__(self, *args):  #{{{
         # Regular love numbers
-        self.h = []  # Provided by PREM model
-        self.k = []  # idem
-        self.l = []  # idem
+        self.h = []   # Provided by PREM model
+        self.k = []   # idem
+        self.l = []   # idem
 
         # Tidal love numbers for computing rotational feedback
@@ -26,5 +28,9 @@
         self.tk = []
         self.tl = []
-        self.tk2secular = 0 # deg 2 secular number
+        self.tk2secular = 0  # deg 2 secular number
+
+        # Time/frequency for visco-elastic love numbers
+        self.timefreq = []
+        self.istime = 1
 
         options = pairoptions(*args)
@@ -34,20 +40,38 @@
     #}}}
 
-    def setdefaultparameters(self, maxdeg, referenceframe): #{{{
+    def __repr__(self):  #{{{
+        s = '   lovenumbers parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'h', 'load Love number for radial displacement'))
+        s += '{}\n'.format(fielddisplay(self, 'k', 'load Love number for gravitational potential perturbation'))
+        s += '{}\n'.format(fielddisplay(self, 'l', 'load Love number for horizontal displacements'))
+        s += '{}\n'.format(fielddisplay(self, 'th', 'tidal load Love number (deg 2)'))
+        s += '{}\n'.format(fielddisplay(self, 'tk', 'tidal load Love number (deg 2)'))
+        s += '{}\n'.format(fielddisplay(self, 'tl', 'tidal load Love number (deg 2)'))
+        s += '{}\n'.format(fielddisplay(self, 'tk2secular', 'secular fluid Love number'))
+        s += '{}\n'.format(fielddisplay(self, 'istime', 'time (default: 1) or frequency love numbers (0)'))
+        s += '{}\n'.format(fielddisplay(self, 'timefreq', 'time/frequency vector (yr or 1/yr)'))
+        return s
+    #}}}
+
+    def setdefaultparameters(self, maxdeg, referenceframe):  #{{{
         # Initialize love numbers
-        self.h = getlovenumbers('type', 'loadingverticaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
-        self.k = getlovenumbers('type', 'loadinggravitationalpotential', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
-        self.l = getlovenumbers('type', 'loadinghorizontaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
-        self.th = getlovenumbers('type', 'tidalverticaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
-        self.tk = getlovenumbers('type', 'tidalgravitationalpotential', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
-        self.tl = getlovenumbers('type', 'tidalhorizontaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg)
+        self.h = getlovenumbers('type', 'loadingverticaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
+        self.k = getlovenumbers('type', 'loadinggravitationalpotential', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
+        self.l = getlovenumbers('type', 'loadinghorizontaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
+        self.th = getlovenumbers('type', 'tidalverticaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
+        self.tk = getlovenumbers('type', 'tidalgravitationalpotential', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
+        self.tl = getlovenumbers('type', 'tidalhorizontaldisplacement', 'referenceframe', referenceframe, 'maxdeg', maxdeg).reshape(-1,1)
 
         # Secular fluid love number
         self.tk2secular = 0.942
+
+        # Time
+        self.istime = 1 # Temporal love numbers by default
+        self.timefreq = np.zeros(1) # Elastic case by default
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses): #{{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
+    def checkconsistency(self, md, solution, analyses):  #{{{
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
             return
         md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.h', 'NaN', 1, 'Inf', 1)
@@ -57,27 +81,25 @@
         md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.th', 'NaN', 1, 'Inf', 1)
         md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tk', 'NaN', 1, 'Inf', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tl', 'NaN', 1, 'Inf', 1)
         md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tk2secular', 'NaN', 1, 'Inf', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.timefreq', 'NaN', 1, 'Inf', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.istime', 'NaN', 1, 'Inf', 1, 'values', [0, 1])
+
         # Check that love numbers are provided at the same level of accuracy
         if (self.h.shape[0] != self.k.shape[0]) or (self.h.shape[0] != self.l.shape[0]):
             raise ValueError('lovenumbers error message: love numbers should be provided at the same level of accuracy')
+
+        ntf = len(self.timefreq)
+        if (np.shape(self.h)[1] != ntf or np.shape(self.k)[1] != ntf or np.shape(self.l)[1] != ntf or np.shape(self.th)[1] != ntf or np.shape(self.tk)[1] != ntf or np.shape(self.tl)[1] != ntf):
+            raise ValueError('lovenumbers error message: love numbers should have as many time/frequency steps as the time/frequency vector')
+
         return md
     #}}}
 
-    def defaultoutputs(self, md): #{{{
+    def defaultoutputs(self, md):  #{{{
         return[]
     #}}}
 
-    def __repr__(self): #{{{
-        s = '   lovenumbers parameters:\n'
-        s += '{}\n'.format(fielddisplay(self, 'h', 'load Love number for radial displacement'))
-        s += '{}\n'.format(fielddisplay(self, 'k', 'load Love number for gravitational potential perturbation'))
-        s += '{}\n'.format(fielddisplay(self, 'l', 'load Love number for horizontal displacements'))
-        s += '{}\n'.format(fielddisplay(self, 'th', 'tidal load Love number (deg 2)'))
-        s += '{}\n'.format(fielddisplay(self, 'tk', 'tidal load Love number (deg 2)'))
-        s += '{}\n'.format(fielddisplay(self, 'tk2secular', 'secular fluid Love number'))
-        return s
-    #}}}
-
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  #{{{
         WriteData(fid, prefix, 'object', self, 'fieldname', 'h', 'name', 'md.solidearth.lovenumbers.h', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'object', self, 'fieldname', 'k', 'name', 'md.solidearth.lovenumbers.k', 'format', 'DoubleMat', 'mattype', 1)
@@ -88,7 +110,14 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'tl', 'name', 'md.solidearth.lovenumbers.tl', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'object', self, 'data', self.tk2secular, 'fieldname', 'lovenumbers.tk2secular', 'format', 'Double')
+
+        if (self.istime):
+            scale = md.constants.yts
+        else:
+            scale = 1.0 / md.constants.yts
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'istime', 'name', 'md.solidearth.lovenumbers.istime', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'timefreq', 'name', 'md.solidearth.lovenumbers.timefreq', 'format', 'DoubleMat', 'mattype', 1, 'scale', scale);
     #}}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  #{{{
         return
 #}}}
Index: issm/trunk/src/m/classes/mask.js
===================================================================
--- issm/trunk/src/m/classes/mask.js	(revision 25994)
+++ issm/trunk/src/m/classes/mask.js	(revision 26744)
@@ -7,6 +7,6 @@
 	//properties 
 	// {{{
-		this.ocean_levelset                           = NaN;
-		this.ice_levelset                           = NaN;
+		this.ocean_levelset	= NaN;
+		this.ice_levelset	= NaN;
 		//}}}
 	//methods 
@@ -14,8 +14,8 @@
 		} // }}}
 		this.disp = function () { //{{{
-			console.log(sprintf("   mask:")); 
+			console.log(sprintf("   masks:")); 
 
-			fielddisplay(this,"ocean_levelset","presence of ocean if < 0, coastline/grounding line if = 0, no ocean if > 0");
-			fielddisplay(this,"ice_levelset","presence of ice if < 0, icefront position if = 0, no ice if > 0");
+			fielddisplay(this,'ocean_levelset','presence of ocean if < 0, coastline/grounding line if = 0, no ocean if > 0');
+			fielddisplay(this,'ice_levelset','presence of ice if < 0, icefront position if = 0, no ice if > 0');
 		} //}}}
 		this.extrude = function(md) {//{{{
@@ -28,4 +28,5 @@
 		} //}}}
 		this.checkconsistency = function(md,solution,analyses){ //{{{
+			if (solution=='LoveSolution') return;
 
 			checkfield(md,'fieldname','mask.ocean_levelset','size',[md.mesh.numberofvertices, 1]);
@@ -46,4 +47,3 @@
 		this.fix=function() { //{{{
 		}//}}}
-
 }
Index: issm/trunk/src/m/classes/masstransport.js
===================================================================
--- issm/trunk/src/m/classes/masstransport.js	(revision 25994)
+++ issm/trunk/src/m/classes/masstransport.js	(revision 26744)
@@ -1,104 +1,102 @@
-//MASSTRANSPORT class definition
-//
-//   Usage:
-//      masstransport=new masstransport();
+class masstransport {//{{{
+	/**
+	 * MASSTRANSPORT class definition
+	 *
+	 * Usage:
+	 *     masstransport = masstransport();
+	 */
+	constructor() {//{{{
+		this.spcthickness = NaN;
+		this.isfreesurface = 0;
+		this.min_thickness = 0;
+		this.hydrostatic_adjustment = 0;
+		this.stabilization = 0;
+		this.vertex_pairing = 0;
+		this.penalty_factor = 0;
+		this.requested_outputs = 0;
 
-function masstransport (){
-	//methods
-	this.setdefaultparameters = function(){// {{{
+		if (arguments.length == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
 
-		//Type of stabilization to use 0:nothing 1:artificial_diffusivity 3:Discontinuous Galerkin
-		this.stabilization=1;
+	disp() {//{{{
+		console.log('WARNING: masstransport::disp is not yet implemented');
+	} //}}}
 
-		//Factor applied to compute the penalties kappa=max(stiffness matrix)*10^penalty_factor
-		this.penalty_factor=3;
+	setdefaultparameters() {//{{{
+		// Type of stabilization to use 0:nothing 1:artificial_diffusivity 3:Discontinuous Galerkin
+		this.stabilization = 1;
 
-		//Minimum ice thickness that can be used
-		this.min_thickness=1;
+		// Factor applied to compute the penalties kappa=max(stiffness matrix)*10^penalty_factor
+		this.penalty_factor = 3;
 
-		//Hydrostatic adjustment
-		this.hydrostatic_adjustment='Absolute';
+		// Minimum ice thickness that can be used
+		this.min_thickness = 1;
 
-		//default output
-		this.requested_outputs=['default'];
+		// Hydrostatic adjustment
+		this.hydrostatic_adjustment = 'Absolute';
 
-	}// }}}
-	this.disp= function(){// {{{
-		console.log(sprintf('   Masstransport solution parameters:'));
-		fielddisplay(this,'spcthickness','thickness constraints (NaN means no constraint) [m]');
-		fielddisplay(this,'isfreesurface','do we use free surfaces (FS only) or mass conservation');
-		fielddisplay(this,'min_thickness','minimum ice thickness allowed [m]');
-		fielddisplay(this,'hydrostatic_adjustment',"adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute' ");
-		fielddisplay(this,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin, 4: Flux Correction Transport');
+		// Default output
+		this.requested_outputs = ['default'];
+	} //}}}
 
-		console.log(sprintf('\n      %s','Penalty options:'));
-		fielddisplay(this,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset');
-		fielddisplay(this,'vertex_pairing','pairs of vertices that are penalized');
-		fielddisplay(this,'requested_outputs','additional outputs requested');
+	checkconsistency(md, solution, analyses) {//{{{
+		// Early return
+		if (analyses.includes('HydrologyShreveAnalysis') || (solution == 'TransientSolution' && !md.trans.ismasstransport)) {
+			return md;
+		}
 
-	}// }}}
-	this.classname= function(){// {{{
-		return "masstransport";
-	}// }}}
-    this.extrude = function(md) {//{{{
-        this.spcthickness=project3d(md,'vector',this.spcthickness,'type','node');
-        return this;
-    }//}}}
-		this.checkconsistency = function (md,solution,analyses){  // {{{
+		md = checkfield(md, 'fieldname', 'masstransport.spcthickness', 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'masstransport.isfreesurface', 'values', [0, 1]);
+		md = checkfield(md, 'fieldname', 'masstransport.hydrostatic_adjustment', 'values', ['Absolute', 'Incremental']);
+		md = checkfield(md, 'fieldname', 'masstransport.stabilization', 'values', [0, 1, 2, 3, 4, 5]);
+		md = checkfield(md, 'fieldname', 'masstransport.min_thickness', '>', 0);
+		md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1);
+		if (!any(isnan(md.stressbalance.vertex.vertex_pairing))) {
+			md = checkfield(md, 'fieldname', 'stressbalance.vertex_pairing', '>', 0);
+		}
 
-			//Early return
-			if(!ArrayAnyEqual(ArrayIsMember('HydrologyShreveAnalysis',analyses),1) | (solution=='TransientSolution' & md.trans.ismasstransport==0)) return; 
+		return md;
+	} //}}}
 
-			checkfield(md,'fieldname','masstransport.spcthickness','Inf',1,'timeseries',1);
-			checkfield(md,'fieldname','masstransport.isfreesurface','values',[0 ,1]);
-			checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',['Absolute', 'Incremental']);
-			checkfield(md,'fieldname','masstransport.stabilization','values',[0,1,2,3,4]);
-			checkfield(md,'fieldname','masstransport.min_thickness','>',0);
-			checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1);
+	defaultoutputs(md) {//{{{
+		return ['Thickness', 'Surface', 'Base'];
+	} //}}}
 
-		} // }}}
-		this.marshall=function(md,prefix,fid) { //{{{
+	marshall(md, prefix, fid) {//{{{
+		let yts = md.constants.yts;
 
-			var yts=md.constants.yts;
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'spcthickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'isfreesurface', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'min_thickness', 'format', 'Double');
+		WriteData(fid, prefix, 'data', this.hydrostatic_adjustment, 'format', 'String', 'name', 'md.masstransport.hydrostatic_adjustment');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'stabilization', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'vertex_pairing', 'format', 'DoubleMat', 'mattype', 3);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'penalty_factor', 'format', 'Double');
 
-			WriteData(fid,prefix,'object',this,'fieldname','spcthickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',this,'fieldname','isfreesurface','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','min_thickness','format','Double');
-			WriteData(fid,prefix,'data',this.hydrostatic_adjustment,'format','String','name','md.masstransport.hydrostatic_adjustment');
-			WriteData(fid,prefix,'object',this,'fieldname','stabilization','format','Integer');
-			WriteData(fid,prefix,'object',this,'fieldname','vertex_pairing','format','DoubleMat','mattype',3);
-			WriteData(fid,prefix,'object',this,'fieldname','penalty_factor','format','Double');
+		// Process requested outputs
+		let outputs = this.requested_outputs;
+		let pos = find(ismember(outputs, 'default'));
+		if (pos.length) {
+			/*
+			NOTE: In order to handle case where user has added 'default' more 
+			than once to this.requested_outputs, need to remove elements by 
+			index in reverse order.
+			*/
+			for (let i = (pos.length - 1); i >= 0; --i) {
+				outputs.splice(pos[i], 1);
+			}
+			let default_outputs = this.defaultoutputs(md);
+			for (let i = 0; i < default_outputs.length; ++i) {
+				outputs.push(default_outputs[i]);
+			}
+		}
+		WriteData(fid, prefix, 'data', outputs, 'name', 'md.masstransport.requested_outputs', 'format', 'StringArray');
+	} //}}}
 
-			//process requested outputs
-			var outputs = this.requested_outputs;
-			for (var i=0;i<outputs.length;i++){
-				if (outputs[i] == 'default') {
-					outputs.splice(i,1);
-					var newoutputs=this.defaultoutputs(md);
-					for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
-				}
-			}
-			WriteData(fid,prefix,'data',outputs,'name','md.masstransport.requested_outputs','format','StringArray');
-		}//}}}
-		this.defaultoutputs = function(md) { //{{{
-			return ['Thickness','Surface','Base'];
-		}//}}}
-		this.fix=function() { //{{{
-			this.spcthickness=NullFix(this.spcthickness,NaN);
-			this.vertex_pairing=NullFix(this.vertex_pairing,NaN);
-		}//}}}
-	//properties 
-	// {{{
-
-	this.spcthickness           = NaN;
-	this.isfreesurface          = 0;
-	this.min_thickness          = 0;
-	this.hydrostatic_adjustment = 0;
-	this.stabilization          = 0;
-	this.vertex_pairing         = NaN;
-	this.penalty_factor         = 0;
-	this.requested_outputs      = [];
-
-	this.setdefaultparameters();
-	//}}}
+	extrude(md) {//{{{
+	} //}}}
 }
Index: issm/trunk/src/m/classes/masstransport.m
===================================================================
--- issm/trunk/src/m/classes/masstransport.m	(revision 25994)
+++ issm/trunk/src/m/classes/masstransport.m	(revision 26744)
@@ -105,5 +105,5 @@
 			fielddisplay(self,'min_thickness','minimum ice thickness allowed [m]');
 			fielddisplay(self,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' ');
-			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin, 4: Flux Correction Transport, 5: streamline upwind Petrov-Galerkin (SUPG)');
+			fielddisplay(self,'stabilization','0: no stabilization, 1: artificial diffusion, 2: streamline upwinding, 3: discontinuous Galerkin, 4: flux corrected transport, 5: streamline upwind Petrov-Galerkin (SUPG)');
 
 			disp(sprintf('\n      %s','Penalty options:'));
Index: issm/trunk/src/m/classes/masstransport.py
===================================================================
--- issm/trunk/src/m/classes/masstransport.py	(revision 25994)
+++ issm/trunk/src/m/classes/masstransport.py	(revision 26744)
@@ -35,5 +35,5 @@
         s += '{}\n'.format(fielddisplay(self, 'min_thickness', 'minimum ice thickness allowed [m]'))
         s += '{}\n'.format(fielddisplay(self, 'hydrostatic_adjustment', 'adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' '))
-        s += '{}\n'.format(fielddisplay(self, 'stabilization', '0: no, 1: artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin, 4: Flux Correction Transport'))
+        s += '{}\n'.format(fielddisplay(self, 'stabilization', '0: no stabilization, 1: artificial diffusion, 2: streamline upwinding, 3: discontinuous Galerkin, 4: flux corrected transport, 5: streamline upwind Petrov-Galerkin (SUPG)'))
         s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
         return s
@@ -71,5 +71,5 @@
         md = checkfield(md, 'fieldname', 'masstransport.isfreesurface', 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'masstransport.hydrostatic_adjustment', 'values', ['Absolute', 'Incremental'])
-        md = checkfield(md, 'fieldname', 'masstransport.stabilization', 'values', [0, 1, 2, 3, 4])
+        md = checkfield(md, 'fieldname', 'masstransport.stabilization', 'values', [0, 1, 2, 3, 4, 5])
         md = checkfield(md, 'fieldname', 'masstransport.min_thickness', '>', 0)
         md = checkfield(md, 'fieldname', 'masstransport.requested_outputs', 'stringrow', 1)
Index: issm/trunk/src/m/classes/matdamageice.m
===================================================================
--- issm/trunk/src/m/classes/matdamageice.m	(revision 25994)
+++ issm/trunk/src/m/classes/matdamageice.m	(revision 26744)
@@ -6,29 +6,23 @@
 classdef matdamageice
 	properties (SetAccess=public) 
-		rho_ice                    = 0.;
-		rho_water                  = 0.;
-		rho_freshwater             = 0.;
-		mu_water                   = 0.;
-		heatcapacity               = 0.;
-		latentheat                 = 0.;
-		thermalconductivity        = 0.;
-		temperateiceconductivity   = 0.;
+		rho_ice                         = 0.;
+		rho_water                       = 0.;
+		rho_freshwater                  = 0.;
+		mu_water                        = 0.;
+		heatcapacity                    = 0.;
+		latentheat                      = 0.;
+		thermalconductivity             = 0.;
+		temperateiceconductivity        = 0.;
 		effectiveconductivity_averaging = 0.;
-		meltingpoint               = 0.;
-		beta                       = 0.;
-		mixed_layer_capacity       = 0.;
-		thermal_exchange_velocity  = 0.;
-		rheology_B   = NaN;
-		rheology_n   = NaN;
-		rheology_law = '';
+		meltingpoint                    = 0.;
+		beta                            = 0.;
+		mixed_layer_capacity            = 0.;
+		thermal_exchange_velocity       = 0.;
+		rheology_B                      = NaN;
+		rheology_n                      = NaN;
+		rheology_law                    = '';
 
-		%giaivins: 
-		lithosphere_shear_modulus  = 0.;
-		lithosphere_density        = 0.;
-		mantle_shear_modulus       = 0.;
-		mantle_density             = 0.;
-
-		%slr
-		earth_density              = 0;
+		%slc
+		earth_density                   = 0;
 
 	end
@@ -78,5 +72,5 @@
 			%ice thermal conductivity (W/m/K)
 			self.thermalconductivity=2.4;
-			
+
 			%wet ice thermal conductivity (W/m/K)
 			self.temperateiceconductivity=.24;
@@ -84,5 +78,5 @@
 			%computation of effective conductivity
 			self.effectiveconductivity_averaging=1;
-            
+
 			%the melting point of ice at 1 atmosphere of pressure in K
 			self.meltingpoint=273.15;
@@ -101,12 +95,6 @@
 			self.rheology_law='Paterson';
 
-			% GIA:
-			self.lithosphere_shear_modulus  = 6.7*10^10;  % (Pa)
-			self.lithosphere_density        = 3.32;       % (g/cm^-3)
-			self.mantle_shear_modulus       = 1.45*10^11; % (Pa)
-			self.mantle_density             = 3.34;       % (g/cm^-3)
-
-			%SLR
-			self.earth_density= 5512;  % average density of the Earth, (kg/m^3)
+			%SLC
+			self.earth_density= 5512; % average density of the Earth (kg/m^3)
 
 		end % }}}
@@ -121,11 +109,5 @@
 			md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]);
 			
-			if ismember('GiaAnalysis',analyses),
-				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
-			end
-			if ismember('SealevelriseAnalysis',analyses),
+			if ismember('SealevelchangeAnalysis',analyses),
 				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
 			end
@@ -152,8 +134,4 @@
 			fielddisplay(self,'rheology_n','Glen''s flow law exponent');
 			fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', ''Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
-			fielddisplay(self,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
-			fielddisplay(self,'lithosphere_density','Lithosphere density [g/cm^-3]');
-			fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
-			fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
 			fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
 		end % }}}
@@ -177,8 +155,4 @@
 			WriteData(fid,prefix,'data',self.rheology_law,'name','md.materials.rheology_law','format','String');
 
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
 			WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double');
 
Index: issm/trunk/src/m/classes/matdamageice.py
===================================================================
--- issm/trunk/src/m/classes/matdamageice.py	(revision 25994)
+++ issm/trunk/src/m/classes/matdamageice.py	(revision 26744)
@@ -1,2 +1,4 @@
+import numpy as np
+
 from fielddisplay import fielddisplay
 from project3d import project3d
@@ -6,6 +8,5 @@
 
 class matdamageice(object):
-    """
-    MATICE class definition
+    """MATICE class definition
 
        Usage:
@@ -14,55 +15,46 @@
 
     def __init__(self):  # {{{
-        self.rho_ice = 0.
-        self.rho_water = 0.
-        self.rho_freshwater = 0.
-        self.mu_water = 0.
-        self.heatcapacity = 0.
-        self.latentheat = 0.
-        self.thermalconductivity = 0.
-        self.temperateiceconductivity = 0.
+        self.rho_ice = 0
+        self.rho_water = 0
+        self.rho_freshwater = 0
+        self.mu_water = 0
+        self.heatcapacity = 0
+        self.latentheat = 0
+        self.thermalconductivity = 0
+        self.temperateiceconductivity = 0
         self.effectiveconductivity_averaging = 0
-        self.meltingpoint = 0.
-        self.beta = 0.
-        self.mixed_layer_capacity = 0.
-        self.thermal_exchange_velocity = 0.
-        self.rheology_B = float('NaN')
-        self.rheology_n = float('NaN')
+        self.meltingpoint = 0
+        self.beta = 0
+        self.mixed_layer_capacity = 0
+        self.thermal_exchange_velocity = 0
+        self.rheology_B = np.nan
+        self.rheology_n = np.nan
         self.rheology_law = ''
 
-    #giaivins:
-        self.lithosphere_shear_modulus = 0.
-        self.lithosphere_density = 0.
-        self.mantle_shear_modulus = 0.
-        self.mantle_density = 0.
+        #SLC
+        self.earth_density = 0
 
-    #SLR
-        self.earth_density = 5512  # average density of the Earth, (kg / m^3)
         self.setdefaultparameters()
     #}}}
 
     def __repr__(self):  # {{{
-        string = "   Materials:"
-        string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg / m^3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "water density [kg / m^3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg / m^3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s / m^2]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J / kg / K]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W / m / K]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W / m / K]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K"))
-        string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J / m^3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K / Pa]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W / kg / K]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m / s]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1 / n)]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent"))
-        string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius' or 'LliboutryDuval'"))
-        string = "%s\n%s" % (string, fielddisplay(self, "lithosphere_shear_modulus", "Lithosphere shear modulus [Pa]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "lithosphere_density", "Lithosphere density [g / cm^ - 3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "mantle_shear_modulus", "Mantle shear modulus [Pa]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "mantle_density", "Mantle density [g / cm^ - 3]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "earth_density", "Mantle density [kg / m^ - 3]"))
+        s = '   Materials:\n'
+        s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)'))
+        s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
+        s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/ kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\''))
+        s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg m^-3]'))
         return string
     #}}}
@@ -75,42 +67,36 @@
 
     def setdefaultparameters(self):  # {{{
-        #ice density (kg / m^3)
-        self.rho_ice = 917.
-        #ocean water density (kg / m^3)
-        self.rho_water = 1023.
-        #fresh water density (kg / m^3)
-        self.rho_freshwater = 1000.
-        #water viscosity (N.s / m^2)
+        # Ice density (kg/m^3)
+        self.rho_ice = 917.0
+        # Ocean water density (kg/m^3)
+        self.rho_water = 1023.0
+        # Fresh water density (kg/m^3)
+        self.rho_freshwater = 1000.0
+        # Water viscosity (N.s/m^2)
         self.mu_water = 0.001787
-        #ice heat capacity cp (J / kg / K)
-        self.heatcapacity = 2093.
-        #ice latent heat of fusion L (J / kg)
-        self.latentheat = 3.34e5
-        #ice thermal conductivity (W / m / K)
+        # Ice heat capacity cp (J/kg/K)
+        self.heatcapacity = 2093.0
+        # Ice latent heat of fusion L (J/kg)
+        self.latentheat = 3.34 * pow(10, 5)
+        # Ice thermal conductivity (W/m/K)
         self.thermalconductivity = 2.4
-        #temperate ice thermal conductivity (W / m / K)
+        # Temperate ice thermal conductivity (W/m/K)
         self.temperateiceconductivity = 0.24
-        #computation of effective conductivity
+        # Computation of effective conductivity
         self.effectiveconductivity_averaging = 1
-        #the melting point of ice at 1 atmosphere of pressure in K
+        # The melting point of ice at 1 atmosphere of pressure in K
         self.meltingpoint = 273.15
-        #rate of change of melting point with pressure (K / Pa)
-        self.beta = 9.8e-8
-        #mixed layer (ice-water interface) heat capacity (J / kg / K)
-        self.mixed_layer_capacity = 3974.
-        #thermal exchange velocity (ice-water interface) (m / s)
+        # Rate of change of melting point with pressure (K/Pa)
+        self.beta = 9.8 * pow(10, -8)
+        # Mixed layer (ice-water interface) heat capacity (J/kg/K)
+        self.mixed_layer_capacity = 3974.0
+        # Thermal exchange velocity (ice-water interface) (m/s)
         self.thermal_exchange_velocity = 1.00e-4
-        #Rheology law: what is the temperature dependence of B with T
-        #available: none, paterson and arrhenius
+        # Rheology law: what is the temperature dependence of B with T 
+        # available: none, paterson and arrhenius
         self.rheology_law = 'Paterson'
 
-        # GIA:
-        self.lithosphere_shear_modulus = 6.7e10  # (Pa)
-        self.lithosphere_density = 3.32  # (g / cm^ - 3)
-        self.mantle_shear_modulus = 1.45e11  # (Pa)
-        self.mantle_density = 3.34  # (g / cm^ - 3)
-
-        #SLR
-        self.earth_density = 5512  #average density of the Earth, (kg / m^3)
+        # SLC
+        self.earth_density = 5512  # average density of the Earth (kg/m^3)
         return self
     #}}}
@@ -125,17 +111,6 @@
         md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval'])
         md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2])
-        md = checkfield(md, 'fieldname', 'materials.lithosphere_shear_modulus', '>', 0, 'numel', [1])
-        md = checkfield(md, 'fieldname', 'materials.lithosphere_density', '>', 0, 'numel', [1])
-        md = checkfield(md, 'fieldname', 'materials.mantle_shear_modulus', '>', 0, 'numel', [1])
-        md = checkfield(md, 'fieldname', 'materials.mantle_density', '>', 0, 'numel', [1])
-        md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', [1])
 
-        if 'GiaAnalysis' in analyses:
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_density', '>', 0, 'numel', 1)
-            md = checkfield(md,'fieldname', 'materials.mantle_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md,'fieldname', 'materials.mantle_density', '>', 0, 'numel', 1)
-
-        if 'SealevelriseAnalysis' in analyses:
+        if 'SealevelchangeAnalysis' in analyses:
                 md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', 1)
 
@@ -161,8 +136,4 @@
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2)
         WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_density', 'format', 'Double', 'scale', 10.**3.)
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_density', 'format', 'Double', 'scale', 10.**3.)
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double')
 
Index: issm/trunk/src/m/classes/matenhancedice.m
===================================================================
--- issm/trunk/src/m/classes/matenhancedice.m	(revision 25994)
+++ issm/trunk/src/m/classes/matenhancedice.m	(revision 26744)
@@ -6,30 +6,24 @@
 classdef matenhancedice
 	properties (SetAccess=public) 
-		rho_ice                    = 0.;
-		rho_water                  = 0.;
-		rho_freshwater             = 0.;
-		mu_water                   = 0.;
-		heatcapacity               = 0.;
-		latentheat                 = 0.;
-		thermalconductivity        = 0.;
-		temperateiceconductivity   = 0.;
+		rho_ice                         = 0.;
+		rho_water                       = 0.;
+		rho_freshwater                  = 0.;
+		mu_water                        = 0.;
+		heatcapacity                    = 0.;
+		latentheat                      = 0.;
+		thermalconductivity             = 0.;
+		temperateiceconductivity        = 0.;
 		effectiveconductivity_averaging = 0.;
-		meltingpoint               = 0.;
-		beta                       = 0.;
-		mixed_layer_capacity       = 0.;
-		thermal_exchange_velocity  = 0.;
-		rheology_E   = NaN;
-		rheology_B   = NaN;
-		rheology_n   = NaN;
-		rheology_law = '';
+		meltingpoint                    = 0.;
+		beta                            = 0.;
+		mixed_layer_capacity            = 0.;
+		thermal_exchange_velocity       = 0.;
+		rheology_E                      = NaN;
+		rheology_B                      = NaN;
+		rheology_n                      = NaN;
+		rheology_law                    = '';
 
-		%giaivins: 
-		lithosphere_shear_modulus  = 0.;
-		lithosphere_density        = 0.;
-		mantle_shear_modulus       = 0.;
-		mantle_density             = 0.;
-
-		%slr
-		earth_density              = 0;
+		%SLC
+		earth_density                   = 0;
 
 	end
@@ -70,5 +64,5 @@
 
 			%water viscosity (N.s/m^2)
-			self.mu_water=0.001787;  
+			self.mu_water=0.001787;
 
 			%ice heat capacity cp (J/kg/K)
@@ -86,5 +80,5 @@
 			%computation of effective conductivity
 			self.effectiveconductivity_averaging=1;
-            
+
 			%the melting point of ice at 1 atmosphere of pressure in K
 			self.meltingpoint=273.15;
@@ -103,11 +97,5 @@
 			self.rheology_law='Paterson';
 
-			% GIA:
-			self.lithosphere_shear_modulus  = 6.7*10^10;  % (Pa)
-			self.lithosphere_density        = 3.32;       % (g/cm^-3)
-			self.mantle_shear_modulus       = 1.45*10^11; % (Pa)
-			self.mantle_density             = 3.34;       % (g/cm^-3)
-
-			%SLR
+			%SLC
 			self.earth_density= 5512;  % average density of the Earth, (kg/m^3)
 
@@ -124,11 +112,5 @@
 			md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]);
             
-			if ismember('GiaAnalysis',analyses),
-				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
-			end
-			if ismember('SealevelriseAnalysis',analyses),
+			if ismember('SealevelchangeAnalysis',analyses),
 				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
 			end
@@ -155,8 +137,4 @@
 			fielddisplay(self,'rheology_n','Glen''s flow law exponent');
 			fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
-			fielddisplay(self,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
-			fielddisplay(self,'lithosphere_density','Lithosphere density [g/cm^-3]');
-			fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
-			fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
 			fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
 		end % }}}
@@ -181,8 +159,4 @@
 			WriteData(fid,prefix,'data',self.rheology_law,'name','md.materials.rheology_law','format','String');
 
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
 			WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double');
 		end % }}}
@@ -207,8 +181,4 @@
 			writejs1Darray(fid,[modelname '.materials.rheology_n'],self.rheology_n);
 			writejsstring(fid,[modelname '.materials.rheology_law'],self.rheology_law);
-			writejsdouble(fid,[modelname '.materials.lithosphere_shear_modulus'],self.lithosphere_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.lithosphere_density'],self.lithosphere_density);
-			writejsdouble(fid,[modelname '.materials.mantle_shear_modulus'],self.mantle_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.mantle_density'],self.mantle_density);
 			writejsdouble(fid,[modelname '.materials.earth_density'],self.earth_density);
 
Index: issm/trunk/src/m/classes/matenhancedice.py
===================================================================
--- issm/trunk/src/m/classes/matenhancedice.py	(revision 25994)
+++ issm/trunk/src/m/classes/matenhancedice.py	(revision 26744)
@@ -1,125 +1,111 @@
+import numpy as np
+
+from checkfield import checkfield
 from fielddisplay import fielddisplay
 from project3d import project3d
-from checkfield import checkfield
 from WriteData import WriteData
 
 
 class matenhancedice(object):
-    """
-    MATICE class definition
+    """MATICE class definition
 
-        Usage:
-            matenhancedice = matenhancedice()
+    Usage:
+        matenhancedice = matenhancedice()
     """
 
-    def __init__(self): #{{{
-        self.rho_ice = 0.
-        self.rho_water = 0.
-        self.rho_freshwater = 0.
-        self.mu_water = 0.
-        self.heatcapacity = 0.
-        self.latentheat = 0.
-        self.thermalconductivity = 0.
-        self.temperateiceconductivity = 0.
+    def __init__(self):  # {{{
+        self.rho_ice = 0
+        self.rho_water = 0
+        self.rho_freshwater = 0
+        self.mu_water = 0
+        self.heatcapacity = 0
+        self.latentheat = 0
+        self.thermalconductivity = 0
+        self.temperateiceconductivity = 0
         self.effectiveconductivity_averaging = 0
-        self.meltingpoint = 0.
-        self.beta = 0.
-        self.mixed_layer_capacity = 0.
-        self.thermal_exchange_velocity = 0.
-        self.rheology_E = float('NaN')
-        self.rheology_B = float('NaN')
-        self.rheology_n = float('NaN')
+        self.meltingpoint = 0
+        self.beta = 0
+        self.mixed_layer_capacity = 0
+        self.thermal_exchange_velocity = 0
+        self.rheology_E = np.nan
+        self.rheology_B = np.nan
+        self.rheology_n = np.nan
         self.rheology_law = ''
 
-        #GIA
-        self.lithosphere_shear_modulus = 0.
-        self.lithosphere_density = 0.
-        self.mantle_shear_modulus = 0.
-        self.mantle_density = 0.
+        #SLC
+        self.earth_density = 0
 
-        #SLR
-        self.earth_density = 0  # average density of the Earth, (kg/m^3)
         self.setdefaultparameters()
-    #}}}
+    # }}}
 
-    def __repr__(self): #{{{
-        s = "   Materials:"
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_water", "water density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mu_water", "water viscosity [N s/m^2]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))
-        s = "%s\n%s" % (s, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K"))
-        s = "%s\n%s" % (s, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_E", "enhancement factor"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_n", "Glen's flow law exponent"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius' or 'LliboutryDuval'"))
-        s = "%s\n%s" % (s, fielddisplay(self, "lithosphere_shear_modulus", "Lithosphere shear modulus [Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "lithosphere_density", "Lithosphere density [g/cm^-3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mantle_shear_modulus", "Mantle shear modulus [Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mantle_density", "Mantle density [g/cm^-3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "earth_density", "Mantle density [kg/m^-3]"))
+    def __repr__(self):  # {{{
+        s = '   Materials:\n'
+        s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)'))
+        s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
+        s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_E', 'enhancement factor'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\''))
+        s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]'))
 
         return s
-    #}}}
+    # }}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  # {{{
         self.rheology_E = project3d(md, 'vector', self.rheology_E, 'type', 'node')
         self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node')
         self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element')
         return self
-    #}}}
+    # }}}
 
-    def setdefaultparameters(self): #{{{
-        #ice density (kg / m^3)
-        self.rho_ice = 917.
-        #ocean water density (kg / m^3)
-        self.rho_water = 1023.
-        #fresh water density (kg / m^3)
-        self.rho_freshwater = 1000.
-        #water viscosity (N.s / m^2)
+    def setdefaultparameters(self):  # {{{
+        # Ice density (kg/m^3)
+        self.rho_ice = 917.0
+        # Ocean water density (kg/m^3)
+        self.rho_water = 1023.0
+        # Fresh water density (kg/m^3)
+        self.rho_freshwater = 1000.0
+        # Water viscosity (N.s/m^2)
         self.mu_water = 0.001787
-        #ice heat capacity cp (J / kg / K)
-        self.heatcapacity = 2093.
-        #ice latent heat of fusion L (J / kg)
-        self.latentheat = 3.34 * 10**5
-        #ice thermal conductivity (W / m / K)
+        # Ice heat capacity cp (J/kg/K)
+        self.heatcapacity = 2093.0
+        # Ice latent heat of fusion L (J/kg)
+        self.latentheat = 3.34 * pow(10, 5)
+        # Ice thermal conductivity (W/m/K)
         self.thermalconductivity = 2.4
-        #temperate ice thermal conductivity (W / m / K)
+        # Temperate ice thermal conductivity (W/m/K)
         self.temperateiceconductivity = 0.24
-        #computation of effective conductivity
+        # Computation of effective conductivity
         self.effectiveconductivity_averaging = 1
-        #the melting point of ice at 1 atmosphere of pressure in K
+        # The melting point of ice at 1 atmosphere of pressure in K
         self.meltingpoint = 273.15
-        #rate of change of melting point with pressure (K / Pa)
-        self.beta = 9.8 * 10**-8
-        #mixed layer (ice-water interface) heat capacity (J / kg / K)
-        self.mixed_layer_capacity = 3974.
-        #thermal exchange velocity (ice-water interface) (m / s)
-        self.thermal_exchange_velocity = 1.00 * 10**-4
-        #Rheology law: what is the temperature dependence of B with T
-        #available: none, paterson and arrhenius
+        # Rate of change of melting point with pressure (K/Pa)
+        self.beta = 9.8 * pow(10, -8)
+        # Mixed layer (ice-water interface) heat capacity (J/kg/K)
+        self.mixed_layer_capacity = 3974.0
+        # Thermal exchange velocity (ice-water interface) (m/s)
+        self.thermal_exchange_velocity = 1.00 * pow(10, -4)
+        # Rheology law: what is the temperature dependence of B with T
+        # available: none, paterson and arrhenius
         self.rheology_law = 'Paterson'
 
-    # GIA:
-        self.lithosphere_shear_modulus = 6.7 * 10**10  # (Pa)
-        self.lithosphere_density = 3.32  # (g / cm^ - 3)
-        self.mantle_shear_modulus = 1.45 * 10**11  # (Pa)
-        self.mantle_density = 3.34  # (g / cm^ - 3)
-
-    #SLR
-        self.earth_density = 5512  #average density of the Earth, (kg / m^3)
+        # SLC
+        self.earth_density = 5512 # average density of the Earth, (kg/m^3)
 
         return self
-    #}}}
+    # }}}
 
-    def checkconsistency(self, md, solution, analyses): #{{{
+    def checkconsistency(self, md, solution, analyses):  # {{{
         md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0)
         md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0)
@@ -132,16 +118,10 @@
         md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2])
 
-        if 'GiaAnalysis' in analyses:
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_density', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.mantle_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.mantle_density', '>', 0, 'numel', 1)
-            
-        if 'SealevelriseAnalysis' in analyses:
+        if 'SealevelchangeAnalysis' in analyses:
             md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', 1)
         return md
     # }}}
 
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 4, 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double')
@@ -162,8 +142,4 @@
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2)
         WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_density', 'format', 'Double', 'scale', 10**3)
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_density', 'format', 'Double', 'scale', 10**3)
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double')
     # }}}
Index: issm/trunk/src/m/classes/materials.js
===================================================================
--- issm/trunk/src/m/classes/materials.js	(revision 26744)
+++ issm/trunk/src/m/classes/materials.js	(revision 26744)
@@ -0,0 +1,380 @@
+class materials {
+	/**
+	 * MATERIALS class definition
+	 *
+	 * Usage:
+	 *     materials = materials();
+	 */
+	constructor() {//{{{
+		this.nature = [];
+
+		let nargs = arguments.length;
+		if (nargs == 0) {
+			this.nature=['ice'];
+		} else {
+			this.nature=arguments;
+		}
+
+		// Check this is acceptable
+		for (let i = 0; i < this.nature.length; ++i) {
+			if (!(strcmpi(this.nature[i], 'litho') || strcmpi(this.nature[i], 'ice') || strcmpi(this.nature[i], 'hydro'))) {
+				error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+		}
+
+		// Start filling in the dynamic fields (not truly dynamic under JavaScript)
+		for (let i = 0; i < length(this.nature); ++i) {
+			let nat = this.nature[i];
+			switch (nat) {
+				case 'ice':
+					this.rho_ice = 0;
+					this.rho_water = 0;
+					this.rho_freshwater = 0;
+					this.mu_water = 0;
+					this.heatcapacity = 0;
+					this.latentheat = 0;
+					this.thermalconductivity = 0;
+					this.temperateiceconductivity = 0;
+					this.effectiveconductivity_averaging = 0;
+					this.meltingpoint = 0;
+					this.beta = 0;
+					this.mixed_layer_capacity = 0;
+					this.thermal_exchange_velocity = 0;
+					this.rheology_B = 0;
+					this.rheology_n = 0;
+					this.rheology_law = 0;
+					break;
+				case 'litho':
+					this.numlayers = 0;
+					this.radius = 0;
+					this.viscosity = 0;
+					this.lame_lambda = 0;
+					this.lame_mu = 0;
+					this.burgers_viscosity = 0;
+					this.burgers_mu = 0;
+					this.ebm_alpha = 0;
+					this.ebm_delta = 0;
+					this.ebm_taul = 0;
+					this.ebm_tauh = 0;
+					this.rheologymodel = 0;
+					this.density = 0;
+					this.issolid = 0;
+					break;
+				case 'hydro':
+					this.rho_ice = 0;
+					this.rho_water = 0;
+					this.rho_freshwater = 0;
+					break;
+				default:
+					error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+			this.earth_density = 0;
+
+			// Set default parameters
+			this.setdefaultparameters();
+		}
+	} //}}}
+	disp() {//{{{
+		console.log(sprintf('   Materials:'));
+
+		for (let i = 0; i < length(this.nature); ++i) {
+			let nat = this.nature[i];
+			switch (nat) {
+				case 'ice':
+					console.log(sprintf('   \nIce:'));
+					fielddisplay(this,'rho_ice','ice density [kg/m^3]');
+					fielddisplay(this,'rho_water','ocean water density [kg/m^3]');
+					fielddisplay(this,'rho_freshwater','fresh water density [kg/m^3]');
+					fielddisplay(this,'mu_water','water viscosity [N s/m^2]');
+					fielddisplay(this,'heatcapacity','heat capacity [J/kg/K]');
+					fielddisplay(this,'thermalconductivity','ice thermal conductivity [W/m/K]');
+					fielddisplay(this,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
+					fielddisplay(this,'meltingpoint','melting point of ice at 1atm in K');
+					fielddisplay(this,'latentheat','latent heat of fusion [J/kg]');
+					fielddisplay(this,'beta','rate of change of melting point with pressure [K/Pa]');
+					fielddisplay(this,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
+					fielddisplay(this,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
+					fielddisplay(this,'rheology_B','flow law parameter [Pa s^(1/n)]');
+					fielddisplay(this,'rheology_n','Glen\'s flow law exponent');
+					fielddisplay(this,'rheology_law','law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\'');
+					break;
+				case 'litho':
+					console.log(sprintf('   \nLitho:'));
+					fielddisplay(this,'numlayers','number of layers (default: 2)');
+					fielddisplay(this,'radius','array describing the radius for each interface (numlayers+1) [m]');
+					fielddisplay(this,'viscosity','array describing each layer\'s viscosity (numlayers) [Pa.s]');
+					fielddisplay(this,'lame_lambda','array describing the lame lambda parameter (numlayers) [Pa]');
+					fielddisplay(this,'lame_mu','array describing the shear modulus for each layers (numlayers) [Pa]');
+					fielddisplay(this,'burgers_viscosity','array describing each layer\'s transient viscosity, only for Burgers rheologies  (numlayers) [Pa.s]');
+					fielddisplay(this,'burgers_mu','array describing each layer\'s transient shear modulus, only for Burgers rheologies  (numlayers) [Pa]');
+
+					fielddisplay(this,'ebm_alpha','array describing each layer\'s exponent parameter controlling the shape of shear modulus curve between taul and tauh, only for EBM rheology (numlayers)');
+					fielddisplay(this,'ebm_delta','array describing each layer\'s amplitude of the transient relaxation (ratio between elastic rigity to pre-maxwell relaxation rigity), only for EBM rheology (numlayers)');
+					fielddisplay(this,'ebm_taul','array describing each layer\'s starting period for transient relaxation, only for EBM rheology  (numlayers) [s]');
+					fielddisplay(this,'ebm_tauh','array describing each layer\'s array describing each layer\'s end period for transient relaxation, only for Burgers rheology (numlayers) [s]');
+
+					fielddisplay(this,'rheologymodel','array describing whether we adopt a Maxwell (0), Burgers (1) or EBM (2) rheology (default: 0)');
+					fielddisplay(this,'density','array describing each layer\'s density (numlayers) [kg/m^3]');
+					fielddisplay(this,'issolid','array describing whether the layer is solid or liquid (default 1) (numlayers)');
+					break;
+				case 'hydro':
+					console.log(sprintf('   \nHydro:'));
+					fielddisplay(this,'rho_ice','ice density [kg/m^3]');
+					fielddisplay(this,'rho_water','ocean water density [kg/m^3]');
+					fielddisplay(this,'earth_density','mantle density [kg/m^3]');
+					fielddisplay(this,'rho_freshwater','fresh water density [kg/m^3]');
+					break;
+				default:
+					error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+		}
+	} //}}}
+	setdefaultparameters() {//{{{
+		for (let i = 0; i < this.nature.length; ++i) {
+			let nat = this.nature[i];
+			switch (nat) {
+				case 'ice':
+					// Ice density (kg/m^3)
+					this.rho_ice = 917;
+
+					// Ocean water density (kg/m^3)
+					this.rho_water = 1023
+
+					// Fresh water density (kg/m^3)
+					this.rho_freshwater = 1000;
+
+					// Water viscosity (N.s/m^2)
+					this.mu_water = 0.001787;
+
+					// Ice heat capacity cp (J/kg/K)
+					this.heatcapacity = 2093;
+
+					// Ice latent heat of fusion L (J/kg)
+					this.latentheat = 3.34 * 1e5;
+
+					// Ice thermal conductivity (W/m/K)
+					this.thermalconductivity = 2.4;
+
+					// Wet ice thermal conductivity (W/m/K)
+					this.temperateiceconductivity = 0.24;
+
+					// Computation of effective conductivity
+					this.effectiveconductivity_averaging = 1;
+
+					// The melting point of ice at 1 atmosphere of pressure in K
+					this.meltingpoint = 273.15;
+
+					// Rate of change of melting point with pressure (K/Pa)
+					this.beta = 9.8 * 1e-8;
+
+					// Mixed layer (ice-water interface) heat capacity (J/kg/K)
+					this.mixed_layer_capacity = 3974;
+
+					// Thermal exchange velocity (ice-water interface) (m/s)
+					this.thermal_exchange_velocity = 1.00 * 1e-4;
+
+					// Rheology law: what is the temperature dependence of B with T
+					// available: none, paterson and arrhenius
+					this.rheology_law = 'Paterson';
+
+					// Rheology fields default
+					this.rheology_B = 1 * 1e8;
+					this.rheology_n = 3;
+					break;
+				case 'litho':
+					// We default to a configuration that enables running GIA 
+					// solutions using giacaron and/or giaivins
+					this.numlayers = 2;
+
+					// Center of the earth (approximation, must not be 0), then the 
+					// lab (lithosphere/asthenosphere boundary) then the surface
+					// (with 1d3 to avoid numerical singularities)
+					this.radius = [1e3, 6278 * 1e3, 6378 * 1e3];
+
+					this.viscosity = [1e21, 1e40]; // Mantle and lithosphere viscosity (respectively) [Pa.s]
+					this.lame_mu = [1.45 * 1e11, 6.7 * 1e10]; // (Pa) // Lithosphere and mantle shear modulus (respectively) [Pa]
+					this.lame_lambda = this.lame_mu; // (Pa) // Mantle and lithosphere lamba parameter (respectively) [Pa]
+					this.burgers_viscosity = [NaN, NaN];
+					this.burgers_mu = [NaN, NaN];
+
+					this.ebm_alpha = [NaN, NaN];
+					this.ebm_delta = [NaN, NaN];
+					this.ebm_taul = [NaN, NaN];
+					this.ebm_tauh = [NaN, NaN];
+					this.rheologymodel = [0, 0];
+					this.density = [5.51 * 1e3, 5.50 * 1e3]; // (Pa) // Mantle and lithosphere density [kg/m^3]
+					this.issolid = [1, 1]; // Is layer solid or liquid?
+					break;
+				case 'hydro':
+					// Ice density (kg/m^3)
+					this.rho_ice = 917;
+
+					// Ocean water density (kg/m^3)
+					this.rho_water = 1023;
+
+					// Fresh water density (kg/m^3)
+					this.rho_freshwater = 1000;
+					break;
+				default:
+					error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+
+			// Average density of the Earth (kg/m^3)
+			this.earth_density = 5512;
+		}
+	} //}}}
+	checkconsistency(md, solution, analyses) {//{{{
+		for (let i = 0; i < this.nature.length; ++i) {
+			let nat = this.nature[i];
+			if (nat == 'ice') {
+				md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.rho_freshwater', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.mu_water', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.rheology_B', '>', 0, 'timeseries', 1, 'NaN', 1, 'Inf', 1);
+				md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'size', [md.mesh.numberofelements, 1]);
+				md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', 'NyeH2O']);
+			} else if (nat == 'litho') {
+				if (!analyses.includes('LoveAnalysis')) {
+					return md;
+				}
+
+				md = checkfield(md, 'fieldname', 'materials.numlayers', 'NaN', 1, 'Inf', 1, '>', 0, 'numel', 1);
+				md = checkfield(md, 'fieldname', 'materials.radius', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers + 1, 1], '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.lame_mu', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.lame_lambda', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.issolid', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<', 2);
+				md = checkfield(md, 'fieldname', 'materials.density', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.viscosity', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.rheologymodel', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<=', 2);
+				md = checkfield(md, 'fieldname', 'materials.burgers_viscosity', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.burgers_mu', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.ebm_alpha', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.ebm_delta', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.ebm_taul', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+				md = checkfield(md, 'fieldname', 'materials.ebm_tauh', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0);
+
+				for (let i = 0; i < md.materials.numlayers; ++i) {
+					if (md.materials.rheologymodel[i] == 1 && (isnan(md.materials.burgers_viscosity[i]) || isnan(md.materials.burgers_mu[i]))) {
+						error('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with rheologymodel choice');
+					}
+					if (md.materials.rheologymodel[i] == 2 && (isnan(md.materials.ebm_alpha[i]) || isnan(md.materials.ebm_delta[i])) || isnan(md.materials.ebm_taul[i] || isnan(md.materials.ebm_tauh[i]))) {
+						error('materials checkconsistency error message: Litho ebm_alpha, ebm_delta, ebm_taul or ebm_tauh has NaN values, inconsistent with rheologymodel choice');
+					}
+				}
+				if (md.materials.issolid[0] == 0 || md.materials.lame_mu[0] == 0) {
+					error('First layer must be solid (issolid[0] > 0 AND lame_mu[0] > 0). Add a weak inner core if necessary.');
+				}
+				let ind = find(md.materials.issolid == 0);
+				if (sum(ismember(diff(ind), 1) >= 1)) { // If there are at least two consecutive indices that contain issolid = 0
+					error('Fluid layers detected at layers #' + ind + ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.');
+				}
+			} else if (nat == 'hydro') {
+				md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0);
+				md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', 1);
+				md = checkfield(md, 'fieldname', 'materials.rho_freshwater', '>', 0);
+			} else {
+				error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+		}
+
+		return md;
+	} //}}}
+	marshall(md, prefix, fid) {//{{{
+		// 1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum
+		WriteData(fid, prefix, 'name', 'md.materials.nature', 'data', naturetointeger(this.nature), 'format', 'IntMat', 'mattype', 3);
+		WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 5, 'format', 'Integer'); // DANGER: this can evolve if you have classes
+		for (let i = 0; i < this.nature.length; ++i) {
+			let nat = this.nature[i];
+			if (nat == 'ice') {
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_freshwater', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'mu_water', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'heatcapacity', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'latentheat', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'thermalconductivity', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'temperateiceconductivity', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'effectiveconductivity_averaging', 'format', 'Integer');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'meltingpoint', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'beta', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'mixed_layer_capacity', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'thermal_exchange_velocity', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2);
+				WriteData(fid, prefix, 'data', this.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String');
+			} else if (nat == 'litho') {
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'numlayers', 'format', 'Integer');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'radius', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'lame_mu', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'lame_lambda', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'issolid', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'density', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'viscosity', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rheologymodel', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'burgers_viscosity', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'burgers_mu', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'ebm_alpha', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'ebm_delta', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'ebm_taul', 'format', 'DoubleMat', 'mattype', 3);
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'ebm_tauh', 'format', 'DoubleMat', 'mattype', 3);
+				// Compute earth density compatible with our layer density distribution
+				let earth_density = 0;
+				for (let i = 0; i < this.numlayers; ++i) {
+					earth_density = earth_density + (Math.pow(this.radius[i + 1], 3) - Math.pow(this.radius[i], 3)) * this.density[i];
+				}
+				earth_density = earth_density / Math.pow(this.radius[this.numlayers]);
+				this.earth_density = earth_density;
+			} else if (nat == 'hydro') {
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double');
+				WriteData(fid, prefix, 'object', this, 'class', 'materials', 'fieldname', 'rho_freshwater', 'format', 'Double');
+			} else {
+				error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+			}
+			WriteData(fid, prefix, 'data', this.earth_density, 'name', 'md.materials.earth_density', 'format', 'Double');
+		}
+	} //}}}
+	extrude(md) {//{{{
+		for (let i = 0; i < this.nature.length; ++i) {
+			let nat = this.nature[i];
+			if (nat == 'ice') {
+				this.rheology_B = project3d(md, 'vector', this.rheology_B, 'type', 'node');
+				this.rheology_n = project3d(md, 'vector', this.rheology_n, 'type', 'element');
+			}
+		}
+	} //}}}
+} //}}}
+
+function naturetointeger(strnat) {//{{{
+	let intnat = zeros(strnat.length, 1);
+	for (let i = 0; i < strnat.length; ++i) {
+		switch (strnat[i]) {
+			case 'damageice':
+				intnat[i] = 1;
+				break;
+			case 'estar':
+				intnat[i] = 2;
+				break;
+			case 'ice':
+				intnat[i] = 3;
+				break;
+			case 'enhancedice':
+				intnat[i] = 4;
+				break;
+			//case 'materials': // This case will never happen, kept to ensure equivalent of codes between IoCodeToMaterialsEnum and IoCodeToNatureEnum
+			//	intnat[i] = 5;
+			//	break;
+			case 'litho':
+				intnat[i] = 6;
+				break;
+			case 'hydro':
+				intnat[i] = 7;
+				break;
+			default:
+				error('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')');
+		}
+	}
+	return intnat;
+}// }}}
Index: issm/trunk/src/m/classes/materials.m
===================================================================
--- issm/trunk/src/m/classes/materials.m	(revision 25994)
+++ issm/trunk/src/m/classes/materials.m	(revision 26744)
@@ -37,4 +37,5 @@
 					self.addprop('thermalconductivity');
 					self.addprop('temperateiceconductivity');
+					self.addprop('effectiveconductivity_averaging');
 					self.addprop('meltingpoint');
 					self.addprop('beta');
@@ -52,5 +53,9 @@
 					self.addprop('burgers_viscosity');
 					self.addprop('burgers_mu');
-					self.addprop('isburgers');
+					self.addprop('ebm_alpha');
+					self.addprop('ebm_delta');
+					self.addprop('ebm_taul');
+					self.addprop('ebm_tauh');
+					self.addprop('rheologymodel');
 					self.addprop('density');
 					self.addprop('issolid');
@@ -59,9 +64,10 @@
 					self.addprop('rho_water');
 					self.addprop('rho_freshwater');
-					self.addprop('earth_density');
 				otherwise
 					error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')');
 				end
 			end
+			self.addprop('earth_density');
+
 			%set default parameters:
 			self.setdefaultparameters();
@@ -90,5 +96,5 @@
 
 					%ice latent heat of fusion L (J/kg)
-					self.latentheat=3.34*10^5;
+					self.latentheat=3.34*1e5;
 
 					%ice thermal conductivity (W/m/K)
@@ -98,9 +104,12 @@
 					self.temperateiceconductivity=.24;
 
+					%computation of effective conductivity
+					self.effectiveconductivity_averaging=1;
+
 					%the melting point of ice at 1 atmosphere of pressure in K
 					self.meltingpoint=273.15;
 
 					%rate of change of melting point with pressure (K/Pa)
-					self.beta=9.8*10^-8;
+					self.beta=9.8*1e-8;
 
 					%mixed layer (ice-water interface) heat capacity (J/kg/K)
@@ -108,5 +117,5 @@
 
 					%thermal exchange velocity (ice-water interface) (m/s)
-					self.thermal_exchange_velocity=1.00*10^-4;
+					self.thermal_exchange_velocity=1.00*1e-4;
 
 					%Rheology law: what is the temperature dependence of B with T
@@ -114,4 +123,8 @@
 					self.rheology_law='Paterson';
 
+					%Rheology fields default: 
+					self.rheology_B   = 1 * 1e8;
+					self.rheology_n   = 3;
+
 				case 'litho'
 					%we default to a configuration that enables running GIA solutions using giacaron and/or giaivins.
@@ -123,9 +136,14 @@
 
 					self.viscosity=[1e21;1e40]; %mantle and lithosphere viscosity (respectively) [Pa.s]
-					self.lame_mu=[1.45*1e11;6.7*10^10];  % (Pa) %lithosphere and mantle shear modulus (respectively) [Pa]
+					self.lame_mu=[1.45*1e11;6.7*1e10];  % (Pa) %lithosphere and mantle shear modulus (respectively) [Pa]
 					self.lame_lambda=self.lame_mu;  % (Pa) %mantle and lithosphere lamba parameter (respectively) [Pa]
 					self.burgers_viscosity=[NaN;NaN];
 					self.burgers_mu=[NaN;NaN];
-					self.isburgers=[0;0];
+
+					self.ebm_alpha=[NaN;NaN];
+					self.ebm_delta=[NaN;NaN];
+					self.ebm_taul=[NaN;NaN];
+					self.ebm_tauh=[NaN;NaN];
+					self.rheologymodel=[0;0];
 					self.density=[5.51*1e3;5.50*1e3];  % (Pa) %mantle and lithosphere density [kg/m^3]
 					self.issolid=[1;1]; % is layer solid or liquid.
@@ -137,7 +155,5 @@
 					%ocean water density (kg/m^3)
 					self.rho_water=1023.;
-					% average density of the Earth (kg/m^3)
-					self.earth_density=5512;
-
+					
 					%fresh water density (kg/m^3)
 					self.rho_freshwater=1000.;
@@ -146,4 +162,8 @@
 					error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')');
 				end
+
+				% average density of the Earth (kg/m^3)
+				self.earth_density=5512;
+
 			end
 		end % }}}
@@ -155,5 +175,5 @@
 				switch nat
 				case 'ice'
-					disp(sprintf('   \nIce:'));
+					disp(sprintf('\n      Ice:'));
 					fielddisplay(self,'rho_ice','ice density [kg/m^3]');
 					fielddisplay(self,'rho_water','ocean water density [kg/m^3]');
@@ -172,6 +192,6 @@
 					fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'', ''LliboutryDuval'', ''NyeCO2'', or ''NyeH2O''']);
 				case 'litho'
-					disp(sprintf('   \nLitho:'));
-					fielddisplay(self,'numlayers','number of layers (default 2)');
+					disp(sprintf('\n      Litho:'));
+					fielddisplay(self,'numlayers','number of layers (default: 2)');
 					fielddisplay(self,'radius','array describing the radius for each interface (numlayers+1) [m]');
 					fielddisplay(self,'viscosity','array describing each layer''s viscosity (numlayers) [Pa.s]');
@@ -180,9 +200,16 @@
 					fielddisplay(self,'burgers_viscosity','array describing each layer''s transient viscosity, only for Burgers rheologies  (numlayers) [Pa.s]');
 					fielddisplay(self,'burgers_mu','array describing each layer''s transient shear modulus, only for Burgers rheologies  (numlayers) [Pa]');
-					fielddisplay(self,'isburgers','array describing whether we adopt a MaxWell (0) or Burgers (1) rheology (default 0)');
+
+					fielddisplay(self,'ebm_alpha','array describing each layer''s exponent parameter controlling the shape of shear modulus curve between taul and tauh, only for EBM rheology (numlayers)');
+					fielddisplay(self,'ebm_delta','array describing each layer''s amplitude of the transient relaxation (ratio between elastic rigity to pre-maxwell relaxation rigity), only for EBM rheology (numlayers)');
+					fielddisplay(self,'ebm_taul','array describing each layer''s starting period for transient relaxation, only for EBM rheology  (numlayers) [s]');
+					fielddisplay(self,'ebm_tauh','array describing each layer''s array describing each layer''s end period for transient relaxation, only for Burgers rheology (numlayers) [s]');
+
+
+					fielddisplay(self,'rheologymodel','array describing whether we adopt a Maxwell (0), Burgers (1) or EBM (2) rheology (default: 0)');
 					fielddisplay(self,'density','array describing each layer''s density (numlayers) [kg/m^3]');
 					fielddisplay(self,'issolid','array describing whether the layer is solid or liquid (default 1) (numlayers)');
 				case 'hydro'
-					disp(sprintf('   \nHydro:'));
+					disp(sprintf('\n      Hydro:'));
 					fielddisplay(self,'rho_ice','ice density [kg/m^3]');
 					fielddisplay(self,'rho_water','ocean water density [kg/m^3]');
@@ -217,19 +244,26 @@
 					md = checkfield(md,'fieldname','materials.density','NaN',1,'Inf',1,'size',[md.materials.numlayers 1],'>',0);
 					md = checkfield(md,'fieldname','materials.viscosity','NaN',1,'Inf',1,'size',[md.materials.numlayers 1],'>=',0);
-					md = checkfield(md,'fieldname','materials.isburgers','NaN',1,'Inf',1,'size',[md.materials.numlayers 1],'>=',0,'<=',1);
+					md = checkfield(md,'fieldname','materials.rheologymodel','NaN',1,'Inf',1,'size',[md.materials.numlayers 1],'>=',0,'<=',2);
 					md = checkfield(md,'fieldname','materials.burgers_viscosity','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
 					md = checkfield(md,'fieldname','materials.burgers_mu','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
+					md = checkfield(md,'fieldname','materials.ebm_alpha','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
+					md = checkfield(md,'fieldname','materials.ebm_delta','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
+					md = checkfield(md,'fieldname','materials.ebm_taul','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
+					md = checkfield(md,'fieldname','materials.ebm_tauh','Inf',1,'size',[md.materials.numlayers 1],'>=',0);
 
 					for i=1:md.materials.numlayers,
-						if md.materials.isburgers(i) & (isnan(md.materials.burgers_viscosity(i) | isnan(md.materials.burgers_mu(i)))),
-							error('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with isburgers choice');
+						if md.materials.rheologymodel(i)==1 & (isnan(md.materials.burgers_viscosity(i) | isnan(md.materials.burgers_mu(i)))),
+							error('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with rheologymodel choice');
+						end
+						if md.materials.rheologymodel(i)==2 & (isnan(md.materials.ebm_alpha(i)) | isnan(md.materials.ebm_delta(i)) | isnan(md.materials.ebm_taul(i)) | isnan(md.materials.ebm_tauh(i))),
+							error('materials checkconsistency error message: Litho ebm_alpha, ebm_delta, ebm_taul or ebm_tauh has NaN values, inconsistent with rheologymodel choice');
 						end
 					end
 					if md.materials.issolid(1)==0 | md.materials.lame_mu(1)==0
-							error('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.');
+						error('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.');
 					end
 					ind=find(md.materials.issolid==0);
 					if sum(ismember(diff(ind),1)>=1) %if there are at least two consecutive indices that contain issolid = 0
-							error(['Fluid layers detected at layers #', num2str(ind'), ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.'])
+						error(['Fluid layers detected at layers #', num2str(ind'), ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.'])
 					end
 
@@ -250,6 +284,5 @@
 			%1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum
 			WriteData(fid,prefix,'name','md.materials.nature','data',naturetointeger(self.nature),'format','IntMat','mattype',3);
-			WriteData(fid,prefix,'name','md.materials.type','data',5,'format','Integer'); %DANGER, this can evolve if you have classes.
-
+			WriteData(fid,prefix,'name','md.materials.type','data',5,'format','Integer'); %DANGER: this can evolve if you have classes.
 			for i=1:length(self.nature),
 				nat=self.nature{i};
@@ -264,4 +297,5 @@
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','thermalconductivity','format','Double');
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','temperateiceconductivity','format','Double');
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','effectiveconductivity_averaging','format','Integer');
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','meltingpoint','format','Double');
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','beta','format','Double');
@@ -279,17 +313,27 @@
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','density','format','DoubleMat','mattype',3);
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','viscosity','format','DoubleMat','mattype',3);
-					WriteData(fid,prefix,'object',self,'class','materials','fieldname','isburgers','format','DoubleMat','mattype',3);
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheologymodel','format','DoubleMat','mattype',3);
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_viscosity','format','DoubleMat','mattype',3);
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_mu','format','DoubleMat','mattype',3);
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','ebm_alpha','format','DoubleMat','mattype',3);
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','ebm_delta','format','DoubleMat','mattype',3);
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','ebm_taul','format','DoubleMat','mattype',3);
+					WriteData(fid,prefix,'object',self,'class','materials','fieldname','ebm_tauh','format','DoubleMat','mattype',3);
+					%compute earth density compatible with our layer density distribution: 
+					earth_density=0;
+					for i=1:self.numlayers,
+						earth_density=earth_density + (self.radius(i+1)^3-self.radius(i)^3)*self.density(i);
+					end
+					earth_density=earth_density/self.radius(self.numlayers+1)^3;
+					self.earth_density=earth_density;
 				case 'hydro'
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_ice','format','Double');
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_water','format','Double');
-					WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double');
 					WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_freshwater','format','Double');
-
 				otherwise
 					error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')');
 				end
 			end
+			WriteData(fid,prefix,'data',self.earth_density,'name','md.materials.earth_density','format','Double');
 		end % }}}
 		function self = extrude(self,md) % {{{
@@ -317,4 +361,5 @@
 					writejsdouble(fid,[modelname '.materials.thermalconductivity'],self.thermalconductivity);
 					writejsdouble(fid,[modelname '.materials.temperateiceconductivity'],self.temperateiceconductivity);
+					writejsdouble(fid,[modelname '.materials.effectiveconductivity_averaging'],self.effectiveconductivity_averaging);
 					writejsdouble(fid,[modelname '.materials.meltingpoint'],self.meltingpoint);
 					writejsdouble(fid,[modelname '.materials.beta'],self.beta);
@@ -333,7 +378,11 @@
 					writejsdouble(fid,[modelname '.materials.density'],self.density);
 					writejsdouble(fid,[modelname '.materials.viscosity'],self.viscosity);
-					writejsdouble(fid,[modelname '.materials.isburgers'],self.isburgers);
+					writejsdouble(fid,[modelname '.materials.rheologymodel'],self.rheologymodel);
 					writejsdouble(fid,[modelname '.materials.burgers_viscosity'],self.burgers_viscosity);
 					writejsdouble(fid,[modelname '.materials.burgers_mu'],self.burgers_mu);
+					writejsdouble(fid,[modelname '.materials.ebm_alpha'],self.ebm_alpha);
+					writejsdouble(fid,[modelname '.materials.ebm_delta'],self.ebm_delta);
+					writejsdouble(fid,[modelname '.materials.ebm_taul'],self.ebm_taul);
+					writejsdouble(fid,[modelname '.materials.ebm_tauh'],self.ebm_tauh);
 
 				case 'hydro'
@@ -351,4 +400,161 @@
 
 		end % }}}
+		function setlitho2prem(self) % {{{
+			%based on materials.radius and materials.issolid, replaces materials.density, materials.lame_mu, materials.lame_lambda
+			% with volumetric averages of a polynomial version of the PREM model
+			if ~strcmpi(self.nature, 'litho')
+			error('materials setlitho2prem error message: materials.nature must be ''litho''')
+			end
+		   
+		   
+		   ra=self.radius(end);
+		   r(1) = 0.0;     r(2) = 1221.5; r(3) = 3480.0; r(4) = 3630.;
+		   r(5) = 5600.0;  r(6) = 5701.0;  r(7) = 5771.0; r(8) = 5971.;
+		   r(9) = 6151.0; r(10) = 6291.0; r(11) = 6346.6;
+		   r(12) = 6356.0; r(13) = 6368.0; r(14) = 6371.;
+		  
+		   if (r(14)*1e3 ~= ra) 
+			error(['materials setlitho2prem error message: Earth surface radius in PREM r=' num2str(r(end)*1e3) ' does not match materials.radius(end)=' num2str(self.radius(end))]); 
+		   end
+
+		  d = zeros(12,4); %polynomial coef for density
+		  d(1,1) = 13.0885; 		         	  d(1,3) = -8.8381 ;
+		  d(2,1) = 12.5815; d(2,2) = -1.2638; d(2,3) = -3.6426; d(2,4) = -5.5281;
+		  d(3,1) = 7.9565 ; d(3,2) = -6.4761;   d(3,3) = 5.5283;  d(3,4) = -3.0807;
+		  d(4,1) = 7.9565 ; d(4,2) = -6.4761;   d(4,3) = 5.5283;  d(4,4) = -3.0807;
+		  d(5,1) = 7.9565 ; d(5,2) = -6.4761;   d(5,3) = 5.5283;  d(5,4) = -3.0807;
+		  d(6,1) = 5.3197 ; d(6,2) = -1.4836;
+		  d(7,1) = 11.2494; d(7,2) = -8.0298;
+		  d(8,1) = 7.1089 ; d(8,2) = -3.8045;
+		  d(9,1) = 2.6910 ; d(9,2) = 0.6924;
+		  d(10,1) = 2.6910; d(10,2) = 0.6924;
+		  d(11,1) = 2.9  ;
+		  d(12,1) = 2.6  ;
+
+		% ocean
+		  if (~self.issolid(end)) 
+		  	d(13,1) = 1.02 ;
+
+		% continental
+		  else
+		  d(13,1) = d(12,1);
+		  end
+
+		  p = zeros(13,4); %polynomial coef for Vp, pressure wave velocity
+		  p(1,1) = 11.2622 ; p(1,3) = -6.3640;
+		  p(2,1) = 11.0487 ; p(2,2) = -4.0362; p(2,3)  = 4.8023; p(2,4) = -13.5732;
+		  p(3,1) = 15.3891 ; p(3,2) = -5.3181; p(3,3)  = 5.5242; p(3,4) = -2.5514;
+		  p(4,1) = 24.952 ; p(4,2)  = -40.4673; p(4,3) = 51.4832; p(4,4) = -26.6419;
+		  p(5,1) = 29.2766 ; p(5,2) = -23.6027; p(5,3) = 5.5242; p(5,4) = -2.5514;
+		  p(6,1) = 19.0957 ; p(6,2)  = -9.8672;
+		  p(7,1) = 39.7027 ; p(7,2)  = -32.6166;
+		  p(8,1) = 20.3926 ; p(8,2)  = -12.2569;
+		  p(9,1) = 4.1875 ; p(9,2)  = 3.9382;
+		  p(10,1) = 4.1875 ; p(10,2) = 3.9382;
+		  p(11,1) = 6.8 ;
+		  p(12,1) = 5.8;
+		%
+		% ocean
+		  if (~self.issolid(end)) 
+		  p(13,1) = 1.45 ;
+		%
+		% continental
+		  else
+		  p(13,1) = p(12,1);
+		  end
+		%----
+		%
+		  s = zeros(13,4); %polynomial coef for Vs, shear wave velocity
+		%
+		  s(1,1) = 3.6678; s(1,3) = -4.4475;
+
+		  s(3,1) = 6.9254; s(3,2) = 1.4672; s(3,3) = -2.0834; s(3,4) = 0.9783;
+		  s(4,1) = 11.1671; s(4,2) = -13.7818; s(4,3) = 17.4575; s(4,4) = -9.2777;
+		  s(5,1) = 22.3459; s(5,2) = -17.2473; s(5,3) = -2.0834; s(5,4) = 0.9783;
+		  s(6,1) = 9.9839; s(6,2) = -4.9324;
+		  s(7,1) = 22.3512; s(7,2) = -18.5856 ;
+		  s(8,1) = 8.9496; s(8,2) = -4.4597;
+		  s(9,1) = 2.1519; s(9,2) = 2.3481;
+		  s(10,1) = 2.1519; s(10,2) = 2.3481;
+		  s(11,1) = 3.9 ;
+		  s(12,1) = 3.2 ;
+		%
+		% ocean (please don't modify)
+		  if (~self.issolid(end))
+		%
+		% continental
+		  else
+		  s(13,1) = s(12,1);
+		  end
+		%
+		%
+		  r = r*1e3;
+		  
+		  %- handling the first layer : central sphere
+		  rad = self.radius;
+		  rad(1) = 0.;
+		  
+		  for j = 1:self.numlayers
+		  
+			ro = 0.;
+			vp = 0.;
+			vs = 0.;
+
+			for i = 1:13
+
+				r1 = 0.;
+				r2 = 0.;
+				if ((rad(j) > r(i)) & (rad(j) <= r(i+1))) 
+					if (rad(j+1) <= r(i+1)) 
+						r2 = rad(j+1);
+						r1 = rad(j);
+					else
+						r2 = r(i+1);
+						r1 = rad(j);
+					end
+				elseif (rad(j) <= r(i))
+					if ((rad(j+1) > r(i)) & (rad(j+1) <= r(i+1)))
+						r2 = rad(j+1);
+						r1 = r(i);
+					elseif (rad(j+1) > r(i+1))
+						r2 = r(i+1);
+						r1 = r(i);
+					end
+				end
+
+				t1 = d(i,1)/3.;
+				t2 = d(i,2)/(ra*4.);
+				t3 = d(i,3)/((ra^2)*5.);
+				t4 = d(i,4)/((ra^3)*6.);
+				ro =  ro + t1*(r2^3) + t2*(r2^4) + t3*(r2^5) + t4*(r2^6) - ( t1*(r1^3) + t2*(r1^4) + t3*(r1^5) + t4*(r1^6) );
+					  
+				t1 = p(i,1)/3.;
+				t2 = p(i,2)/(ra*4.);
+				t3 = p(i,3)/((ra^2)*5.);
+				t4 = p(i,4)/((ra^3)*6.);
+				vp =  vp + t1*(r2^3) + t2*(r2^4) + t3*(r2^5) + t4*(r2^6) - ( t1*(r1^3) + t2*(r1^4) + t3*(r1^5) + t4*(r1^6) );
+					  
+				t1 = s(i,1)/3.;
+				t2 = s(i,2)/(ra*4.);
+				t3 = s(i,3)/((ra^2)*5.);
+				t4 = s(i,4)/((ra^3)*6.);
+				vs =  vs + t1*(r2^3) + t2*(r2^4) + t3*(r2^5) + t4*(r2^6) - ( t1*(r1^3) + t2*(r1^4) + t3*(r1^5) + t4*(r1^6) );
+
+			end
+			ro = ro*3 / (rad(j+1)^3-rad(j)^3);
+			vp = vp*3 /(rad(j+1)^3-rad(j)^3);
+			vs = vs*3 / (rad(j+1)^3-rad(j)^3);
+			mu = ro*vs.^2;
+			la = ro*vp.^2 - 2.*mu;
+			ro = ro*1e3;
+			la = la*1e9;
+			mu = mu*1e9;
+
+			self.density(j) = ro;
+			self.lame_lambda(j) = la;
+			self.lame_mu(j) = mu;
+		  end
+
+		end % }}}
 	end
 end
@@ -358,5 +564,5 @@
 	for i=1:length(strnat),
 		switch strnat{i},
-			case 'damageice'
+		case 'damageice'
 			intnat(i)=1;
 		case 'estar'
Index: issm/trunk/src/m/classes/materials.py
===================================================================
--- issm/trunk/src/m/classes/materials.py	(revision 25994)
+++ issm/trunk/src/m/classes/materials.py	(revision 26744)
@@ -8,14 +8,13 @@
 
 class materials(object):
-    '''
-    MATERIALS class definition
-
-       Usage:
-          materials = materials()
-    '''
+    """MATERIALS class definition
+
+    Usage:
+        materials = materials()
+    """
 
     def __init__(self, *args): #{{{
         self.nature = []
-        if not len(args):
+        if len(args) == 0:
             self.nature = ['ice']
         else:
@@ -26,148 +25,188 @@
                 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
 
-        #start filling in the dynamic fields:
-        for i in range(len(self.nature)):
-            nat = self.nature[i]
-            if nat == 'ice':
-                setattr(self, 'rho_ice', 0)
-                setattr(self, 'rho_water', 0)
-                setattr(self, 'rho_freshwater', 0)
-                setattr(self, 'mu_water', 0)
-                setattr(self, 'heatcapacity', 0)
-                setattr(self, 'latentheat', 0)
-                setattr(self, 'thermalconductivity', 0)
-                setattr(self, 'temperateiceconductivity', 0)
-                setattr(self, 'meltingpoint', 0)
-                setattr(self, 'beta', 0)
-                setattr(self, 'mixed_layer_capacity', 0)
-                setattr(self, 'thermal_exchange_velocity', 0)
-                setattr(self, 'rheology_B', 0)
-                setattr(self, 'rheology_n', 0)
-                setattr(self, 'rheology_law', 0)
-            elif nat == 'litho':
-                setattr(self, 'numlayers', 0)
-                setattr(self, 'radius', 0)
-                setattr(self, 'viscosity', 0)
-                setattr(self, 'lame_lambda', 0)
-                setattr(self, 'lame_mu', 0)
-                setattr(self, 'burgers_viscosity', 0)
-                setattr(self, 'burgers_mu', 0)
-                setattr(self, 'isburgers', 0)
-                setattr(self, 'density', 0)
-                setattr(self, 'issolid', 0)
-            elif nat == 'hydro':
-                setattr(self, 'rho_ice', 0)
-                setattr(self, 'rho_water', 0)
-                setattr(self, 'rho_freshwater', 0)
-                setattr(self, 'earth_density', 0)
+        # Start filling in the dynamic fields (not truly dynamic under Python)
+        for i in range(len(self.nature)):
+            nat = self.nature[i]
+            if nat == 'ice':
+                self.rho_ice = 0
+                self.rho_water = 0
+                self.rho_freshwater = 0
+                self.mu_water = 0
+                self.heatcapacity = 0
+                self.latentheat = 0
+                self.thermalconductivity = 0
+                self.temperateiceconductivity = 0
+                self.effectiveconductivity_averaging = 0
+                self.meltingpoint = 0
+                self.beta = 0
+                self.mixed_layer_capacity = 0
+                self.thermal_exchange_velocity = 0
+                self.rheology_B = 0
+                self.rheology_n = 0
+                self.rheology_law = 0
+            elif nat == 'litho':
+                self.numlayers = 0
+                self.radius = 0
+                self.viscosity = 0
+                self.lame_lambda = 0
+                self.lame_mu = 0
+                self.burgers_viscosity = 0
+                self.burgers_mu = 0
+                self.ebm_alpha = 0
+                self.ebm_delta = 0
+                self.ebm_taul = 0
+                self.ebm_tauh = 0
+                self.rheologymodel = 0
+                self.density = 0
+                self.issolid = 0
+            elif nat == 'hydro':
+                self.rho_ice = 0
+                self.rho_water = 0
+                self.rho_freshwater = 0
             else:
                 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
-
-        #set default parameters:
+        self.earth_density = 0
+
         self.setdefaultparameters()
     #}}}
 
+    def __repr__(self): #{{{
+        s = '   Materials:\n'
+        for i in range(len(self.nature)):
+            nat = self.nature[i]
+            if nat == 'ice':
+                s += '\n      Ice:\n'
+                s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))
+                s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
+                s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]'))
+                s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
+                s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
+                s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
+                s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))
+                s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
+                s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]'))
+                s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent'))
+                s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\''))
+            elif nat == 'litho':
+                s += '\n      Litho:\n'
+                s += '{}\n'.format(fielddisplay(self, 'numlayers', 'number of layers (default: 2)'))
+                s += '{}\n'.format(fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]'))
+                s += '{}\n'.format(fielddisplay(self, 'viscosity', 'array describing each layer\'s viscosity (numlayers) [Pa.s]'))
+                s += '{}\n'.format(fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]'))
+                s += '{}\n'.format(fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]'))
+                s += '{}\n'.format(fielddisplay(self, 'burgers_viscosity', 'array describing each layer\'s transient viscosity, only for Burgers rheologies  (numlayers) [Pa.s]'))
+                s += '{}\n'.format(fielddisplay(self, 'burgers_mu', 'array describing each layer\'s transient shear modulus, only for Burgers rheologies  (numlayers) [Pa]'))
+
+                s += '{}\n'.format(fielddisplay(self, 'ebm_alpha', 'array describing each layer\'s exponent parameter controlling the shape of shear modulus curve between taul and tauh, only for EBM rheology (numlayers)'))
+                s += '{}\n'.format(fielddisplay(self, 'ebm_delta', 'array describing each layer\'s amplitude of the transient relaxation (ratio between elastic rigity to pre-maxwell relaxation rigity), only for EBM rheology (numlayers)'))
+                s += '{}\n'.format(fielddisplay(self, 'ebm_taul', 'array describing each layer\'s starting period for transient relaxation, only for EBM rheology  (numlayers) [s]'))
+                s += '{}\n'.format(fielddisplay(self, 'ebm_tauh', 'array describing each layer''s array describing each layer\'s end period for transient relaxation, only for Burgers rheology (numlayers) [s]'))
+
+                s += '{}\n'.format(fielddisplay(self, 'rheologymodel', 'array describing whether we adopt a Maxwell (0), Burgers (1) or EBM (2) rheology (default: 0)'))
+                s += '{}\n'.format(fielddisplay(self, 'density', 'array describing each layer\'s density (numlayers) [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default: 1) (numlayers)'))
+            elif nat == 'hydro':
+                s += '\n      Hydro:\n'
+                s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'earth_density', 'mantle density [kg/m^3]'))
+                s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+
+            else:
+                raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')')
+        return s
+    #}}}
+
     def setdefaultparameters(self): #{{{
         for i in range(len(self.nature)):
             nat = self.nature[i]
             if nat == 'ice':
-                #ice density (kg/m^3)
-                self.rho_ice = 917.
-                #ocean water density (kg/m^3)
-                self.rho_water = 1023.
-                #fresh water density (kg/m^3)
-                self.rho_freshwater = 1000.
-                #water viscosity (N.s/m^2)
+                # Ice density (kg/m^3)
+                self.rho_ice = 917.0
+
+                # Ocean water density (kg/m^3)
+                self.rho_water = 1023.0
+
+                # Fresh water density (kg/m^3)
+                self.rho_freshwater = 1000.0
+
+                # Water viscosity (N.s/m^2)
                 self.mu_water = 0.001787
-                #ice heat capacity cp (J/kg/K)
-                self.heatcapacity = 2093.
-                #ice latent heat of fusion L (J / kg)
-                self.latentheat = 3.34e5
-                #ice thermal conductivity (W/m/K)
+
+                # Ice heat capacity cp (J/kg/K)
+                self.heatcapacity = 2093.0
+
+                # Ice latent heat of fusion L (J/kg)
+                self.latentheat = 3.34 * 1e5
+
+                # Ice thermal conductivity (W/m/K)
                 self.thermalconductivity = 2.4
-                #wet ice thermal conductivity (W/m/K)
+
+                # Wet ice thermal conductivity (W/m/K)
                 self.temperateiceconductivity = 0.24
-                #the melting point of ice at 1 atmosphere of pressure in K
+
+                # Computation of effective conductivity
+                self.effectiveconductivity_averaging = 1
+
+                # The melting point of ice at 1 atmosphere of pressure in K
                 self.meltingpoint = 273.15
-                #rate of change of melting point with pressure (K/Pa)
-                self.beta = 9.8e-8
-                #mixed layer (ice-water interface) heat capacity (J/kg/K)
-                self.mixed_layer_capacity = 3974.
-                #thermal exchange velocity (ice-water interface) (m/s)
-                self.thermal_exchange_velocity = 1.00e-4
-                #Rheology law: what is the temperature dependence of B with T
-                #available: none, paterson and arrhenius
+
+                # Rate of change of melting point with pressure (K/Pa)
+                self.beta = 9.8 * 1e-8
+
+                # Mixed layer (ice-water interface) heat capacity (J/kg/K)
+                self.mixed_layer_capacity = 3974.0
+
+                # Thermal exchange velocity (ice-water interface) (m/s)
+                self.thermal_exchange_velocity = 1.00 * 1e-4
+
+                # Rheology law: what is the temperature dependence of B with T
+                # available: none, paterson and arrhenius
                 self.rheology_law = 'Paterson'
-            elif nat == 'litho':
-                #we default to a configuration that enables running GIA solutions using giacaron and / or giaivins.
+
+                # Rheology fields default
+                self.rheology_B = 1 * 1e8
+                self.rheology_n = 3
+            elif nat == 'litho':
+                # We default to a configuration that enables running GIA 
+                # solutions using giacaron and/or giaivins
                 self.numlayers = 2
-                #center of the earth (approximation, must not be 0), then the lab (lithosphere / asthenosphere boundary) then the surface
-                #(with 1d3 to avoid numerical singularities)
-                self.radius = [1e3, 6278e3, 6378e3]
-                self.viscosity = [1e21, 1e40]  #mantle and lithosphere viscosity (respectively) [Pa.s]
-                self.lame_mu = [1.45e11, 6.7e10]  # (Pa)  #lithosphere and mantle shear modulus (respectively) [Pa]
-                self.lame_lambda = self.lame_mu  # (Pa)  #mantle and lithosphere lamba parameter (respectively) [Pa]
+
+                # Center of the earth (approximation, must not be 0), then the 
+                # lab (lithosphere/asthenosphere boundary) then the surface
+                # (with 1d3 to avoid numerical singularities)
+                self.radius = [1e3, 6278 * 1e3, 6378 * 1e3]
+
+                self.viscosity = [1e21, 1e40] # Mantle and lithosphere viscosity (respectively) [Pa.s]
+                self.lame_mu = [1.45 * 1e11, 6.7 * 1e10] # (Pa) # Lithosphere and mantle shear modulus (respectively) [Pa]
+                self.lame_lambda = self.lame_mu # (Pa) # Mantle and lithosphere lamba parameter (respectively) [Pa]
                 self.burgers_viscosity = [np.nan, np.nan]
                 self.burgers_mu = [np.nan, np.nan]
-                self.isburgers = [0, 0]
-                self.density = [5.51e3, 5.50e3]  # (Pa)  #mantle and lithosphere density [kg/m^3]
-                self.issolid = [1, 1]  # is layer solid or liquid.
-            elif nat == 'hydro':
-                #ice density (kg/m^3)
-                self.rho_ice = 917.
-                #ocean water density (kg/m^3)
-                self.rho_water = 1023.
-                #average density of the Earth (kg/m^3)
-                self.earth_density = 5512
-                #fresh water density (kg/m^3)
-                self.rho_freshwater = 1000.
+
+                self.ebm_alpha = [np.nan, np.nan]
+                self.ebm_delta = [np.nan, np.nan]
+                self.ebm_taul = [np.nan, np.nan]
+                self.ebm_tauh = [np.nan, np.nan]
+                self.rheologymodel = [0, 0]
+                self.density = [5.51 * 1e3, 5.50 * 1e3] # (Pa) # Mantle and lithosphere density [kg/m^3]
+                self.issolid = [1, 1] # Is layer solid or liquid?
+            elif nat == 'hydro':
+                # Ice density (kg/m^3)
+                self.rho_ice = 917.0
+
+                # Ocean water density (kg/m^3)
+                self.rho_water = 1023.0
+
+                # Fresh water density (kg/m^3)
+                self.rho_freshwater = 1000.0
             else:
                 raise RuntimeError("materials setdefaultparameters error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
-    #}}}
-
-    def __repr__(self): #{{{
-        string = "   Materials:"
-        for i in range(len(self.nature)):
-            nat = self.nature[i]
-            if nat == 'ice':
-                string = "%s\n%s" % (string, 'Ice:')
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s/m^2]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K"))
-                string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'"))
-            elif nat == 'litho':
-                string = "%s\n%s" % (string, 'Litho:')
-                string = "%s\n%s" % (string, fielddisplay(self, 'numlayers', 'number of layers (default 2)'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'viscosity', 'array describing each layer''s viscosity (numlayers) [Pa.s]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'burgers_viscosity', 'array describing each layer''s transient viscosity, only for Burgers rheologies  (numlayers) [Pa.s]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'burgers_mu', 'array describing each layer''s transient shear modulus, only for Burgers rheologies  (numlayers) [Pa]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'isburgers', 'array describing whether we adopt a MaxWell (0) or Burgers (1) rheology (default 0)'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'density', 'array describing each layer''s density (numlayers) [kg/m^3]'))
-                string = "%s\n%s" % (string, fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default 1) (numlayers)'))
-            elif nat == 'hydro':
-                string = "%s\n%s" % (string, 'Hydro:')
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "earth_density", "mantle density [kg/m^3]"))
-                string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))
-
-            else:
-                raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
-
-        return string
+
+            # Average density of the Earth (kg/m^3)
+            self.earth_density = 5512
     #}}}
 
@@ -194,18 +233,24 @@
                 md = checkfield(md, 'fieldname', 'materials.density', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>', 0)
                 md = checkfield(md, 'fieldname', 'materials.viscosity', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
-                md = checkfield(md, 'fieldname', 'materials.isburgers', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<=', 1)
+                md = checkfield(md, 'fieldname', 'materials.rheologymodel', 'NaN', 1, 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0, '<=', 2)
                 md = checkfield(md, 'fieldname', 'materials.burgers_viscosity', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
                 md = checkfield(md, 'fieldname', 'materials.burgers_mu', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
+                md = checkfield(md, 'fieldname', 'materials.ebm_alpha', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
+                md = checkfield(md, 'fieldname', 'materials.ebm_delta', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
+                md = checkfield(md, 'fieldname', 'materials.ebm_taul', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
+                md = checkfield(md, 'fieldname', 'materials.ebm_tauh', 'Inf', 1, 'size', [md.materials.numlayers, 1], '>=', 0)
 
                 for i in range(md.materials.numlayers):
-                    if md.materials.isburgers[i] and (np.isnan(md.materials.burgers_viscosity[i] or np.isnan(md.materials.burgers_mu[i]))):
-                        raise RuntimeError("materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with isburgers choice")
-
-                    if md.materials.issolid[0] == 0 or md.materials.lame_mu[0] == 0:
-                        raise RuntimeError('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.')
-
-                    for i in range(md.materials.numlayers - 1):
-                        if (not md.materials.issolid[i]) and (not md.materials.issolid[i + 1]):  #if there are at least two consecutive indices that contain issolid = 0
-                            raise RuntimeError("%s%i%s" % ('2 or more adjacent fluid layers detected starting at layer ', i, '. This is not supported yet. Consider merging them.'))
+                    if md.materials.rheologymodel[i] == 1 and (np.isnan(md.materials.burgers_viscosity[i] or np.isnan(md.materials.burgers_mu[i]))):
+                        raise RuntimeError('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with rheologymodel choice')
+
+                    if md.materials.rheologymodel[i] == 2 and (np.isnan(md.materials.ebm_alpha[i]) or np.isnan(md.materials.ebm_delta[i]) or np.isnan(md.materials.ebm_taul[i]) or np.isnan(md.materials.ebm_tauh[i])):
+                        raise RuntimeError('materials checkconsistency error message: Litho ebm_alpha, ebm_delta, ebm_taul or ebm_tauh has NaN values, inconsistent with rheologymodel choice')
+                if md.materials.issolid[0] == 0 or md.materials.lame_mu[0] == 0:
+                    raise RuntimeError('First layer must be solid (issolid[0] > 0 AND lame_mu[0] > 0). Add a weak inner core if necessary.')
+                ind = np.where(md.materials.issolid == 0)[0]
+                if np.sum(np.in1d(np.diff(ind),1) >= 1): # If there are at least two consecutive indices that contain issolid = 0
+                    raise RuntimeError('Fluid layers detected at layers #' + indices + ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.')
+
             elif nat == 'hydro':
                 md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0)
@@ -214,5 +259,5 @@
                 md = checkfield(md, 'fieldname', 'materials.rho_freshwater', '>', 0)
             else:
-                raise RuntimeError("materials checkconsistency error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
+                raise RuntimeError('materials checkconsistency error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')')
 
         return md
@@ -222,10 +267,8 @@
         #1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum
         WriteData(fid, prefix, 'name', 'md.materials.nature', 'data', naturetointeger(self.nature), 'format', 'IntMat', 'mattype', 3)
-        WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 5, 'format', 'Integer') #DANGER, this can evolve if you have classes
-
-        for i in range(len(self.nature)):
-            nat = self.nature[i]
-            if nat == 'ice':
-                WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 3, 'format', 'Integer')
+        WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 5, 'format', 'Integer') #DANGER: this can evolve if you have classes
+        for i in range(len(self.nature)):
+            nat = self.nature[i]
+            if nat == 'ice':
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double')
@@ -236,4 +279,5 @@
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'thermalconductivity', 'format', 'Double')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'temperateiceconductivity', 'format', 'Double')
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'effectiveconductivity_averaging', 'format', 'Integer')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'meltingpoint', 'format', 'Double')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'beta', 'format', 'Double')
@@ -251,14 +295,24 @@
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'density', 'format', 'DoubleMat', 'mattype', 3)
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'viscosity', 'format', 'DoubleMat', 'mattype', 3)
-                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'isburgers', 'format', 'DoubleMat', 'mattype', 3)
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheologymodel', 'format', 'DoubleMat', 'mattype', 3) 
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_viscosity', 'format', 'DoubleMat', 'mattype', 3)
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_mu', 'format', 'DoubleMat', 'mattype', 3)
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_alpha', 'format', 'DoubleMat', 'mattype', 3)
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_delta', 'format', 'DoubleMat', 'mattype', 3)
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_taul', 'format', 'DoubleMat', 'mattype', 3)
+                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'ebm_tauh', 'format', 'DoubleMat', 'mattype', 3)
+                # Compute earth density compatible with our layer density distribution
+                earth_density = 0
+                for i in range(self.numlayers):
+                    earth_density = earth_density + (pow(self.radius[i + 1], 3) - pow(self.radius[i], 3)) * self.density[i]
+                earth_density = earth_density / pow(self.radius[self.numlayers], 3)
+                self.earth_density = earth_density
             elif nat == 'hydro':
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double')
-                WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double')
                 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_freshwater', 'format', 'Double')
             else:
-                raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
+                raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')')
+        WriteData(fid, prefix, 'data', self.earth_density, 'name', 'md.materials.earth_density', 'format', 'Double')
     #}}}
 
@@ -277,20 +331,21 @@
 
     for i in range(len(intnat)):
-        if strnat[i] == 'damageice':
+        str_nat = strnat[i]
+        if str_nat == 'damageice':
             intnat[i] = 1
-        elif strnat[i] == 'estar':
+        elif str_nat == 'estar':
             intnat[i] = 2
-        elif strnat[i] == 'ice':
+        elif str_nat == 'ice':
             intnat[i] = 3
-        elif strnat[i] == 'enhancedice':
+        elif str_nat == 'enhancedice':
             intnat[i] = 4
-        # elif strnat[i] == 'materials':
+        # elif str_nat == 'materials':
         #     intnat[i] = 5 #this case will never happen, kept to ensure equivalent of codes between IoCodeToMeterialsEnum and IoCodeToNatureEnum
-        elif strnat[i] == 'litho':
+        elif str_nat == 'litho':
             intnat[i] = 6
-        elif strnat[i] == 'hydro':
+        elif str_nat == 'hydro':
             intnat[i] = 7
         else:
-            raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
+            raise RuntimeError('materials constructor error message: nature of the material not supported yet! (\'ice\' or \'litho\' or \'hydro\')')
 
     return intnat
Index: issm/trunk/src/m/classes/matestar.m
===================================================================
--- issm/trunk/src/m/classes/matestar.m	(revision 25994)
+++ issm/trunk/src/m/classes/matestar.m	(revision 26744)
@@ -6,30 +6,24 @@
 classdef matestar
 	properties (SetAccess=public) 
-		rho_ice                    = 0.;
-		rho_water                  = 0.;
-		rho_freshwater             = 0.;
-		mu_water                   = 0.;
-		heatcapacity               = 0.;
-		latentheat                 = 0.;
-		thermalconductivity        = 0.;
-		temperateiceconductivity   = 0.;
+		rho_ice                         = 0.;
+		rho_water                       = 0.;
+		rho_freshwater                  = 0.;
+		mu_water                        = 0.;
+		heatcapacity                    = 0.;
+		latentheat                      = 0.;
+		thermalconductivity             = 0.;
+		temperateiceconductivity        = 0.;
 		effectiveconductivity_averaging = 0;
-		meltingpoint               = 0.;
-		beta                       = 0.;
-		mixed_layer_capacity       = 0.;
-		thermal_exchange_velocity  = 0.;
-		rheology_B    = NaN;
-		rheology_Ec   = NaN;
-		rheology_Es   = NaN;
-		rheology_law = '';
+		meltingpoint                    = 0.;
+		beta                            = 0.;
+		mixed_layer_capacity            = 0.;
+		thermal_exchange_velocity       = 0.;
+		rheology_B                      = NaN;
+		rheology_Ec                     = NaN;
+		rheology_Es                     = NaN;
+		rheology_law                    = '';
 
-		%giaivins: 
-		lithosphere_shear_modulus  = 0.;
-		lithosphere_density        = 0.;
-		mantle_shear_modulus       = 0.;
-		mantle_density             = 0.;
-
-		%slr
-		earth_density              = 0;
+		%SLC
+		earth_density                   = 0;
 
 	end
@@ -93,5 +87,5 @@
 			%computation of effective conductivity
 			self.effectiveconductivity_averaging=1;
-            
+
 			%the melting point of ice at 1 atmosphere of pressure in K
 			self.meltingpoint=273.15;
@@ -110,12 +104,6 @@
 			self.rheology_law='Paterson';
 
-			% GIA:
-			self.lithosphere_shear_modulus  = 6.7*10^10;  % (Pa)
-			self.lithosphere_density        = 3.32;       % (g/cm^-3)
-			self.mantle_shear_modulus       = 1.45*10^11; % (Pa)
-			self.mantle_density             = 3.34;       % (g/cm^-3)
-
-			%SLR
-			self.earth_density= 5512;  % average density of the Earth, (kg/m^3)
+			%SLC
+			self.earth_density= 5512; % average density of the Earth, (kg/m^3)
 
 		end % }}}
@@ -130,12 +118,6 @@
 			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'BuddJacka' 'Cuffey' 'CuffeyTemperate' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
 			md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]);
-            
-			if ismember('GiaAnalysis',analyses),
-				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
-			end
-			if ismember('SealevelriseAnalysis',analyses),
+
+			if ismember('SealevelchangeAnalysis',analyses),
 				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
 			end
@@ -162,8 +144,4 @@
 			fielddisplay(self,'rheology_Es','shear enhancement factor');
 			fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', ''Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
-			fielddisplay(self,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
-			fielddisplay(self,'lithosphere_density','Lithosphere density [g/cm^-3]');
-			fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
-			fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
 			fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
 		end % }}}
@@ -188,8 +166,4 @@
 			WriteData(fid,prefix,'data',self.rheology_law,'name','md.materials.rheology_law','format','String');
 
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
 			WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double');
 		end % }}}
@@ -214,8 +188,4 @@
 			writejs1Darray(fid,[modelname '.materials.rheology_Es'],self.rheology_Es);
 			writejsstring(fid,[modelname '.materials.rheology_law'],self.rheology_law);
-			writejsdouble(fid,[modelname '.materials.lithosphere_shear_modulus'],self.lithosphere_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.lithosphere_density'],self.lithosphere_density);
-			writejsdouble(fid,[modelname '.materials.mantle_shear_modulus'],self.mantle_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.mantle_density'],self.mantle_density);
 			writejsdouble(fid,[modelname '.materials.earth_density'],self.earth_density);
 
Index: issm/trunk/src/m/classes/matestar.py
===================================================================
--- issm/trunk/src/m/classes/matestar.py	(revision 25994)
+++ issm/trunk/src/m/classes/matestar.py	(revision 26744)
@@ -8,12 +8,11 @@
 
 class matestar(object):
-    '''
-    MATESTAR class definition
+    """MATESTAR class definition
 
-        Usage:
-            matestar = matestar()
-    '''
+    Usage:
+        matestar = matestar()
+    """
 
-    def __init__(self): #{{{
+    def __init__(self):  # {{{
         self.rho_ice = 0.
         self.rho_water = 0.
@@ -34,46 +33,36 @@
         self.rheology_law = ''
 
-        #GIA
-        self.lithosphere_shear_modulus = 0.
-        self.lithosphere_density = 0.
-        self.mantle_shear_modulus = 0.
-        self.mantle_density = 0.
-
-        #SLR
+        # SLC
         self.earth_density = 0
 
-        #set default parameters
+        # Set default parameters
         self.setdefaultparameters()
-    #}}}
+    # }}}
 
-    def __repr__(self): #{{{
-        s = "   Materials:"
-        s = "%s\n%s" % (s, fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'thermalconductivity', ['ice thermal conductivity [W/m/K]']))
-        s = "%s\n%s" % (s, fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
-        s = "%s\n%s" % (s, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))
-        s = "%s\n%s" % (s, fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'latentheat', 'latent heat of fusion [J / kg]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/3)]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rheology_Ec', 'compressive enhancement factor'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rheology_Es', 'shear enhancement factor'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'rheology_law', ['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', ''Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']))
-        s = "%s\n%s" % (s, fielddisplay(self, 'lithosphere_shear_modulus', 'Lithosphere shear modulus [Pa]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'lithosphere_density', 'Lithosphere density [g/cm^-3]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mantle_shear_modulus', 'Mantle shear modulus [Pa]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'mantle_density', 'Mantle density [g/cm^-3]'))
-        s = "%s\n%s" % (s, fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]'))
+    def __repr__(self):  # {{{
+        s = '   Materials:\n'
+        s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', ['ice thermal conductivity [W/m/K]']))
+        s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))
+        s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
+        s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/kg]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/3)]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_Ec', 'compressive enhancement factor'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_Es', 'shear enhancement factor'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_law', ['law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\'']))
+        s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]'))
 
         return s
-    #}}}
+    # }}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  # {{{
         self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node')
         self.rheology_Ec = project3d(md, 'vector', self.rheology_Ec, 'type', 'node')
@@ -81,48 +70,43 @@
 
         return self
-    #}}}
+    # }}}
 
-    def setdefaultparameters(self): #{{{
-        #ice density (kg / m^3)
-        self.rho_ice = 917.
-        #ocean water density (kg / m^3)
-        self.rho_water = 1023.
-        #fresh water density (kg / m^3)
-        self.rho_freshwater = 1000.
-        #water viscosity (N.s / m^2)
+    def setdefaultparameters(self):  # {{{
+        # Ice density (kg/m^3)
+        self.rho_ice = 917.0
+        # Ocean water density (kg/m^3)
+        self.rho_water = 1023.0
+        # Fresh water density (kg/m^3)
+        self.rho_freshwater = 1000.0
+        # Water viscosity (N.s/m^2)
         self.mu_water = 0.001787
-        #ice heat capacity cp (J / kg / K)
-        self.heatcapacity = 2093.
-        #ice latent heat of fusion L (J / kg)
-        self.latentheat = 3.34e5
-        #ice thermal conductivity (W / m / K)
+        # Ice heat capacity cp (J/kg/K)
+        self.heatcapacity = 2093.0
+        # Ice latent heat of fusion L (J/kg)
+        self.latentheat = 3.34 * pow(10, 5)
+        # Ice thermal conductivity (W/m/K)
         self.thermalconductivity = 2.4
-        #wet ice thermal conductivity (W / m / K)
+        # Wet ice thermal conductivity (W/m/K)
         self.temperateiceconductivity = 0.24
-        #computation of effective conductivity
+        # Computation of effective conductivity
         self.effectiveconductivity_averaging = 1
-        #the melting point of ice at 1 atmosphere of pressure in K
+        # The melting point of ice at 1 atmosphere of pressure in K
         self.meltingpoint = 273.15
-        #rate of change of melting point with pressure (K / Pa)
-        self.beta = 9.8e-8
-        #mixed layer (ice-water interface) heat capacity (J / kg / K)
-        self.mixed_layer_capacity = 3974.
-        #thermal exchange velocity (ice-water interface) (m / s)
-        self.thermal_exchange_velocity = 1.00e-4
-        #Rheology law: what is the temperature dependence of B with T
-        #available: none, paterson and arrhenius
+        # Rate of change of melting point with pressure (K/Pa)
+        self.beta = 9.8 * pow(10, -8)
+        # Mixed layer (ice-water interface) heat capacity (J/kg/K)
+        self.mixed_layer_capacity = 3974.0
+        # Thermal exchange velocity (ice-water interface) (m/s)
+        self.thermal_exchange_velocity = 1.00 * pow(10, -4)
+        # Rheology law: what is the temperature dependence of B with T
+        # available: none, paterson and arrhenius
         self.rheology_law = 'Paterson'
-        # GIA
-        self.lithosphere_shear_modulus = 6.7e10  # (Pa)
-        self.lithosphere_density = 3.32  # (g / cm^ - 3)
-        self.mantle_shear_modulus = 1.45e11  # (Pa)
-        self.mantle_density = 3.34  # (g / cm^ - 3)
-        #SLR
-        self.earth_density = 5512  # average density of the Earth, (kg / m^3)
+        # SLC
+        self.earth_density = 5512 # average density of the Earth (kg/m^3)
 
         return self
-    #}}}
+    # }}}
 
-    def checkconsistency(self, md, solution, analyses): #{{{
+    def checkconsistency(self, md, solution, analyses):  # {{{
         md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0)
         md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0)
@@ -135,11 +119,5 @@
         md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2])
 
-        if 'GiaAnalysis' in analyses:
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_density', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.mantle_shear_modulus', '>', 0, 'numel', 1)
-            md = checkfield(md, 'fieldname', 'materials.mantle_density', '>', 0, 'numel', 1)
-
-        if 'SealevelriseAnalysis' in analyses:
+        if 'SealevelchangeAnalysis' in analyses:
             md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', 1)
 
@@ -147,5 +125,5 @@
     # }}}
 
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 2, 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double')
@@ -166,8 +144,4 @@
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_Es', 'format', 'DoubleMat', 'mattype', 1)
         WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_density', 'format', 'Double', 'scale', 1.0e3)
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_density', 'format', 'Double', 'scale', 1.0e3)
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double')
     # }}}
Index: issm/trunk/src/m/classes/matice.js
===================================================================
--- issm/trunk/src/m/classes/matice.js	(revision 25994)
+++ issm/trunk/src/m/classes/matice.js	(revision 26744)
@@ -2,27 +2,52 @@
 //
 //   Usage:
-//      matice=matice();
+//      matice = new matice();
 
 function matice(){
+	//properties
+	// {{{
+	this.rho_ice							= 0;
+	this.rho_water							= 0;
+	this.rho_freshwater						= 0;
+	this.mu_water							= 0;
+	this.heatcapacity						= 0;
+	this.latentheat							= 0;
+	this.thermalconductivity				= 0;
+	this.temperateiceconductivity			= 0;
+	this.effectiveconductivity_averaging	= 0;
+	this.meltingpoint						= 0;
+	this.beta								= 0;
+	this.mixed_layer_capacity				= 0;
+	this.thermal_exchange_velocity			= 0;
+	this.rheology_B							= NaN;
+	this.rheology_n							= NaN;
+	this.rheology_law						= '';
+
+	//SLC
+	this.earth_density= 5512; // average density of the Earth, (kg/m^3)
+
+	this.setdefaultparameters();
+	//}}}
+
 	//methods
 	this.setdefaultparameters = function(){ // {{{
 
 		//ice density (kg/m^3)
-		this.rho_ice=917.;
+		this.rho_ice=917;
 
 		//ocean water density (kg/m^3)
-		this.rho_water=1023.;
+		this.rho_water=1023;
 
 		//fresh water density (kg/m^3)
-		this.rho_freshwater=1000.;
+		this.rho_freshwater=1000;
 
 		//water viscosity (N.s/m^2)
-		this.mu_water=0.001787;  
+		this.mu_water=0.001787;
 
 		//ice heat capacity cp (J/kg/K)
-		this.heatcapacity=2093.;
+		this.heatcapacity=2093;
 
 		//ice latent heat of fusion L (J/kg)
-		this.latentheat=3.34*Math.pow(10,5);
+		this.latentheat=3.34*Math.pow(10, 5);
 
 		//ice thermal conductivity (W/m/K)
@@ -32,15 +57,18 @@
 		this.temperateiceconductivity=.24;
 
+		//computation of effective conductivity
+		this.effectiveconductivity_averaging=1;
+
 		//the melting point of ice at 1 atmosphere of pressure in K
 		this.meltingpoint=273.15;
 
 		//rate of change of melting point with pressure (K/Pa)
-		this.beta=9.8*Math.pow(10,-8);
+		this.beta=9.8e-8;
 
 		//mixed layer (ice-water interface) heat capacity (J/kg/K)
-		this.mixed_layer_capacity=3974.;
+		this.mixed_layer_capacity=3974;
 
 		//thermal exchange velocity (ice-water interface) (m/s)
-		this.thermal_exchange_velocity=1.00*Math.pow(10,-4);
+		this.thermal_exchange_velocity=1.00*1e-4;
 
 		//Rheology law: what is the temperature dependence of B with T
@@ -48,12 +76,10 @@
 		this.rheology_law='Paterson';
 
-		// GIA:
-		this.lithosphere_shear_modulus  = 6.7*Math.pow(10,10);  // (Pa)
-		this.lithosphere_density        = 3.32;       // (g/cm^-3)
-		this.mantle_shear_modulus       = 1.45*Math.pow(10,11); // (Pa)
-		this.mantle_density             = 3.34;       // (g/cm^-3)
+		// Rheology for ice
+		this.rheology_B = 2.1 * 1e8
+		this.rheology_n = 3
 
-		//SLR
-		this.earth_density= 5512;  // average density of the Earth, (kg/m^3)
+		//SLC
+		this.earth_density= 5512; // average density of the Earth, (kg/m^3)
 
 
@@ -69,4 +95,5 @@
 		fielddisplay(this,'thermalconductivity','ice thermal conductivity [W/m/K]');
 		fielddisplay(this,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
+		fielddisplay(this,'effectiveconductivity_averaging','computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)');
 		fielddisplay(this,'meltingpoint','melting point of ice at 1atm in K');
 		fielddisplay(this,'latentheat','latent heat of fusion [J/kg]');
@@ -75,10 +102,6 @@
 		fielddisplay(this,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
 		fielddisplay(this,'rheology_B','flow law parameter [Pa s^(1/n)]');
-		fielddisplay(this,'rheology_n',"Glen's flow law exponent");
-		fielddisplay(this,'rheology_law',"law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius','LliboutryDuval','NyeH2O', or 'NyeCO2'");
-		fielddisplay(this,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
-		fielddisplay(this,'lithosphere_density','Lithosphere density [g/cm^-3]');
-		fielddisplay(this,'mantle_shear_modulus','Mantle shear modulus [Pa]');
-		fielddisplay(this,'mantle_density','Mantle density [g/cm^-3]');
+		fielddisplay(this,'rheology_n','Glen\'s flow law exponent');
+		fielddisplay(this,'rheology_law','law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeH2O\', or \'NyeCO2\'');
 		fielddisplay(this,'earth_density','Mantle density [kg/m^-3]');
 
@@ -90,26 +113,19 @@
 	}//}}}
 	this.classname = function() {// {{{
-		return "matice";
+		return 'matice';
 	} // }}}
 	this.checkconsistency = function(md,solution,analyses) { // {{{
-		checkfield(md,'fieldname','materials.rho_ice','>',0);
-		checkfield(md,'fieldname','materials.rho_water','>',0);
-		checkfield(md,'fieldname','materials.rho_freshwater','>',0);
-		checkfield(md,'fieldname','materials.mu_water','>',0);
-		checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1,'Inf',1);
-		checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements,1]);
-		checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval','NyeH2O','NyeCO2']);
-
-		if(ArrayAnyEqual(ArrayIsMember('GiaAnalysis',analyses),1)){
-			checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
-			checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
-			checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
-			checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
+		if (solution == 'TransientSolution' && md.transient.isslc) {
+			checkfield(md,'fieldname','materials.earth_density','>',0,'numel',[1])
+		} else {
+			checkfield(md,'fieldname','materials.rho_ice','>',0);
+			checkfield(md,'fieldname','materials.rho_water','>',0);
+			checkfield(md,'fieldname','materials.rho_freshwater','>',0);
+			checkfield(md,'fieldname','materials.mu_water','>',0);
+			checkfield(md,'fieldname','materials.rheology_B','>',0,'universal',1,'NaN',1,'Inf',1);
+			checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1);
+			checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval','NyeH2O','NyeCO2']);
+			checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0,1,2])
 		}
-		if (ArrayAnyEqual(ArrayIsMember('SealevelriseAnalysis',analyses),1)){
-			checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
-		}
-
-
 	} // }}}
 	this.marshall=function(md,prefix,fid) { //{{{
@@ -123,15 +139,19 @@
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermalconductivity','format','Double');
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','temperateiceconductivity','format','Double');
+		WriteData(fid,prefix,'object',this,'class','materials','fieldname','effectiveconductivity_averaging','format','Integer');
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','meltingpoint','format','Double');
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','beta','format','Double');
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','mixed_layer_capacity','format','Double');
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermal_exchange_velocity','format','Double');
-		WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+		if ((shape(self.rheology_B)[0] == md.mesh.numberofvertices) || (shape(self.rheology_B)[0] == md.mesh.numberofvertices + 1) or (shape(self.rheology_B)[0] == md.mesh.numberofelements && shape(self.rheology_B)[1] > 1)) {
+			mattype = 1
+			tsl = md.mesh.numberofvertices
+		} else {
+			mattype = 2
+			tsl = md.mesh.numberofelements
+		}
+		WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',mattype,'timeserieslength',tsl+1,'yts',md.constants.yts);
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
 		WriteData(fid,prefix,'data',this.rheology_law,'name','md.materials.rheology_law','format','String');
-		WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
-		WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_density','format','Double','scale',Math.pow(10,3));
-		WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_shear_modulus','format','Double');
-		WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_density','format','Double','scale',Math.pow(10,3));
 		WriteData(fid,prefix,'object',this,'class','materials','fieldname','earth_density','format','Double');
 
@@ -139,32 +159,3 @@
 	this.fix=function() { //{{{
 	}//}}}
-	//properties 
-	// {{{
-		this.rho_ice                    = 0.;
-		this.rho_water                  = 0.;
-		this.rho_freshwater             = 0.;
-		this.mu_water                   = 0.;
-		this.heatcapacity               = 0.;
-		this.latentheat                 = 0.;
-		this.thermalconductivity        = 0.;
-		this.temperateiceconductivity   = 0.;
-		this.meltingpoint               = 0.;
-		this.beta                       = 0.;
-		this.mixed_layer_capacity       = 0.;
-		this.thermal_exchange_velocity  = 0.;
-		this.rheology_B   = NaN;
-		this.rheology_n   = NaN;
-		this.rheology_law = '';
-
-		//giaivins: 
-		this.lithosphere_shear_modulus  = 0.;
-		this.lithosphere_density        = 0.;
-		this.mantle_shear_modulus       = 0.;
-		this.mantle_density             = 0.;
-
-		//SLR
-		this.earth_density= 5512;  // average density of the Earth, (kg/m^3)
-
-		this.setdefaultparameters();
-		//}}}
 }
Index: issm/trunk/src/m/classes/matice.m
===================================================================
--- issm/trunk/src/m/classes/matice.m	(revision 25994)
+++ issm/trunk/src/m/classes/matice.m	(revision 26744)
@@ -6,29 +6,23 @@
 classdef matice
 	properties (SetAccess=public) 
-		rho_ice                    = 0.;
-		rho_water                  = 0.;
-		rho_freshwater             = 0.;
-		mu_water                   = 0.;
-		heatcapacity               = 0.;
-		latentheat                 = 0.;
-		thermalconductivity        = 0.;
-		temperateiceconductivity   = 0.;
+		rho_ice                         = 0.;
+		rho_water                       = 0.;
+		rho_freshwater                  = 0.;
+		mu_water                        = 0.;
+		heatcapacity                    = 0.;
+		latentheat                      = 0.;
+		thermalconductivity             = 0.;
+		temperateiceconductivity        = 0.;
 		effectiveconductivity_averaging = 0.;
-		meltingpoint               = 0.;
-		beta                       = 0.;
-		mixed_layer_capacity       = 0.;
-		thermal_exchange_velocity  = 0.;
-		rheology_B   = NaN;
-		rheology_n   = NaN;
-		rheology_law = '';
+		meltingpoint                    = 0.;
+		beta                            = 0.;
+		mixed_layer_capacity            = 0.;
+		thermal_exchange_velocity       = 0.;
+		rheology_B                      = NaN;
+		rheology_n                      = NaN;
+		rheology_law                    = '';
 
-		%giaivins: 
-		lithosphere_shear_modulus  = 0.;
-		lithosphere_density        = 0.;
-		mantle_shear_modulus       = 0.;
-		mantle_density             = 0.;
-
-		%slr
-		earth_density              = 0;
+		%slc
+		earth_density                   = 0;
 
 	end
@@ -81,5 +75,5 @@
 			%wet ice thermal conductivity (W/m/K)
 			self.temperateiceconductivity=.24;
-			
+
 			%computation of effective conductivity
 			self.effectiveconductivity_averaging=1;
@@ -101,9 +95,7 @@
 			self.rheology_law='Paterson';
 
-			% GIA:
-			self.lithosphere_shear_modulus  = 6.7*10^10;  % (Pa)
-			self.lithosphere_density        = 3.32;       % (g/cm^-3)
-			self.mantle_shear_modulus       = 1.45*10^11; % (Pa)
-			self.mantle_density             = 3.34;       % (g/cm^-3)
+			%Rheology for ice: 
+			self.rheology_B=2.1*1e8;
+			self.rheology_n=3;
 
 			%SLR
@@ -112,6 +104,8 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
-	
-			if ~strcmpi(solution,'SealevelriseSolution'),
+
+			if strcmpi(solution,'TransientSolution') & md.transient.isslc,
+				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
+			else
 				md = checkfield(md,'fieldname','materials.rho_ice','>',0);
 				md = checkfield(md,'fieldname','materials.rho_water','>',0);
@@ -119,17 +113,7 @@
 				md = checkfield(md,'fieldname','materials.mu_water','>',0);
 				md = checkfield(md,'fieldname','materials.rheology_B','>',0,'universal',1,'NaN',1,'Inf',1);
-				md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
+				md = checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1);
 				md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'BuddJacka' 'Cuffey' 'CuffeyTemperate' 'Paterson' 'Arrhenius' 'LliboutryDuval' 'NyeCO2' 'NyeH2O'});
 				md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]);
-			end
-
-			if ismember('GiaAnalysis',analyses),
-				md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
-				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
-			end
-			if ismember('SealevelriseAnalysis',analyses),
-				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
 			end
 
@@ -154,8 +138,4 @@
 			fielddisplay(self,'rheology_n','Glen''s flow law exponent');
 			fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'', ''LliboutryDuval'', ''NyeH2O'', or ''NyeCO2''']);
-			fielddisplay(self,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
-			fielddisplay(self,'lithosphere_density','Lithosphere density [g/cm^-3]');
-			fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
-			fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
 			fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
 		end % }}}
@@ -183,8 +163,4 @@
 			WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'data',self.rheology_law,'name','md.materials.rheology_law','format','String');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
-			WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
 			WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double');
 		end % }}}
@@ -208,8 +184,4 @@
 			writejs1Darray(fid,[modelname '.materials.rheology_n'],self.rheology_n);
 			writejsstring(fid,[modelname '.materials.rheology_law'],self.rheology_law);
-			writejsdouble(fid,[modelname '.materials.lithosphere_shear_modulus'],self.lithosphere_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.lithosphere_density'],self.lithosphere_density);
-			writejsdouble(fid,[modelname '.materials.mantle_shear_modulus'],self.mantle_shear_modulus);
-			writejsdouble(fid,[modelname '.materials.mantle_density'],self.mantle_density);
 			writejsdouble(fid,[modelname '.materials.earth_density'],self.earth_density);
 
Index: issm/trunk/src/m/classes/matice.py
===================================================================
--- issm/trunk/src/m/classes/matice.py	(revision 25994)
+++ issm/trunk/src/m/classes/matice.py	(revision 26744)
@@ -8,116 +8,105 @@
 
 class matice(object):
-    '''
-    MATICE class definition
+    """MATICE class definition
 
     Usage:
             matice = matice()
-    '''
+    """
 
-    def __init__(self): #{{{
-        self.rho_ice = 0.
-        self.rho_water = 0.
-        self.rho_freshwater = 0.
-        self.mu_water = 0.
-        self.heatcapacity = 0.
-        self.latentheat = 0.
-        self.thermalconductivity = 0.
-        self.temperateiceconductivity = 0.
+    def __init__(self):  # {{{
+        self.rho_ice = 0
+        self.rho_water = 0
+        self.rho_freshwater = 0
+        self.mu_water = 0
+        self.heatcapacity = 0
+        self.latentheat = 0
+        self.thermalconductivity = 0
+        self.temperateiceconductivity = 0
         self.effectiveconductivity_averaging = 0
-        self.meltingpoint = 0.
-        self.beta = 0.
-        self.mixed_layer_capacity = 0.
-        self.thermal_exchange_velocity = 0.
+        self.meltingpoint = 0
+        self.beta = 0
+        self.mixed_layer_capacity = 0
+        self.thermal_exchange_velocity = 0
         self.rheology_B = np.nan
         self.rheology_n = np.nan
         self.rheology_law = ''
 
-        #giaivins
-        self.lithosphere_shear_modulus = 0.
-        self.lithosphere_density = 0.
-        self.mantle_shear_modulus = 0.
-        self.mantle_density = 0.
+        # SLC
+        self.earth_density = 0
 
-        #slr
-        self.earth_density = 0
         self.setdefaultparameters()
-    #}}}
+    # }}}
 
-    def __repr__(self): #{{{
-        s = "   Materials:"
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_ice", "ice density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_water", "water density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mu_water", "water viscosity [Ns/m^2]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))
-        s = "%s\n%s" % (s, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K"))
-        s = "%s\n%s" % (s, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_n", "Glen's flow law exponent"))
-        s = "%s\n%s" % (s, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'"))
-        s = "%s\n%s" % (s, fielddisplay(self, "lithosphere_shear_modulus", "Lithosphere shear modulus [Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "lithosphere_density", "Lithosphere density [g/cm^-3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mantle_shear_modulus", "Mantle shear modulus [Pa]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "mantle_density", "Mantle density [g/cm^-3]"))
-        s = "%s\n%s" % (s, fielddisplay(self, "earth_density", "Mantle density [kg/m^-3]"))
+    def __repr__(self):  # {{{
+        s = '   Materials:\n'
+        s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [Ns/m^2]'))
+        s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)'))
+        s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))
+        s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))
+        s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))
+        s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent'))
+        s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\''))
+        s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]'))
+        return s
+    # }}}
 
-        return s
-    #}}}
-
-    def extrude(self, md): #{{{
+    def extrude(self, md):  # {{{
         self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node')
         self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element')
         return self
-    #}}}
+    # }}}
 
-    def setdefaultparameters(self): #{{{
-        #ice density (kg/m^3)
-        self.rho_ice = 917.
-        #ocean water density (kg/m^3)
-        self.rho_water = 1023.
-        #fresh water density (kg/m^3)
-        self.rho_freshwater = 1000.
-        #water viscosity (N.s/m^2)
+    def setdefaultparameters(self):  # {{{
+        # Ice density (kg/m^3)
+        self.rho_ice = 917.0
+        # Ocean water density (kg/m^3)
+        self.rho_water = 1023.0
+        # Fresh water density (kg/m^3)
+        self.rho_freshwater = 1000.0
+        # Water viscosity (N.s/m^2)
         self.mu_water = 0.001787
-        #ice heat capacity cp (J/kg/K)
-        self.heatcapacity = 2093.
-        #ice latent heat of fusion L (J/kg)
-        self.latentheat = 3.34e5
-        #ice thermal conductivity (W/m/K)
+        # Ice heat capacity cp (J/kg/K)
+        self.heatcapacity = 2093.0
+        # Ice latent heat of fusion L (J/kg)
+        self.latentheat = 3.34 * pow(10, 5)
+        # Ice thermal conductivity (W/m/K)
         self.thermalconductivity = 2.4
-        #temperate ice thermal conductivity (W/m/K)
+        # Temperate ice thermal conductivity (W/m/K)
         self.temperateiceconductivity = 0.24
-        #computation of effective conductivity
+        # Computation of effective conductivity
         self.effectiveconductivity_averaging = 1
-        #the melting point of ice at 1 atmosphere of pressure in K
+        # The melting point of ice at 1 atmosphere of pressure in K
         self.meltingpoint = 273.15
-        #rate of change of melting point with pressure (K/Pa)
-        self.beta = 9.8e-8
-        #mixed layer (ice-water interface) heat capacity (J/kg/K)
-        self.mixed_layer_capacity = 3974.
-        #thermal exchange velocity (ice-water interface) (m/s)
-        self.thermal_exchange_velocity = 1.00e-4
-        #Rheology law: what is the temperature dependence of B with T
-        #available: none, paterson and arrhenius
+        # Rate of change of melting point with pressure (K/Pa)
+        self.beta = 9.8 * pow(10, -8)
+        # Mixed layer (ice-water interface) heat capacity (J/kg/K)
+        self.mixed_layer_capacity = 3974.0
+        # Thermal exchange velocity (ice-water interface) (m/s)
+        self.thermal_exchange_velocity = 1.00 * pow(10, -4)
+        # Rheology law: what is the temperature dependence of B with T
+        # available: none, paterson and arrhenius
         self.rheology_law = 'Paterson'
 
-        # GIA:
-        self.lithosphere_shear_modulus = 6.7e10 # (Pa)
-        self.lithosphere_density = 3.32  # (g/cm^-3)
-        self.mantle_shear_modulus = 1.45e11  # (Pa)
-        self.mantle_density = 3.34  # (g/cm^-3)
+        # Rheology for ice
+        self.rheology_B = 2.1 * 1e8
+        self.rheology_n = 3
 
         # SLR
         self.earth_density = 5512  # average density of the Earth, (kg/m^3)
-    #}}}
+    # }}}
 
-    def checkconsistency(self, md, solution, analyses): #{{{
-        if solution != 'SealevelriseSolution':
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if solution == 'TransientSolution' and md.transient.isslc:
+            md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', [1])
+        else:
             md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0)
             md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0)
@@ -125,21 +114,12 @@
             md = checkfield(md, 'fieldname', 'materials.mu_water', '>', 0)
             md = checkfield(md, 'fieldname', 'materials.rheology_B', '>', 0, 'universal', 1, 'NaN', 1, 'Inf', 1)
-            md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'size', [md.mesh.numberofelements])
+            md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'universal',1, 'NaN', 1, 'Inf', 1)
             md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', 'NyeH2O'])
             md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2])
 
-        if 'GiaAnalysis' in analyses:
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_shear_modulus', '>', 0, 'numel', [1])
-            md = checkfield(md, 'fieldname', 'materials.lithosphere_density', '>', 0, 'numel', [1])
-            md = checkfield(md, 'fieldname', 'materials.mantle_shear_modulus', '>', 0, 'numel', [1])
-            md = checkfield(md, 'fieldname', 'materials.mantle_density', '>', 0, 'numel', [1])
+        return md
+    # }}}
 
-        if 'SealevelriseAnalysis' in analyses:
-            md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', [1])
-
-        return md
-    #}}}
-
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 3, 'format', 'Integer')
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double')
@@ -156,11 +136,14 @@
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mixed_layer_capacity', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'thermal_exchange_velocity', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+        # NOTE: We first have to check if we have a NumPy array here
+        if np.size(self.rheology_B)==1 or (((np.shape(self.rheology_B)[0] == md.mesh.numberofvertices) or (np.shape(self.rheology_B)[0] == md.mesh.numberofvertices + 1)) or ((len(np.shape(self.rheology_B)) == 2) and (np.shape(self.rheology_B)[0] == md.mesh.numberofelements) and (np.shape(self.rheology_B)[1] > 1))):
+            mattype = 1
+            tsl = md.mesh.numberofvertices
+        else:
+            mattype = 2
+            tsl = md.mesh.numberofelements
+        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', mattype, 'timeserieslength', tsl + 1, 'yts', md.constants.yts)
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2)
         WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'lithosphere_density', 'format', 'Double', 'scale', 10.**3.)
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_shear_modulus', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mantle_density', 'format', 'Double', 'scale', 10.**3.)
         WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double')
-    #}}}
+    # }}}
Index: issm/trunk/src/m/classes/mesh3dprisms.js
===================================================================
--- issm/trunk/src/m/classes/mesh3dprisms.js	(revision 25994)
+++ issm/trunk/src/m/classes/mesh3dprisms.js	(revision 26744)
@@ -23,5 +23,5 @@
 
             if(ArrayAnyEqual(ArrayIsMember(NewArrayFillIncrement(md.mesh.numberofvertices,1,1),ArraySort(ArrayUnique(MatrixToList(md.mesh.elements)))),0)){
-				//md = checkmessage(md,'orphan nodes have been found. Check the mesh outline'); @TODO
+				//checkmessage(md,'orphan nodes have been found. Check the mesh outline'); @TODO
                 md.checkmessage('orphan nodes have been found. Check the mesh outline');
 			}
@@ -127,5 +127,6 @@
         } //}}}
 
-        //properties (SetAccess=public) 
+	//properties 
+	// {{{
         this.x                           = NaN;
         this.y                           = NaN;
@@ -139,5 +140,5 @@
         this.long                        = NaN;
         this.epsg                        = 0;
-		  this.scale_factor                = NaN;
+		this.scale_factor                = NaN;
 
         this.vertexonbase                = NaN;
@@ -161,3 +162,4 @@
         this.extractedvertices           = NaN;
         this.extractedelements           = NaN;
+	//}}}
 }
Index: issm/trunk/src/m/classes/mesh3dsurface.js
===================================================================
--- issm/trunk/src/m/classes/mesh3dsurface.js	(revision 25994)
+++ issm/trunk/src/m/classes/mesh3dsurface.js	(revision 26744)
@@ -87,4 +87,5 @@
 			WriteData(fid,prefix,'object',this,'fieldname','long','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','r','format','DoubleMat','mattype',1);
+			//WriteData(fid,prefix,'object',this,'fieldname','z','format','DoubleMat','mattype',1);
 			WriteData(fid,prefix,'object',this,'fieldname','elements','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'object',this,'fieldname','numberofelements','format','Integer');
@@ -92,5 +93,5 @@
 			WriteData(fid,prefix,'object',this,'fieldname','average_vertex_connectivity','format','Integer');
 			WriteData(fid,prefix,'object',this,'fieldname','vertexonboundary','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',this,'fieldname','segments','format','DoubleMat','mattype',3);
+			//WriteData(fid,prefix,'object',this,'fieldname','segments','format','DoubleMat','mattype',3);
 		}//}}}
 		this.fix=function() { //{{{
Index: issm/trunk/src/m/classes/mmeadditionalsolidearthsolution.m
===================================================================
--- issm/trunk/src/m/classes/mmeadditionalsolidearthsolution.m	(revision 26744)
+++ issm/trunk/src/m/classes/mmeadditionalsolidearthsolution.m	(revision 26744)
@@ -0,0 +1,104 @@
+%MMEADDITIONALSOLIDEARTHSOLUTION class definition
+%
+%   Usage:
+%      addsol=mmeadditionalsolidearthsolution(); where the additional solid earth solutions %                               are based on a multi-model ensemble (ex: Caron et al 2017 statistics) 
+
+classdef mmeadditionalsolidearthsolution < additionalsolidearthsolution 
+	properties (SetAccess=public) 
+		modelid; %index into the multi-model ensemble, each ensemble variable being defined 
+	         %in the father class.
+	end
+	methods
+		function self = mmeadditionalsolidearthsolution(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.setdefaultparameters@additionalsolidearthsolution();
+			self.modelid=0;
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.solidearth.settings.isgrd==0), 
+				error('mmeadditionalsolidearthsolution checkconsistency error message: need to run GRD solution if you are supplying a GRD additional pattern solution');
+			end
+
+			seast=length(self.displacementeast);
+			snorth=length(self.displacementnorth);
+			sup=length(self.displacementup);
+			sgeoid=length(self.geoid);
+
+			if (seast-snorth)~=0,
+				error('mmeadditionalsolidearthsolution checkconsistency error message: displacementeast and displacementnorth should be the same size');
+			end
+
+			if (seast-sup)~=0,
+				error('mmeadditionalsolidearthsolution checkconsistency error message: displacementeast and displacementup should be the same size');
+			end
+
+			if (seast-sgeoid)~=0,
+				error('mmeadditionalsolidearthsolution checkconsistency error message: displacementeast and geoid should be the same size');
+			end
+			
+			md = checkfield(md,'field',self.modelid,'NaN',1,'Inf',1,'>=',1,'<=',length(self.displacementeast));
+
+			for i=1:seast,
+				md = checkfield(md,'field',self.displacementeast{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.displacementup{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.displacementnorth{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.geoid{i},'NaN',1,'Inf',1,'timeseries',1);
+			end
+
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   external: mmeadditionalsolidearth solution:'));
+			self.disp@solidearthsolution();
+			fielddisplay(self,'modelid','index into the multi-model ensemble, determines which field will be used.');
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			WriteData(fid,prefix,'data',3,'name','md.solidearth.external.nature','format','Integer'); %code 3 for mmeadditionalsolidearthsolution class
+
+			nummodels=length(self.displacementeast);
+			WriteData(fid,prefix,'name','md.solidearth.external.nummodels','data',nummodels,'format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','modelid','format','Double');
+
+			%transform our cell array of time series into cell array of time series of rates 
+			for i=1:nummodels,
+				displacementeast=self.displacementeast{i}; 
+				displacementnorth=self.displacementnorth{i}; 
+				displacementup=self.displacementup{i}; 
+				geoid=self.geoid{i}; 
+
+				time=displacementeast(end,:);
+				dt=diff(time,1,2);
+				
+				displacementeast_rate=diff(displacementeast(1:end-1,:),1,2)./dt;
+				displacementnorth_rate=diff(displacementnorth(1:end-1,:),1,2)./dt;
+				displacementup_rate=diff(displacementup(1:end-1,:),1,2)./dt;
+				geoid_rate=diff(geoid(1:end-1,:),1,2)./dt;
+
+				self.displacementeast{i}=displacementeast_rate; 
+				self.displacementnorth{i}=displacementnorth_rate; 
+				self.displacementup{i}=displacementup_rate; 
+				self.geoid{i}=geoid_rate; 
+			end
+			
+			WriteData(fid,prefix,'object',self,'fieldname','displacementeast','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementup','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementnorth','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','geoid','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+
+		end % }}}
+
+		function savemodeljs(self,fid,modelname) % {{{
+			error('mmeadditionalsolidearthsolution error message: not implemented yet');
+		end % }}}
+		function self = extrude(self,md) % {{{
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/mmeofflinesolidearthsolution.m
===================================================================
--- issm/trunk/src/m/classes/mmeofflinesolidearthsolution.m	(revision 26744)
+++ issm/trunk/src/m/classes/mmeofflinesolidearthsolution.m	(revision 26744)
@@ -0,0 +1,103 @@
+%MMEOFFLINESOLIDEARTHSOLUTION class definition
+%
+%   Usage:
+%      addsol=mmeofflinesolidearthsolution(); where the offline solid earth solutions %                               are based on a multi-model ensemble (ex: Caron et al 2017 statistics) 
+
+classdef mmeofflinesolidearthsolution < offlinesolidearthsolution 
+	properties (SetAccess=public) 
+		modelid; %index into the multi-model ensemble, each ensemble variable being defined 
+	         %in the father class.
+	end
+	methods
+		function self = mmeofflinesolidearthsolution(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.setdefaultparameters@offlinesolidearthsolution();
+			self.modelid=0;
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.solidearth.settings.isgrd==1), 
+				error('mmeofflinesolidearthsolution checkconsistency error message: trying to run GRD patterns while supplying an offline solution for those patterns!'); 
+			end
+			
+			seast=length(self.displacementeast);
+			snorth=length(self.displacementnorth);
+			sup=length(self.displacementup);
+			sgeoid=length(self.geoid);
+
+			if (seast-snorth)~=0,
+				error('mmeofflinesolidearthsolution checkconsistency error message: displacementeast and displacementnorth should be the same size');
+			end
+
+			if (seast-sup)~=0,
+				error('mmeofflinesolidearthsolution checkconsistency error message: displacementeast and displacementup should be the same size');
+			end
+
+			if (seast-sgeoid)~=0,
+				error('mmeofflinesolidearthsolution checkconsistency error message: displacementeast and geoid should be the same size');
+			end
+			
+			md = checkfield(md,'field',self.modelid,'NaN',1,'Inf',1,'>=',1,'<=',length(self.displacementeast));
+
+			for i=1:seast,
+				md = checkfield(md,'field',self.displacementeast{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.displacementup{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.displacementnorth{i},'NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'field',self.geoid{i},'NaN',1,'Inf',1,'timeseries',1);
+			end
+
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   external: mmeofflinesolidearth solution:'));
+			self.disp@solidearthsolution();
+			fielddisplay(self,'modelid','index into the multi-model ensemble, determines which field will be used.');
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			WriteData(fid,prefix,'data',4,'name','md.solidearth.external.nature','format','Integer'); %code 4 for mmeofflinesolidearthsolution class
+			WriteData(fid,prefix,'object',self,'fieldname','modelid','format','Double');
+			nummodels=length(self.displacementeast);
+			WriteData(fid,prefix,'name','md.solidearth.external.nummodels','data',nummodels,'format','Integer');
+
+			%transform our cell array of time series into cell array of time series of rates 
+			for i=1:nummodels,
+				displacementeast=self.displacementeast{i}; 
+				displacementnorth=self.displacementnorth{i}; 
+				displacementup=self.displacementup{i}; 
+				geoid=self.geoid{i}; 
+
+				time=displacementeast(end,:);
+				dt=diff(time,1,2);
+				
+				displacementeast_rate=diff(displacementeast(1:end-1,:),1,2)./dt;
+				displacementnorth_rate=diff(displacementnorth(1:end-1,:),1,2)./dt;
+				displacementup_rate=diff(displacementup(1:end-1,:),1,2)./dt;
+				geoid_rate=diff(geoid(1:end-1,:),1,2)./dt;
+				barystaticsealevel_rate=diff(barystaticsealevel(1:end-1,:),1,2)./dt;
+
+				self.displacementeast{i}=displacementeast_rate; 
+				self.displacementnorth{i}=displacementnorth_rate; 
+				self.displacementup{i}=displacementup_rate; 
+				self.geoid{i}=geoid_rate; 
+			end
+			
+			WriteData(fid,prefix,'object',self,'fieldname','displacementeast','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementup','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementnorth','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+			WriteData(fid,prefix,'object',self,'fieldname','geoid','format','MatArray','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1/yts);
+
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+			error('mmeofflinesolidearthsolution error message: not implemented yet');
+		end % }}}
+		function self = extrude(self,md) % {{{
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/model.js
===================================================================
--- issm/trunk/src/m/classes/model.js	(revision 25994)
+++ issm/trunk/src/m/classes/model.js	(revision 26744)
@@ -1,780 +1,785 @@
-//MODEL class definition
-//
-//   Usage:
-//      md = new model()
-
-function model () {
+/**
+ * MODEL class definition
+ *
+ * Usage:
+ *     md = new model();
+ *
+ * TODO:
+ * - Convert to ES6 class
+ */
+function model(planet) {
 	//methods
-		this.disp = function() { //{{{
-			console.log(sprintf("class model echo: "));
-			console.log(sprintf("//19s: //-22s -- //s","mesh"            ,"[1x1 " + typeof(this.mesh) + "]","mesh properties"));
-			console.log(sprintf("//19s: //-22s -- //s","mask"            ,"[1x1 " + typeof(this.mask) + "]","defines grounded and floating elements"));
-			console.log(sprintf("//19s: //-22s -- //s","geometry"        ,"[1x1 " + typeof(this.geometry) + "]","surface elevation, bedrock topography, ice thickness,..."));
-			console.log(sprintf("//19s: //-22s -- //s","constants"       ,"[1x1 " + typeof(this.constants) + "]","physical constants"));
-			console.log(sprintf("//19s: //-22s -- //s","smb"             ,"[1x1 " + typeof(this.smb) + "]","surface mass balance"));
-			console.log(sprintf("//19s: //-22s -- //s","basalforcings"   ,"[1x1 " + typeof(this.basalforcings) + "]","bed forcings"));
-			console.log(sprintf("//19s: //-22s -- //s","materials"       ,"[1x1 " + typeof(this.materials) + "]","material properties"));
-			console.log(sprintf("//19s: //-22s -- //s","damage"          ,"[1x1 " + typeof(this.damage) + "]","parameters for damage evolution solution"));
-			console.log(sprintf("//19s: //-22s -- //s","friction"        ,"[1x1 " + typeof(this.friction) + "]","basal friction/drag properties"));
-			console.log(sprintf("//19s: //-22s -- //s","flowequation"    ,"[1x1 " + typeof(this.flowequation) + "]","flow equations"));
-			console.log(sprintf("//19s: //-22s -- //s","timestepping"    ,"[1x1 " + typeof(this.timestepping) + "]","time stepping for trans models"));
-			console.log(sprintf("//19s: //-22s -- //s","initialization"  ,"[1x1 " + typeof(this.initialization) + "]","initial guess/state"));
-			console.log(sprintf("//19s: //-22s -- //s","rifts"           ,"[1x1 " + typeof(this.rifts) + "]","rifts properties"));
-			console.log(sprintf("//19s: //-22s -- //s","slr"             ,"[1x1 " + typeof(this.slr) + "]","slr forcings"));
-			console.log(sprintf("//19s: //-22s -- //s","dsl"             ,"[1x1 " + typeof(this.dsl) + "]","dynamic sea level"));
-			console.log(sprintf("//19s: //-22s -- //s","debug"           ,"[1x1 " + typeof(this.debug) + "]","debugging tools (valgrind, gprof)"));
-			console.log(sprintf("//19s: //-22s -- //s","verbose"         ,"[1x1 " + typeof(this.verbose) + "]","verbosity level in solve"));
-			console.log(sprintf("//19s: //-22s -- //s","settings"        ,"[1x1 " + typeof(this.settings) + "]","settings properties"));
-			console.log(sprintf("//19s: //-22s -- //s","toolkits"        ,"[1x1 " + typeof(this.toolkits) + "]","PETSc options for each solution"));
-			console.log(sprintf("//19s: //-22s -- //s","cluster"         ,"[1x1 " + typeof(this.cluster) + "]","cluster parameters (number of cpus...)"));
-			console.log(sprintf("//19s: //-22s -- //s","balancethickness","[1x1 " + typeof(this.balancethickness) + "]","parameters for balancethickness solution"));
-			console.log(sprintf("//19s: //-22s -- //s","stressbalance"   ,"[1x1 " + typeof(this.stressbalance) + "]","parameters for stressbalance solution"));
-			console.log(sprintf("//19s: //-22s -- //s","groundingline"   ,"[1x1 " + typeof(this.groundingline) + "]","parameters for groundingline solution"));
-			console.log(sprintf("//19s: //-22s -- //s","hydrology"       ,"[1x1 " + typeof(this.hydrology) + "]","parameters for hydrology solution"));
-			console.log(sprintf("//19s: //-22s -- //s","masstransport"   ,"[1x1 " + typeof(this.masstransport) + "]","parameters for masstransport solution"));
-			console.log(sprintf("//19s: //-22s -- //s","thermal"         ,"[1x1 " + typeof(this.thermal) + "]","parameters for thermal solution"));
-			console.log(sprintf("//19s: //-22s -- //s","steadystate"     ,"[1x1 " + typeof(this.steadystate) + "]","parameters for steadystate solution"));
-			console.log(sprintf("//19s: //-22s -- //s","trans"           ,"[1x1 " + typeof(this.trans) + "]","parameters for trans solution"));
-			console.log(sprintf("//19s: //-22s -- //s","levelset"        ,"[1x1 " + typeof(this.levelset) + "]","parameters for moving boundaries (level-set method)"));
-			console.log(sprintf("//19s: //-22s -- //s","calving"         ,"[1x1 " + typeof(this.calving) + "]","parameters for calving"));
-			console.log(sprintf("//19s: //-22s -- //s","gia"             ,"[1x1 " + typeof(this.gia) + "]","parameters for gia solution"));
-			console.log(sprintf("//19s: //-22s -- //s","love"            ,"[1x1 " + typeof(this.love) + "]","parameters for love solution"));
-			console.log(sprintf("//19s: //-22s -- //s","esa"             ,"[1x1 " + typeof(this.esa) + "]","parameters for elastic adjustment solution"));
-			console.log(sprintf("//19s: //-22s -- //s","autodiff"        ,"[1x1 " + typeof(this.autodiff) + "]","automatic differentiation parameters"));
-			console.log(sprintf("//19s: //-22s -- //s","inversion"       ,"[1x1 " + typeof(this.inversion) + "]","parameters for inverse methods"));
-			console.log(sprintf("//19s: //-22s -- //s","qmu"             ,"[1x1 " + typeof(this.qmu) + "]","dakota properties"));
-			console.log(sprintf("//19s: //-22s -- //s","amr"             ,"[1x1 " + typeof(this.amr) + "]","adaptive mesh refinement properties"));
-			console.log(sprintf("//19s: //-22s -- //s","outputdefinition","[1x1 " + typeof(this.outputdefinition) + "]","output definition"));
-			console.log(sprintf("//19s: //-22s -- //s","results"         ,"[1x1 " + typeof(this.results) + "]","model results"));
-			console.log(sprintf("//19s: //-22s -- //s","radaroverlay"    ,"[1x1 " + typeof(this.radaroverlay) + "]","radar image for plot overlay"));
-			console.log(sprintf("//19s: //-22s -- //s","miscellaneous"   ,"[1x1 " + typeof(this.miscellaneous) + "]","miscellaneous fields"));
-		} //}}}
-		this.setdefaultparameters = function () { // {{{
-
-			//initialize subclasses
-			this.mesh             = new mesh2d();
-			this.mask             = new mask();
-			this.constants        = new constants();
-			this.geometry         = new geometry();
-			this.smb              = new SMBforcing();
-			this.basalforcings    = new basalforcings();
-			this.materials        = new matice();
-			this.damage           = new damage();
-			this.friction         = new friction();
-			this.flowequation     = new flowequation();
-			this.timestepping     = new timestepping();
-			this.initialization   = new initialization();
-			this.rifts            = new rifts();
-			this.slr              = new slr();
-			this.dsl              = new dsl();
-
-			this.debug            = new debug();
-			this.verbose          = new verbose();
-			this.settings         = new issmsettings();
-			this.toolkits         = new toolkits();
-			this.cluster          = new local();
-
-			this.balancethickness = new balancethickness();
-			this.stressbalance    = new stressbalance();
-			this.groundingline    = new groundingline();
-			this.hydrology        = new hydrologyshreve();
-			this.masstransport    = new masstransport();
-			this.thermal          = new thermal();
-			this.steadystate      = new steadystate();
-			this.trans            = new trans();
-			this.levelset         = new levelset();
-			this.calving          = new calving();
-			this.gia              = new giaivins();
-			this.love             = new fourierlove();
-			this.esa              = new esa();
-			this.autodiff         = new autodiff();
-			this.inversion        = new inversion();
-			this.qmu              = new qmu();
-			this.amr					 = new amr();
-			this.radaroverlay     = new radaroverlay();
-			this.results          = {};
-			this.outputdefinition = new outputdefinition();
-			this.radaroverlay     = new radaroverlay();
-			this.miscellaneous    = new miscellaneous();
-			this.priv             = new priv();
-		} //}}}
-		this.checkmessage = function(string){ //{{{
-			console.log('model not consistent: ' + string);
-			this.priv.isconsistent=false;
-		} //}}}
-		this.fix = function(){ //{{{
-
-			for (var field in this){
-
-				//Some properties do not need to be fixed
-				if (field == 'results' | field =='radaroverlay' | field == 'toolkits' | field =='cluster' | field == 'priv') continue;
-
-				//Check that current field is a class
-				if(typeof this[field] == 'function'){
-					continue;
+	this.disp = function() { //{{{
+		console.log(sprintf("class model echo: "));
+		console.log(sprintf("//19s: //-22s -- //s","mesh"            ,"[1x1 " + typeof(this.mesh) + "]","mesh properties"));
+		console.log(sprintf("//19s: //-22s -- //s","mask"            ,"[1x1 " + typeof(this.mask) + "]","defines grounded and floating elements"));
+		console.log(sprintf("//19s: //-22s -- //s","geometry"        ,"[1x1 " + typeof(this.geometry) + "]","surface elevation, bedrock topography, ice thickness,..."));
+		console.log(sprintf("//19s: //-22s -- //s","constants"       ,"[1x1 " + typeof(this.constants) + "]","physical constants"));
+		console.log(sprintf("//19s: //-22s -- //s","smb"             ,"[1x1 " + typeof(this.smb) + "]","surface mass balance"));
+		console.log(sprintf("//19s: //-22s -- //s","basalforcings"   ,"[1x1 " + typeof(this.basalforcings) + "]","bed forcings"));
+		console.log(sprintf("//19s: //-22s -- //s","materials"       ,"[1x1 " + typeof(this.materials) + "]","material properties"));
+		console.log(sprintf("//19s: //-22s -- //s","damage"          ,"[1x1 " + typeof(this.damage) + "]","parameters for damage evolution solution"));
+		console.log(sprintf("//19s: //-22s -- //s","friction"        ,"[1x1 " + typeof(this.friction) + "]","basal friction/drag properties"));
+		console.log(sprintf("//19s: //-22s -- //s","flowequation"    ,"[1x1 " + typeof(this.flowequation) + "]","flow equations"));
+		console.log(sprintf("//19s: //-22s -- //s","timestepping"    ,"[1x1 " + typeof(this.timestepping) + "]","time stepping for trans models"));
+		console.log(sprintf("//19s: //-22s -- //s","initialization"  ,"[1x1 " + typeof(this.initialization) + "]","initial guess/state"));
+		console.log(sprintf("//19s: //-22s -- //s","rifts"           ,"[1x1 " + typeof(this.rifts) + "]","rifts properties"));
+		console.log(sprintf("//19s: //-22s -- //s","solidearth"      ,"[1x1 " + typeof(this.solidearth) + "]","solidearth inputs and settings"));
+		console.log(sprintf("//19s: //-22s -- //s","slr"             ,"[1x1 " + typeof(this.slr) + "]","slr forcings"));
+		console.log(sprintf("//19s: //-22s -- //s","dsl"             ,"[1x1 " + typeof(this.dsl) + "]","dynamic sea level"));
+		console.log(sprintf("//19s: //-22s -- //s","debug"           ,"[1x1 " + typeof(this.debug) + "]","debugging tools (valgrind, gprof)"));
+		console.log(sprintf("//19s: //-22s -- //s","verbose"         ,"[1x1 " + typeof(this.verbose) + "]","verbosity level in solve"));
+		console.log(sprintf("//19s: //-22s -- //s","settings"        ,"[1x1 " + typeof(this.settings) + "]","settings properties"));
+		console.log(sprintf("//19s: //-22s -- //s","toolkits"        ,"[1x1 " + typeof(this.toolkits) + "]","PETSc options for each solution"));
+		console.log(sprintf("//19s: //-22s -- //s","cluster"         ,"[1x1 " + typeof(this.cluster) + "]","cluster parameters (number of CPUs...)"));
+		console.log(sprintf("//19s: //-22s -- //s","balancethickness","[1x1 " + typeof(this.balancethickness) + "]","parameters for balancethickness solution"));
+		console.log(sprintf("//19s: //-22s -- //s","stressbalance"   ,"[1x1 " + typeof(this.stressbalance) + "]","parameters for stressbalance solution"));
+		console.log(sprintf("//19s: //-22s -- //s","groundingline"   ,"[1x1 " + typeof(this.groundingline) + "]","parameters for groundingline solution"));
+		console.log(sprintf("//19s: //-22s -- //s","hydrology"       ,"[1x1 " + typeof(this.hydrology) + "]","parameters for hydrology solution"));
+		console.log(sprintf("//19s: //-22s -- //s","masstransport"   ,"[1x1 " + typeof(this.masstransport) + "]","parameters for masstransport solution"));
+		console.log(sprintf("//19s: //-22s -- //s","thermal"         ,"[1x1 " + typeof(this.thermal) + "]","parameters for thermal solution"));
+		console.log(sprintf("//19s: //-22s -- //s","steadystate"     ,"[1x1 " + typeof(this.steadystate) + "]","parameters for steadystate solution"));
+		console.log(sprintf("//19s: //-22s -- //s","transient"       ,"[1x1 " + typeof(this.transient) + "]","parameters for transient solution"));
+		console.log(sprintf("//19s: //-22s -- //s","levelset"        ,"[1x1 " + typeof(this.levelset) + "]","parameters for moving boundaries (level-set method)"));
+		console.log(sprintf("//19s: //-22s -- //s","calving"         ,"[1x1 " + typeof(this.calving) + "]","parameters for calving"));
+		console.log(sprintf("//19s: //-22s -- //s","gia"             ,"[1x1 " + typeof(this.gia) + "]","parameters for gia solution"));
+		console.log(sprintf("//19s: //-22s -- //s","love"            ,"[1x1 " + typeof(this.love) + "]","parameters for love solution"));
+		console.log(sprintf("//19s: //-22s -- //s","esa"             ,"[1x1 " + typeof(this.esa) + "]","parameters for elastic adjustment solution"));
+		console.log(sprintf("//19s: //-22s -- //s","sampling"        ,"[1x1 " + typeof(this.sampling) + "]","parameters for stochastic sampler"));
+		console.log(sprintf("//19s: //-22s -- //s","autodiff"        ,"[1x1 " + typeof(this.autodiff) + "]","automatic differentiation parameters"));
+		console.log(sprintf("//19s: //-22s -- //s","inversion"       ,"[1x1 " + typeof(this.inversion) + "]","parameters for inverse methods"));
+		console.log(sprintf("//19s: //-22s -- //s","qmu"             ,"[1x1 " + typeof(this.qmu) + "]","Dakota properties"));
+		console.log(sprintf("//19s: //-22s -- //s","amr"             ,"[1x1 " + typeof(this.amr) + "]","adaptive mesh refinement properties"));
+		console.log(sprintf("//19s: //-22s -- //s","outputdefinition","[1x1 " + typeof(this.outputdefinition) + "]","output definition"));
+		console.log(sprintf("//19s: //-22s -- //s","results"         ,"[1x1 " + typeof(this.results) + "]","model results"));
+		console.log(sprintf("//19s: //-22s -- //s","radaroverlay"    ,"[1x1 " + typeof(this.radaroverlay) + "]","radar image for plot overlay"));
+		console.log(sprintf("//19s: //-22s -- //s","miscellaneous"   ,"[1x1 " + typeof(this.miscellaneous) + "]","miscellaneous fields"));
+	} //}}}
+	this.setdefaultparameters = function(planet) { // {{{
+		this.mesh             = new mesh2d();
+		this.mask             = new mask();
+
+		this.geometry         = new geometry();
+		this.constants        = new constants();
+		this.smb              = new SMBforcing();
+		this.basalforcings    = new basalforcings();
+		this.materials        = new matice();
+		this.damage           = new damage();
+		this.friction         = new friction();
+		this.flowequation     = new flowequation();
+		this.timestepping     = new timestepping();
+		this.initialization   = new initialization();
+		this.rifts            = new rifts();
+		this.dsl              = new dsl();
+		this.solidearth       = new solidearth(planet);
+
+		this.debug            = new debug();
+		this.verbose          = new verbose();
+		this.settings         = new issmsettings();
+		this.toolkits         = new toolkits();
+		this.cluster          = new local();
+
+		this.balancethickness = new balancethickness();
+		this.stressbalance    = new stressbalance();
+		this.groundingline    = new groundingline();
+		this.hydrology        = new hydrologyshreve();
+		this.masstransport    = new masstransport();
+		this.thermal          = new thermal();
+		this.steadystate      = new steadystate();
+		this.transient        = new transient();
+		this.levelset         = new levelset();
+		this.calving          = new calving();
+		this.frontalforcings  = new frontalforcings();
+		this.love             = new fourierlove();
+		this.esa              = new esa();
+		this.sampling         = new sampling();
+
+		this.autodiff         = new autodiff();
+		this.inversion        = new inversion();
+		this.qmu              = new qmu();
+		this.amr              = new amr();
+		this.results          = {};
+		this.outputdefinition = new outputdefinition();
+		this.radaroverlay     = new radaroverlay();
+		this.miscellaneous    = new miscellaneous();
+		this.priv             = new priv();
+	} //}}}
+	this.checkmessage = function(string){ //{{{
+		console.log('model not consistent: ' + string);
+		this.priv.isconsistent=false;
+	} //}}}
+	this.fix = function(){ //{{{
+
+		for (var field in this){
+
+			//Some properties do not need to be fixed
+			if (field == 'results' | field =='radaroverlay' | field == 'toolkits' | field =='cluster' | field == 'priv') continue;
+
+			//Check that current field is a class
+			if(typeof this[field] == 'function'){
+				continue;
+			}
+
+			//Fix current object
+			this[field].fix(this);
+		}
+
+	} //}}}
+	this.extrude = function(md) { //{{{
+		//EXTRUDE - vertically extrude a 2d mesh
+		//
+		//   vertically extrude a 2d mesh and create corresponding 3d mesh.
+		//   The vertical distribution can:
+		//    - follow a polynomial law
+		//    - follow two polynomial laws, one for the lower part and one for the upper part of the mesh
+		//    - be described by a list of coefficients (between 0 and 1)
+		//   
+		//
+		//   Usage:
+		//      md=extrude(md,numlayers,extrusionexponent);
+		//      md=extrude(md,numlayers,lowerexponent,upperexponent);
+		//      md=extrude(md,listofcoefficients);
+		//
+		//   Example:
+		//      md=extrude(md,15,1.3);
+		//      md=extrude(md,15,1.3,1.2);
+		//      md=extrude(md,[0 0.2 0.5 0.7 0.9 0.95 1]);
+		//
+		//   See also: MODELEXTRACT, COLLAPSE
+
+		//some checks on list of arguments
+		var argc = arguments.length;
+		var extrusionlist;
+		var numlayers;
+		
+		if ((argc > 4) | (argc < 2)) {
+			error("extrude error message");
+		}
+
+		//Extrude the mesh
+		if (argc==2) { //list of coefficients
+			clist=arguments[0];
+			if (ArrayAnyBelowStrict(clist,0) || ArrayAnyAboveStrict(clist,1)) {
+				error('extrusioncoefficients must be between 0 and 1');
+			}
+			extrusionlist=ArraySort(ArrayUnique(clist.push(0,1)));
+			numlayers=extrusionlist.length;
+		} else if (argc==3) { //one polynomial law
+			if (arguments[1]<=0) {
+				error('extrusionexponent must be >=0');
+			}
+			numlayers=arguments[1];
+			extrusionlist = [];
+			for (var i = 0; i < numlayers; i++) {
+				extrusionlist.push(Math.pow(i/(numlayers-1), arguments[2]));
+			}
+		} else if (argc==4) { //two polynomial laws
+			numlayers=arguments[1];
+			var lowerexp=arguments[2];
+			var upperexp=arguments[3];
+
+			if (arguments[2]<=0 || arguments[3]<=0) {
+				error('lower and upper extrusionexponents must be >=0');
+			}
+
+			var lowerextrusionlist = [];
+			for (var i = 0; i <= 1; i += (2/(numlayers-1))) {
+				lowerextrusionlist.push(Math.pow(i, lowerexp)/2)
+			}
+			var upperextrusionlist = [];
+			for (var i = 0; i <= 1; i += (2/(numlayers-1))) {
+				upperextrusionlist.push(1-Math.pow(i, upperexp)/2)
+			}
+			extrusionlist=ArrayConcat(lowerextrusionlist,upperextrusionlist);
+			extrusionlist=ArraySort(ArrayUnique(extrusionlist.push(1)));
+		}
+
+		if (numlayers<2) {
+			console.error('number of layers should be at least 2');
+		}
+		if (md.mesh.domaintype() === '3D') {
+			console.error('Cannot extrude a 3d mesh (extrude cannot be called more than once)');
+		}
+
+		//Initialize with the 2d mesh
+		var mesh2d = md.mesh;
+		md.mesh=new mesh3dprisms();
+		md.mesh.x                           = mesh2d.x;
+		md.mesh.y                           = mesh2d.y;
+		md.mesh.elements                    = mesh2d.elements;
+		md.mesh.numberofelements            = mesh2d.numberofelements;
+		md.mesh.numberofvertices            = mesh2d.numberofvertices;
+
+		md.mesh.lat                         = mesh2d.lat;
+		md.mesh.long                        = mesh2d.long;
+		md.mesh.epsg                        = mesh2d.epsg;
+		md.mesh.scale_factor                = mesh2d.scale_factor;
+
+		md.mesh.vertexonboundary            = mesh2d.vertexonboundary;
+		md.mesh.vertexconnectivity          = mesh2d.vertexconnectivity;
+		md.mesh.elementconnectivity         = mesh2d.elementconnectivity;
+		md.mesh.average_vertex_connectivity = mesh2d.average_vertex_connectivity;
+
+		md.mesh.extractedvertices           = mesh2d.extractedvertices;
+		md.mesh.extractedelements           = mesh2d.extractedelements;
+
+		var x3d=new Float64Array(); 
+		var y3d=new Float64Array();
+		var z3d=new Float64Array();  //the lower node is on the bed
+		var thickness3d=md.geometry.thickness; //thickness and bed for these nodes
+		var bed3d=md.geometry.base;
+
+		//Create the new layers
+		//Dimensions of x/y/z3d: md.mesh.numberofvertices * numlayers, 1
+		for (var i = 1; i <= numlayers; i++) {
+			x3d=ArrayConcat(x3d, md.mesh.x); 
+			y3d=ArrayConcat(y3d, md.mesh.y); 
+			//nodes are distributed between bed and surface accordingly to the given exponent
+			z3d=ArrayConcat(z3d, FloatFix(thickness3d.map(function(value,index) { return bed3d[index] + value * extrusionlist[i-1]; }), thickness3d.length)); 
+		}
+		var number_nodes3d=x3d.length; //number of 3d nodes for the non extruded part of the mesh
+
+		//Extrude elements 
+		//Create the elements of the 3d mesh for the non extruded part
+		//Dimensions of elements3d: md.mesh.numberofelements * (numlayers - 1), 6
+		var elements3d=[];
+		var elements_prisms=[];
+		for (var i = 1; i < numlayers; i++) {
+			for (var j = 0; j < md.mesh.numberofelements; j++) {
+				elements_prisms = [];
+				for (var k = 0, offset = (i - 1) * md.mesh.numberofvertices; k < 3; k++) {
+					elements_prisms.push(md.mesh.elements[j][k]+offset);
 				}
-
-				//Fix current object
-				this[field].fix(this);
-			}
-
-		} //}}}
-		this.extrude = function(md) { //{{{
-			//EXTRUDE - vertically extrude a 2d mesh
-			//
-			//   vertically extrude a 2d mesh and create corresponding 3d mesh.
-			//   The vertical distribution can:
-			//    - follow a polynomial law
-			//    - follow two polynomial laws, one for the lower part and one for the upper part of the mesh
-			//    - be described by a list of coefficients (between 0 and 1)
-			//   
-			//
-			//   Usage:
-			//      md=extrude(md,numlayers,extrusionexponent);
-			//      md=extrude(md,numlayers,lowerexponent,upperexponent);
-			//      md=extrude(md,listofcoefficients);
-			//
-			//   Example:
-			//      md=extrude(md,15,1.3);
-			//      md=extrude(md,15,1.3,1.2);
-			//      md=extrude(md,[0 0.2 0.5 0.7 0.9 0.95 1]);
-			//
-			//   See also: MODELEXTRACT, COLLAPSE
-
-			//some checks on list of arguments
-			var argc = arguments.length;
-			var extrusionlist;
-			var numlayers;
-			
-			if ((argc > 4) | (argc < 2)) {
-				throw "extrude error message";
-			}
-
-			//Extrude the mesh
-			if (argc==2) { //list of coefficients
-				clist=arguments[0];
-				if (ArrayAnyBelowStrict(clist,0) || ArrayAnyAboveStrict(clist,1)) {
-					throw 'extrusioncoefficients must be between 0 and 1';
+				for (var k = 0, offset = i * md.mesh.numberofvertices; k < 3; k++) {
+					elements_prisms.push(md.mesh.elements[j][k]+offset);
 				}
-				extrusionlist=ArraySort(ArrayUnique(clist.push(0,1)));
-				numlayers=extrusionlist.length;
-			} else if (argc==3) { //one polynomial law
-				if (arguments[1]<=0) {
-					throw 'extrusionexponent must be >=0';
+				elements3d.push(elements_prisms);
+			}				
+		}
+		number_el3d=elements3d.length; //number of 3d nodes for the non extruded part of the mesh
+
+		//Keep a trace of lower and upper nodes
+		var lowervertex = NewArrayFill(number_nodes3d, NaN);
+		var uppervertex = NewArrayFill(number_nodes3d, NaN);
+		//Set first layer to NaN and start count from 1 at next layer (i = md.mesh.numberofvertices+1)
+		for (var i = md.mesh.numberofvertices, k = 1; i < lowervertex.length; i++, k++) {
+			lowervertex[i] = k;
+		};
+		//Set last layer to NaN and start count from md.mesh.numberofvertices+1 at first layer (i = 1)
+		for (var i = 0, k = md.mesh.numberofvertices+1; i < (numlayers-1)*md.mesh.numberofvertices; i++, k++) {
+			uppervertex[i] = k;
+		};
+		md.mesh.lowervertex=lowervertex;
+		md.mesh.uppervertex=uppervertex;
+
+		//same for lower and upper elements
+		var lowerelements = NewArrayFill(number_el3d, NaN);
+		var upperelements = NewArrayFill(number_el3d, NaN);
+		//Set first layer to NaN and start count from 1 at next layer (i = md.mesh.numberofelements+1)
+		for (var i = md.mesh.numberofelements, k = 1; i < lowerelements.length; i++, k++) {
+			lowerelements[i] = k;
+		};
+		//Set last 2 layers to NaN and start count from md.mesh.numberofvertices+1 at first layer (i = 1)
+		for (var i = 0, k = md.mesh.numberofelements + 1; i < (numlayers-2)*md.mesh.numberofelements; i++, k++) {
+			upperelements[i] = k;
+		};
+		md.mesh.lowerelements=lowerelements;
+		md.mesh.upperelements=upperelements;
+
+		//Save old mesh 
+		md.mesh.x2d=md.mesh.x;
+		md.mesh.y2d=md.mesh.y;
+		md.mesh.elements2d=md.mesh.elements;
+		md.mesh.numberofelements2d=md.mesh.numberofelements;
+		md.mesh.numberofvertices2d=md.mesh.numberofvertices;
+
+		//Build global 3d mesh 
+		md.mesh.elements=elements3d;
+		md.mesh.x=x3d;
+		md.mesh.y=y3d;
+		md.mesh.z=z3d;
+		md.mesh.numberofelements=number_el3d;
+		md.mesh.numberofvertices=number_nodes3d;
+		md.mesh.numberoflayers=numlayers;
+
+		//Ok, now deal with the other fields from the 2d mesh:
+
+		//bedinfo and surface info
+		md.mesh.vertexonbase=project3d(md,'vector',NewArrayFill(md.mesh.numberofvertices2d,1),'type','node','layer',1);
+		md.mesh.vertexonsurface=project3d(md,'vector',NewArrayFill(md.mesh.numberofvertices2d,1),'type','node','layer',md.mesh.numberoflayers);
+		md.mesh.vertexonboundary=project3d(md,'vector',md.mesh.vertexonboundary,'type','node');
+
+		//lat long
+		md.mesh.lat=project3d(md,'vector',md.mesh.lat,'type','node');
+		md.mesh.long=project3d(md,'vector',md.mesh.long,'type','node');
+		md.mesh.scale_factor=project3d(md,'vector',md.mesh.scale_factor,'type','node');
+
+		md.geometry=md.geometry.extrude(md);
+		md.friction=md.friction.extrude(md);
+		md.inversion=md.inversion.extrude(md);
+		md.smb=md.smb.extrude(md);
+		md.initialization=md.initialization.extrude(md);
+
+		md.flowequation=md.flowequation.extrude(md);
+		md.stressbalance=md.stressbalance.extrude(md);
+		md.thermal=md.thermal.extrude(md);
+		md.masstransport=md.masstransport.extrude(md);
+		md.levelset=md.levelset.extrude(md);
+		md.calving=md.calving.extrude(md);
+		md.hydrology = md.hydrology.extrude(md);
+		md.solidearth = md.solidearth.extrude(md);
+
+		//connectivity
+		if (!ArrayAnyNaN(md.mesh.elementconnectivity)) {
+			//md.mesh.elementconnectivity=repmat(md.mesh.elementconnectivity,numlayers-1,1); //Replicate the matrix across numlayers-1 
+			var temparr = [];
+			for (var i = 0; i < numlayers - 1; i++) {
+				temparr = ArrayConcat(temparr, md.mesh.elementconnectivity);
+			}
+			md.mesh.elementconnectivity = temparr;
+	
+			//md.mesh.elementconnectivity(find(md.mesh.elementconnectivity==0))=NaN;
+			var indices = ArrayFind(md.mesh.elementconnectivity, 0);
+			for (var i = 0; i < indices.length; i++) {
+				md.mesh.elementconnectivity[i] = NaN;
+			};
+	
+			for (var i = 2; i < numlayers; i++) {
+				//md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)...
+				//=md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)+md.mesh.numberofelements2d;
+				for (var j = (i-1)*md.mesh.numberofelements2d; j <= (i)*md.mesh.numberofelements2d-1; j++) {
+					for (var k = 0; k < 3; k++) {
+						md.mesh.elementconnectivity[j][k] += md.mesh.numberofelements2d;
+					}
 				}
-				numlayers=arguments[1];
-				extrusionlist = [];
-				for (var i = 0; i < numlayers; i++) {
-					extrusionlist.push(Math.pow(i/(numlayers-1), arguments[2]));
-				}
-			} else if (argc==4) { //two polynomial laws
-				numlayers=arguments[1];
-				var lowerexp=arguments[2];
-				var upperexp=arguments[3];
-
-				if (arguments[2]<=0 || arguments[3]<=0) {
-					throw 'lower and upper extrusionexponents must be >=0';
-				}
-
-				var lowerextrusionlist = [];
-				for (var i = 0; i <= 1; i += (2/(numlayers-1))) {
-					lowerextrusionlist.push(Math.pow(i, lowerexp)/2)
-				}
-				var upperextrusionlist = [];
-				for (var i = 0; i <= 1; i += (2/(numlayers-1))) {
-					upperextrusionlist.push(1-Math.pow(i, upperexp)/2)
-				}
-				extrusionlist=ArrayConcat(lowerextrusionlist,upperextrusionlist);
-				extrusionlist=ArraySort(ArrayUnique(extrusionlist.push(1)));
-			}
-
-			if (numlayers<2) {
-				console.error('number of layers should be at least 2');
-			}
-			if (md.mesh.domaintype() === '3D') {
-				console.error('Cannot extrude a 3d mesh (extrude cannot be called more than once)');
-			}
-
-			//Initialize with the 2d mesh
-			var mesh2d = md.mesh;
-			md.mesh=new mesh3dprisms();
-			md.mesh.x                           = mesh2d.x;
-			md.mesh.y                           = mesh2d.y;
-			md.mesh.elements                    = mesh2d.elements;
-			md.mesh.numberofelements            = mesh2d.numberofelements;
-			md.mesh.numberofvertices            = mesh2d.numberofvertices;
-
-			md.mesh.lat                         = mesh2d.lat;
-			md.mesh.long                        = mesh2d.long;
-			md.mesh.epsg                        = mesh2d.epsg;
-			md.mesh.scale_factor                = mesh2d.scale_factor;
-
-			md.mesh.vertexonboundary            = mesh2d.vertexonboundary;
-			md.mesh.vertexconnectivity          = mesh2d.vertexconnectivity;
-			md.mesh.elementconnectivity         = mesh2d.elementconnectivity;
-			md.mesh.average_vertex_connectivity = mesh2d.average_vertex_connectivity;
-
-			md.mesh.extractedvertices           = mesh2d.extractedvertices;
-			md.mesh.extractedelements           = mesh2d.extractedelements;
-
-			var x3d=new Float64Array(); 
-			var y3d=new Float64Array();
-			var z3d=new Float64Array();  //the lower node is on the bed
-			var thickness3d=md.geometry.thickness; //thickness and bed for these nodes
-			var bed3d=md.geometry.base;
-
-			//Create the new layers
-			//Dimensions of x/y/z3d: md.mesh.numberofvertices * numlayers, 1
-			for (var i = 1; i <= numlayers; i++) {
-				x3d=ArrayConcat(x3d, md.mesh.x); 
-				y3d=ArrayConcat(y3d, md.mesh.y); 
-				//nodes are distributed between bed and surface accordingly to the given exponent
-				z3d=ArrayConcat(z3d, FloatFix(thickness3d.map(function(value,index) { return bed3d[index] + value * extrusionlist[i-1]; }), thickness3d.length)); 
-			}
-			var number_nodes3d=x3d.length; //number of 3d nodes for the non extruded part of the mesh
-
-			//Extrude elements 
-			//Create the elements of the 3d mesh for the non extruded part
-			//Dimensions of elements3d: md.mesh.numberofelements * (numlayers - 1), 6
-			var elements3d=[];
-			var elements_prisms=[];
-			for (var i = 1; i < numlayers; i++) {
-				for (var j = 0; j < md.mesh.numberofelements; j++) {
-					elements_prisms = [];
-					for (var k = 0, offset = (i - 1) * md.mesh.numberofvertices; k < 3; k++) {
-						elements_prisms.push(md.mesh.elements[j][k]+offset);
-					}
-					for (var k = 0, offset = i * md.mesh.numberofvertices; k < 3; k++) {
-						elements_prisms.push(md.mesh.elements[j][k]+offset);
-					}
-					elements3d.push(elements_prisms);
-				}				
-			}
-			number_el3d=elements3d.length; //number of 3d nodes for the non extruded part of the mesh
-
-			//Keep a trace of lower and upper nodes
-			var lowervertex = NewArrayFill(number_nodes3d, NaN);
-			var uppervertex = NewArrayFill(number_nodes3d, NaN);
-			//Set first layer to NaN and start count from 1 at next layer (i = md.mesh.numberofvertices+1)
-			for (var i = md.mesh.numberofvertices, k = 1; i < lowervertex.length; i++, k++) {
-				lowervertex[i] = k;
-			};
-			//Set last layer to NaN and start count from md.mesh.numberofvertices+1 at first layer (i = 1)
-			for (var i = 0, k = md.mesh.numberofvertices+1; i < (numlayers-1)*md.mesh.numberofvertices; i++, k++) {
-				uppervertex[i] = k;
-			};
-			md.mesh.lowervertex=lowervertex;
-			md.mesh.uppervertex=uppervertex;
-
-			//same for lower and upper elements
-			var lowerelements = NewArrayFill(number_el3d, NaN);
-			var upperelements = NewArrayFill(number_el3d, NaN);
-			//Set first layer to NaN and start count from 1 at next layer (i = md.mesh.numberofelements+1)
-			for (var i = md.mesh.numberofelements, k = 1; i < lowerelements.length; i++, k++) {
-				lowerelements[i] = k;
-			};
-			//Set last 2 layers to NaN and start count from md.mesh.numberofvertices+1 at first layer (i = 1)
-			for (var i = 0, k = md.mesh.numberofelements + 1; i < (numlayers-2)*md.mesh.numberofelements; i++, k++) {
-				upperelements[i] = k;
-			};
-			md.mesh.lowerelements=lowerelements;
-			md.mesh.upperelements=upperelements;
-
-			//Save old mesh 
-			md.mesh.x2d=md.mesh.x;
-			md.mesh.y2d=md.mesh.y;
-			md.mesh.elements2d=md.mesh.elements;
-			md.mesh.numberofelements2d=md.mesh.numberofelements;
-			md.mesh.numberofvertices2d=md.mesh.numberofvertices;
-
-			//Build global 3d mesh 
-			md.mesh.elements=elements3d;
-			md.mesh.x=x3d;
-			md.mesh.y=y3d;
-			md.mesh.z=z3d;
-			md.mesh.numberofelements=number_el3d;
-			md.mesh.numberofvertices=number_nodes3d;
-			md.mesh.numberoflayers=numlayers;
-
-			//Ok, now deal with the other fields from the 2d mesh:
-
-			//bedinfo and surface info
-			md.mesh.vertexonbase=project3d(md,'vector',NewArrayFill(md.mesh.numberofvertices2d,1),'type','node','layer',1);
-			md.mesh.vertexonsurface=project3d(md,'vector',NewArrayFill(md.mesh.numberofvertices2d,1),'type','node','layer',md.mesh.numberoflayers);
-			md.mesh.vertexonboundary=project3d(md,'vector',md.mesh.vertexonboundary,'type','node');
-
-			//lat long
-			md.mesh.lat=project3d(md,'vector',md.mesh.lat,'type','node');
-			md.mesh.long=project3d(md,'vector',md.mesh.long,'type','node');
-			md.mesh.scale_factor=project3d(md,'vector',md.mesh.scale_factor,'type','node');
-
-			md.geometry=md.geometry.extrude(md);
-			md.friction=md.friction.extrude(md);
-			md.inversion=md.inversion.extrude(md);
-			md.smb=md.smb.extrude(md);
-			md.initialization=md.initialization.extrude(md);
-
-			md.flowequation=md.flowequation.extrude(md);
-			md.stressbalance=md.stressbalance.extrude(md);
-			md.thermal=md.thermal.extrude(md);
-			md.masstransport=md.masstransport.extrude(md);
-			md.levelset=md.levelset.extrude(md);
-			md.calving=md.calving.extrude(md);
-			md.hydrology = md.hydrology.extrude(md);
-
-			//connectivity
-			if (!ArrayAnyNaN(md.mesh.elementconnectivity)) {
-				//md.mesh.elementconnectivity=repmat(md.mesh.elementconnectivity,numlayers-1,1); //Replicate the matrix across numlayers-1 
-				var temparr = [];
-				for (var i = 0; i < numlayers - 1; i++) {
-					temparr = ArrayConcat(temparr, md.mesh.elementconnectivity);
-				}
-				md.mesh.elementconnectivity = temparr;
+			}
+			md.mesh.elementconnectivity = md.mesh.elementconnectivity.map(function(value) { return (Number.isNaN(value)) ? 0 : value; });
+		}
+
+		md.materials=md.materials.extrude(md);
+		md.damage=md.damage.extrude(md);
+		md.mask=md.mask.extrude(md);
+		md.qmu=md.qmu.extrude(md);
+		md.basalforcings=md.basalforcings.extrude(md);
+
+		//increase connectivity if less than 25:
+		if (md.mesh.average_vertex_connectivity<=25) {
+			md.mesh.average_vertex_connectivity=100;
+		}
+	} //}}}
+	this.extract = function(md,area) { //{{{
+		//extract - extract a model according to an Argus contour or flag list
+		//
+		//   This routine extracts a submodel from a bigger model with respect to a given contour
+		//   md must be followed by the corresponding exp file or flags list
+		//   It can either be a domain file (argus type, .exp extension), or an array of element flags. 
+		//   If user wants every element outside the domain to be 
+		//   extract2d, add '~' to the name of the domain file (ex: '~HO.exp');
+		//   an empty string '' will be considered as an empty domain
+		//   a string 'all' will be considered as the entire domain
+		//
+		//   Usage:
+		//      md2=extract(md,area);
+		//
+		//   Examples:
+		//      md2=extract(md,'Domain.exp');
+		//
+		//   See also: EXTRUDE, COLLAPSE
+
+		//some checks on list of arguments
+		var argc = arguments.length;
+
+		if (!((argc == 2) | (argc == 1))) {
+			error('extract error message: bad usage');
+		}
 		
-				//md.mesh.elementconnectivity(find(md.mesh.elementconnectivity==0))=NaN;
-				var indices = ArrayFind(md.mesh.elementconnectivity, 0);
-				for (var i = 0; i < indices.length; i++) {
-					md.mesh.elementconnectivity[i] = NaN;
-				};
+		//get elements that are inside area
+		flag_elem=FlagElements(this,area);
+
+		if (!ArrayAnyEqual(flag_elem,1)) {
+			error('extracted model is empty!');
+		}
+
+		/*kick out all elements with 3 dirichlets: actually, not so fast, not good for javscript usually.
+		spc_elem=find(~flag_elem);
+		spc_node=sort(unique(md1.mesh.elements(spc_elem,:)));
+		flag=ones(md1.mesh.numberofvertices,1);
+		flag(spc_node)=0;
+		pos=find(sum(flag(md1.mesh.elements),2)==0);
+		flag_elem(pos)=0;*/
+
+		//extracted elements and nodes lists
+		var pos_elem = ArrayFind(flag_elem,1);
+		var dup_nodes= new Array(pos_elem.length*3);
+		for(var i=0;i<pos_elem.length;i++){
+			dup_nodes[3*i]=md.mesh.elements[pos_elem[i]][0]-1;
+			dup_nodes[3*i+1]=md.mesh.elements[pos_elem[i]][1]-1;
+			dup_nodes[3*i+2]=md.mesh.elements[pos_elem[i]][2]-1;
+		}
+		pos_node=ArrayUnique(dup_nodes); pos_node=ArraySort(pos_node);
+
+		//keep track of some fields
+		var numberofvertices1=md.mesh.numberofvertices;
+		var numberofelements1=md.mesh.numberofelements;
+		var numberofvertices2=pos_node.length;
+		var numberofelements2=pos_elem.length;
+		var flag_node=NewArrayFill(numberofvertices1,0);
+		for (var i=0;i<pos_node.length;i++)flag_node[pos_node[i]]=1;
+
+		//Create Pelem and Pnode (transform old nodes in new nodes and same thing for the elements)
+		Pelem=NewArrayFill(numberofelements1,0);
+		for (var i=0;i<numberofelements2;i++) Pelem[pos_elem[i]]=i;
+		Pnode=NewArrayFill(numberofvertices1,0);
+		for (var i=0;i<numberofvertices2;i++) Pnode[pos_node[i]]=i;
+		//renumber the elements (some nodes won't exist anymore)
+		var elements_2=NewArrayFill2D(numberofelements2,3,0);
+		for (var i=0;i<numberofelements2;i++){
+			for (var j=0;j<3;j++){
+				elements_2[i][j]=Pnode[md.mesh.elements[i][j]-1]+1;
+			}
+		}
 		
-				for (var i = 2; i < numlayers; i++) {
-					//md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)...
-					//=md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)+md.mesh.numberofelements2d;
-					for (var j = (i-1)*md.mesh.numberofelements2d; j <= (i)*md.mesh.numberofelements2d-1; j++) {
-						for (var k = 0; k < 3; k++) {
-							md.mesh.elementconnectivity[j][k] += md.mesh.numberofelements2d;
+		/*if isa(md.mesh,'mesh3dprisms'),
+			elements_2(:,4)=Pnode(elements_2(:,4));
+			elements_2(:,5)=Pnode(elements_2(:,5));
+			elements_2(:,6)=Pnode(elements_2(:,6));
+		end
+		*/
+		
+		//OK, now create the new model!
+
+		//take every field from model
+		var md2=md.deepcopy(md);
+		//var md2=new model(); md2.mesh=new mesh3dsurface();
+		
+		//deal with mesh: {{{
+		md2.mesh.numberofvertices=numberofvertices2;
+		md2.mesh.numberofelements=numberofelements2;
+		md2.mesh.elements=elements_2;
+
+		md2.mesh.x=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.x[i]=md.mesh.x[pos_node[i]];
+		md2.mesh.y=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.y[i]=md.mesh.y[pos_node[i]];
+		md2.mesh.z=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.z[i]=md.mesh.z[pos_node[i]];
+		md2.mesh.lat=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.lat[i]=md.mesh.lat[pos_node[i]];
+		md2.mesh.long=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.long[i]=md.mesh.long[pos_node[i]];
+		md2.mesh.r=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.r[i]=md.mesh.r[pos_node[i]];
+		//}}}
+		//deal with geometry: {{{
+		md2.geometry.base=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.base[i]=md.geometry.base[pos_node[i]];
+		md2.geometry.thickness=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.thickness[i]=md.geometry.thickness[pos_node[i]];
+		md2.geometry.surface=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.surface[i]=md.geometry.surface[pos_node[i]];
+		md2.geometry.bed=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.bed[i]=md.geometry.bed[pos_node[i]];
+		//}}}
+
+		//Keep track of pos_node and pos_elem
+		for (var i=0;i<md2.mesh.numberofvertices;i++)pos_node[i]=pos_node[i]+1;
+		for (var i=0;i<md2.mesh.numberofelements;i++)pos_elem[i]=pos_elem[i]+1;
+		md2.mesh.extractedvertices=pos_node;
+		md2.mesh.extractedelements=pos_elem;
+
+		return md2;
+
+		//automatically modify fields
+
+		//loop over model fields
+		//model_fields=fields(md);
+	} //}}}
+	this.collapse = function(md) { //{{{
+		/*
+		 *COLLAPSE - collapses a 3d mesh into a 2d mesh
+		 *
+		 *   This routine collapses a 3d model into a 2d model
+		 *   and collapses all the fileds of the 3d model by
+		 *   taking their depth-averaged values
+		 *
+		 *   Usage:
+		 *	 md=collapse(md)
+		 *
+		 *   See also: EXTRUDE, MODELEXTRACT
+		 */
+
+		// Check that the model is really a 3d model
+		if (md.mesh.elementtype() !== 'Penta') {
+			console.error('collapse error message: only 3d mesh can be collapsed')
+		}
+
+		// Start with changing all the fields from the 3d mesh 
+
+		// dealing with the friction law
+		// drag is limited to nodes that are on the bedrock.
+		if (md.friction.classname() === 'friction') {
+			md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+			md.friction.p=project2d(md,md.friction.p,1);
+			md.friction.q=project2d(md,md.friction.q,1);
+		} else if (md.friction.classname() === 'frictionhydro') {
+			md.friction.q=project2d(md,md.friction.q,1);
+			md.friction.C=project2d(md,md.friction.C,1);
+			md.friction.As=project2d(md,md.friction.As,1);
+			md.friction.effective_pressure=project2d(md,md.friction.effective_pressure,1);
+		} else if (md.friction.classname() === 'frictionwaterlayer') {
+			md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+			md.friction.p=project2d(md,md.friction.p,1);
+			md.friction.q=project2d(md,md.friction.q,1);
+			md.friction.water_layer=project2d(md,md.friction.water_layer,1);
+		} else if (md.friction.classname() === 'frictionweertman') {
+			md.friction.C=project2d(md,md.friction.C,1);
+			md.friction.m=project2d(md,md.friction.m,1);
+		} else if (md.friction.classname() === 'frictionweertmantemp') {
+			md.friction.C=project2d(md,md.friction.C,1);
+			md.friction.m=project2d(md,md.friction.m,1);
+		} else {
+			disp('friction type not supported');
+		}
+
+		// observations
+		if (!Number.isNaN(md.inversion.vx_obs))
+			md.inversion.vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers);
+
+		if (!Number.isNaN(md.inversion.vy_obs))
+			md.inversion.vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers);
+
+		if (!Number.isNaN(md.inversion.vel_obs))
+			md.inversion.vel_obs=project2d(md,md.inversion.vel_obs,md.mesh.numberoflayers);
+
+		if (!Number.isNaN(md.inversion.cost_functions_coefficients))
+			md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers);
+
+		if (numel(md.inversion.min_parameters)>1)
+			md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers);
+
+		if (numel(md.inversion.max_parameters)>1) 
+			md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers);
+
+		if (md.smb.classname() === 'SMBforcing' && !Number.isNaN(md.smb.mass_balance)) {
+			md.smb.mass_balance=project2d(md,md.smb.mass_balance,md.mesh.numberoflayers);
+		} else if (md.smb.classname() === 'SMBhenning' && !Number.isNaN(md.smb.smbref)) {
+			md.smb.smbref=project2d(md,md.smb.smbref,md.mesh.numberoflayers);
+		}
+
+		// results
+		if (!Number.isNaN(md.initialization.vx))
+			md.initialization.vx=DepthAverage(md,md.initialization.vx);
+		if (!Number.isNaN(md.initialization.vy))
+			md.initialization.vy=DepthAverage(md,md.initialization.vy);
+		if (!Number.isNaN(md.initialization.vz))
+			md.initialization.vz=DepthAverage(md,md.initialization.vz);
+		if (!Number.isNaN(md.initialization.vel))
+			md.initialization.vel=DepthAverage(md,md.initialization.vel);
+		if (!Number.isNaN(md.initialization.temperature))
+			md.initialization.temperature=DepthAverage(md,md.initialization.temperature);
+		if (!Number.isNaN(md.initialization.pressure))
+			md.initialization.pressure=project2d(md,md.initialization.pressure,1);
+		if (!Number.isNaN(md.initialization.sediment_head))
+			md.initialization.sediment_head=project2d(md,md.initialization.sediment_head,1);
+		if (!Number.isNaN(md.initialization.epl_head))
+			md.initialization.epl_head=project2d(md,md.initialization.epl_head,1);
+		if (!Number.isNaN(md.initialization.epl_thickness))
+			md.initialization.epl_thickness=project2d(md,md.initialization.epl_thickness,1);
+
+		// giaivins
+		if (!Number.isNaN(md.gia.mantle_viscosity))
+			md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1);
+		if (!Number.isNaN(md.gia.lithosphere_thickness))
+			md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1);
+
+		// elementstype
+		if (!Number.isNaN(md.flowequation.element_equation)) {
+			md.flowequation.element_equation=project2d(md,md.flowequation.element_equation,1);
+			md.flowequation.vertex_equation=project2d(md,md.flowequation.vertex_equation,1);
+			md.flowequation.borderSSA=project2d(md,md.flowequation.borderSSA,1);
+			md.flowequation.borderHO=project2d(md,md.flowequation.borderHO,1);
+			md.flowequation.borderFS=project2d(md,md.flowequation.borderFS,1);
+		}
+
+		// boundary conditions
+		md.stressbalance.spcvx=project2d(md,md.stressbalance.spcvx,md.mesh.numberoflayers);
+		md.stressbalance.spcvy=project2d(md,md.stressbalance.spcvy,md.mesh.numberoflayers);
+		md.stressbalance.spcvz=project2d(md,md.stressbalance.spcvz,md.mesh.numberoflayers);
+		md.stressbalance.referential=project2d(md,md.stressbalance.referential,md.mesh.numberoflayers);
+		md.stressbalance.loadingforce=project2d(md,md.stressbalance.loadingforce,md.mesh.numberoflayers);
+		md.masstransport.spcthickness=project2d(md,md.masstransport.spcthickness,md.mesh.numberoflayers);
+		if (!Number.isNaN(md.damage.spcdamage))
+			md.damage.spcdamage=project2d(md,md.damage.spcdamage,md.mesh.numberoflayers);
+		md.thermal.spctemperature=project2d(md,md.thermal.spctemperature,md.mesh.numberoflayers);
+
+		// Hydrologydc variables
+		if (md.hydrology.classname() === 'hydrologydc') {
+			md.hydrology.spcsediment_head=project2d(md,md.hydrology.spcsediment_head,1);
+			md.hydrology.mask_eplactive_node=project2d(md,md.hydrology.mask_eplactive_node,1);
+			md.hydrology.sediment_transmitivity=project2d(md,md.hydrology.sediment_transmitivity,1);
+			md.hydrology.basal_moulin_input=project2d(md,md.hydrology.basal_moulin_input,1);
+
+			if(md.hydrology.isefficientlayer==1)
+				md.hydrology.spcepl_head=project2d(md,md.hydrology.spcepl_head,1);
+		}
+		
+		// materials
+		md.materials.rheology_B=DepthAverage(md,md.materials.rheology_B);
+		md.materials.rheology_n=project2d(md,md.materials.rheology_n,1);
+		
+		// damage: 
+		if (md.damage.isdamage)
+			md.damage.D=DepthAverage(md,md.damage.D);
+
+		// special for thermal modeling:
+		if (!Number.isNaN(md.basalforcings.groundedice_melting_rate))
+			md.basalforcings.groundedice_melting_rate=project2d(md,md.basalforcings.groundedice_melting_rate,1); 
+
+		if (!Number.isNaN(md.basalforcings.floatingice_melting_rate))
+			md.basalforcings.floatingice_melting_rate=project2d(md,md.basalforcings.floatingice_melting_rate,1); 
+
+		md.basalforcings.geothermalflux=project2d(md,md.basalforcings.geothermalflux,1); // bedrock only gets geothermal flux
+
+		// update of connectivity matrix
+		md.mesh.average_vertex_connectivity=25;
+
+		// Collapse the mesh
+		var nodes2d=md.mesh.numberofvertices2d;
+		var elements2d=md.mesh.numberofelements2d;
+
+		// parameters
+		md.geometry.surface=project2d(md,md.geometry.surface,1);
+		md.geometry.thickness=project2d(md,md.geometry.thickness,1);
+		md.geometry.base=project2d(md,md.geometry.base,1);
+		if (!Number.isNaN(md.geometry.bed))
+			md.geometry.bed=project2d(md,md.geometry.bed,1);
+
+		if (!Number.isNaN(md.mask.ocean_levelset))
+			md.mask.ocean_levelset=project2d(md,md.mask.ocean_levelset,1);
+
+		if (!Number.isNaN(md.mask.ice_levelset))
+			md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1);
+
+		// lat long
+		if (numel(md.mesh.lat) === md.mesh.numberofvertices)
+			md.mesh.lat=project2d(md,md.mesh.lat,1);
+		if (numel(md.mesh.long) === md.mesh.numberofvertices)
+			md.mesh.long=project2d(md,md.mesh.long,1);
+		if (numel(md.mesh.scale_factor) === md.mesh.numberofvertices)
+			md.mesh.scale_factor=project2d(md,md.mesh.scale_factor,1);
+
+		// Initialize with the 2d mesh
+		var mesh = new mesh2d();
+		mesh.x=md.mesh.x2d;
+		mesh.y=md.mesh.y2d;
+		mesh.numberofvertices=md.mesh.numberofvertices2d;
+		mesh.numberofelements=md.mesh.numberofelements2d;
+		mesh.elements=md.mesh.elements2d;
+
+		if (!Number.isNaN(md.mesh.vertexonboundary))
+			mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
+		if (!Number.isNaN(md.mesh.elementconnectivity))
+			mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
+
+		md.mesh=mesh;
+		md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+		md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+		md.mesh.segments=contourenvelope(md.mesh);
+
+		return md;
+	} /*}}}*/
+	this.deepCopy = function(md) { //{{{
+		/*
+		 *DEEPCOPY - returns a deep copy of the model.
+		 *
+		 *   This routine creates a new model with new objects 
+		 *   for each corresponding object in the original model,
+		 *   so that changes in one do not affect the other.
+		 *
+		 *   Usage:
+		 *	 md1=deepCopy(md)
+		 *
+		 */
+		function recursiveDeepCopy(obj) {
+			var returnValue;
+
+			switch (typeof obj) {
+				case "object":
+					if (obj === null) {
+						// null => null
+						returnValue = null;
+					} else {
+						switch (toString.call(obj)) {
+							case "[object Array]":
+								// It's an array, create a new array with deep copies of the entries
+								returnValue = obj.map(recursiveDeepCopy);
+								break;
+							default:
+								// Some other kind of object, deep-copy its properties into a new object
+								returnValue = Object.keys(obj).reduce(function(prev, key) {
+									prev[key] = recursiveDeepCopy(obj[key]);
+									return prev;
+								}, {});
+								break;
 						}
 					}
-				}
-				md.mesh.elementconnectivity = md.mesh.elementconnectivity.map(function(value) { return (Number.isNaN(value)) ? 0 : value; });
-			}
-
-			md.materials=md.materials.extrude(md);
-			md.damage=md.damage.extrude(md);
-			md.mask=md.mask.extrude(md);
-			md.qmu=md.qmu.extrude(md);
-			md.basalforcings=md.basalforcings.extrude(md);
-
-			//increase connectivity if less than 25:
-			if (md.mesh.average_vertex_connectivity<=25) {
-				md.mesh.average_vertex_connectivity=100;
-			}
-		} //}}}
-		this.extract = function(md,area) { //{{{
-			//extract - extract a model according to an Argus contour or flag list
-			//
-			//   This routine extracts a submodel from a bigger model with respect to a given contour
-			//   md must be followed by the corresponding exp file or flags list
-			//   It can either be a domain file (argus type, .exp extension), or an array of element flags. 
-			//   If user wants every element outside the domain to be 
-			//   extract2d, add '~' to the name of the domain file (ex: '~HO.exp');
-			//   an empty string '' will be considered as an empty domain
-			//   a string 'all' will be considered as the entire domain
-			//
-			//   Usage:
-			//      md2=extract(md,area);
-			//
-			//   Examples:
-			//      md2=extract(md,'Domain.exp');
-			//
-			//   See also: EXTRUDE, COLLAPSE
-
-			//some checks on list of arguments
-			var argc = arguments.length;
-
-			if (!((argc == 2) | (argc == 1))) {
-				throw "extract error message: bad usage";
-			}
-			
-			//get elements that are inside area
-			flag_elem=FlagElements(this,area);
-
-			if (!ArrayAnyEqual(flag_elem,1))throw "extracted model is empty!"
-
-			/*kick out all elements with 3 dirichlets: actually, not so fast, not good for javscript usually.
-			spc_elem=find(~flag_elem);
-			spc_node=sort(unique(md1.mesh.elements(spc_elem,:)));
-			flag=ones(md1.mesh.numberofvertices,1);
-			flag(spc_node)=0;
-			pos=find(sum(flag(md1.mesh.elements),2)==0);
-			flag_elem(pos)=0;*/
-
-			//extracted elements and nodes lists
-			var pos_elem = ArrayFind(flag_elem,1);
-			var dup_nodes= new Array(pos_elem.length*3);
-			for(var i=0;i<pos_elem.length;i++){
-				dup_nodes[3*i]=md.mesh.elements[pos_elem[i]][0]-1;
-				dup_nodes[3*i+1]=md.mesh.elements[pos_elem[i]][1]-1;
-				dup_nodes[3*i+2]=md.mesh.elements[pos_elem[i]][2]-1;
-			}
-			pos_node=ArrayUnique(dup_nodes); pos_node=ArraySort(pos_node);
-
-			//keep track of some fields
-			var numberofvertices1=md.mesh.numberofvertices;
-			var numberofelements1=md.mesh.numberofelements;
-			var numberofvertices2=pos_node.length;
-			var numberofelements2=pos_elem.length;
-			var flag_node=NewArrayFill(numberofvertices1,0);
-			for (var i=0;i<pos_node.length;i++)flag_node[pos_node[i]]=1;
-
-			//Create Pelem and Pnode (transform old nodes in new nodes and same thing for the elements)
-			Pelem=NewArrayFill(numberofelements1,0);
-			for (var i=0;i<numberofelements2;i++) Pelem[pos_elem[i]]=i;
-			Pnode=NewArrayFill(numberofvertices1,0);
-			for (var i=0;i<numberofvertices2;i++) Pnode[pos_node[i]]=i;
-			//renumber the elements (some nodes won't exist anymore)
-			var elements_2=NewArrayFill2D(numberofelements2,3,0);
-			for (var i=0;i<numberofelements2;i++){
-				for (var j=0;j<3;j++){
-					elements_2[i][j]=Pnode[md.mesh.elements[i][j]-1]+1;
-				}
-			}
-			
-			/*if isa(md.mesh,'mesh3dprisms'),
-				elements_2(:,4)=Pnode(elements_2(:,4));
-				elements_2(:,5)=Pnode(elements_2(:,5));
-				elements_2(:,6)=Pnode(elements_2(:,6));
-			end
-			*/
-			
-			//OK, now create the new model!
-
-			//take every field from model
-			var md2=md.deepcopy(md);
-			//var md2=new model(); md2.mesh=new mesh3dsurface();
-			
-			//deal with mesh: {{{
-			md2.mesh.numberofvertices=numberofvertices2;
-			md2.mesh.numberofelements=numberofelements2;
-			md2.mesh.elements=elements_2;
-
-			md2.mesh.x=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.x[i]=md.mesh.x[pos_node[i]];
-			md2.mesh.y=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.y[i]=md.mesh.y[pos_node[i]];
-			md2.mesh.z=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.z[i]=md.mesh.z[pos_node[i]];
-			md2.mesh.lat=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.lat[i]=md.mesh.lat[pos_node[i]];
-			md2.mesh.long=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.long[i]=md.mesh.long[pos_node[i]];
-			md2.mesh.r=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.mesh.r[i]=md.mesh.r[pos_node[i]];
-			//}}}
-			//deal with geometry: {{{
-			md2.geometry.base=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.base[i]=md.geometry.base[pos_node[i]];
-			md2.geometry.thickness=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.thickness[i]=md.geometry.thickness[pos_node[i]];
-			md2.geometry.surface=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.surface[i]=md.geometry.surface[pos_node[i]];
-			md2.geometry.bed=new Array(numberofvertices2); for (var i=0;i<numberofvertices2;i++)md2.geometry.bed[i]=md.geometry.bed[pos_node[i]];
-			//}}}
-
-			//Keep track of pos_node and pos_elem
-			for (var i=0;i<md2.mesh.numberofvertices;i++)pos_node[i]=pos_node[i]+1;
-			for (var i=0;i<md2.mesh.numberofelements;i++)pos_elem[i]=pos_elem[i]+1;
-			md2.mesh.extractedvertices=pos_node;
-			md2.mesh.extractedelements=pos_elem;
-
-			return md2;
-
-
-
-			//automatically modify fields
-
-			//loop over model fields
-			//model_fields=fields(md);
-
-
-
-
-
-		} //}}}
-		this.collapse = function(md) { //{{{
-			/*
-			 *COLLAPSE - collapses a 3d mesh into a 2d mesh
-			 *
-			 *   This routine collapses a 3d model into a 2d model
-			 *   and collapses all the fileds of the 3d model by
-			 *   taking their depth-averaged values
-			 *
-			 *   Usage:
-			 *	 md=collapse(md)
-			 *
-			 *   See also: EXTRUDE, MODELEXTRACT
-			 */
-
-			// Check that the model is really a 3d model
-			if (md.mesh.elementtype() !== 'Penta') {
-				console.error('collapse error message: only 3d mesh can be collapsed')
-			}
-
-			// Start with changing all the fields from the 3d mesh 
-
-			// dealing with the friction law
-			// drag is limited to nodes that are on the bedrock.
-			if (md.friction.classname() === 'friction') {
-				md.friction.coefficient=project2d(md,md.friction.coefficient,1);
-				md.friction.p=project2d(md,md.friction.p,1);
-				md.friction.q=project2d(md,md.friction.q,1);
-			} else if (md.friction.classname() === 'frictionhydro') {
-				md.friction.q=project2d(md,md.friction.q,1);
-				md.friction.C=project2d(md,md.friction.C,1);
-				md.friction.As=project2d(md,md.friction.As,1);
-				md.friction.effective_pressure=project2d(md,md.friction.effective_pressure,1);
-			} else if (md.friction.classname() === 'frictionwaterlayer') {
-				md.friction.coefficient=project2d(md,md.friction.coefficient,1);
-				md.friction.p=project2d(md,md.friction.p,1);
-				md.friction.q=project2d(md,md.friction.q,1);
-				md.friction.water_layer=project2d(md,md.friction.water_layer,1);
-			} else if (md.friction.classname() === 'frictionweertman') {
-				md.friction.C=project2d(md,md.friction.C,1);
-				md.friction.m=project2d(md,md.friction.m,1);
-			} else if (md.friction.classname() === 'frictionweertmantemp') {
-				md.friction.C=project2d(md,md.friction.C,1);
-				md.friction.m=project2d(md,md.friction.m,1);
-			} else {
-				disp('friction type not supported');
-			}
-
-			// observations
-			if (!Number.isNaN(md.inversion.vx_obs))
-				md.inversion.vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers);
-
-			if (!Number.isNaN(md.inversion.vy_obs))
-				md.inversion.vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers);
-
-			if (!Number.isNaN(md.inversion.vel_obs))
-				md.inversion.vel_obs=project2d(md,md.inversion.vel_obs,md.mesh.numberoflayers);
-
-			if (!Number.isNaN(md.inversion.cost_functions_coefficients))
-				md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers);
-
-			if (numel(md.inversion.min_parameters)>1)
-				md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers);
-
-			if (numel(md.inversion.max_parameters)>1) 
-				md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers);
-
-			if (md.smb.classname() === 'SMBforcing' && !Number.isNaN(md.smb.mass_balance)) {
-				md.smb.mass_balance=project2d(md,md.smb.mass_balance,md.mesh.numberoflayers);
-			} else if (md.smb.classname() === 'SMBhenning' && !Number.isNaN(md.smb.smbref)) {
-				md.smb.smbref=project2d(md,md.smb.smbref,md.mesh.numberoflayers);
-			}
-
-			// results
-			if (!Number.isNaN(md.initialization.vx))
-				md.initialization.vx=DepthAverage(md,md.initialization.vx);
-			if (!Number.isNaN(md.initialization.vy))
-				md.initialization.vy=DepthAverage(md,md.initialization.vy);
-			if (!Number.isNaN(md.initialization.vz))
-				md.initialization.vz=DepthAverage(md,md.initialization.vz);
-			if (!Number.isNaN(md.initialization.vel))
-				md.initialization.vel=DepthAverage(md,md.initialization.vel);
-			if (!Number.isNaN(md.initialization.temperature))
-				md.initialization.temperature=DepthAverage(md,md.initialization.temperature);
-			if (!Number.isNaN(md.initialization.pressure))
-				md.initialization.pressure=project2d(md,md.initialization.pressure,1);
-			if (!Number.isNaN(md.initialization.sediment_head))
-				md.initialization.sediment_head=project2d(md,md.initialization.sediment_head,1);
-			if (!Number.isNaN(md.initialization.epl_head))
-				md.initialization.epl_head=project2d(md,md.initialization.epl_head,1);
-			if (!Number.isNaN(md.initialization.epl_thickness))
-				md.initialization.epl_thickness=project2d(md,md.initialization.epl_thickness,1);
-
-			// giaivins
-			if (!Number.isNaN(md.gia.mantle_viscosity))
-				md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1);
-			if (!Number.isNaN(md.gia.lithosphere_thickness))
-				md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1);
-
-			// elementstype
-			if (!Number.isNaN(md.flowequation.element_equation)) {
-				md.flowequation.element_equation=project2d(md,md.flowequation.element_equation,1);
-				md.flowequation.vertex_equation=project2d(md,md.flowequation.vertex_equation,1);
-				md.flowequation.borderSSA=project2d(md,md.flowequation.borderSSA,1);
-				md.flowequation.borderHO=project2d(md,md.flowequation.borderHO,1);
-				md.flowequation.borderFS=project2d(md,md.flowequation.borderFS,1);
-			}
-
-			// boundary conditions
-			md.stressbalance.spcvx=project2d(md,md.stressbalance.spcvx,md.mesh.numberoflayers);
-			md.stressbalance.spcvy=project2d(md,md.stressbalance.spcvy,md.mesh.numberoflayers);
-			md.stressbalance.spcvz=project2d(md,md.stressbalance.spcvz,md.mesh.numberoflayers);
-			md.stressbalance.referential=project2d(md,md.stressbalance.referential,md.mesh.numberoflayers);
-			md.stressbalance.loadingforce=project2d(md,md.stressbalance.loadingforce,md.mesh.numberoflayers);
-			md.masstransport.spcthickness=project2d(md,md.masstransport.spcthickness,md.mesh.numberoflayers);
-			if (!Number.isNaN(md.damage.spcdamage))
-				md.damage.spcdamage=project2d(md,md.damage.spcdamage,md.mesh.numberoflayers);
-			md.thermal.spctemperature=project2d(md,md.thermal.spctemperature,md.mesh.numberoflayers);
-
-			// Hydrologydc variables
-			if (md.hydrology.classname() === 'hydrologydc') {
-				md.hydrology.spcsediment_head=project2d(md,md.hydrology.spcsediment_head,1);
-				md.hydrology.mask_eplactive_node=project2d(md,md.hydrology.mask_eplactive_node,1);
-				md.hydrology.sediment_transmitivity=project2d(md,md.hydrology.sediment_transmitivity,1);
-				md.hydrology.basal_moulin_input=project2d(md,md.hydrology.basal_moulin_input,1);
-
-				if(md.hydrology.isefficientlayer==1)
-					md.hydrology.spcepl_head=project2d(md,md.hydrology.spcepl_head,1);
-			}
-			
-			// materials
-			md.materials.rheology_B=DepthAverage(md,md.materials.rheology_B);
-			md.materials.rheology_n=project2d(md,md.materials.rheology_n,1);
-			
-			// damage: 
-			if (md.damage.isdamage)
-				md.damage.D=DepthAverage(md,md.damage.D);
-
-			// special for thermal modeling:
-			if (!Number.isNaN(md.basalforcings.groundedice_melting_rate))
-				md.basalforcings.groundedice_melting_rate=project2d(md,md.basalforcings.groundedice_melting_rate,1); 
-
-			if (!Number.isNaN(md.basalforcings.floatingice_melting_rate))
-				md.basalforcings.floatingice_melting_rate=project2d(md,md.basalforcings.floatingice_melting_rate,1); 
-
-			md.basalforcings.geothermalflux=project2d(md,md.basalforcings.geothermalflux,1); // bedrock only gets geothermal flux
-
-			// update of connectivity matrix
-			md.mesh.average_vertex_connectivity=25;
-
-			// Collapse the mesh
-			var nodes2d=md.mesh.numberofvertices2d;
-			var elements2d=md.mesh.numberofelements2d;
-
-			// parameters
-			md.geometry.surface=project2d(md,md.geometry.surface,1);
-			md.geometry.thickness=project2d(md,md.geometry.thickness,1);
-			md.geometry.base=project2d(md,md.geometry.base,1);
-			if (!Number.isNaN(md.geometry.bed))
-				md.geometry.bed=project2d(md,md.geometry.bed,1);
-
-			if (!Number.isNaN(md.mask.ocean_levelset))
-				md.mask.ocean_levelset=project2d(md,md.mask.ocean_levelset,1);
-
-			if (!Number.isNaN(md.mask.ice_levelset))
-				md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1);
-
-			// lat long
-			if (numel(md.mesh.lat) === md.mesh.numberofvertices)
-				md.mesh.lat=project2d(md,md.mesh.lat,1);
-			if (numel(md.mesh.long) === md.mesh.numberofvertices)
-				md.mesh.long=project2d(md,md.mesh.long,1);
-			if (numel(md.mesh.scale_factor) === md.mesh.numberofvertices)
-				md.mesh.scale_factor=project2d(md,md.mesh.scale_factor,1);
-
-			// Initialize with the 2d mesh
-			var mesh = new mesh2d();
-			mesh.x=md.mesh.x2d;
-			mesh.y=md.mesh.y2d;
-			mesh.numberofvertices=md.mesh.numberofvertices2d;
-			mesh.numberofelements=md.mesh.numberofelements2d;
-			mesh.elements=md.mesh.elements2d;
-
-			if (!Number.isNaN(md.mesh.vertexonboundary))
-				mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
-			if (!Number.isNaN(md.mesh.elementconnectivity))
-				mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
-
-			md.mesh=mesh;
-			md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
-			md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
-			md.mesh.segments=contourenvelope(md.mesh);
-
-			return md;
-		} /*}}}*/
-		this.deepCopy = function(md) { //{{{
-			/*
-			 *DEEPCOPY - returns a deep copy of the model.
-			 *
-			 *   This routine creates a new model with new objects 
-			 *   for each corresponding object in the original model,
-			 *   so that changes in one do not affect the other.
-			 *
-			 *   Usage:
-			 *	 md1=deepCopy(md)
-			 *
-			 */
-			function recursiveDeepCopy(obj) {
-				var returnValue;
-
-				switch (typeof obj) {
-					case "object":
-						if (obj === null) {
-							// null => null
-							returnValue = null;
-						} else {
-							switch (toString.call(obj)) {
-								case "[object Array]":
-									// It's an array, create a new array with deep copies of the entries
-									returnValue = obj.map(recursiveDeepCopy);
-									break;
-								default:
-									// Some other kind of object, deep-copy its properties into a new object
-									returnValue = Object.keys(obj).reduce(function(prev, key) {
-										prev[key] = recursiveDeepCopy(obj[key]);
-										return prev;
-									}, {});
-									break;
-							}
-						}
-						break;
-					default:
-						// It's a primitive, copy via assignment
-						returnValue = obj;
-						break;
-				}
-				return returnValue;
-			}
-			
-			return recursiveDeepCopy(md);
-		} /*}}}*/
-	//properties
-	// {{{
-		//Careful here: no other class should be used as default value this is a bug of matlab
-		this.mesh             = 0;
-		this.mask             = 0;
-
-		this.geometry         = 0;
-		this.constants        = 0;
-		this.smb              = 0;
-		this.basalforcings    = 0;
-		this.materials        = 0;
-		this.damage           = 0;
-		this.friction         = 0;
-		this.flowequation     = 0;
-		this.timestepping     = 0;
-		this.initialization   = 0;
-		this.rifts            = 0;
-		this.slr              = 0;
-		this.dsl              = 0;
-
-		this.debug            = 0;
-		this.verbose          = 0;
-		this.settings         = 0;
-		this.toolkits         = 0;
-		this.cluster          = 0;
-
-		this.balancethickness = 0;
-		this.stressbalance    = 0;
-		this.groundingline    = 0;
-		this.hydrology        = 0;
-		this.masstransport    = 0;
-		this.thermal          = 0;
-		this.steadystate      = 0;
-		this.trans            = 0;
-		this.levelset         = 0;
-		this.calving          = 0;
-		this.love             = 0;
-		this.gia              = 0;
-		this.esa              = 0;
-
-		this.autodiff         = 0;
-		this.inversion        = 0;
-		this.qmu              = 0;
-		this.amr					 = 0;
-
-		this.results          = 0;
-		this.outputdefinition = 0;
-		this.radaroverlay     = 0;
-		this.miscellaneous    = 0;
-		this.priv             = 0;
-
-		//set default values for fields
-		this.setdefaultparameters();
-
-		//}}}
+					break;
+				default:
+					// It's a primitive, copy via assignment
+					returnValue = obj;
+					break;
+			}
+			return returnValue;
+		}
+		
+		return recursiveDeepCopy(md);
+	} /*}}}*/
+//properties
+// {{{
+	//Careful here: no other class should be used as default value this is a bug of matlab
+	this.mesh             = 0;
+	this.mask             = 0;
+
+	this.geometry         = 0;
+	this.constants        = 0;
+	this.smb              = 0;
+	this.basalforcings    = 0;
+	this.materials        = 0;
+	this.damage           = 0;
+	this.friction         = 0;
+	this.flowequation     = 0;
+	this.timestepping     = 0;
+	this.initialization   = 0;
+	this.rifts            = 0;
+	this.dsl              = 0;
+	this.solidearth       = 0;
+
+	this.debug            = 0;
+	this.verbose          = 0;
+	this.settings         = 0;
+	this.toolkits         = 0;
+	this.cluster          = 0;
+
+	this.balancethickness = 0;
+	this.stressbalance    = 0;
+	this.groundingline    = 0;
+	this.hydrology        = 0;
+	this.masstransport    = 0;
+	this.thermal          = 0;
+	this.steadystate      = 0;
+	this.transient        = 0;
+	this.levelset         = 0;
+	this.calving          = 0;
+	this.frontalforcings  = 0;
+	this.love             = 0;
+	this.esa              = 0;
+	this.sampling         = 0;
+
+	this.autodiff         = 0;
+	this.inversion        = 0;
+	this.qmu              = 0;
+	this.amr              = 0;
+	this.results          = 0;
+	this.outputdefinition = 0;
+	this.radaroverlay     = 0;
+	this.miscellaneous    = 0;
+	this.priv             = 0;
+
+	// Set default values for fields
+	if (arguments.length == 0) {
+		this.setdefaultparameters('earth');
+	} else {
+		this.setdefaultparameters(planet);
+	}
+	//}}}
 }
Index: issm/trunk/src/m/classes/model.m
===================================================================
--- issm/trunk/src/m/classes/model.m	(revision 25994)
+++ issm/trunk/src/m/classes/model.m	(revision 26744)
@@ -39,15 +39,15 @@
 		steadystate      = 0;
 		transient        = 0;
-		levelset			  = 0;
+		levelset         = 0;
 		calving          = 0;
 		frontalforcings  = 0;
-		love			     = 0;
-		gia				  = 0;
+		love             = 0;
 		esa              = 0;
+		sampling         = 0;
 
 		autodiff         = 0;
 		inversion        = 0;
 		qmu              = 0;
-		amr				 = 0;
+		amr              = 0;
 		results          = 0;
 		outputdefinition = 0;
@@ -55,4 +55,5 @@
 		miscellaneous    = 0;
 		private          = 0;
+		stochasticforcing= 0;
 
 		%}}}
@@ -133,6 +134,4 @@
 				end
 			end
-			%2017 April 10th
-			if isa(md.gia,'gia'), md.gia=giamme(); end
 			%2017 May 4th
 			if isa(md.amr,'double'); md.amr=amr(); end
@@ -156,5 +155,5 @@
 			if isa(md.frontalforcings,'double');
 				if(isprop('meltingrate',md.calving) & ~isnan(md.calving.meltingrate))
-					disp('Warning: md.calving.meltingrate is now in md.frontalforcings');
+		gia			disp('Warning: md.calving.meltingrate is now in md.frontalforcings');
 				end
 				md.frontalforcings=frontalforcings(md.calving); 
@@ -168,14 +167,17 @@
 				end
 			end
-			%2019 Mar 28
+			%2019 Mar 28, updated 2021 April 23
 			if isa(md.smb,'SMBcomponents') | isa(md.smb,'SMBmeltcomponents') | isa(md.smb,'SMBforcing') | isa(md.smb,'SMBgemb') 
-				if isa(md.smb.isclimatology,'double')
-					if prod(size(md.smb.isclimatology)) ~= 1
-						md.smb.isclimatology = 0;
+				if any(strcmp(fieldnames(md.smb),'isclimatology'))
+					if isa(md.smb.isclimatology,'double')
+						if prod(size(md.smb.isclimatology)) ~= 1
+							md.smb.isclimatology = 0;
+						end
+						md.timestepping.cycle_forcing=md.smb.isclimatology;
 					end
 				end
 			end
 			%2019 Dec 16
-			if isa(md.dsl,'double') | isempty(md.dsl.compute_fingerprints)
+			if isa(md.dsl,'double') 
 				md.dsl=dsl();
 			end
@@ -188,4 +190,8 @@
 				end
 			end
+			%2021 February 17
+			if isa(md.sampling,'double'); md.sampling=sampling(); end
+			%VV
+			if ~isa(md.stochasticforcing,'stochasticforcing'); md.stochasticforcing=stochasticforcing(); end
 		end% }}}
 	end
@@ -204,4 +210,49 @@
 		end
 		%}}}
+		function disp(self) % {{{
+			disp(sprintf('%19s: %-22s -- %s','mesh'            ,['[1x1 ' class(self.mesh) ']'],'mesh properties'));
+			disp(sprintf('%19s: %-22s -- %s','mask'            ,['[1x1 ' class(self.mask) ']'],'defines grounded and floating elements'));
+			disp(sprintf('%19s: %-22s -- %s','geometry'        ,['[1x1 ' class(self.geometry) ']'],'surface elevation, bedrock topography, ice thickness,...'));
+			disp(sprintf('%19s: %-22s -- %s','constants'       ,['[1x1 ' class(self.constants) ']'],'physical constants'));
+			disp(sprintf('%19s: %-22s -- %s','smb'             ,['[1x1 ' class(self.smb) ']'],'surface mass balance'));
+			disp(sprintf('%19s: %-22s -- %s','basalforcings'   ,['[1x1 ' class(self.basalforcings) ']'],'bed forcings'));
+			disp(sprintf('%19s: %-22s -- %s','materials'       ,['[1x1 ' class(self.materials) ']'],'material properties'));
+			disp(sprintf('%19s: %-22s -- %s','damage'          ,['[1x1 ' class(self.damage) ']'],'parameters for damage evolution solution'));
+			disp(sprintf('%19s: %-22s -- %s','friction'        ,['[1x1 ' class(self.friction) ']'],'basal friction/drag properties'));
+			disp(sprintf('%19s: %-22s -- %s','flowequation'    ,['[1x1 ' class(self.flowequation) ']'],'flow equations'));
+			disp(sprintf('%19s: %-22s -- %s','timestepping'    ,['[1x1 ' class(self.timestepping) ']'],'time stepping for transient models'));
+			disp(sprintf('%19s: %-22s -- %s','initialization'  ,['[1x1 ' class(self.initialization) ']'],'initial guess/state'));
+			disp(sprintf('%19s: %-22s -- %s','rifts'           ,['[1x1 ' class(self.rifts) ']'],'rifts properties'));
+			disp(sprintf('%19s: %-22s -- %s','solidearth'      ,['[1x1 ' class(self.solidearth) ']'],'solidearth inputs and settings'));
+			disp(sprintf('%19s: %-22s -- %s','dsl'             ,['[1x1 ' class(self.dsl) ']'],'dynamic sea-level '));
+			disp(sprintf('%19s: %-22s -- %s','debug'           ,['[1x1 ' class(self.debug) ']'],'debugging tools (valgrind, gprof)'));
+			disp(sprintf('%19s: %-22s -- %s','verbose'         ,['[1x1 ' class(self.verbose) ']'],'verbosity level in solve'));
+			disp(sprintf('%19s: %-22s -- %s','settings'        ,['[1x1 ' class(self.settings) ']'],'settings properties'));
+			disp(sprintf('%19s: %-22s -- %s','toolkits'        ,['[1x1 ' class(self.toolkits) ']'],'PETSc options for each solution'));
+			disp(sprintf('%19s: %-22s -- %s','cluster'         ,['[1x1 ' class(self.cluster) ']'],'cluster parameters (number of CPUs...)'));
+			disp(sprintf('%19s: %-22s -- %s','balancethickness',['[1x1 ' class(self.balancethickness) ']'],'parameters for balancethickness solution'));
+			disp(sprintf('%19s: %-22s -- %s','stressbalance'   ,['[1x1 ' class(self.stressbalance) ']'],'parameters for stressbalance solution'));
+			disp(sprintf('%19s: %-22s -- %s','groundingline'   ,['[1x1 ' class(self.groundingline) ']'],'parameters for groundingline solution'));
+			disp(sprintf('%19s: %-22s -- %s','hydrology'       ,['[1x1 ' class(self.hydrology) ']'],'parameters for hydrology solution'));
+			disp(sprintf('%19s: %-22s -- %s','masstransport'   ,['[1x1 ' class(self.masstransport) ']'],'parameters for masstransport solution'));
+			disp(sprintf('%19s: %-22s -- %s','thermal'         ,['[1x1 ' class(self.thermal) ']'],'parameters for thermal solution'));
+			disp(sprintf('%19s: %-22s -- %s','steadystate'     ,['[1x1 ' class(self.steadystate) ']'],'parameters for steadystate solution'));
+			disp(sprintf('%19s: %-22s -- %s','transient'       ,['[1x1 ' class(self.transient) ']'],'parameters for transient solution'));
+			disp(sprintf('%19s: %-22s -- %s','levelset'        ,['[1x1 ' class(self.levelset) ']'],'parameters for moving boundaries (level-set method)'));
+			disp(sprintf('%19s: %-22s -- %s','calving'         ,['[1x1 ' class(self.calving) ']'],'parameters for calving'));
+			disp(sprintf('%19s: %-22s -- %s','frontalforcings' ,['[1x1 ' class(self.frontalforcings) ']'],'parameters for frontalforcings'));
+			disp(sprintf('%19s: %-22s -- %s','esa'             ,['[1x1 ' class(self.esa) ']'],'parameters for elastic adjustment solution'));
+			disp(sprintf('%19s: %-22s -- %s','love'            ,['[1x1 ' class(self.love) ']'],'parameters for love solution'));
+			disp(sprintf('%19s: %-22s -- %s','sampling'        ,['[1x1 ' class(self.sampling) ']'],'parameters for stochastic sampler'));
+			disp(sprintf('%19s: %-22s -- %s','autodiff'        ,['[1x1 ' class(self.autodiff) ']'],'automatic differentiation parameters'));
+			disp(sprintf('%19s: %-22s -- %s','inversion'       ,['[1x1 ' class(self.inversion) ']'],'parameters for inverse methods'));
+			disp(sprintf('%19s: %-22s -- %s','qmu'             ,['[1x1 ' class(self.qmu) ']'],'Dakota properties'));
+			disp(sprintf('%19s: %-22s -- %s','amr'             ,['[1x1 ' class(self.amr) ']'],'adaptive mesh refinement properties'));
+			disp(sprintf('%19s: %-22s -- %s','outputdefinition',['[1x1 ' class(self.outputdefinition) ']'],'output definition'));
+			disp(sprintf('%19s: %-22s -- %s','results'         ,['[1x1 ' class(self.results) ']'],'model results'));
+			disp(sprintf('%19s: %-22s -- %s','radaroverlay'    ,['[1x1 ' class(self.radaroverlay) ']'],'radar image for plot overlay'));
+			disp(sprintf('%19s: %-22s -- %s','miscellaneous'   ,['[1x1 ' class(self.miscellaneous) ']'],'miscellaneous fields'));
+			disp(sprintf('%19s: %-22s -- %s','stochasticforcing',['[1x1 ' class(self.stochasticforcing) ']'],'stochasticity applied to model forcings'));
+		end % }}}
 		function md = setdefaultparameters(md,planet) % {{{
 
@@ -238,7 +289,7 @@
 			md.calving          = calving();
 			md.frontalforcings  = frontalforcings();
-			md.gia              = giamme();
 			md.love             = fourierlove();
 			md.esa              = esa();
+			md.sampling         = sampling();
 			md.autodiff         = autodiff();
 			md.inversion        = inversion();
@@ -250,4 +301,5 @@
 			md.miscellaneous    = miscellaneous();
 			md.private          = private();
+			md.stochasticforcing= stochasticforcing();
 		end
 		%}}}
@@ -304,4 +356,7 @@
 				md.friction.C=project2d(md,md.friction.C,1);
 				md.friction.m=project2d(md,md.friction.m,1);
+			elseif isa(md.friction,'frictionjosh'),
+				md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+				md.friction.pressure_adjusted_temperature=project2d(md,md.friction.pressure_adjusted_temperature,1);
 			else
 				disp('friction type not supported');
@@ -371,9 +426,4 @@
 			end
 
-			%giaivins
-			if isa(md.gia,'giaivins'),
-				if ~isnan(md.gia.mantle_viscosity), md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1); end
-				if ~isnan(md.gia.lithosphere_thickness), md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1); end
-			end
 
 			%elementstype
@@ -417,4 +467,7 @@
 			md.materials.rheology_B=DepthAverage(md,md.materials.rheology_B);
 			md.materials.rheology_n=project2d(md,md.materials.rheology_n,1);
+			if isprop(md.materials,'rheology_E')
+				md.materials.rheology_E=project2d(md,md.materials.rheology_E,1);
+			end
 			
 			%damage: 
@@ -615,6 +668,6 @@
 						elseif fieldsize(1)==numberofelements1
 							md2.(model_fields{i}).(object_fields{j})=field(pos_elem,:);
-                        elseif (fieldsize(1)==numberofelements1+1)
-                            md2.(model_fields{i}).(object_fields{j})=[field(pos_elem,:); field(end,:)];
+						elseif (fieldsize(1)==numberofelements1+1)
+							md2.(model_fields{i}).(object_fields{j})=[field(pos_elem,:); field(end,:)];
 						end
 					end
@@ -628,5 +681,5 @@
 					elseif fieldsize(1)==numberofelements1
 						md2.(model_fields{i})=field(pos_elem,:);
-                    elseif (fieldsize(1)==numberofelements1+1)
+					elseif (fieldsize(1)==numberofelements1+1)
 						md2.(model_fields{i})=[field(pos_elem,:); field(end,:)];
 					end
@@ -775,16 +828,16 @@
 						% loop over time steps
 						for p=1:length(md1.results.(solutionfields{i}))
-						    current = md1.results.(solutionfields{i})(p);
-						    solutionsubfields=fields(current);
-						    for j=1:length(solutionsubfields),
+							current = md1.results.(solutionfields{i})(p);
+							solutionsubfields=fields(current);
+							for j=1:length(solutionsubfields),
 							field=md1.results.(solutionfields{i})(p).(solutionsubfields{j});
 							if length(field)==numberofvertices1,
-							    md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field(pos_node);
+								md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field(pos_node);
 							elseif length(field)==numberofelements1,
-							    md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field(pos_elem);
+								md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field(pos_elem);
 							else
-							    md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field;
+								md2.results.(solutionfields{i})(p).(solutionsubfields{j})=field;
 							end
-						    end
+							end
 						end
 					else
@@ -820,4 +873,126 @@
 			md2.mesh.extractedvertices=pos_node;
 			md2.mesh.extractedelements=pos_elem;
+		end % }}}
+		function md2 = refine(md) % {{{
+			%refine - split all triangles into 3 to refine the mesh everywhere
+			%
+			%   This function only works for 2d triangle meshes
+			%
+			%   Usage:
+			%      md2=refine(md);
+			%
+			%   See also: EXTRUDE, COLLAPSE, EXTRACT
+
+			%Check incoming 
+			if ~strcmp(elementtype(md.mesh),'Tria')
+				error('not supported for 3d meshes');
+			end
+
+			%copy model
+			md2=md;
+
+			disp('Getting edges');
+			%initialization of some variables
+			nbe   = md.mesh.numberofelements;
+			nbv   = md.mesh.numberofvertices;
+			index = md.mesh.elements;
+			elementslist=1:nbe;
+			%1: list of edges
+			edges=[index(:,[1,2]); index(:,[2,3]); index(:,[3,1])];
+			%2: find unique edges
+			[edges,I,J]=unique(sort(edges,2),'rows');
+			%3: unique edge numbers
+			vec=J;
+			%4: unique edges numbers in each triangle (2 triangles sharing the same edge will have the same edge number)
+			edges_tria=[vec(elementslist+nbe) vec(elementslist+2*nbe) vec(elementslist)];
+
+			% We divide each element as follows
+			%
+			%                   e2
+			%    n1 ------------+------------ n3
+			%       \          / \          /
+			%        \    1   /   \   3    /
+			%         \      /     \      /
+			%          \    /   2   \    /
+			%           \  /         \  /
+			%         e3 +____________\/ e1
+			%             \           /
+			%              \         /
+			%               \   4   /
+			%                \     /
+			%                 \   /
+			%                   n2
+
+			%Create new coordinates
+			disp('Remeshing...');
+			x_edges = 0.5*(md.mesh.x(edges(:,1)) + md.mesh.x(edges(:,2)));
+			y_edges = 0.5*(md.mesh.y(edges(:,1)) + md.mesh.y(edges(:,2)));
+			md2.mesh.x = [md2.mesh.x;x_edges];
+			md2.mesh.y = [md2.mesh.y;y_edges];
+			md2.mesh.elements = [...
+				index(:,1)          nbv+edges_tria(:,3) nbv+edges_tria(:,2);...
+				nbv+edges_tria(:,2) nbv+edges_tria(:,3) nbv+edges_tria(:,1);...
+				nbv+edges_tria(:,2) nbv+edges_tria(:,1) index(:,3);...
+				nbv+edges_tria(:,3) index(:,2)          nbv+edges_tria(:,1)];
+			md2.mesh.numberofelements = 4*nbe;
+			md2.mesh.numberofvertices = nbv + size(edges,1);
+			disp(['   Old number of elements: ' num2str(nbe)]);
+			disp(['   New number of elements: ' num2str(4*nbe)]);
+
+			disp('Interpolate all fields');
+			numberofvertices1 = md.mesh.numberofvertices;
+			numberofelements1 = md.mesh.numberofelements;
+			nbv2 = md2.mesh.numberofvertices;
+
+			%Create transformation vectors
+			nbedges = size(edges,1);
+			Pelem = sparse(1:4*nbe,repmat([1:nbe],1,4),ones(4*nbe,1),4*nbe,nbe);
+			Pnode = sparse([1:nbv,repmat([nbv+1:nbv+nbedges],1,2)],[1:nbv edges(:)'],[ones(nbv,1);1/2*ones(2*nbedges,1)],md2.mesh.numberofvertices,nbv);
+
+			%Deal with mesh
+			if numel(md.mesh.scale_factor)==md.mesh.numberofvertices
+				md2.mesh.scale_factor=Pnode*md.mesh.scale_factor;
+			end
+
+			%loop over model fields
+			model_fields=setxor(fields(md),{'mesh'});
+			%remove mesh from this field
+			for i=1:length(model_fields),
+				%get field
+				field=md.(model_fields{i});
+				fieldsize=size(field);
+				if isobject(field), %recursive call
+					object_fields=fields(md.(model_fields{i}));
+					for j=1:length(object_fields),
+						%get field
+						field=md.(model_fields{i}).(object_fields{j});
+						fieldsize=size(field);
+						%size = number of nodes * n
+						if fieldsize(1)==numberofvertices1
+							md2.(model_fields{i}).(object_fields{j})=Pnode*field;
+						elseif (fieldsize(1)==numberofvertices1+1)
+							md2.(model_fields{i}).(object_fields{j})=[Pnode*field(1:end-1,:); field(end,:)];
+							%size = number of elements * n
+						elseif fieldsize(1)==numberofelements1
+							md2.(model_fields{i}).(object_fields{j})=Pelem*field;
+						elseif (fieldsize(1)==numberofelements1+1)
+							md2.(model_fields{i}).(object_fields{j})=[Pelem*field(1:end-1,:); field(end,:)];
+						end
+					end
+				else
+					%size = number of nodes * n
+					if fieldsize(1)==numberofvertices1
+						md2.(model_fields{i})=Pnode*field;
+					elseif (fieldsize(1)==numberofvertices1+1)
+						md2.(model_fields{i})=[Pnode*field(1:end-1,:); field(end,:)];
+						%size = number of elements * n
+					elseif fieldsize(1)==numberofelements1
+						md2.(model_fields{i})=Pelem*field;
+					elseif (fieldsize(1)==numberofelements1+1)
+						md2.(model_fields{i})=[Pelem*field(1:end-1,:); field(end,:)];
+					end
+				end
+			end
+
 		end % }}}
 		function md = extrude(md,varargin) % {{{
@@ -1017,5 +1192,5 @@
 				md.mesh.average_vertex_connectivity=100;
 			end
-			end % }}}
+		end % }}}
 		function md = structtomodel(md,structmd) % {{{
 
@@ -1300,5 +1475,6 @@
 				md.smb=SMBhenning(structmd.surfaceforcings);
 			end
-			if isfield(structmd,'slr'),
+			if isfield(structmd,'slr') && ~isempty(structmd.slr)
+				md.solidearth       = solidearth('Earth');
 				disp('Recovering old slr class');
 				if isfield(structmd.slr,'sealevel'),
@@ -1467,95 +1643,52 @@
 			end
 		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('%19s: %-22s -- %s','mesh'            ,['[1x1 ' class(self.mesh) ']'],'mesh properties'));
-			disp(sprintf('%19s: %-22s -- %s','mask'            ,['[1x1 ' class(self.mask) ']'],'defines grounded and floating elements'));
-			disp(sprintf('%19s: %-22s -- %s','geometry'        ,['[1x1 ' class(self.geometry) ']'],'surface elevation, bedrock topography, ice thickness,...'));
-			disp(sprintf('%19s: %-22s -- %s','constants'       ,['[1x1 ' class(self.constants) ']'],'physical constants'));
-			disp(sprintf('%19s: %-22s -- %s','smb'             ,['[1x1 ' class(self.smb) ']'],'surface mass balance'));
-			disp(sprintf('%19s: %-22s -- %s','basalforcings'   ,['[1x1 ' class(self.basalforcings) ']'],'bed forcings'));
-			disp(sprintf('%19s: %-22s -- %s','materials'       ,['[1x1 ' class(self.materials) ']'],'material properties'));
-			disp(sprintf('%19s: %-22s -- %s','damage'          ,['[1x1 ' class(self.damage) ']'],'parameters for damage evolution solution'));
-			disp(sprintf('%19s: %-22s -- %s','friction'        ,['[1x1 ' class(self.friction) ']'],'basal friction/drag properties'));
-			disp(sprintf('%19s: %-22s -- %s','flowequation'    ,['[1x1 ' class(self.flowequation) ']'],'flow equations'));
-			disp(sprintf('%19s: %-22s -- %s','timestepping'    ,['[1x1 ' class(self.timestepping) ']'],'time stepping for transient models'));
-			disp(sprintf('%19s: %-22s -- %s','initialization'  ,['[1x1 ' class(self.initialization) ']'],'initial guess/state'));
-			disp(sprintf('%19s: %-22s -- %s','rifts'           ,['[1x1 ' class(self.rifts) ']'],'rifts properties'));
-			disp(sprintf('%19s: %-22s -- %s','solidearth'      ,['[1x1 ' class(self.solidearth) ']'],'solidearth inputs and settings'));
-			disp(sprintf('%19s: %-22s -- %s','dsl'             ,['[1x1 ' class(self.dsl) ']'],'dynamic sea-level '));
-			disp(sprintf('%19s: %-22s -- %s','debug'           ,['[1x1 ' class(self.debug) ']'],'debugging tools (valgrind, gprof)'));
-			disp(sprintf('%19s: %-22s -- %s','verbose'         ,['[1x1 ' class(self.verbose) ']'],'verbosity level in solve'));
-			disp(sprintf('%19s: %-22s -- %s','settings'        ,['[1x1 ' class(self.settings) ']'],'settings properties'));
-			disp(sprintf('%19s: %-22s -- %s','toolkits'        ,['[1x1 ' class(self.toolkits) ']'],'PETSc options for each solution'));
-			disp(sprintf('%19s: %-22s -- %s','cluster'         ,['[1x1 ' class(self.cluster) ']'],'cluster parameters (number of cpus...)'));
-			disp(sprintf('%19s: %-22s -- %s','balancethickness',['[1x1 ' class(self.balancethickness) ']'],'parameters for balancethickness solution'));
-			disp(sprintf('%19s: %-22s -- %s','stressbalance'   ,['[1x1 ' class(self.stressbalance) ']'],'parameters for stressbalance solution'));
-			disp(sprintf('%19s: %-22s -- %s','groundingline'   ,['[1x1 ' class(self.groundingline) ']'],'parameters for groundingline solution'));
-			disp(sprintf('%19s: %-22s -- %s','hydrology'       ,['[1x1 ' class(self.hydrology) ']'],'parameters for hydrology solution'));
-			disp(sprintf('%19s: %-22s -- %s','masstransport'   ,['[1x1 ' class(self.masstransport) ']'],'parameters for masstransport solution'));
-			disp(sprintf('%19s: %-22s -- %s','thermal'         ,['[1x1 ' class(self.thermal) ']'],'parameters for thermal solution'));
-			disp(sprintf('%19s: %-22s -- %s','steadystate'     ,['[1x1 ' class(self.steadystate) ']'],'parameters for steadystate solution'));
-			disp(sprintf('%19s: %-22s -- %s','transient'       ,['[1x1 ' class(self.transient) ']'],'parameters for transient solution'));
-			disp(sprintf('%19s: %-22s -- %s','levelset'        ,['[1x1 ' class(self.levelset) ']'],'parameters for moving boundaries (level-set method)'));
-			disp(sprintf('%19s: %-22s -- %s','calving'         ,['[1x1 ' class(self.calving) ']'],'parameters for calving'));
-			disp(sprintf('%19s: %-22s -- %s','frontalforcings' ,['[1x1 ' class(self.frontalforcings) ']'],'parameters for frontalforcings'));
-			disp(sprintf('%19s: %-22s -- %s','gia'             ,['[1x1 ' class(self.gia) ']'],'parameters for gia solution'));
-			disp(sprintf('%19s: %-22s -- %s','esa'             ,['[1x1 ' class(self.esa) ']'],'parameters for elastic adjustment solution'));
-			disp(sprintf('%19s: %-22s -- %s','love'            ,['[1x1 ' class(self.love) ']'],'parameters for love solution'));
-			disp(sprintf('%19s: %-22s -- %s','autodiff'        ,['[1x1 ' class(self.autodiff) ']'],'automatic differentiation parameters'));
-			disp(sprintf('%19s: %-22s -- %s','inversion'       ,['[1x1 ' class(self.inversion) ']'],'parameters for inverse methods'));
-			disp(sprintf('%19s: %-22s -- %s','qmu'             ,['[1x1 ' class(self.qmu) ']'],'dakota properties'));
-			disp(sprintf('%19s: %-22s -- %s','amr'             ,['[1x1 ' class(self.amr) ']'],'adaptive mesh refinement properties'));
-			disp(sprintf('%19s: %-22s -- %s','outputdefinition',['[1x1 ' class(self.outputdefinition) ']'],'output definition'));
-			disp(sprintf('%19s: %-22s -- %s','results'         ,['[1x1 ' class(self.results) ']'],'model results'));
-			disp(sprintf('%19s: %-22s -- %s','radaroverlay'    ,['[1x1 ' class(self.radaroverlay) ']'],'radar image for plot overlay'));
-			disp(sprintf('%19s: %-22s -- %s','miscellaneous'   ,['[1x1 ' class(self.miscellaneous) ']'],'miscellaneous fields'));
-		end % }}}
 		function memory(self) % {{{
 
-		disp(sprintf('\nMemory imprint:\n'));
-
-		fields=properties('model');
-		mem=0;
-
-		for i=1:length(fields),
-			field=self.(fields{i});
-			s=whos('field'); 
-			mem=mem+s.bytes/1e6;
-			disp(sprintf('%19s: %6.2f Mb',fields{i},s.bytes/1e6));
+			disp(sprintf('\nMemory imprint:\n'));
+
+			fields=properties('model');
+			mem=0;
+
+			for i=1:length(fields),
+				field=self.(fields{i});
+				s=whos('field'); 
+				mem=mem+s.bytes/1e6;
+				disp(sprintf('%19s: %6.2f Mb',fields{i},s.bytes/1e6));
+			end
+			disp(sprintf('%19s--%10s','--------------','--------------'));
+			disp(sprintf('%19s: %g Mb','Total',mem));
 		end
-		disp(sprintf('%19s--%10s','--------------','--------------'));
-		disp(sprintf('%19s: %g Mb','Total',mem));
-		end % }}}
+		% }}}
 		function netcdf(self,filename) % {{{
-		%NETCDF - save model as netcdf
-		%
-		%   Usage:
-		%      netcdf(md,filename)
-		%
-		%   Example:
-		%      netcdf(md,'model.nc');
-
-		disp('Saving model as NetCDF');
-		%1. Create NetCDF file
-		ncid=netcdf.create(filename,'CLOBBER');
-		netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Conventions','CF-1.4');
-		netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Title',['ISSM model (' self.miscellaneous.name ')']);
-		netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Author',getenv('USER'));
-		netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Date',datestr(now));
-
-		%Preallocate variable id, needed to write variables in netcdf file
-		var_id=zeros(1000,1);%preallocate
-
-		for step=1:2,
-			counter=0;
-			[var_id,counter]=structtonc(ncid,'md',self,0,var_id,counter,step);
-			if step==1, netcdf.endDef(ncid); end
-		end
-
-		if counter>1000,
-			warning(['preallocation of var_id need to be updated from ' num2str(1000) ' to ' num2str(counter)]);
-		end
-
-		netcdf.close(ncid)
+			%NETCDF - save model as netcdf
+			%
+			%   Usage:
+			%      netcdf(md,filename)
+			%
+			%   Example:
+			%      netcdf(md,'model.nc');
+
+			disp('Saving model as NetCDF');
+			%1. Create NetCDF file
+			ncid=netcdf.create(filename,'CLOBBER');
+			netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Conventions','CF-1.4');
+			netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Title',['ISSM model (' self.miscellaneous.name ')']);
+			netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Author',getenv('USER'));
+			netcdf.putAtt(ncid,netcdf.getConstant('NC_GLOBAL'),'Date',datestr(now));
+
+			%Preallocate variable id, needed to write variables in netcdf file
+			var_id=zeros(1000,1);%preallocate
+
+			for step=1:2,
+				counter=0;
+				[var_id,counter]=structtonc(ncid,'md',self,0,var_id,counter,step);
+				if step==1, netcdf.endDef(ncid); end
+			end
+
+			if counter>1000,
+				warning(['preallocation of var_id need to be updated from ' num2str(1000) ' to ' num2str(counter)]);
+			end
+
+			netcdf.close(ncid)
 		end % }}}
 		function xylim(self) % {{{
@@ -1565,38 +1698,38 @@
 		end % }}}
 		function md=upload(md) % {{{
-		%the goal of this routine is to upload the model onto a server, and to empty it.
-		%So first, save the model with a unique name and upload the file to the server: 
-		random_part=fix(rand(1)*10000);
-		id=[md.miscellaneous.name '-' regexprep(datestr(now),'[^\w'']','') '-' num2str(random_part)  '-' getenv('USER') '-' oshostname() '.upload']; 
-		eval(['save ' id ' md']);
-
-		%Now, upload the file: 
-		issmscpout(md.settings.upload_server,md.settings.upload_path,md.settings.upload_login,md.settings.upload_port,{id},1);
-
-		%Now, empty this model of everything except settings, and record name of file we just uploaded!
-		settings_back=md.settings;
-		md=model();
-		md.settings=settings_back;
-		md.settings.upload_filename=id;
-
-		%get locally rid of file that was uploaded
-		eval(['delete ' id]);
+			%the goal of this routine is to upload the model onto a server, and to empty it.
+			%So first, save the model with a unique name and upload the file to the server: 
+			random_part=fix(rand(1)*10000);
+			id=[md.miscellaneous.name '-' regexprep(datestr(now),'[^\w'']','') '-' num2str(random_part)  '-' getenv('USER') '-' oshostname() '.upload']; 
+			eval(['save ' id ' md']);
+
+			%Now, upload the file: 
+			issmscpout(md.settings.upload_server,md.settings.upload_path,md.settings.upload_login,md.settings.upload_port,{id},1);
+
+			%Now, empty this model of everything except settings, and record name of file we just uploaded!
+			settings_back=md.settings;
+			md=model();
+			md.settings=settings_back;
+			md.settings.upload_filename=id;
+
+			%get locally rid of file that was uploaded
+			eval(['delete ' id]);
 
 		end % }}}
 		function md=download(md) % {{{
 
-		%the goal of this routine is to download the internals of the current model from a server, because 
-		%this model is empty, except for the settings which tell us where to go and find this model!
-
-		%Download the file: 
-		issmscpin(md.settings.upload_server, md.settings.upload_login, md.settings.upload_port, md.settings.upload_path, {md.settings.upload_filename});
-
-		name=md.settings.upload_filename;
-
-		%Now, load this model: 
-		md=loadmodel(md.settings.upload_filename);
-
-		%get locally rid of file that was downloaded
-		eval(['delete ' name]);
+			%the goal of this routine is to download the internals of the current model from a server, because 
+			%this model is empty, except for the settings which tell us where to go and find this model!
+
+			%Download the file: 
+			issmscpin(md.settings.upload_server, md.settings.upload_login, md.settings.upload_port, md.settings.upload_path, {md.settings.upload_filename});
+
+			name=md.settings.upload_filename;
+
+			%Now, load this model: 
+			md=loadmodel(md.settings.upload_filename);
+
+			%get locally rid of file that was downloaded
+			eval(['delete ' name]);
 
 		end % }}}
Index: issm/trunk/src/m/classes/model.py
===================================================================
--- issm/trunk/src/m/classes/model.py	(revision 25994)
+++ issm/trunk/src/m/classes/model.py	(revision 26744)
@@ -37,10 +37,4 @@
 from toolkits import toolkits
 from generic import generic
-from pfe import pfe
-from vilje import vilje
-from hexagon import hexagon
-from cyclone import cyclone
-from stallo import stallo
-from saga import saga
 from balancethickness import balancethickness
 from stressbalance import stressbalance
@@ -55,6 +49,4 @@
 from steadystate import steadystate
 from transient import transient
-from giaivins import giaivins
-from giamme import giamme
 from esa import esa
 from autodiff import autodiff
@@ -76,26 +68,34 @@
 from contourenvelope import contourenvelope
 from DepthAverage import DepthAverage
+from sampling import sampling
+from stochasticforcing import stochasticforcing
 #}}}
 
 
 class model(object):
-    #properties
-    def __init__(self, *args): #{{{
+    """MODEL - class definition
+
+    Usage:
+        md = model()
+    """
+
+    def __init__(self, *args):  #{{{
         self.mesh = None
         self.mask = None
+
+        self.geometry = None
         self.constants = None
-        self.geometry = None
-        self.initialization = None
         self.smb = None
         self.basalforcings = None
-        self.friction = None
-        self.rifts = None
-        self.solidearth = None
-        self.dsl = None
-        self.timestepping = None
-        self.groundingline = None
         self.materials = None
         self.damage = None
+        self.friction = None
         self.flowequation = None
+        self.timestepping = None
+        self.initialization = None
+        self.rifts = None
+        self.dsl = None
+        self.solidearth = None
+
         self.debug = None
         self.verbose = None
@@ -103,6 +103,8 @@
         self.toolkits = None
         self.cluster = None
+
         self.balancethickness = None
         self.stressbalance = None
+        self.groundingline = None
         self.hydrology = None
         self.masstransport = None
@@ -113,82 +115,32 @@
         self.calving = None
         self.frontalforcings = None
-        self.gia = None
         self.love = None
         self.esa = None
+        self.sampling = None
+
         self.autodiff = None
         self.inversion = None
         self.qmu = None
         self.amr = None
-        self.radaroverlay = None
         self.results = None
         self.outputdefinition = None
+        self.radaroverlay = None
         self.miscellaneous = None
         self.private = None
-
-        nargs = len(args)
-
-        if nargs == 0:
+        self.stochasticforcing = None
+
+        if len(args) == 0:
             self.setdefaultparameters('earth')
         else:
-            self.setdefaultparameters(args[0])
             options = pairoptions(*args)
             planet = options.getfieldvalue('planet', 'earth')
             self.setdefaultparameters(planet)
-#}}}
-
-    def properties(self):  # {{{
-        # ordered list of properties since vars(self) is random
-        return ['mesh',
-                'mask',
-                'constants',
-                'geometry',
-                'initialization',
-                'smb',
-                'basalforcings',
-                'friction',
-                'rifts',
-                'solidearth',
-                'dsl',
-                'timestepping',
-                'groundingline',
-                'materials',
-                'damage',
-                'flowequation',
-                'debug',
-                'verbose',
-                'settings',
-                'toolkits',
-                'cluster',
-                'balancethickness',
-                'stressbalance',
-                'hydrology',
-                'masstransport',
-                'thermal',
-                'steadystate',
-                'transient',
-                'levelset',
-                'calving',
-                'frontalforcings',
-                'gia',
-                'love',
-                'esa',
-                'autodiff',
-                'inversion',
-                'qmu',
-                'amr',
-                'radaroverlay',
-                'results',
-                'outputdefinition',
-                'miscellaneous',
-                'private']
-    # }}}
+    #}}}
 
     def __repr__(obj):  #{{{
         # TODO:
-        # - Convert all formatting to calls to <string>.format (see any 
+        # - Convert all formatting to calls to <string>.format (see any
         #   already converted <class>.__repr__ method for examples)
         #
-
-        #print "Here %s the number: %d" % ("is", 37)
         s = "%19s: %-22s -- %s" % ("mesh", "[%s %s]" % ("1x1", obj.mesh.__class__.__name__), "mesh properties")
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("mask", "[%s %s]" % ("1x1", obj.mask.__class__.__name__), "defines grounded and floating elements"))
@@ -210,5 +162,5 @@
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("settings", "[%s %s]" % ("1x1", obj.settings.__class__.__name__), "settings properties"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("toolkits", "[%s %s]" % ("1x1", obj.toolkits.__class__.__name__), "PETSc options for each solution"))
-        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("cluster", "[%s %s]" % ("1x1", obj.cluster.__class__.__name__), "cluster parameters (number of cpus...)"))
+        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("cluster", "[%s %s]" % ("1x1", obj.cluster.__class__.__name__), "cluster parameters (number of CPUs...)"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("balancethickness", "[%s %s]" % ("1x1", obj.balancethickness.__class__.__name__), "parameters for balancethickness solution"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("stressbalance", "[%s %s]" % ("1x1", obj.stressbalance.__class__.__name__), "parameters for stressbalance solution"))
@@ -219,13 +171,13 @@
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("steadystate", "[%s %s]" % ("1x1", obj.steadystate.__class__.__name__), "parameters for steadystate solution"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("transient", "[%s %s]" % ("1x1", obj.transient.__class__.__name__), "parameters for transient solution"))
-        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("levelset", "[%s %s]" % ("1x1", obj.levelset.__class__.__name__), "parameters for moving boundaries (level - set method)"))
+        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("levelset", "[%s %s]" % ("1x1", obj.levelset.__class__.__name__), "parameters for moving boundaries (level-set method)"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("calving", "[%s %s]" % ("1x1", obj.calving.__class__.__name__), "parameters for calving"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("frontalforcings", "[%s %s]" % ("1x1", obj.frontalforcings.__class__.__name__), "parameters for frontalforcings"))
-        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("gia", "[%s %s]" % ("1x1", obj.gia.__class__.__name__), "parameters for gia solution"))
         s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("esa", "[%s %s]" % ("1x1", obj.esa.__class__.__name__), "parameters for elastic adjustment solution"))
+        s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("sampling", "[%s %s]" % ("1x1", obj.sampling.__class__.__name__), "parameters for stochastic sampler"))
         s = "%s\n%s" % (s, '%19s: %-22s -- %s' % ("love", "[%s %s]" % ("1x1", obj.love.__class__.__name__), "parameters for love solution"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("autodiff", "[%s %s]" % ("1x1", obj.autodiff.__class__.__name__), "automatic differentiation parameters"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("inversion", "[%s %s]" % ("1x1", obj.inversion.__class__.__name__), "parameters for inverse methods"))
-        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("qmu", "[%s %s]" % ("1x1", obj.qmu.__class__.__name__), "dakota properties"))
+        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("qmu", "[%s %s]" % ("1x1", obj.qmu.__class__.__name__), "Dakota properties"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("amr", "[%s %s]" % ("1x1", obj.amr.__class__.__name__), "adaptive mesh refinement properties"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("outputdefinition", "[%s %s]" % ("1x1", obj.outputdefinition.__class__.__name__), "output definition"))
@@ -233,8 +185,59 @@
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("radaroverlay", "[%s %s]" % ("1x1", obj.radaroverlay.__class__.__name__), "radar image for plot overlay"))
         s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("miscellaneous", "[%s %s]" % ("1x1", obj.miscellaneous.__class__.__name__), "miscellaneous fields"))
+        s = "%s\n%s" % (s, "%19s: %-22s -- %s" % ("stochasticforcing", "[%s %s]" % ("1x1", obj.stochasticforcing.__class__.__name__), "stochasticity applied to model forcings"))
         return s
-    # }}}
-
-    def setdefaultparameters(self, planet): #{{{
+    #}}}
+
+    def properties(self):  #{{{
+        # ordered list of properties since vars(self) is random
+        return [
+            'mesh',
+            'mask',
+            'geometry',
+            'constants',
+            'smb',
+            'basalforcings',
+            'materials',
+            'damage',
+            'friction',
+            'flowequation',
+            'timestepping',
+            'initialization',
+            'rifts',
+            'dsl',
+            'solidearth',
+            'debug',
+            'verbose',
+            'settings',
+            'toolkits',
+            'cluster',
+            'balancethickness',
+            'stressbalance',
+            'groundingline',
+            'hydrology',
+            'masstransport',
+            'thermal',
+            'steadystate',
+            'transient',
+            'levelset',
+            'calving',
+            'frontalforcings',
+            'love',
+            'esa',
+            'sampling',
+            'autodiff',
+            'inversion',
+            'qmu',
+            'amr',
+            'results',
+            'outputdefinition',
+            'radaroverlay',
+            'miscellaneous',
+            'private',
+            'stochasticforcing'
+        ]
+    #}}}
+
+    def setdefaultparameters(self, planet):  #{{{
         self.mesh = mesh2d()
         self.mask = mask()
@@ -268,7 +271,7 @@
         self.calving = calving()
         self.frontalforcings = frontalforcings()
-        self.gia = giamme()
         self.love = fourierlove()
         self.esa = esa()
+        self.sampling = sampling()
         self.autodiff = autodiff()
         self.inversion = inversion()
@@ -280,14 +283,15 @@
         self.miscellaneous = miscellaneous()
         self.private = private()
+        self.stochasticforcing = stochasticforcing()
     #}}}
 
-    def checkmessage(self, string):  # {{{
+    def checkmessage(self, string):  #{{{
         print("model not consistent: {}".format(string))
         self.private.isconsistent = False
         return self
-    # }}}
+    #}}}
     #@staticmethod
 
-    def extract(self, area):  # {{{
+    def extract(self, area):  #{{{
         """EXTRACT - extract a model according to an Argus contour or flag list
 
@@ -367,5 +371,5 @@
             field = getattr(md1, fieldi)
             fieldsize = np.shape(field)
-            if hasattr(field, '__dict__') and fieldi not in ['results']: #recursive call
+            if hasattr(field, '__dict__') and fieldi not in ['results']:  #recursive call
                 object_fields = vars(field)
                 for fieldj in object_fields:
@@ -566,7 +570,7 @@
 
         return md2
-    # }}}
-
-    def extrude(md, *args):  # {{{
+    #}}}
+
+    def extrude(md, *args):  #{{{
         """EXTRUDE - vertically extrude a 2d mesh
 
@@ -753,7 +757,7 @@
 
         return md
-    # }}}
-
-    def collapse(md): #{{{
+    #}}}
+
+    def collapse(md):  #{{{
         """COLLAPSE - collapses a 3d mesh into a 2d mesh
 
@@ -847,11 +851,4 @@
             md.initialization.watercolumn = project2d(md, md.initialization.watercolumn, 1)
 
-        # giaivins
-        if md.gia.__class__.__name__ == 'giaivins':
-            if not np.isnan(md.gia.mantle_viscosity).all():
-                md.gia.mantle_viscosity = project2d(md, md.gia.mantle_viscosity, 1)
-            if not np.isnan(md.gia.lithosphere_thickness).all():
-                md.gia.lithosphere_thickness = project2d(md, md.gia.lithosphere_thickness, 1)
-
         # elementstype
         if not np.isnan(md.flowequation.element_equation).all():
@@ -979,5 +976,5 @@
             mesh.scale_factor = project2d(md, md.mesh.scale_factor, 1)
         if hasattr(md.mesh, 'vertexonboundary') and not np.isnan(md.mesh.vertexonboundary).all():
-            mesh.vertexonboundary= project2d(md, md.mesh.vertexonboundary, 1)
+            mesh.vertexonboundary = project2d(md, md.mesh.vertexonboundary, 1)
         if hasattr(md.mesh, 'elementonboundary') and not np.isnan(md.mesh.elementonboundary).all():
             mesh.elementonboundary = project2d(md, md.mesh.elementonboundary, 1)
Index: issm/trunk/src/m/classes/nodalvalue.m
===================================================================
--- issm/trunk/src/m/classes/nodalvalue.m	(revision 25994)
+++ issm/trunk/src/m/classes/nodalvalue.m	(revision 26744)
@@ -3,7 +3,7 @@
 %   Usage:
 %      nodalvalue=nodalvalue();
-%      nodalvalue=nodalvalue('name','SealevelriseSNodalValue',...
+%      nodalvalue=nodalvalue('name','SealevelchangeSNodalValue',...
 %                    'definitionstring','Outputdefinition1', 
-%                    'model_string','SealevelriseS',
+%                    'model_string','SealevelchangeS',
 %                    'node',1);
 
Index: issm/trunk/src/m/classes/nodalvalue.py
===================================================================
--- issm/trunk/src/m/classes/nodalvalue.py	(revision 25994)
+++ issm/trunk/src/m/classes/nodalvalue.py	(revision 26744)
@@ -1,4 +1,3 @@
 import numpy as np
-
 from checkfield import checkfield
 from fielddisplay import fielddisplay
@@ -13,28 +12,28 @@
         nodalvalue=nodalvalue()
         nodalvalue=nodalvalue(
-            'name', 'SealevelriseSNodalValue',
+            'name', 'SealevelchangeSNodalValue',
             'definitionstring', 'Outputdefinition1',
-            'model_string', 'SealevelriseS',
+            'model_string', 'SealevelchangeS',
             'node', 1
         )
     """
 
-    def __init__(self, *args): #{{{
-        self.name               = ''
-        self.definitionstring   = '' # string that identifies this output definition uniquely, from 'Outputdefinition[1-10]'
-        self.model_string       = '' # string for field that is being retrieved
-        self.node               = np.nan #for which node are we retrieving the value?
-        
+    def __init__(self, *args):  #{{{
+        self.name = ''
+        self.definitionstring = ''  # string that identifies this output definition uniquely, from 'Outputdefinition[1-10]'
+        self.model_string = ''  # string for field that is being retrieved
+        self.node = np.nan  #for which node are we retrieving the value?
+
         #use provided options to change fields
         options = pairoptions(*args)
 
         # Get name
-        self.name               = options.getfieldvalue('name', '')
-        self.definitionstring   = options.getfieldvalue('definitionstring', '')
-        self.model_string       = options.getfieldvalue('model_string', '')
-        self.node               = options.getfieldvalue('node', '')
+        self.name = options.getfieldvalue('name', '')
+        self.definitionstring = options.getfieldvalue('definitionstring', '')
+        self.model_string = options.getfieldvalue('model_string', '')
+        self.node = options.getfieldvalue('node', '')
     #}}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  # {{{
         s = '   Nodalvalue:\n'
         s += '{}\n'.format(fielddisplay(self, 'name', 'identifier for this nodalvalue response'))
@@ -45,10 +44,10 @@
     #}}}
 
-    def setdefaultparameters(self): # {{{
+    def setdefaultparameters(self):  # {{{
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if not isinstance(self.name, basestring):
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if not isinstance(self.name, str):
             raise Exception('nodalvalue error message: \'name\' field should be a string!')
         OutputdefinitionStringArray = []
@@ -60,5 +59,5 @@
     #}}}
 
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  #{{{
         WriteData(fid, prefix, 'data', self.name, 'name', 'md.nodalvalue.name', 'format', 'String')
         WriteData(fid, prefix, 'data', self.definitionstring, 'name', 'md.nodalvalue.definitionenum', 'format', 'String')
Index: issm/trunk/src/m/classes/offlinesolidearthsolution.m
===================================================================
--- issm/trunk/src/m/classes/offlinesolidearthsolution.m	(revision 26744)
+++ issm/trunk/src/m/classes/offlinesolidearthsolution.m	(revision 26744)
@@ -0,0 +1,44 @@
+%OFFLINESOLIDEARTHSOLUTION class definition
+%
+%   Usage:
+%      addsol=offlinesolidearthsolution();
+
+classdef offlinesolidearthsolution < solidearthsolution
+	properties (SetAccess=public) 
+	end
+	methods
+		function self = offlinesolidearthsolution(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.setdefaultparameters@solidearthsolution();
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.solidearth.settings.isgrd==1), 
+				error('offlinesolidearthsolution.m::checkconsistency: trying to run GRD patterns while supplying an offline solution for those patterns!'); 
+			end
+			self.checkconsistency@solidearthsolution(md,solution,analyses);
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   external: offlinesolidearth solution:'));
+			self.disp@solidearthsolution();
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+			disp(sprintf('   external (offlinesolidearthsolution) solution:'));
+			WriteData(fid,prefix,'data',2,'name','md.solidearth.external.nature','format','Integer'); %code 2 for offlinesolidearthsolution  class
+			self.marshall@solidearthsolution(prefix,md,fid);
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+			self.savemodeljs@solidearthsolution(fid,modelname);
+		end % }}}
+		function self = extrude(self,md) % {{{
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/offlinesolidearthsolution.py
===================================================================
--- issm/trunk/src/m/classes/offlinesolidearthsolution.py	(revision 26744)
+++ issm/trunk/src/m/classes/offlinesolidearthsolution.py	(revision 26744)
@@ -0,0 +1,85 @@
+import numpy as np
+
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+from WriteData import WriteData
+
+
+class offlinesolidearthsolution(object):
+    """OFFLINESOLIDEARTHSOLUTION class definition
+
+    Usage:
+        offlinesolidearthsolution = offlinesolidearthsolution()
+    """
+
+    def __init__(self, *args): #{{{
+        self.displacementeast = None
+        self.displacementnorth = None
+        self.displacementup = None
+        self.geoid = None
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise RuntimeError('constructor not supported')
+    #}}}
+
+    def __repr__(self): #{{{
+        s = '         units for time series is (yr)\n       external: offlinesolidearth solution\n'
+        s += '{}\n'.format(fielddisplay(self, 'displacementeast', 'solid-Earth Eastwards bedrock displacement series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'displacementnorth', 'solid-Earth Northwards bedrock displacement time series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'displacementup', 'solid-Earth bedrock uplift time series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'geoid', 'solid-Earth geoid time series (m)'))
+
+        return s
+    #}}}
+
+    def setdefaultparameters(self): #{{{
+        self.displacementeast = []
+        self.displacementnorth = []
+        self.displacementup = []
+        self.geoid = []
+    #}}}
+
+    def checkconsistency(self, md, solution, analyses): #{{{
+        if ('SealevelchangeAnalysis' not in analyses) or ((solution=='TransientSolution') and (md.solidearth.settings.isgrd==1)): 
+            print('offlinesolidearthsolution checkconsistency error message: trying to run GRD patterns while supplying an offline solution for those patterns!')
+            return md
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementeast', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementnorth', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementup', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.geoid', 'Inf', 1, 'timeseries', 1)
+    #}}}
+
+    def marshall(self, prefix, md, fid): #{{{
+        yts = md.constants.yts
+
+        # Transform our time series into time series rates
+        if len(np.shape(self.displacementeast)) == 1:
+            print('Warning: offlinesolidearthsolution.py::marshall: only one time step provided, assuming the values are rates per year')
+            displacementeast_rate = np.append(np.array(self.displacementeast).reshape(-1, 1), 0)
+            displacementnorth_rate = np.append(np.array(self.displacementnorth).reshape(-1, 1), 0)
+            displacementup_rate = np.append(np.array(self.displacementup).reshape(-1, 1), 0)
+            geoid_rate = np.append(np.array(self.geoid).reshape(-1, 1), 0)
+        else:
+            time = self.displacementeast[-1, :]
+            dt = np.diff(time, axis=0)
+            displacementeast_rate = np.diff(self.displacementeast[0:-2, :], 1, 1) / dt
+            displacementeast_rate = np.append(displacementeast_rate,time[:-1].reshape(1,-1),axis=0)
+            displacementnorth_rate = np.diff(self.displacementnorth[0:-2, :], 1, 1) / dt
+            displacementnorth_rate = np.append(displacementnorth_rate,time[:-1].reshape(1,-1),axis=0)
+            displacementup_rate = np.diff(self.displacementup[0:-2, :], 1, 1) / dt
+            displacementup_rate = np.append(displacementup_rate,time[:-1].reshape(1,-1),axis=0)
+            geoid_rate = np.diff(self.geoid[0:-2, :], 1, 1) / dt
+            geoid_rate = np.append(geoid_rate,time[:-1].reshape(1,-1),axis=0)
+
+        WriteData(fid, prefix, 'name', 'md.solidearth.external.nature', 'data', 2, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementeast', 'data', displacementeast_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementeast', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementup', 'data', displacementup_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementup', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementnorth', 'data', displacementnorth_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementnorth', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'geoid', 'data', geoid_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.geoid', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+    #}}}
+
+    def extrude(self, md): #{{{
+        return self
+    #}}}
Index: issm/trunk/src/m/classes/organizer.py
===================================================================
--- issm/trunk/src/m/classes/organizer.py	(revision 25994)
+++ issm/trunk/src/m/classes/organizer.py	(revision 26744)
@@ -9,5 +9,5 @@
 try:
     #py3 import
-    from dbm.ndbm import whichdb
+    import dbm
 except ImportError:
     #py2 import
@@ -110,12 +110,12 @@
 
         #figure out if the model is there, otherwise, we have to use the default path supplied by user.
-        if whichdb(path1):
+        if dbm.whichdb(path1):
             md = loadmodel(path1)
             return md
-        elif whichdb(path2):
+        elif dbm.whichdb(path2):
             md = loadmodel(path2)
             return md
 
-    #If we are here, the model has not been found. Try trunk prefix if provided
+        #If we are here, the model has not been found. Try trunk prefix if provided
         if self.trunkprefix:
             path2 = os.path.join(self.repository, self.trunkprefix + string)
@@ -153,5 +153,5 @@
             print(("   step  #%i : %s" % (self.steps[self._currentstep - 1]['id'], self.steps[self._currentstep - 1]['string'])))
 
-    #Ok, now if _currentstep is a member of steps, return true
+        #Ok, now if _currentstep is a member of steps, return true
         if self._currentstep in self.requestedsteps:
             print(("\n   step  #%i : %s\n" % (self.steps[self._currentstep - 1]['id'], self.steps[self._currentstep - 1]['string'])))
@@ -159,5 +159,5 @@
 
             #last check: is this step locked?
-            s = self.steps[self._currentstep].string
+            s = self.steps[self._currentstep - 1]['string']
             if len(s) > 7:
                 if s[-6:] == 'Locked':
Index: issm/trunk/src/m/classes/pairoptions.m
===================================================================
--- issm/trunk/src/m/classes/pairoptions.m	(revision 25994)
+++ issm/trunk/src/m/classes/pairoptions.m	(revision 26744)
@@ -182,5 +182,5 @@
 		end % }}}
 		function value = getfieldvalue(self,field,varargin), % {{{
-		%GETOPTION - get the value of an option
+		%GETFIELDVALUE - get the value of an option
 		%
 		%   Usage:
@@ -220,5 +220,5 @@
 		end % }}}
 		function values = getfieldvalues(self,field,varargin), % {{{
-		%GETOPTION - get the value of an option (if the option is repeated, return multiple values)
+		%GETFIELDVALUES - get the value of an option (if the option is repeated, return multiple values)
 		%
 		%   Usage:
@@ -229,6 +229,6 @@
 		%
 		%   Examples:
-		%      values=getfieldvalue(options,'caxis');
-		%      values=getfieldvalue(options,'caxis',{[0 2],[3 4]});
+		%      values=getfieldvalues(options,'caxis');
+		%      values=getfieldvalues(options,'caxis',{[0 2],[3 4]});
 
 			%some argument checking: 
@@ -248,5 +248,5 @@
 				for i=1:length(pos),
 					values{i}=self.list{pos(i),2};
-					self.list{pos(i),3}=true;  % option used
+					self.list{pos(i),3}=true; % option used
 				end
 				return;
@@ -267,5 +267,5 @@
 		%
 		%   if warn==1 display an info message to warn user that
-		%   some of his options have been removed.
+		%   some of their options have been removed.
 
 			%check is field exist
Index: issm/trunk/src/m/classes/pairoptions.py
===================================================================
--- issm/trunk/src/m/classes/pairoptions.py	(revision 25994)
+++ issm/trunk/src/m/classes/pairoptions.py	(revision 26744)
@@ -14,10 +14,10 @@
         self.list = OrderedDict()
 
-    #get calling function name
+        #get calling function name
         import inspect
         if len(inspect.stack()) > 1:
             self.functionname = inspect.stack()[1][3]
 
-    #initialize list
+        #initialize list
         if not len(arg):
             pass  #Do nothing,
@@ -57,5 +57,7 @@
 
     def addfield(self, field, value):  # {{{
-        """ADDFIELD - add a field to an options list"""
+        """ADDFIELD - add a field to an options list
+        """
+
         if isinstance(field, str):
             if field in self.list:
@@ -65,5 +67,7 @@
 
     def addfielddefault(self, field, value):  # {{{
-        """ADDFIELDDEFAULT - add a field to an options list if it does not already exist"""
+        """ADDFIELDDEFAULT - add a field to an options list if it does not already exist
+        """
+
         if isinstance(field, str):
             if field not in self.list:
@@ -72,5 +76,7 @@
 
     def AssignObjectFields(self, obj2):  # {{{
-        """ASSIGNOBJECTFIELDS - assign object fields from options"""
+        """ASSIGNOBJECTFIELDS - assign object fields from options
+        """
+
         for item in list(self.list.items()):
             if item[0] in dir(obj2):
@@ -82,11 +88,19 @@
 
     def changefieldvalue(self, field, newvalue):  # {{{
-        """CHANGEOPTIONVALUE - change the value of an option in an option list"""
+        """CHANGEOPTIONVALUE - change the value of an option in an option list
+        """
 
         self.list[field] = newvalue
     # }}}
 
+    def displayunused(self): #{{{
+        """DISPLAYUNUSED - display unused options
+        """
+
+        disp(['WARNING: pairoptions::displayunused is not yet implemented'])
+    # }}}
     def exist(self, field):  # {{{
-        """EXIST - check if the option exist"""
+        """EXIST - check if the option exists
+        """
 
         #some argument checking:
@@ -104,6 +118,5 @@
 
     def getfieldvalue(self, field, default=None):  # {{{
-        """
-        GETOPTION - get the value of an option
+        """GETFIELDVALUE - get the value of an option
 
         Usage:
@@ -118,5 +131,5 @@
         """
 
-    #some argument checking:
+        #some argument checking:
         if field is None or field == '':
             raise ValueError('getfieldvalue error message: bad usage')
@@ -124,5 +137,5 @@
             raise TypeError("getfieldvalue error message: field '%s' should be a string." % str(field))
 
-    #Recover option
+        #Recover option
         if field in self.list:
             value = self.list[field]
@@ -137,6 +150,5 @@
 
     def removefield(self, field, warn):  # {{{
-        """
-        REMOVEFIELD - delete a field in an option list
+        """REMOVEFIELD - delete a field in an option list
 
         Usage:
@@ -144,5 +156,5 @@
 
         if warn == 1 display an info message to warn user that
-        some of his options have been removed.
+        some of their options have been removed.
         """
 
Index: issm/trunk/src/m/classes/plumebasalforcings.py
===================================================================
--- issm/trunk/src/m/classes/plumebasalforcings.py	(revision 25994)
+++ issm/trunk/src/m/classes/plumebasalforcings.py	(revision 26744)
@@ -39,13 +39,13 @@
         else:
             error('constuctor not supported')
-    #}}}
+    # }}}
 
     def __repr__(self):  # {{{
         s = '   mantle plume basal melt parameterization:\n'
-        s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'mantleconductivity', 'mantle heat conductivity [W / m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m/yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'mantleconductivity', 'mantle heat conductivity [W/m^3]'))
         s += '{}\n'.format(fielddisplay(self, 'nusselt', 'nusselt number, ratio of mantle to plume [1]'))
-        s += '{}\n'.format(fielddisplay(self, 'dtbg', 'background temperature gradient [degree / m]'))
+        s += '{}\n'.format(fielddisplay(self, 'dtbg', 'background temperature gradient [degree/m]'))
         s += '{}\n'.format(fielddisplay(self, 'plumeradius', 'radius of the mantle plume [m]'))
         s += '{}\n'.format(fielddisplay(self, 'topplumedepth', 'depth of the mantle plume top below the crust [m]'))
@@ -55,8 +55,8 @@
         s += '{}\n'.format(fielddisplay(self, 'crustthickness', 'thickness of the crust [m]'))
         s += '{}\n'.format(fielddisplay(self, 'uppercrustthickness', 'thickness of the upper crust [m]'))
-        s += '{}\n'.format(fielddisplay(self, 'uppercrustheat', 'volumic heat of the upper crust [w / m^3]'))
-        s += '{}\n'.format(fielddisplay(self, 'lowercrustheat', 'volumic heat of the lowercrust [w / m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'uppercrustheat', 'volumic heat of the upper crust [w/m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'lowercrustheat', 'volumic heat of the lowercrust [w/m^3]'))
         return s
-    #}}}
+    # }}}
 
     def initialize(self, md):  #{{{
@@ -68,5 +68,5 @@
             print('      no basalforcings.floatingice_melting_rate specified: values set as zero')
         return self
-    #}}}
+    # }}}
 
     def extrude(self, md):  # {{{
@@ -74,5 +74,5 @@
         self.floatingice_melting_rate = project3d(md, 'vector', self.floatingice_melting_rate, 'type', 'node', 'layer', 1)
         return self
-    #}}}
+    # }}}
 
     def setdefaultparameters(self):  # {{{
@@ -80,5 +80,5 @@
         self.mantleconductivity = 2.2
         self.nusselt = 300
-        self.dtbg = 11 / 1000.
+        self.dtbg = 11 / 1000.0
         self.plumeradius = 100000
         self.topplumedepth = 10000
@@ -86,8 +86,8 @@
         self.crustthickness = 30000
         self.uppercrustthickness = 14000
-        self.uppercrustheat = 1.7 * 10**-6
-        self.lowercrustheat = 0.4 * 10**-6
+        self.uppercrustheat = 1.7 * pow(10, -6)
+        self.lowercrustheat = 0.4 * pow(10, -6)
         return self
-    #}}}
+    # }}}
 
     def checkconsistency(self, md, solution, analyses):  # {{{
Index: issm/trunk/src/m/classes/qmu.js
===================================================================
--- issm/trunk/src/m/classes/qmu.js	(revision 25994)
+++ issm/trunk/src/m/classes/qmu.js	(revision 26744)
@@ -12,5 +12,7 @@
 		console.log(sprintf('   qmu parameters:'));
 
-		/*fielddisplay(this,'isdakota','is qmu analysis activated?');
+		fielddisplay(this,'isdakota','is qmu analysis activated?');
+		fielddisplay(this,'output','are we outputting ISSM results, default is 0');
+		/*
 		for (var i=0;i<this.variables.length;i++){
 			console.log(sprintf('         variables%s:  (arrays of each variable class)',...
@@ -106,4 +108,5 @@
 		this.marshall=function(md,prefix,fid) { //{{{
 			WriteData(fid,prefix,'object',this,'fieldname','isdakota','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','output','format','Boolean');
 			if (!this.isdakota){
 				WriteData(fid,prefix,'data',0,'name','md.qmu.mass_flux_segments_present','format','Boolean');
@@ -129,4 +132,5 @@
 
 	this.isdakota                    = 0;
+	this.output                      = 0;
 	this.variables                   = []
 	this.responses                   = [];
Index: issm/trunk/src/m/classes/qmu.m
===================================================================
--- issm/trunk/src/m/classes/qmu.m	(revision 25994)
+++ issm/trunk/src/m/classes/qmu.m	(revision 26744)
@@ -88,5 +88,5 @@
 					md = checkmessage(md,['evaluation_scheduling in qmu.params should be set to ''master''']);
 				end
-				if md.cluster.np<=1,
+				if md.cluster.nprocs()<=1,
 					md = checkmessage(md,['in parallel library mode, Dakota needs to run on at least 2 cpus, 1 cpu for the master, 1 cpu for the slave. Modify md.cluster.np accordingly.']);
 				end
@@ -95,5 +95,5 @@
 					md = checkmessage(md,['in parallel library mode, Dakota needs to run at least one slave on one cpu (md.qmu.params.processors_per_evaluation >=1)!']);
 				end
-				if mod(md.cluster.np-1,self.params.processors_per_evaluation),
+				if mod(md.cluster.nprocs()-1,self.params.processors_per_evaluation),
 					%md = checkmessage(md,['in parallel library mode, the requirement is for md.cluster.np = md.qmu.params.processors_per_evaluation * number_of_slaves, where number_of_slaves will automatically be determined by Dakota. Modify md.cluster.np accordingly']);
 				end
Index: issm/trunk/src/m/classes/qmu.py
===================================================================
--- issm/trunk/src/m/classes/qmu.py	(revision 25994)
+++ issm/trunk/src/m/classes/qmu.py	(revision 26744)
@@ -149,5 +149,5 @@
                 md.checkmessage('evaluation_scheduling in qmu.params should be set to "master"')
 
-            if md.cluster.np <= 1:
+            if md.cluster.nprocs() <= 1:
                 md.checkmessage('in parallel library mode, Dakota needs to run on at least 2 cpus, 1 cpu for the master, 1 cpu for the slave. Modify md.cluster.np accordingly.')
 
@@ -155,5 +155,5 @@
                 md.checkmessage('in parallel library mode, Dakota needs to run at least one slave on one cpu (md.qmu.params.processors_per_evaluation >= 1)!')
 
-            if np.mod(md.cluster.np - 1, self.params.processors_per_evaluation):
+            if np.mod(md.cluster.nprocs() - 1, self.params.processors_per_evaluation):
                 #md.checkmessage('in parallel library mode, the requirement is for md.cluster.np = md.qmu.params.processors_per_evaluation * number_of_slaves, where number_of_slaves will automatically be determined by Dakota. Modify md.cluster.np accordingly')
                 pass
Index: issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.m
===================================================================
--- issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.m	(revision 25994)
+++ issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.m	(revision 26744)
@@ -598,6 +598,4 @@
 	else
 		warning('param_write:param_unrecog','Parameter ''%s'' is of unrecognized type ''%s''.',pname,class(params.(pname)));
-		return
 	end
-
 end% }}}
Index: issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.py
===================================================================
--- issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.py	(revision 25994)
+++ issm/trunk/src/m/classes/qmu/dakota_method/dmeth_params_write.py	(revision 26744)
@@ -7,7 +7,7 @@
 
 def dmeth_params_write(dm, fid, sbeg='\t  '):
-    '''  write the parameters from a dakota_method object.
+    """write the parameters from a dakota_method object.
     [] = dmeth_params_write(dm, fid, sbeg)
-    '''
+    """
 
     if not isinstance(dm, dakota_method):
@@ -509,10 +509,10 @@
     #  check for errors
     if not isfield(params, pname):
-        warning('param_write:param_not_found', 'Parameter ' + str(pname) + ' not found in ' + params + '.')
+        print('Warning: dmeth_params_write.py::param_write: Parameter {} not found in {}.'.format(pname, params))
         return
     elif type(vars(params)[pname]) == bool and not vars(params)[pname]:
         return
     elif isempty(vars(params)[pname]):
-        print('Warning: param_write:param_empty: Parameter {} requires input of type {}.'.format(pname, type(vars(params)[pname])))
+        print('Warning: dmeth_params_write.py::param_write: Parameter {} requires input of type {}.'.format(pname, type(vars(params)[pname])))
         return
 
@@ -535,4 +535,4 @@
 
     else:
-        print('Warning: param_write:param_unrecog: Parameter {} is of unrecognized type {}.'.format(pname, type(vars(params)[pname])))
-        return
+        print('Warning: dmeth_params_write.py::param_write: Parameter {} is of unrecognized type {}.'.format(pname, type(vars(params)[pname])))
+    return
Index: issm/trunk/src/m/classes/qmustatistics.m
===================================================================
--- issm/trunk/src/m/classes/qmustatistics.m	(revision 25994)
+++ issm/trunk/src/m/classes/qmustatistics.m	(revision 26744)
@@ -14,5 +14,5 @@
 
 		%name: name of method, one of 'None','Histogram','SampleSeries' or 'MeanVariance'
-		%fields: fields for the  statistics being requested, ex: 'Sealevel','BslrIce','BslrHydro'
+		%fields: fields for the  statistics being requested, ex: 'Sealevel','BslcIce','BslcHydro'
 		%steps: time steps at which each field statistic is computed, ex: [1:2,5,20] or 1:100
 		%nbins: number of bins for 'Histogram' statistics
Index: issm/trunk/src/m/classes/rotational.js
===================================================================
--- issm/trunk/src/m/classes/rotational.js	(revision 26744)
+++ issm/trunk/src/m/classes/rotational.js	(revision 26744)
@@ -0,0 +1,58 @@
+class rotational {//{{{
+	/**
+	 * ROTATIONAL class definition
+	 *
+	 * Usage:
+	 *     rotational = rotational();
+	 */
+	constructor() {//{{{
+		this.equatorialmoi		= 0;
+		this.polarmoi			= 0;
+		this.angularvelocity	= 0;
+
+		let nargs = arguments.length;
+		if (nargs == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
+
+	disp() {//{{{
+		console.log('WARNING: rotational::disp is not yet implemented');
+	} //}}}
+
+	setdefaultparameters() {//{{{
+		// Moment of inertia
+		this.equatorialmoi	= 8.0077e37; // [kg m^2]
+		this.polarmoi		= 8.0345e37; // [kg m^2]
+
+		// Mean rotational velocity of earth
+		this.angularvelocity = 7.2921e-5; // [s^-1]
+	} //}}}
+
+	checkconsistency(md, solution, analyses) {//{{{
+		if (!analyses.includes('SealevelchangeAnalysis') || (solution === 'TransientSolution' && !md.transient.isslc)) {
+			return md;
+		}
+
+		md = checkfield(md, 'fieldname', 'solidearth.rotational.equatorialmoi', 'NaN', 1, 'Inf', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.rotational.polarmoi', 'NaN', 1, 'Inf', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.rotational.angularvelocity', 'NaN', 1, 'Inf', 1);
+
+		return md;
+	} //}}}
+
+	defaultoutputs(md) {//{{{
+		return [];
+	} //}}}
+
+	marshall(md, prefix, fid) {//{{{
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'equatorialmoi', 'name', 'md.solidearth.rotational.equatorialmoi', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'polarmoi', 'name', 'md.solidearth.rotational.polarmoi', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'angularvelocity', 'name', 'md.solidearth.rotational.angularvelocity', 'format', 'Double');
+	} //}}}
+
+	extrude(md) {//{{{
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/rotational.m
===================================================================
--- issm/trunk/src/m/classes/rotational.m	(revision 25994)
+++ issm/trunk/src/m/classes/rotational.m	(revision 26744)
@@ -20,15 +20,15 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
-		
-		%moment of inertia: 
-		self.equatorialmoi	=8.0077*10^37; % [kg m^2] 
-		self.polarmoi		=8.0345*10^37; % [kg m^2] 
 
-		% mean rotational velocity of earth 
-		self.angularvelocity=7.2921*10^-5; % [s^-1] 
+			%moment of inertia:
+			self.equatorialmoi	=8.0077*10^37; % [kg m^2]
+			self.polarmoi		=8.0345*10^37; % [kg m^2]
+
+			% mean rotational velocity of earth
+			self.angularvelocity=7.2921*10^-5; % [s^-1]
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0), 
 				return; 
 			end
Index: issm/trunk/src/m/classes/rotational.py
===================================================================
--- issm/trunk/src/m/classes/rotational.py	(revision 25994)
+++ issm/trunk/src/m/classes/rotational.py	(revision 26744)
@@ -1,4 +1,2 @@
-import numpy as np
-
 from checkfield import checkfield
 from fielddisplay import fielddisplay
@@ -13,8 +11,8 @@
     """
 
-    def __init__(self, *args): #{{{
-        self.equatorialmoi      = 0
-        self.polarmoi           = 0
-        self.langularvelocity   = 0
+    def __init__(self, *args):  #{{{
+        self.equatorialmoi = 0
+        self.polarmoi = 0
+        self.langularvelocity = 0
 
         nargin = len(args)
@@ -25,5 +23,5 @@
     #}}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  # {{{
         s = '   rotational parameters:\n'
         s += '{}\n'.format(fielddisplay(self, 'equatorialmoi', 'mean equatorial moment of inertia [kg m^2]'))
@@ -33,16 +31,16 @@
     #}}}
 
-    def setdefaultparameters(self): # {{{
+    def setdefaultparameters(self):  # {{{
         # Moment of inertia
-        self.equatorialmoi  = 8.0077e37 # [kg m^2]
-        self.polarmoi       = 8.0345e37 # [kg m^2]
+        self.equatorialmoi = 8.0077 * pow(10, 37) # [kg m^2]
+        self.polarmoi = 8.0345 * pow(10, 37) # [kg m^2]
 
         # Mean rotational velocity of earth
-        self.angularvelocity = 7.2921e-5 # [s^-1]
+        self.angularvelocity = 7.2921 * pow(10, -5) # [s^-1]
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
             return md
         md = checkfield(md, 'fieldname', 'solidearth.rotational.equatorialmoi', 'NaN', 1, 'Inf', 1)
@@ -52,9 +50,9 @@
     #}}}
 
-    def defaultoutputs(self, md): #{{{
+    def defaultoutputs(self, md):  #{{{
         return []
     #}}}
 
-    def marshall(self, prefix, md, fid): #{{{
+    def marshall(self, prefix, md, fid):  #{{{
         WriteData(fid, prefix, 'object', self, 'fieldname', 'equatorialmoi', 'name', 'md.solidearth.rotational.equatorialmoi', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'polarmoi', 'name', 'md.solidearth.rotational.polarmoi', 'format', 'Double')
@@ -62,5 +60,5 @@
     #}}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  #{{{
         return self
     #}}}
Index: issm/trunk/src/m/classes/sampling.js
===================================================================
--- issm/trunk/src/m/classes/sampling.js	(revision 26744)
+++ issm/trunk/src/m/classes/sampling.js	(revision 26744)
@@ -0,0 +1,99 @@
+//SAMPLING class definition
+//
+//   Usage:
+//      sampling=new sampling();
+
+function sampling (){
+	//methods
+	this.defaultoutputs = function(){// {{{
+       	return [];
+	}// }}}
+	this.setdefaultparameters = function(){// {{{
+
+		//Scaling coefficient
+		this.tau=1;  
+
+		//Apply Robin boundary conditions
+		this.robin=0;   
+		
+		//Temporal correlation factor
+		this.phi=0;  
+		
+		//Exponent in fraction SPDE (default=2, biLaplacian covariance
+		//operator)
+		this.alpha=2; // Default 
+		
+		//Seed for pseudorandom number generator (default -1 for random seed)
+		this.seed=-1;
+		
+		//default output
+		this.requested_outputs=['default'];
+	}// }}}
+	this.disp= function(){// {{{
+		console.log(sprintf('   Sampling parameters:'));
+
+		console.log(sprintf('\n      %s','Parameters of PDE operator (kappa^2 I-Laplacian)^(alpha/2)(tau):'));
+		fielddisplay(this,'kappa','coefficient of the identity operator');
+		fielddisplay(this,'tau','scaling coefficient of the solution (default 1.0)');
+		fielddisplay(this,'alpha','exponent in PDE operator, (default 2.0, BiLaplacian covariance operator)');
+	  
+		console.log(sprintf('\n      %s','Parameters of Robin boundary conditions nabla () \cdot normvec + beta ():'));
+		fielddisplay(this,'robin','Apply Robin boundary conditions (1 if applied and 0 for homogenous Neumann boundary conditions) (default 0)');
+		fielddisplay(this,'beta','Coefficient in Robin boundary conditions (to be defined for robin = 1)');          
+		
+		console.log(sprintf('\n      %s','Parameters for first-order autoregressive process (X_t = phi X_{t-1} + noise) (if transient):'));
+		fielddisplay(this,'phi','Temporal correlation factor (|phi|<1 for stationary process, phi = 1 for random walk process) (default 0)');
+		
+		console.log(sprintf('\n      %s','Other parameters of stochastic sampler:'));
+		fielddisplay(this,'seed','Seed for pseudorandom number generator (given seed if >=0 and random seed if <0) (default -1)');
+		fielddisplay(this,'requested_outputs','additional outputs requested (not implemented yet)');
+	}// }}}
+	this.classname= function(){// {{{
+		return "sampling";
+	}// }}}
+	this.checkconsistency = function(md,solution,analyses) { //{{{
+		if (!ismember('SamplingAnalysis',analyses)) return;
+		
+		checkfield(md,'fieldname','sampling.kappa','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1],'>',0);
+		checkfield(md,'fieldname','sampling.tau','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','sampling.robin','numel',1,'values',[0,1]);
+		if (md.sampling.robin) {
+			checkfield(md,'fieldname','sampling.beta','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1],'>',0);
+		}
+		checkfield(md,'fieldname','sampling.phi','NaN',1,'Inf',1,'numel',1,'>=',0);
+		checkfield(md,'fieldname','sampling.alpha','NaN',1,'Inf',1,'numel',1,'>',0);
+		checkfield(md,'fieldname','sampling.seed','NaN',1,'Inf',1,'numel',1);
+		checkfield(md,'fieldname','sampling.requested_outputs','stringrow',1);
+	} // }}}
+	this.marshall=function(md,prefix,fid) { //{{{
+		WriteData(fid,prefix,'object',this,'fieldname','kappa','format','DoubleMat','mattype',1);
+		WriteData(fid,prefix,'object',this,'fieldname','tau','format','Double');
+		WriteData(fid,prefix,'object',this,'fieldname','beta','format','DoubleMat','mattype',1);
+		WriteData(fid,prefix,'object',this,'fieldname','phi','format','Double');
+		WriteData(fid,prefix,'object',this,'fieldname','alpha','format','Integer');
+		WriteData(fid,prefix,'object',this,'fieldname','robin','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','seed','format','Integer');
+		
+		//process requested outputs
+		outputs = this.requested_outputs;
+		pos = find(ismember(outputs,'default'));
+		if (!isempty(pos)) {
+			ArrayIndex(outputs,pos,[]);                         //remove 'default' from outputs
+			outputs = ArrayConcat(outputs, this.defaultoutputs()); //add defaults
+		}
+		WriteData(fid,prefix,'data',outputs,'name','md.sampling.requested_outputs','format','StringArray');
+	}//}}}
+	//properties 
+	// {{{
+    this.kappa          	= NaN;
+	this.tau            	= 0;
+	this.beta           	= NaN;
+    this.phi            	= 0;
+    this.alpha          	= 0;
+    this.robin          	= 0;
+    this.seed           	= 0;
+	this.requested_outputs  = [];
+
+	this.setdefaultparameters();
+	//}}}
+}
Index: issm/trunk/src/m/classes/sampling.m
===================================================================
--- issm/trunk/src/m/classes/sampling.m	(revision 26744)
+++ issm/trunk/src/m/classes/sampling.m	(revision 26744)
@@ -0,0 +1,131 @@
+%SAMPLING class definition
+%
+%   Usage:
+%      sampling=sampling();
+
+classdef sampling
+	properties (SetAccess=public)
+		kappa             = NaN;
+		tau               = 0;
+		beta              = NaN;
+		phi               = 0;
+		alpha             = 0;
+		robin             = 0;
+		seed              = 0;
+		requested_outputs = {};
+	end
+	methods
+		function self = sampling(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function disp(self) % {{{
+
+			disp(sprintf('   Sampling parameters:'));
+
+			disp(sprintf('\n      %s','Parameters of PDE operator (kappa^2 I-Laplacian)^(alpha/2)(tau):'));
+			fielddisplay(self,'kappa','coefficient of the identity operator');
+			fielddisplay(self,'tau','scaling coefficient of the solution (default: 1.0)');
+			fielddisplay(self,'alpha','exponent in PDE operator, (default: 2.0, BiLaplacian covariance operator)');
+
+			disp(sprintf('\n      %s','Parameters of Robin boundary conditions nabla () \cdot normvec + beta ():'));
+			fielddisplay(self,'robin','Apply Robin boundary conditions (1 if applied and 0 for homogenous Neumann boundary conditions) (default: 0)');
+			fielddisplay(self,'beta','Coefficient in Robin boundary conditions (to be defined for robin = 1)');
+
+			disp(sprintf('\n      %s','Parameters for first-order autoregressive process (X_t = phi X_{t-1} + noise) (if transient):'));
+			fielddisplay(self,'phi','Temporal correlation factor (|phi|<1 for stationary process, phi = 1 for random walk process) (default 0)');
+
+			disp(sprintf('\n      %s','Other parameters of stochastic sampler:'));
+			fielddisplay(self,'seed','Seed for pseudorandom number generator (given seed if >=0 and random seed if <0) (default: -1)');
+			fielddisplay(self,'requested_outputs','additional outputs requested (not implemented yet)');
+
+		end % }}}','
+		function self = setdefaultparameters(self) % {{{
+
+			%Scaling coefficient
+			self.tau=1;
+
+			%Apply Robin boundary conditions
+			self.robin=0;
+
+			%Temporal correlation factor
+			self.phi=0;
+
+			%Exponent in fraction SPDE (default: 2, biLaplacian covariance
+			%operator)
+			self.alpha=2; % Default 
+
+			%Seed for pseudorandom number generator (default: -1, for random seed)
+			self.seed=-1;
+
+			%default output
+			self.requested_outputs={'default'};
+
+		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+
+			list = {};
+
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			if ~ismember('SamplingAnalysis',analyses), return; end
+
+			md = checkfield(md,'fieldname','sampling.kappa','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
+			md = checkfield(md,'fieldname','sampling.tau','NaN',1,'Inf',1,'numel',1,'>',0);
+			md = checkfield(md,'fieldname','sampling.robin','numel',1,'values',[0 1]);
+			if(md.sampling.robin)
+				md = checkfield(md,'fieldname','sampling.beta','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
+			end
+			md = checkfield(md,'fieldname','sampling.phi','NaN',1,'Inf',1,'numel',1,'>=',0);
+			md = checkfield(md,'fieldname','sampling.alpha','NaN',1,'Inf',1,'numel',1,'>',0);
+			md = checkfield(md,'fieldname','sampling.seed','NaN',1,'Inf',1,'numel',1);
+			md = checkfield(md,'fieldname','sampling.requested_outputs','stringrow',1);
+
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+
+			WriteData(fid,prefix,'object',self,'fieldname','kappa','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','tau','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','beta','format','DoubleMat','mattype',1);
+			WriteData(fid,prefix,'object',self,'fieldname','phi','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','alpha','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','robin','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','seed','format','Integer');
+
+			%process requested outputs
+			outputs = self.requested_outputs;
+			pos  = find(ismember(outputs,'default'));
+			if ~isempty(pos),
+				outputs(pos) = [];                         %remove 'default' from outputs
+				outputs      = [outputs defaultoutputs(self,md)]; %add defaults
+			end
+			WriteData(fid,prefix,'data',outputs,'name','md.sampling.requested_outputs','format','StringArray');
+		end % }}}
+		function md = setparameters(self,md,lc,sigma) % {{{
+
+			nu = self.alpha-1;
+			KAPPA = sqrt(8*nu)/lc;
+			TAU = sqrt(gamma(nu)/(gamma(self.alpha)*(4*pi)*KAPPA^(2*nu)*sigma^2));
+			md.sampling.kappa = KAPPA*ones(md.mesh.numberofvertices,1);
+			md.sampling.tau = TAU;
+
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+
+			writejsdouble(fid,[modelname '.sampling.kappa'],self.kappa);
+			writejsdouble(fid,[modelname '.sampling.tau'],self.tau);
+			writejsdouble(fid,[modelname '.sampling.beta'],self.beta);
+			writejsdouble(fid,[modelname '.sampling.phi'],self.beta);
+			writejsdouble(fid,[modelname '.sampling.alpha'],self.alpha);
+			writejsdouble(fid,[modelname '.sampling.robin'],self.robin);
+			writejsdouble(fid,[modelname '.sampling.seed'],self.seed);
+			writejscellstring(fid,[modelname '.sampling.requested_outputs'],self.requested_outputs);
+
+		end % }}}
+	end
+end
Index: issm/trunk/src/m/classes/sampling.py
===================================================================
--- issm/trunk/src/m/classes/sampling.py	(revision 26744)
+++ issm/trunk/src/m/classes/sampling.py	(revision 26744)
@@ -0,0 +1,125 @@
+import numpy as np
+
+from math import *
+
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+from project3d import project3d
+from WriteData import WriteData
+
+
+class sampling(object):
+    """SAMPLING class definition
+
+    Usage:
+        sampling = sampling()
+    """
+
+    def __init__(self, *args): #{{{
+        self.kappa = np.nan
+        self.tau = 0
+        self.beta = np.nan
+        self.phi = 0
+        self.alpha = 0
+        self.robin = 0
+        self.seed = 0
+        self.requested_outputs = []
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise RuntimeError('constructor not supported')
+    #}}}
+
+    def __repr__(self): #{{{
+        s = '   Sampling parameters::\n'
+        s += '      Parameters of PDE operator (kappa^2 I-Laplacian)^(alpha/2)(tau):\n'
+        s += '{}\n'.format(fielddisplay(self, 'kappa', 'coefficient of the identity operator'))
+        s += '{}\n'.format(fielddisplay(self, 'tau', 'scaling coefficient of the solution (default: 1.0)'))
+        s += '{}\n'.format(fielddisplay(self, 'alpha', 'exponent in PDE operator, (default: 2.0, BiLaplacian covariance operator)'))
+
+        s += '      Parameters of Robin boundary conditions nabla () \cdot normvec + beta ():\n'
+        s += '{}\n'.format(fielddisplay(self, 'robin', 'Apply Robin boundary conditions (1 if applied and 0 for homogenous Neumann boundary conditions) (default: 0)'))
+        s += '{}\n'.format(fielddisplay(self, 'beta', 'Coefficient in Robin boundary conditions (to be defined for robin = 1)'))
+
+        s += '      Parameters for first-order autoregressive process (X_t = phi X_{t-1} + noise) (if transient):\n'
+        s += '{}\n'.format(fielddisplay(self, 'phi', 'Temporal correlation factor (|phi|<1 for stationary process, phi = 1 for random walk process) (default 0)'))
+
+        s += '      Other parameters of stochastic sampler:\n'
+        s += '{}\n'.format(fielddisplay(self, 'seed', 'Seed for pseudorandom number generator (given seed if >=0 and random seed if <0) (default: -1)'))
+        s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested (not implemented yet)'))
+
+        return s
+    #}}}
+
+    def setdefaultparameters(self): #{{{
+        # Scaling coefficient
+        self.tau = 1
+
+        # Apply Robin boundary conditions
+        self.robin = 0
+
+        # Temporal correlation factor
+        self.phi = 0
+
+        # Exponent in fraction SPDE (default: 2, biLaplacian covariance operator)
+        self.alpha = 2
+
+        # Seed for pseudorandom number generator (default: -1, for random seed)
+        self.seed = -1
+
+        # Default output
+        self.requested_outputs = ['default']
+
+        return self
+    #}}}
+
+    def defaultoutputs(self, md): #{{{
+        return []
+    #}}}
+
+    def checkconsistency(self, md, solution, analyses): #{{{
+        if ('SamplingAnalysis' not in analyses):
+            return md
+
+        md = checkfield(md, 'fieldname', 'sampling.kappa', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>', 0)
+        md = checkfield(md, 'fieldname', 'sampling.tau', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'sampling.robin', 'numel', 1, 'values', [0, 1])
+        if md.sampling.robin:
+            md = checkfield(md, 'fieldname', 'sampling.beta', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices], '>', 0)
+        end
+        md = checkfield(md, 'fieldname', 'sampling.phi', 'NaN', 1, 'Inf', 1, 'numel', 1, '>=', 0)
+        md = checkfield(md, 'fieldname', 'sampling.alpha', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
+        md = checkfield(md, 'fieldname', 'sampling.seed', 'NaN', 1, 'Inf', 1, 'numel', 1)
+        md = checkfield(md, 'fieldname', 'sampling.requested_outputs', 'stringrow', 1)
+
+        return md
+    #}}}
+
+    def marshall(self, prefix, md, fid): #{{{
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'kappa', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'tau', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'beta', 'format', 'DoubleMat', 'mattype', 1)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'phi', 'format', 'Double')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'alpha', 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'robin', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'seed', 'format', 'Integer')
+
+        # Process requested outputs
+        outputs = self.requested_outputs
+        indices = [i for i, x in enumerate(outputs) if x == 'default']
+        if len(indices) > 0:
+            outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:]
+            outputs = outputscopy
+        WriteData(fid, prefix, 'data', outputs, 'name', 'md.sampling.requested_outputs', 'format', 'StringArray')
+    #}}}
+
+    def setparameters(self, md, lc, sigma): #{{{
+        nu = self.alpha - 1
+        KAPPA = pow((8 * nu), 0.5) / lc
+        TAU = pow((math.gamma(nu) / math.gamma(self.alpha) * (4 *  np.pi) * pow(KAPPA, 2 * nu) * pow(sigma, 2)), 0.5)
+        md.sampling.kappa = KAPPA * np.ones((md.mesh.numberofvertices, 1))
+        md.sampling.tau = TAU
+
+        return md
+    #}}}
Index: issm/trunk/src/m/classes/sealevelmodel.js
===================================================================
--- issm/trunk/src/m/classes/sealevelmodel.js	(revision 26744)
+++ issm/trunk/src/m/classes/sealevelmodel.js	(revision 26744)
@@ -0,0 +1,143 @@
+class sealevelmodel {
+	/**
+	 * SEALEVELMODEL class definition
+	 * 
+	 * Usage:
+	 *     slm = sealevelmodel(varargin)
+	 *
+	 * Example:
+	 *     slm = sealevelmodel(
+	 *         'icecap', md_greenland,
+	 *         'icecap', md_antarctica,
+	 *         'earth', md_earth
+	 *     )
+	 *
+	 * TODO:
+	 * - Finish translation
+	 */
+	constructor(...varargin) {//{{{
+		this.icecaps = []; // list of land/ice models; name should be changed later
+		this.earth = null; // model for the whole earth
+		this.basins = []; // list of basins, matching icecaps, where shapefile info is held
+		this.cluster = null;
+		this.miscellaneous = null;
+		this.settings = null;
+		this.private = null;
+		this.mergedcaps = null;
+		this.transitions = [];
+		this.eltransitions = [];
+		this.planet = '';
+
+		this.setdefaultparamters();
+
+		if (varargin.length) {
+			let options = pairoptions(varargin);
+
+			// Recover all the icecap models
+			this.icecaps = options.getfieldvalues('ice_cap', []);
+
+			// Recover the earth model
+			this.earth = options.getfieldvalue('earth', 0);
+
+			// Set planet type
+			this.planet = options.getfieldvalue('planet', 'earth');
+		}
+	} //}}}
+
+	setdefaultparamters() {//{{{
+		// Initialize subclasses
+		this.icecaps = [];
+		this.earth = [];
+		this.cluster = generic();
+		this.miscellaneous = miscellaneous();
+		this.settings = issmsettings();
+		this.private = private();
+		this.transitions = [];
+		this.eltransitions = [];
+		this.planet = 'earth';
+	} //}}}
+
+	static checkconsistency(slm, solutiontype) {//{{{
+		// Is the coupler turned on?
+		for (let i = 0; slm.icecaps.length; ++i) {
+			if (!slm.icecaps[0].transient.iscoupler) {
+				console.log('sealevelmodel checkconsistency error: icecap model ' +  slm.icecaps[0].miscellaneous.name + ' should have the transient coupler option turned on!');
+			}
+		}
+
+		if (!slm.earth.transient.iscoupler) {
+			console.log('sealevelmodel checkconsistency error: earth model should have the transient coupler option turned on!');
+		}
+
+		// Check that the transition vectors have the right size
+		for (let i = 0; i < slm.icecaps.length; ++i) {
+			if (slm.icecaps[0].mesh.numberorvertices != slm.earth.solidearth.transitions[0].length) {
+				error('sealevelmodel checkconsistency issue with size of transition vector for ice cap: ' + i + ' name: ' + slm.icecaps[0].miscellaneous.name);
+			}
+		}
+
+		// Check that runfrequency is the same everywhere
+		for (let i = 0; i < slm.icecaps; ++i) {
+			if (slm.icecaps[i].solidearth.settings.runfrequency != slm.earth.solidearth.settings.runfrequency) {
+				error('sealevelmodel checkconsistency error: icecap model ' + slm.icecaps[i].miscellaneous.name + ' should have the same run frequency as earth!');
+			}
+		}
+
+		// Make sure steric_rate is the same everywhere
+		for (let i = 0; i < slm.icecaps.length; ++i) {
+			let md = slm.icecaps[i];
+			if (!isempty(find(md.dsl.steric_rate - slm.earth.dsl.steric_rate[slm.earth.dsl.transitions[i]]))) {
+				error('steric rate on ice cap ' + md.miscellaneous.name + ' is not the same as for the earth');
+			}
+		}
+
+		// Make sure grd is the same everywhere
+		for (let i = 0; i < slm.icecaps.length; ++i) {
+			let md = slm.icecaps[i];
+			if (md.solidearthsettings.isgrd != slm.earth.solidearthsettings.isgrd) {
+				error('isgrd on ice cap ' + md.miscellaneous.name + ' is not the same as for the earth');
+			}
+		}
+
+		// Make sure that there is no solid earth external forcing on the basins
+		for (let i = 0; i < slm.icecaps.length; ++i) {
+			let md = slm.icecaps[i];
+			if (!isempty(md.solidearth.external)) {
+				error('cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model');
+			}
+		}
+
+		// Make sure that we have the right grd model for computing out sealevel patterns
+		for (let i = 0; i < slm.icecaps.length; ++i) {
+			let md = slm.icecaps[i];
+			if (md.solidearth.settings.grdmodel) {
+				error('sealevelmodel checkconsistency error message: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap ' + i);
+			}
+		}
+	} //}}}
+
+	disp() {//{{{
+		console.log('WARNING: sealevelmodel::disp is not yet implemented');
+	} //}}}
+
+	mergeresults() {//{{{
+		let champs = fieldnames(this.icecaps[0].results.TransientSolution);
+		for (let i = 0; i < this.mergedcaps.length / 2; ++i) {
+			let md = this.mergedcaps[2 * i];
+			let trans = this.mergedcaps[2 * i + 1];
+			//let icecaps = this.icecaps[this.range[2 * i + 2]];
+			for (let j = 0; j < this.icecaps[0].results.TransientSolution) {
+				for (let k = 0; champs.length; ++k) {
+					if (strcmpi(typeof(icecaps[0].results.TransientSolution[j][champs[k]]) == 'double')) {
+						// Vertex or element?
+						if (icecaps[0].results.TransientSolution[j][champs[k]].length == icecaps[0].mesh.numberofvertices) {
+							md.results.TransientSolution[j][champs[k]] == icecaps[0].mesh.numberofvertices;
+
+						}
+					} else {
+
+					}
+				}
+			}
+	} //}}}
+}
Index: issm/trunk/src/m/classes/sealevelmodel.m
===================================================================
--- issm/trunk/src/m/classes/sealevelmodel.m	(revision 25994)
+++ issm/trunk/src/m/classes/sealevelmodel.m	(revision 26744)
@@ -4,7 +4,7 @@
 %      slm = sealevelmodel(varargin)
 %
-%      where varargin is a variable list of options: 
+%      where varargin is a variable list of options:
 %
-%   Example: 
+%   Example:
 %      slm = sealevel('icecap',md_greenland,'icecap',md_antarctica,'earth',md_earth);
 
@@ -14,5 +14,5 @@
 		icecaps          = {}; % list of land/ice models, name should  be change longer term.
 		earth            = 0;  % model for the whole earth
-		basins           = {}; % list  of basins, matching icecaps, where shapefile info is held.
+		basins           = {}; % list of basins, matching icecaps, where shapefile info is held
 		cluster          = 0;
 		miscellaneous    = 0;
@@ -33,11 +33,11 @@
 				options=pairoptions(varargin{:});
 
-				%recover all the icecap models: 
-				slm.icecaps=getfieldvalues(options,'ice_cap',{}); 
+				%recover all the icecap models:
+				slm.icecaps=getfieldvalues(options,'ice_cap',{});
 				
 				%recover the earth model:
 				slm.earth = getfieldvalue(options,'earth',0);
 
-				%set planet type: 
+				%set planet type:
 				slm.planet=getfieldvalue(options,'planet','earth');
 
@@ -47,34 +47,58 @@
 		function checkconsistency(slm,solutiontype) % {{{
 
-			%is the coupler turned on? 
+			%is the coupler turned on?
 			for i=1:length(slm.icecaps),
 				if slm.icecaps{i}.transient.iscoupler==0,
-					warning(sprintf('sealevelmodel checkconsistenty error:  icecap model %s should have the transient coupler option turned on!',slm.icecaps{i}.miscellaneous.name));
+					warning(sprintf('sealevelmodel.m::checkconsistency: icecap model %s should have the transient coupler option turned on!',slm.icecaps{i}.miscellaneous.name));
 				end
 			end
 				
 			if slm.earth.transient.iscoupler==0,
-				warning('sealevelmodel checkconsistenty error:  earth model should have the transient coupler option turned on!');
-			end
-
-			%check that the transition vectors have the right size: 
-			for i=1:length(slm.icecaps),
-				if slm.icecaps{i}.mesh.numberofvertices ~= length(slm.earth.slr.transitions{i}),
-					error(['sealevelmodel checkconsistenty issue with size of transition vector for ice cap: ' num2str(i) ' name: ' slm.icecaps{i}.miscellaneous.name]);
-				end
-			end
-			
-			%check that run_frequency is the same everywhere: 
-			for i=1:length(slm.icecaps),
-				if slm.icecaps{i}.slr.geodetic_run_frequency~=slm.earth.slr.geodetic_run_frequency,
-					error(sprintf('sealevelmodel checkconsistenty error:  icecap model %s should have the same run frequency as earth!',slm.icecaps{i}.miscellaneous.name));
-				end
-			end
-
-			%make sure steric_rate is the same everywhere: 
-			for i=1:length(slm.icecaps),
-				md= slm.icecaps{i}; 
-				if ~isempty(find(md.slr.steric_rate - slm.earth.slr.steric_rate(slm.earth.slr.transitions{i}))),
-					error(sprintf('steric rate on ice cap %s is not the same as for the earth\n',md.miscellaneous.name));
+				warning('sealevelmodel.m::checkconsistency: earth model should have the transient coupler option turned on!');
+			end
+
+			%check that the transition vectors have the right size:
+			for i=1:length(slm.icecaps),
+				if slm.icecaps{i}.mesh.numberofvertices ~= length(slm.earth.solidearth.transitions{i}),
+					error(['sealevelmodel.m::checkconsistency: issue with size of transition vector for ice cap: ' num2str(i) ' name: ' slm.icecaps{i}.miscellaneous.name]);
+				end
+			end
+			
+			%check that runfrequency is the same everywhere:
+			for i=1:length(slm.icecaps),
+				if slm.icecaps{i}.solidearth.settings.runfrequency~=slm.earth.solidearth.settings.runfrequency,
+					error(sprintf('sealevelmodel.m::checkconsistency: icecap model %s should have the same run frequency as earth!',slm.icecaps{i}.miscellaneous.name));
+				end
+			end
+
+			%make sure steric_rate is the same everywhere:
+			for i=1:length(slm.icecaps),
+				md= slm.icecaps{i};
+				if ~isempty(find(md.dsl.steric_rate - slm.earth.dsl.steric_rate(slm.earth.dsl.transitions{i}))),
+					error(sprintf('sealevelmodel.m::checkconsistency: steric rate on ice cap %s is not the same as for the earth\n',md.miscellaneous.name));
+				end
+			end
+
+			%make sure grd is the same everywhere:
+			for i=1:length(slm.icecaps),
+				md= slm.icecaps{i};
+				if md.solidearthsettings.isgrd~=slm.earth.solidearthsettings.isgrd
+					error(sprintf('sealevelmodel.m::checkconsistency: isgrd on ice cap %s is not the same as for the earth\n',md.miscellaneous.name));
+				end
+			end
+
+			%make sure that there is no solid earth external forcing on the basins:
+			for i=1:length(slm.icecaps),
+				md= slm.icecaps{i};
+				if ~isempty(md.solidearth.external),
+					error('sealevelmodel.m::checkconsistency: cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model');
+				end
+
+			end
+			%make sure that we have the right grd model for computing out sealevel patterns:
+			for i=1:length(slm.icecaps),
+				md= slm.icecaps{i};
+				if md.solidearth.settings.grdmodel~=0
+					error(sprintf('sealevelmodel.m::checkconsistency: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap %i',i));
 				end
 			end
@@ -111,5 +135,5 @@
 					for k=1:length(champs),
 						if strcmpi(class(icecaps{1}.results.TransientSolution(j).(champs{k})),'double'),
-							%vertex or element? 
+							%vertex or element?
 							if length(icecaps{1}.results.TransientSolution(j).(champs{k}))==icecaps{1}.mesh.numberofvertices,
 								md.results.TransientSolution(j).(champs{k})=zeros(md.mesh.numberofvertices,1);
@@ -118,5 +142,5 @@
 									md.results.TransientSolution(j).(champs{k})(trans{l})=resultcap;
 								end
-							else 
+							else
 								if strcmpi(champs{k},'IceVolume') | strcmpi(champs{k},'IceVolumeAboveFloatation') ,
 									md.results.TransientSolution(j).(champs{k})=0;
@@ -171,8 +195,8 @@
 		function intersections2d(self,varargin) % {{{
 
-			options=pairoptions(varargin{:}); 
+			options=pairoptions(varargin{:});
 			force=getfieldvalue(options,'force',0);
 			
-			%initialize, to avoid issues of having more transitions than meshes. 
+			%initialize, to avoid issues of having more transitions than meshes.
 			self.transitions={};
 			self.eltransitions={};
@@ -185,5 +209,5 @@
 				mdi=self.icecaps{i};
 		
-				%for elements: 
+				%for elements:
 				xei=mdi.mesh.x(mdi.mesh.elements)*[1;1;1]/3;
 				yei=mdi.mesh.y(mdi.mesh.elements)*[1;1;1]/3;
@@ -198,8 +222,8 @@
 		function intersections(self,varargin) % {{{
 
-			options=pairoptions(varargin{:}); 
+			options=pairoptions(varargin{:});
 			force=getfieldvalue(options,'force',0);
 			
-			%initialize, to avoid issues of having more transitions than meshes. 
+			%initialize, to avoid issues of having more transitions than meshes.
 			self.transitions={};
 			self.eltransitions={};
@@ -214,5 +238,5 @@
 				mdi=TwoDToThreeD(mdi,self.planet);
 		
-				%for elements: 
+				%for elements:
 				xei=mdi.mesh.x(mdi.mesh.elements)*[1;1;1]/3;
 				yei=mdi.mesh.y(mdi.mesh.elements)*[1;1;1]/3;
@@ -241,5 +265,5 @@
 		end % }}}
 		function baslist=basinindx(self,varargin) % {{{
-			options=pairoptions(varargin{:}); 
+			options=pairoptions(varargin{:});
 			continent=getfieldvalue(options,'continent','all');
 			bas=getfieldvalue(options,'basin','all');
@@ -249,6 +273,6 @@
 				if length(continent)==1,
 					if strcmpi(continent{1},'all'),
-						%need to transform this into a list of continents: 
-						continent={}; 
+						%need to transform this into a list of continents:
+						continent={};
 						for i=1:length(self.basins),
 							continent{end+1}=self.basins{i}.continent;
@@ -263,6 +287,6 @@
 			else
 				if strcmpi(continent,'all'),
-					%need to transform this into a list of continents: 
-					continent={}; 
+					%need to transform this into a list of continents:
+					continent={};
 					for i=1:length(self.basins),
 						continent{end+1}=self.basins{i}.continent;
@@ -278,5 +302,5 @@
 				if length(bas)==1,
 					if strcmpi(bas{1},'all'),
-						%need to transform this into a list of basins: 
+						%need to transform this into a list of basins:
 						baslist=[];
 						for i=1:length(self.basins),
@@ -299,5 +323,5 @@
 					end
 				else
-					%we have a list of basin names: 
+					%we have a list of basin names:
 					baslist=[];
 					for i=1:length(bas),
@@ -350,6 +374,6 @@
 		function caticecaps(self,varargin) % {{{
 			
-			%recover options: 
-			options=pairoptions(varargin{:}); 
+			%recover options:
+			options=pairoptions(varargin{:});
 			tolerance=getfieldvalue(options,'tolerance',.65);
 			loneedgesdetect=getfieldvalue(options,'loneedgesdetect',0);
@@ -362,5 +386,5 @@
 			
 			%Plug all models together:
-			md=models{1}; 
+			md=models{1};
 			for i=2:length(models),
 				md=modelmerge3d(md,models{i},'tolerance',tolerance);
@@ -381,5 +405,5 @@
 			end %}}}
 	
-			%Plug into earth: 
+			%Plug into earth:
 			self.earth=md;
 
@@ -390,6 +414,6 @@
 		function caticecaps2d(self,varargin) % {{{
 
-			%recover options: 
-			options=pairoptions(varargin{:}); 
+			%recover options:
+			options=pairoptions(varargin{:});
 			tolerance=getfieldvalue(options,'tolerance',1e-5);
 			loneedgesdetect=getfieldvalue(options,'loneedgesdetect',0);
@@ -397,5 +421,5 @@
 
 			%Plug all models together:
-			md=models{1}; 
+			md=models{1};
 			for i=2:length(models),
 				md=modelmerge2d(md,models{i},'tolerance',tolerance);
@@ -413,5 +437,5 @@
 			end %}}}
 
-			%Plug into earth: 
+			%Plug into earth:
 			self.earth=md;
 
@@ -439,5 +463,5 @@
 		end % }}}
 		function transfer(self,string) % {{{
-			%Recover field size in one icecap: 
+			%Recover field size in one icecap:
 			eval(['n=size(self.icecaps{1}.' string ',1);']);
 			if n==self.icecaps{1}.mesh.numberofvertices,
@@ -447,5 +471,5 @@
 				end
 			elseif n==(self.icecaps{1}.mesh.numberofvertices+1),
-				%dealing with a transient dataset. 
+				%dealing with a transient dataset.
 				%check that all timetags are similar between all icecaps:  %{{{
 				for i=1:length(self.icecaps),
@@ -458,5 +482,5 @@
 					end
 				end
-				eval(['capfield1= self.icecaps{1}.' string ';']); 
+				eval(['capfield1= self.icecaps{1}.' string ';']);
 				times=capfield1(end,:);
 				nsteps=length(times);
@@ -490,5 +514,5 @@
 			mintimestep=Inf;
 			for  i=1:length(self.icecaps),
-				ic=self.icecaps{i}; 
+				ic=self.icecaps{i};
 				mintimestep=min(mintimestep, length(ic.results.TransientSolution));
 			end
@@ -498,5 +522,5 @@
 			
 			for  i=1:length(self.icecaps),
-				ic=self.icecaps{i}; 
+				ic=self.icecaps{i};
 				ic.results.TransientSolution=ic.results.TransientSolution(1:mintimestep);
 				self.icecaps{i}=ic;
Index: issm/trunk/src/m/classes/sealevelmodel.py
===================================================================
--- issm/trunk/src/m/classes/sealevelmodel.py	(revision 25994)
+++ issm/trunk/src/m/classes/sealevelmodel.py	(revision 26744)
@@ -1,4 +1,3 @@
 from copy import deepcopy
-import warnings
 
 import numpy as np
@@ -36,7 +35,7 @@
     """
 
-    def __init__(self, *args):  #{{{
-        self.icecaps = []  # list of land/ice models; name should be changed later
-        self.earth = 0  # model for the whole earth
+    def __init__(self, *args):  # {{{
+        self.icecaps = [] # list of land/ice models; name should be changed later
+        self.earth = 0 # model for the whole earth
         self.basins = []  # list of basins, matching icecaps, where shapefile info is held
         self.cluster = 0
@@ -62,5 +61,5 @@
             # Set planet type
             self.planet = options.getfieldvalue('planet', 'earth')
-    #}}}
+    # }}}
 
     def __repr__(self):  # {{{
@@ -72,5 +71,5 @@
 
         return s
-    #}}}
+    # }}}
 
     def setdefaultparameters(self):  # {{{
@@ -84,5 +83,5 @@
         self.eltransitions = []
         self.planet = 'earth'
-    #}}}
+    # }}}
 
     @staticmethod
@@ -91,25 +90,42 @@
         for i in range(len(slm.icecaps)):
             if not slm.icecaps[i].transient.iscoupler:
-                warnings.warn('sealevelmodel checkconsistency error: icecap model {} should have the transient coupler option turned on!'.format(slm.icecaps[i].miscellaneous.name))
+                print('Warning: sealevelmodel.py::checkconsistency: icecap model {} should have the transient coupler option turned on!'.format(slm.icecaps[i].miscellaneous.name))
 
         if not slm.earth.transient.iscoupler:
-            warnings.warn('sealevelmodel checkconsistency error: earth model should have the transient coupler option turned on!')
+            print('Warning: sealevelmodel.py::checkconsistency: earth model should have the transient coupler option turned on!')
 
         # Check that the transition vectors have the right size
         for i in range(len(slm.icecaps)):
             if slm.icecaps[i].mesh.numberofvertices != len(slm.earth.slr.transitions[i]):
-                raise Exception('sealevelmodel checkconsistency issue with size of transition vector for ice cap: {} name: {}'.format(i, slm.icecaps[i].miscellaneous.name))
+                raise Exception('sealevelmodel.py::checkconsistency: issue with size of transition vector for ice cap: {} name: {}'.format(i, slm.icecaps[i].miscellaneous.name))
 
         # Check that run frequency is the same everywhere
         for i in range(len(slm.icecaps)):
-            if slm.icecaps[i].slr.geodetic_run_frequency != slm.earth.geodetic_run_frequency:
-                raise Exception('sealevelmodel checkconsistency error: icecap model {} should have the same run frequency as earth!'.format(slm.icecaps[i].miscellaneous.name))
+            if slm.icecaps[i].solidearth.settings.runfrequency != slm.earth.solidearth.settings.runfrequency:
+                raise Exception('sealevelmodel.py::checkconsistency: icecap model {} should have the same run frequency as earth!'.format(slm.icecaps[i].miscellaneous.name))
 
         # Make sure steric_rate is the same everywhere
         for i in range(len(slm.icecaps)):
             md = slm.icecaps[i]
-            if np.nonzero(md.slr.steric_rate - slm.earth.slr.steric_rate[slm.earth.slr.transitions[i]]) != []:
-                raise Exception('steric rate on ice cap {} is not the same as for the earth'.format(md.miscellaneous.name))
-    #}}}
+            if np.nonzero(md.dsl.steric_rate - slm.earth.dsl.steric_rate[slm.earth.dsl.transitions[i]]) != []:
+                raise Exception('sealevelmodel.py::checkconsistency: steric rate on ice cap {} is not the same as for the earth'.format(md.miscellaneous.name))
+
+        # Make sure grd is the same everywhere
+        for i in range(len(slm.icecaps)):
+            md = slm.icecaps[i]
+            if md.solidearthsettings.isgrd != slm.earth.solidearthsettings.isgrd:
+                raise RuntimeError('sealevelmodel.py::checkconsistency: isgrd on ice cap {} is not the same as for the earth\n'.format(md.miscellaneous.name))
+
+        # Make sure that there is no solid earth external forcing on the basins
+        for i in range(len(slm.icecaps)):
+            md = slm.icecaps[i]
+            if md.solidearth.external:
+                raise RuntimeError('sealevelmodel.py::checkconsistency: cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model')
+        # Make sure that we have the right grd model for computing our sealevel patterns
+        for i in range(len(slm.icecaps)):
+            md = slm.icecaps[i]
+            if md.solidearth.settings.grdmodel != 0:
+                raise RuntimeError('sealevelmodel.py::checkconsistency: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap {}'.format(i))
+    # }}}
 
     def mergeresults(self):  # {{{
@@ -118,4 +134,5 @@
             md = self.mergedcaps[2 * i]
             trans = self.mergedcaps[2 * i + 1]
+            #icecaps = self.icecaps[self.range[2 * i + 2]]
             for j in range(len(self.icecaps[0].results.TransientSolution)):
                 for k in range(len(champs)):
@@ -140,14 +157,14 @@
                         continue
             self.mergedcaps[2 * i] = md
-    #}}}
+    # }}}
 
     def listcaps(self):  # {{{
         for i in range(len(self.icecaps)):
             print('{}: {}'.format(i, self.icecaps[i].miscellaneous.name))
-    #}}}
+    # }}}
 
     def ncaps(self): #{{{
         return len(self.icecaps)
-    #}}}
+    # }}}
 
     def continents(self):  # {{{
@@ -156,5 +173,5 @@
             list.append = self.basins[i].continent
         return np.unique(list)
-    #}}}
+    # }}}
 
     def basinsfromcontinent(self, continent):  # {{{
@@ -164,5 +181,5 @@
                 list.append = self.basins[i].name
         return np.unique(list)
-    #}}}
+    # }}}
 
     def addbasin(self, bas):  # {{{
@@ -170,5 +187,5 @@
             raise Exception('addbasin method only takes a \'basin\' class object as input')
         self.basins.append(bas)
-    #}}}
+    # }}}
 
     def intersections2d(self, *args): #{{{
@@ -195,7 +212,7 @@
             self.transitions.append(meshintersect2d(self.earth.mesh.x, self.earth.mesh.y, mdi.mesh.x, mdi.mesh.y, 'force', force))
             self.eltransitions.append(meshintersect2d(xe, ye, xei, yei, 'force', force))
-    #}}}
-
-    def intersections(self, *args):  #{{{
+    # }}}
+
+    def intersections(self, *args):  # {{{
         options = pairoptions(*args)
         force = options.getfieldvalue('force', 0)
@@ -223,19 +240,19 @@
             self.transitions.append(meshintersect3d(self.earth.mesh.x, self.earth.mesh.y, self.earth.mesh.z, mdi.mesh.x, mdi.mesh.y, mdi.mesh.z, 'force', force))
             self.eltransitions.append(meshintersect3d(xe, ye, ze, xei, yei, zei, 'force', force))
-    #}}}
-
-    def checkintersections(self):  #{{{
+    # }}}
+
+    def checkintersections(self):  # {{{
         flags = np.zeros(self.earth.mesh.numberofvertices, 1)
         for i in range(len(self.basins)):
             flags[self.transitions[i]] = i
         plotmodel(self.earth, 'data', flags, 'coastline', 'on')
-    #}}}
-
-    def checkbasinconsistency(self):  #{{{
+    # }}}
+
+    def checkbasinconsistency(self):  # {{{
         for i in range(len(self.basins)):
             self.basins[i].checkconsistency()
-    #}}}
-
-    def basinindx(self, *args):  #{{{
+    # }}}
+
+    def basinindx(self, *args):  # {{{
         options = pairoptions(*args)
         continent = options.getfieldvalue('continent', 'all')
@@ -264,5 +281,5 @@
             else:
                 pass  # Nothing to do: assume we have a list of continents
-        #}}}
+        # }}}
 
         # Expand basins list using the continent list above and the extra bas discriminator #{{{
@@ -309,20 +326,20 @@
 
         return baslist
-        #}}}
-    #}}}
-
-    def addicecap(self, md):  #{{{
+        # }}}
+    # }}}
+
+    def addicecap(self, md):  # {{{
         if not type(md) == model:
             raise Exception("addicecap method only takes a 'model' class object as input")
 
         self.icecaps.append(md)
-    #}}}
-
-    def basinsplot3d(self, *args):  #{{{
+    # }}}
+
+    def basinsplot3d(self, *args):  # {{{
         for i in range(len(self.basins)):
             self.basins[i].plot3d(*args)
-    #}}}
-
-    def caticecaps(self, *args):  #{{{
+    # }}}
+
+    def caticecaps(self, *args):  # {{{
         # Recover options
         options = pairoptions(*args)
@@ -356,7 +373,7 @@
         # Create mesh radius
         self.earth.mesh.r = planetradius('earth') * np.ones((md.mesh.numberofvertices, ))
-    #}}}
-
-    def caticecaps2d(self, *args):  #{{{
+    # }}}
+
+    def caticecaps2d(self, *args):  # {{{
         # Recover options
         options = pairoptions(*args)
@@ -382,7 +399,7 @@
         # Plug into earth
         self.earth = md
-    #}}}
-
-    def viscousiterations(self):  #{{{
+    # }}}
+
+    def viscousiterations(self):  # {{{
         for i in range(len(self.icecaps)):
             ic = self.icecaps[i]
@@ -391,7 +408,7 @@
                 mvi = np.max(mvi, ic.results.TransientSolution[j].StressbalanceConvergenceNumSteps)
             print("{}, {}: {}".format(i, self.icecaps[i].miscellaneous.name, mvi))
-    #}}}
-
-    def maxtimestep(self):  #{{{
+    # }}}
+
+    def maxtimestep(self):  # {{{
         for i in range(len(self.icecaps)):
             ic = self.icecaps[i]
@@ -403,7 +420,7 @@
         timei = self.earth.results.TransientSolution[-1].time
         print("Earth: {}/{}", mvi, timei)
-    #}}}
-
-    def transfer(self, string):  #{{{
+    # }}}
+
+    def transfer(self, string):  # {{{
         # Recover field size in one icecap
         n = getsubattr(self.icecaps[0], string).shape[0]
@@ -426,9 +443,9 @@
             times = capfield1[-1, :]
             nsteps = len(times)
-            #}}}
+            # }}}
             # Initialize #{{{
             field = np.zeros((self.earth.mesh.numberofvertices + 1, nsteps))
             field[-1, :] = times  # Transfer the times only, not the values
-            #}}}
+            # }}}
             # Transfer all the time fields #{{{
             for i in range(len(self.icecaps)):
@@ -437,5 +454,5 @@
                     field[self.transitions[i], j] = capfieldi[0:-1, j]  # Transfer only the values, not the time
             setsubattr(self.earth, string, field)  # Do not forget to plug the field variable into its final location
-            #}}}
+            # }}}
         elif n == (self.icecaps[0].mesh.numberofelements):
             setsubattr(self.earth, string, np.zeros((self.earth.mesh.numberofelements, ))) # Assign array of zeros to target attribute
@@ -445,7 +462,7 @@
         else:
             raise Exception('not supported yet')
-    #}}}
-
-    def homogenize(self, noearth=0):  #{{{
+    # }}}
+
+    def homogenize(self, noearth=0):  # {{{
         mintimestep = np.inf
 
@@ -470,10 +487,10 @@
 
         return self
-    #}}}
-
-    def initializemodels(self):  #{{{
+    # }}}
+
+    def initializemodels(self):  # {{{
         for i in range(len(self.basins)):
             md = model()
             md.miscellaneous.name = self.basins[i].name
             self.addicecap(md)
-    #}}}
+    # }}}
Index: issm/trunk/src/m/classes/slr.js
===================================================================
--- issm/trunk/src/m/classes/slr.js	(revision 25994)
+++ issm/trunk/src/m/classes/slr.js	(revision 26744)
@@ -114,5 +114,6 @@
 		} //}}}
 		this.marshall=function(md,prefix,fid) { //{{{
-
+			console.log('WARNING: NOT MARHSALLING SLR FOR NOW.');
+			return;
 			WriteData(fid,prefix,'object',this,'fieldname','deltathickness','format','DoubleMat','mattype',2);
 			WriteData(fid,prefix,'object',this,'fieldname','sealevel','mattype',1,'format','DoubleMat','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
Index: issm/trunk/src/m/classes/slr.m
===================================================================
--- issm/trunk/src/m/classes/slr.m	(revision 25994)
+++ 	(revision )
@@ -1,257 +1,0 @@
-%SLR class definition
-%
-%   Usage:
-%      slr=slr();
-
-classdef slr
-	properties (SetAccess=public) 
-		deltathickness         = NaN;
-		sealevel               = NaN;
-		spcthickness           = NaN;
-		maxiter                = 0;
-		reltol                 = 0;
-		abstol                 = 0;
-		love_h                 = 0; %provided by PREM model
-		love_k                 = 0; %ideam
-		love_l                 = 0; %ideam
-		tide_love_k            = 0; %ideam
-		tide_love_h            = 0; %ideam
-		fluid_love             = 0;
-		equatorial_moi         = 0;
-		polar_moi              = 0;
-		angular_velocity       = 0;
-		rigid                  = 0;
-		elastic                = 0;
-		rotation               = 0;
-		ocean_area_scaling     = 0;
-		hydro_rate             = 0; %rate of steric expansion from hydrological effects.
-		geodetic_run_frequency = 1; %how many time steps we skip before we run the geodetic part of the solver during transient
-		geodetic               = 0; %compute geodetic SLR? (in addition to steric?)
-		degacc                 = 0;
-		horiz                  = 0;
-		planetradius           = planetradius('earth');
-		requested_outputs      = {};
-		transitions            = {};
-	end
-	methods
-		function self = slr(varargin) % {{{
-			switch nargin
-				case 0
-					self=setdefaultparameters(self);
-				otherwise
-					error('constructor not supported');
-			end
-		end % }}}
-		function self = setdefaultparameters(self) % {{{
-		
-		%Convergence criterion: absolute, relative and residual
-		self.reltol=0.01; % 1 per cent 
-		self.abstol=NaN;  % default 
-
-		%maximum of non-linear iterations.
-		self.maxiter=5;
-
-		%computational flags: 
-		self.geodetic=0;
-		self.rigid=1;
-		self.elastic=1;
-		self.ocean_area_scaling=0;
-		self.rotation=1;
-
-		%tidal love numbers: 
-		self.tide_love_h=0.6149; %degree 2
-		self.tide_love_k=0.3055; % degree 2
-	
-		%secular fluid love number: 
-		self.fluid_love=0.942; 
-		
-		%moment of inertia: 
-		self.equatorial_moi=8.0077*10^37; % [kg m^2] 
-		self.polar_moi		 =8.0345*10^37; % [kg m^2] 
-
-		% mean rotational velocity of earth 
-		self.angular_velocity=7.2921*10^-5; % [s^-1] 
-
-		%numerical discretization accuracy
-		self.degacc=.01;
-
-		%hydro
-		self.hydro_rate=0;
-	
-		%how many time steps we skip before we run SLR solver during transient
-		self.geodetic_run_frequency=1;
-	
-		%output default:
-		self.requested_outputs={'default'};
-
-		%transitions should be a cell array of vectors: 
-		self.transitions={};
-
-		%horizontal displacement?  (not by default)
-		self.horiz=0;
-
-		%earth area
-		self.planetradius= planetradius('earth');
-		
-		end % }}}
-		function md = checkconsistency(self,md,solution,analyses) % {{{
-
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
-				return; 
-			end
-
-			%md = checkfield(md,'fieldname','slr.deltathickness','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','slr.deltathickness','timeseries',1,'NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.sealevel','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','slr.spcthickness','Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','slr.love_h','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.love_k','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.love_l','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.tide_love_h','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.tide_love_k','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.fluid_love','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.equatorial_moi','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.polar_moi','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.angular_velocity','NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','slr.reltol','size',[1 1]);
-			md = checkfield(md,'fieldname','slr.abstol','size',[1 1]);
-			md = checkfield(md,'fieldname','slr.maxiter','size',[1 1],'>=',1);
-			md = checkfield(md,'fieldname','slr.geodetic_run_frequency','size',[1 1],'>=',1);
-			md = checkfield(md,'fieldname','slr.hydro_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','slr.degacc','size',[1 1],'>=',1e-10);
-			md = checkfield(md,'fieldname','slr.requested_outputs','stringrow',1);
-			md = checkfield(md,'fieldname','slr.horiz','NaN',1,'Inf',1,'values',[0 1]);
-
-			%check that love numbers are provided at the same level of accuracy: 
-			if (size(self.love_h,1)~=size(self.love_k,1) | size(self.love_h,1)~=size(self.love_l,1)),
-				error('slr error message: love numbers should be provided at the same level of accuracy');
-			end
-
-			%cross check that whereever we have an ice load, the mask is <0 on each vertex: 
-			%pos=find(self.deltathickness);
-			%maskpos=md.mask.ice_levelset(md.mesh.elements(pos,:)); 
-			%[els,vertices]=find(maskpos>0);
-			%if length(els),
-			%	warning('slr checkconsistency fail: there are elements with ice loads where some vertices are not on the ice!');
-			%end
-
-			%check that if geodetic is requested, we are a mesh3dsurface model (planet), or if we are not, 
-			%a coupler to a planet model is provided. 
-			if self.geodetic,
-				if md.transient.iscoupler, 
-					%we are good; 
-				else
-					if strcmpi(class(md.mesh),'mesh3dsurface'),
-						%we are good
-					else
-						error('model is requesting geodetic computations without being a mesh3dsurface, or being coupled to one!');
-					end
-				end
-			end
-
-		end % }}}
-		function list=defaultoutputs(self,md) % {{{
-			list = {'Sealevel'};
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   slr parameters:'));
-
-			fielddisplay(self,'deltathickness','thickness change: ice height equivalent [m]');
-			fielddisplay(self,'sealevel','current sea level (prior to computation) [m]');
-			fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint) [m]');
-			fielddisplay(self,'reltol','sea level rise relative convergence criterion, (default, NaN: not applied)');
-			fielddisplay(self,'abstol','sea level rise absolute convergence criterion, NaN: not applied');
-			fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
-			fielddisplay(self,'love_h','load Love number for radial displacement');
-			fielddisplay(self,'love_k','load Love number for gravitational potential perturbation');
-			fielddisplay(self,'love_l','load Love number for horizontal displacements');
-			fielddisplay(self,'tide_love_k','tidal load Love number (deg 2)');
-			fielddisplay(self,'tide_love_h','tidal load Love number (deg 2)');
-			fielddisplay(self,'fluid_love','secular fluid Love number');
-			fielddisplay(self,'equatorial_moi','mean equatorial moment of inertia [kg m^2]');
-			fielddisplay(self,'polar_moi','polar moment of inertia [kg m^2]');
-			fielddisplay(self,'angular_velocity','mean rotational velocity of earth [per second]'); 
-			fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]'); 
-			fielddisplay(self,'hydro_rate','rate of hydrological expansion (in mm/yr)'); 
-			fielddisplay(self,'geodetic','compute geodetic SLR? ( in addition to steric?) default 0');
-			fielddisplay(self,'geodetic_run_frequency','how many time steps we skip before we run SLR solver during transient (default: 1)');
-			fielddisplay(self,'rigid','rigid earth graviational potential perturbation');
-			fielddisplay(self,'elastic','elastic earth graviational potential perturbation');
-			fielddisplay(self,'rotation','earth rotational potential perturbation');
-			fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
-			fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
-			fielddisplay(self,'requested_outputs','additional outputs requested');
-
-		end % }}}
-		function marshall(self,prefix,md,fid) % {{{
-			%WriteData(fid,prefix,'object',self,'fieldname','deltathickness','format','DoubleMat','mattype',2);
-			WriteData(fid,prefix,'object',self,'fieldname','deltathickness','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
-			%WriteData(fid,prefix,'object',self,'fieldname','deltathickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofelements+1);
-			WriteData(fid,prefix,'object',self,'fieldname','sealevel','mattype',1,'format','DoubleMat','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','spcthickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','reltol','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','abstol','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','maxiter','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','love_h','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','love_k','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','love_l','format','DoubleMat','mattype',1);
-			WriteData(fid,prefix,'object',self,'fieldname','tide_love_h','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','tide_love_k','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','fluid_love','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','equatorial_moi','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','polar_moi','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','angular_velocity','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','rigid','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','elastic','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','rotation','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','ocean_area_scaling','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','geodetic_run_frequency','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','hydro_rate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','degacc','format','Double');
-			WriteData(fid,prefix,'object',self,'fieldname','transitions','format','MatArray');
-			WriteData(fid,prefix,'object',self,'fieldname','horiz','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','geodetic','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','planetradius','format','Double');
-			
-			%process requested outputs
-			outputs = self.requested_outputs;
-			pos  = find(ismember(outputs,'default'));
-			if ~isempty(pos),
-				outputs(pos) = [];                         %remove 'default' from outputs
-				outputs      = [outputs defaultoutputs(self,md)]; %add defaults
-			end
-			WriteData(fid,prefix,'data',outputs,'name','md.slr.requested_outputs','format','StringArray');
-
-		end % }}}
-		function savemodeljs(self,fid,modelname) % {{{
-		
-			writejs1Darray(fid,[modelname '.slr.deltathickness'],self.deltathickness);
-			writejs1Darray(fid,[modelname '.slr.sealevel'],self.sealevel);
-			writejs1Darray(fid,[modelname '.slr.spcthickness'],self.spcthickness);
-			writejsdouble(fid,[modelname '.slr.maxiter'],self.maxiter);
-			writejsdouble(fid,[modelname '.slr.reltol'],self.reltol);
-			writejsdouble(fid,[modelname '.slr.abstol'],self.abstol);
-			writejs1Darray(fid,[modelname '.slr.love_h'],self.love_h);
-			writejs1Darray(fid,[modelname '.slr.love_k'],self.love_k);
-			writejs1Darray(fid,[modelname '.slr.love_l'],self.love_l);
-			writejsdouble(fid,[modelname '.slr.tide_love_k'],self.tide_love_k);
-			writejsdouble(fid,[modelname '.slr.tide_love_h'],self.tide_love_h);
-			writejsdouble(fid,[modelname '.slr.fluid_love'],self.fluid_love);
-			writejsdouble(fid,[modelname '.slr.equatorial_moi'],self.equatorial_moi);
-			writejsdouble(fid,[modelname '.slr.polar_moi'],self.polar_moi);
-			writejsdouble(fid,[modelname '.slr.angular_velocity'],self.angular_velocity);
-			writejsdouble(fid,[modelname '.slr.rigid'],self.rigid);
-			writejsdouble(fid,[modelname '.slr.elastic'],self.elastic);
-			writejsdouble(fid,[modelname '.slr.rotation'],self.rotation);
-			writejsdouble(fid,[modelname '.slr.ocean_area_scaling'],self.ocean_area_scaling);
-			writejsdouble(fid,[modelname '.slr.geodetic_run_frequency'],self.geodetic_run_frequency);
-			writejs1Darray(fid,[modelname '.slr.hydro_rate'],self.hydro_rate);
-			writejsdouble(fid,[modelname '.slr.degacc'],self.degacc);
-			writejscellstring(fid,[modelname '.slr.requested_outputs'],self.requested_outputs);
-			writejscellarray(fid,[modelname '.slr.transitions'],self.transitions);
-		end % }}}
-		function self = extrude(self,md) % {{{
-			self.sealevel=project3d(md,'vector',self.sealevel,'type','node');
-		end % }}}
-	end
-end
Index: issm/trunk/src/m/classes/slr.py
===================================================================
--- issm/trunk/src/m/classes/slr.py	(revision 25994)
+++ issm/trunk/src/m/classes/slr.py	(revision 26744)
@@ -7,13 +7,13 @@
 from planetradius import planetradius
 from WriteData import WriteData
+from project3d import project3d
 
 
 class slr(object):
-    '''
-    SLR class definition
-
-        Usage:
-          slr = slr()
-    '''
+    """SLR class definition
+
+    Usage:
+        slr = slr()
+    """
     def __init__(self):  # {{{
         self.deltathickness = np.nan
@@ -120,5 +120,5 @@
     def checkconsistency(self, md, solution, analyses):  # {{{
         # Early return
-        if 'SealevelriseAnalysis' not in analyses or (solution == 'TransientSolution' and not md.transient.isslr):
+        if 'SealevelchangeAnalysis' not in analyses or (solution == 'TransientSolution' and not md.transient.isslr):
             return md
 
@@ -153,5 +153,5 @@
         els = np.where(maskpos > 0)
         if len(els[0]) > 0:
-            warnings.warn('slr checkconsistency fail: there are elements with ice loads where some vertices are not on the ice!')
+            print('Warning: slr.py::checkconsistency: there are elements with ice loads where some vertices are not on the ice!')
 
         # Check that if geodetic is requested, we are a mesh3dsurface model (planet), or if we are not, a coupler to a planet model is provided
Index: issm/trunk/src/m/classes/solidearth.js
===================================================================
--- issm/trunk/src/m/classes/solidearth.js	(revision 26744)
+++ issm/trunk/src/m/classes/solidearth.js	(revision 26744)
@@ -0,0 +1,135 @@
+class solidearth {//{{{
+	/**
+	 * SOLIDEARTH class definition
+	 *
+	 * Usage:
+	 *     solidearth = solidearth();
+	 *     solidearth = solidearth('earth');
+	 */
+	constructor() {//{{{
+		this.settings = new solidearthsettings();
+		this.external = null;
+		this.lovenumbers = new lovenumbers();
+		this.rotational = new rotational();
+		this.planetradius = planetradius('earth');
+		this.requested_outputs = [];
+		this.transitions = [];
+		this.partitionice = [];
+		this.partitionhydro = [];
+		this.partitionocean = [];
+
+		let nargs = arguments.length;
+		if (nargs == 0) {
+			this.setdefaultparameters('earth');
+		} else if (nargs == 1) {
+			this.setdefaultparameters(arguments[0]);
+		} else {
+			error('solidearth constructor error message: zero or one argument only!');
+		}
+	} //}}}
+
+	disp() {//{{{
+		console.log('WARNING: solidearth::disp is not yet implemented');
+	} //}}}
+
+	setdefaultparameters(planet) {//{{{
+		// Output default
+		this.requested_outputs = ['default'];
+
+		// Transitions should be an array
+		this.transitions = [];
+
+		// No partitions requested for barystatic contribution
+		this.partitionice = [];
+		this.partitionhydro = [];
+		this.partitionocean = [];
+
+		// No external solutions by default
+		this.external = null;
+
+		// Planet radius
+		this.planetradius = planetradius(planet);
+	} //}}}
+
+	checkconsistency(md, solution, analyses) {//{{{
+		if (!analyses.includes('SealevelchangeAnalysis') || (solution === 'TransientSolution' && !md.transient.isslc)) {
+			return md;
+		}
+
+		md = checkfield(md, 'fieldname', 'solidearth.requested_outputs', 'stringrow', 1);
+
+		this.settings.checkconsistency(md, solution, analyses);
+		this.lovenumbers.checkconsistency(md, solution, analyses);
+		this.rotational.checkconsistency(md, solution, analyses);
+
+		if (this.external != null) {
+			if (typeof(this.external) != 'solidearthsolution') {
+				error('solidearth consistency check: external field should be a solidearthsolution');
+			}
+		}
+
+		return md;
+	} //}}}
+
+	defaultoutputs(md) {//{{{
+		return ['Sealevel'];
+	} //}}}
+
+	marshall(md, prefix, fid) {//{{{
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'planetradius', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'transitions', 'format', 'MatArray');
+
+		let npartice = 0;
+		if (this.partitionice.length) {
+			npartice = max(this.partitionice) + 2;
+		}
+
+		let nparthydro = 0;
+		if (this.partitionhydro.length) {
+			nparthydro = max(this.partitionhydro) + 2;
+		}
+
+		let npartocean = 0;
+		if (this.partitionocean.length) {
+			npartocean = max(this.partitionocean) + 2;
+		}
+
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'partitionice', 'mattype', 1, 'format', 'DoubleMat');
+		WriteData(fid, prefix, 'data', npartice, 'format', 'Integer', 'name', 'md.solidearth.npartice');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'partitionhydro', 'mattype', 1, 'format', 'DoubleMat');
+		WriteData(fid, prefix, 'data', nparthydro, 'format', 'Integer', 'name', 'md.solidearth.nparthydro');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'partitionocean', 'mattype', 1, 'format', 'DoubleMat');
+		WriteData(fid, prefix, 'data', npartocean, 'format', 'Integer', 'name', 'md.solidearth.npartocean');
+
+		this.settings.marshall(md, prefix, fid);
+		this.lovenumbers.marshall(md, prefix, fid);
+		this.rotational.marshall(md, prefix, fid);
+
+		if (this.external != null) {
+			WriteData(fid, prefix, 'data', 1, 'format', 'Integer', 'name', 'md.solidearth.isexternal');
+			this.external.marshall(md, prefix, fid);
+		} else {
+			WriteData(fid, prefix, 'data', 0, 'format', 'Integer', 'name', 'md.solidearth.isexternal');
+		}
+
+		// Process requested outputs
+		let outputs = this.requested_outputs;
+		let pos = find(ismember(outputs, 'default'));
+		if (pos.length) {
+			/*
+			NOTE: In order to handle case where user has added 'default' more 
+			than once to this.requested_outputs, need to remove elements by 
+			index in reverse order.
+			*/
+			for (let i = (pos.length - 1); i >= 0; --i) {
+				outputs.splice(pos[i], 1);
+			}
+
+			outputs.push(this.defaultoutputs(md));
+		}
+		WriteData(fid, prefix, 'data', outputs, 'name', 'md.solidearth.requested_outputs', 'format', 'StringArray');
+	} //}}}
+
+	extrude(md) {//{{{
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/solidearth.m
===================================================================
--- issm/trunk/src/m/classes/solidearth.m	(revision 25994)
+++ issm/trunk/src/m/classes/solidearth.m	(revision 26744)
@@ -3,11 +3,10 @@
 %   Usage:
 %      solidearth=solidearth();
+%      solidearth=solidearth('earth');
 
 classdef solidearth
 	properties (SetAccess=public) 
-		initialsealevel        = NaN;
 		settings               = solidearthsettings(); 
 		external               = [];
-		surfaceload            = surfaceload();
 		lovenumbers            = lovenumbers();
 		rotational             = rotational();
@@ -17,4 +16,22 @@
 		partitionice           = [];
 		partitionhydro         = [];
+		partitionocean         = [];
+	end
+	methods (Static)
+		function self = loadobj(self) % {{{
+			% 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 isstruct(self)
+				% 2021, Jan 10
+				if isfield(self,'sealevel')
+					self.initialsealevel = self.sealevel;
+				end
+				self = structtoobj(solidearth(),self);
+
+			end
+		end% }}}
 	end
 	methods
@@ -29,4 +46,22 @@
 			end
 		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   solidearth inputs, forcings and settings:'));
+
+			fielddisplay(self,'planetradius','planet radius [m]');
+			fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
+			fielddisplay(self,'requested_outputs','additional outputs requested');
+			fielddisplay(self,'partitionice','ice partition vector for barystatic contribution');
+			fielddisplay(self,'partitionhydro','hydro partition vector for barystatic contribution');
+			fielddisplay(self,'partitionocean','ocean partition vector for barystatic contribution');
+			if isempty(self.external), fielddisplay(self,'external','external solution, of the type solidearthsolution'); end
+			self.settings.disp();
+			self.lovenumbers.disp();
+			self.rotational.disp();
+			if ~isempty(self.external),
+				self.external.disp();
+			end
+
+		end % }}}
 		function self = setdefaultparameters(self,planet) % {{{
 
@@ -34,29 +69,28 @@
 			self.requested_outputs={'default'};
 
-			%transitions should be a cell array of vectors: 
+			%transitions should be a cell array of vectors:
 			self.transitions={};
-			
-			%no partitions requested for barystatic contribution: 
+
+			%no partitions requested for barystatic contribution:
 			self.partitionice=[];
 			self.partitionhydro=[];
+			self.partitionocean=[];
 
-			%no external solutions by defalt: 
+			%no external solutions by default:
 			self.external=[];
 
-			%earth radius
+			%planet radius
 			self.planetradius= planetradius(planet);
-		
+
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0), 
 				return; 
 			end
 
-			md = checkfield(md,'fieldname','solidearth.initialsealevel','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 			md = checkfield(md,'fieldname','solidearth.requested_outputs','stringrow',1);
 
 			self.settings.checkconsistency(md,solution,analyses);
-			self.surfaceload.checkconsistency(md,solution,analyses);
 			self.lovenumbers.checkconsistency(md,solution,analyses);
 			self.rotational.checkconsistency(md,solution,analyses);
@@ -68,34 +102,13 @@
 			end
 
-			
 		end % }}}
 		function list=defaultoutputs(self,md) % {{{
 			list = {'Sealevel'};
 		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   solidearth inputs, forcings and settings:'));
+		function marshall(self,prefix,md,fid) % {{{
 
-			fielddisplay(self,'initialsealevel','sea level at the start of computation) [m]');
-			fielddisplay(self,'planetradius','planet radius [m]');
-			fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
-			fielddisplay(self,'requested_outputs','additional outputs requested');
-			fielddisplay(self,'partitionice','ice partition vector for barystatic contribution');
-			fielddisplay(self,'partitionhydro','hydro partition vector for barystatic contribution');
-			if isempty(self.external), fielddisplay(self,'external','external solution, of the type solidearthsolution'); end
-			self.settings.disp();
-			self.surfaceload.disp();
-			self.lovenumbers.disp();
-			self.rotational.disp();
-			if ~isempty(self.external),
-				self.external.disp();
-			end
-
-		end % }}}
-		function marshall(self,prefix,md,fid) % {{{
-			
-			WriteData(fid,prefix,'object',self,'fieldname','initialsealevel','mattype',1,'format','DoubleMat','timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'fieldname','planetradius','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','transitions','format','MatArray');
-		
+
 			if ~isempty(self.partitionice),
 				npartice=max(self.partitionice)+2;
@@ -103,4 +116,5 @@
 				npartice=0;
 			end
+
 			if ~isempty(self.partitionhydro),
 				nparthydro=max(self.partitionhydro)+2;
@@ -108,22 +122,30 @@
 				nparthydro=0;
 			end
+			if ~isempty(self.partitionocean),
+				npartocean=max(self.partitionocean)+2;
+			else
+				npartocean=0;
+			end
 
-			
 			WriteData(fid,prefix,'object',self,'fieldname','partitionice','mattype',1,'format','DoubleMat');
 			WriteData(fid,prefix,'data',npartice,'format','Integer','name','md.solidearth.npartice');
 			WriteData(fid,prefix,'object',self,'fieldname','partitionhydro','mattype',1,'format','DoubleMat');
 			WriteData(fid,prefix,'data',nparthydro,'format','Integer','name','md.solidearth.nparthydro');
-			
+			WriteData(fid,prefix,'object',self,'fieldname','partitionocean','mattype',1,'format','DoubleMat');
+			WriteData(fid,prefix,'data',npartocean,'format','Integer','name','md.solidearth.npartocean');
+
 			self.settings.marshall(prefix,md,fid);
-			self.surfaceload.marshall(prefix,md,fid);
 			self.lovenumbers.marshall(prefix,md,fid);
 			self.rotational.marshall(prefix,md,fid);
 			if ~isempty(self.external),
+				WriteData(fid,prefix,'data',1,'format','Integer','name','md.solidearth.isexternal');
 				self.external.marshall(prefix,md,fid);
+			else
+				WriteData(fid,prefix,'data',0,'format','Integer','name','md.solidearth.isexternal');
 			end
-			
+
 			%process requested outputs
 			outputs = self.requested_outputs;
-			pos  = find(ismember(outputs,'default'));
+			pos = find(ismember(outputs,'default'));
 			if ~isempty(pos),
 				outputs(pos) = [];                         %remove 'default' from outputs
@@ -133,9 +155,9 @@
 
 		end % }}}
+		function self = extrude(self,md) % {{{
+		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
 		
-			writejs1Darray(fid,[modelname '.solidearth.initialsealevel'],self.initialsealevel);
 			self.settings.savemodeljs(fid,modelname);
-			self.surfaceload.savemodeljs(fid,modelname);
 			self.lovenumbers.savemodeljs(fid,modelname);
 			self.rotational.savemodeljs(fid,modelname);
@@ -147,7 +169,4 @@
 			writejscellarray(fid,[modelname '.solidearth.partition'],self.partition);
 		end % }}}
-		function self = extrude(self,md) % {{{
-			self.initialsealevel=project3d(md,'vector',self.initialsealevel,'type','node');
-		end % }}}
 	end
 end
Index: issm/trunk/src/m/classes/solidearth.py
===================================================================
--- issm/trunk/src/m/classes/solidearth.py	(revision 25994)
+++ issm/trunk/src/m/classes/solidearth.py	(revision 26744)
@@ -4,9 +4,10 @@
 from fielddisplay import fielddisplay
 from lovenumbers import lovenumbers
+from MatlabFuncs import *
 from planetradius import planetradius
 from project3d import project3d
 from rotational import rotational
 from solidearthsettings import solidearthsettings
-from surfaceload import surfaceload
+from solidearthsolution import solidearthsolution
 from WriteData import WriteData
 
@@ -17,11 +18,13 @@
     Usage:
         solidearth = solidearth()
+        solidearth = solidearth('earth')
+
+    TODO:
+    - Update translation from solidearth.m
     """
 
-    def __init__(self, *args):  #{{{
-        self.initialsealevel    = np.nan
+    def __init__(self, *args):  # {{{
         self.settings           = solidearthsettings()
-        self.external           = []
-        self.surfaceload        = surfaceload()
+        self.external           = None
         self.lovenumbers        = lovenumbers()
         self.rotational         = rotational()
@@ -31,7 +34,7 @@
         self.partitionice       = []
         self.partitionhydro     = []
+        self.partitionocean     = []
 
         nargs = len(args)
-
         if nargs == 0:
             self.setdefaultparameters('earth')
@@ -40,9 +43,7 @@
         else:
             raise Exception('solidearth constructor error message: zero or one argument only!')
-    #}}}
-
+    # }}}
     def __repr__(self):  # {{{
         s = '   solidearthinputs, forcings and settings:\n'
-        s += '{}\n'.format(fielddisplay(self, 'initialsealevel', 'sea level at the start of computation [m]'))
         s += '{}\n'.format(fielddisplay(self, 'planetradius', 'planet radius [m]'))
         s += '{}\n'.format(fielddisplay(self, 'transitions', 'indices into parts of the mesh that will be icecaps'))
@@ -50,17 +51,16 @@
         s += '{}\n'.format(fielddisplay(self, 'partitionice', 'ice partition vector for barystatic contribution'))
         s += '{}\n'.format(fielddisplay(self, 'partitionhydro', 'hydro partition vector for barystatic contribution'))
+        s += '{}\n'.format(fielddisplay(self, 'partitionocean', 'ocean partition vector for barystatic contribution'))
         if not self.external:
             s += '{}\n'.format(fielddisplay(self, 'external', 'external solution, of the type solidearthsolution'))
         print(self.settings)
-        print(self.surfaceload)
         print(self.lovenumbers)
         print(self.rotational)
-        if self.external:
+        if len(self.external):
             print(self.external)
         return s
-    #}}}
-
+    # }}}
     def setdefaultparameters(self, planet):  # {{{
-        # Default output
+        # Output default
         self.requested_outputs = ['default']
 
@@ -71,36 +71,31 @@
         self.partitionice = []
         self.partitionhydro = []
+        self.partitionocean = []
 
-        # No external solutions by defalt
-        self.external = []
+        # No external solutions by default
+        self.external = None
 
-        # Earth radius
+        # Planet radius
         self.planetradius = planetradius(planet)
-    #}}}
+    # }}}
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
+            return md
 
-    def checkconsistency(self, md, solution, analyses):  # {{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
-            return md
-        md = checkfield(md, 'fieldname', 'solidearth.initialsealevel', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices])
         md = checkfield(md, 'fieldname', 'solidearth.requested_outputs', 'stringrow', 1)
 
         self.settings.checkconsistency(md, solution, analyses)
-        self.surfaceload.checkconsistency(md, solution, analyses)
         self.lovenumbers.checkconsistency(md, solution, analyses)
         self.rotational.checkconsistency(md, solution, analyses)
         if self.external:
-            if not isinstance(self.external,'solidearthsolution'):
+            if not isa(self.external, solidearthsolution):
                 raise Exception('solidearth consistency check: external field should be a solidearthsolution')
-            end
-            self.external.checkconsistency(md,solution,analyses)
+            self.external.checkconsistency(md, solution, analyses)
         return md
-    #}}}
-
-    def defaultoutputs(self, md):  #{{{
+    # }}}
+    def defaultoutputs(self, md):  # {{{
         return ['Sealevel']
-    #}}}
-
-    def marshall(self, prefix, md, fid):  #{{{
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'initialsealevel', 'mattype', 1, 'format', 'DoubleMat', 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
+    # }}}
+    def marshall(self, prefix, md, fid):  # {{{
         WriteData(fid, prefix, 'object', self, 'fieldname', 'planetradius', 'format', 'Double')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'transitions', 'format', 'MatArray')
@@ -116,27 +111,34 @@
             nparthydro = 0
 
+        if len(self.partitionocean):
+            npartocean = np.max(self.partitionocean) + 2
+        else:
+            npartocean = 0
+
         WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionice', 'mattype', 1, 'format', 'DoubleMat');
         WriteData(fid, prefix, 'data', npartice, 'format', 'Integer', 'name', 'md.solidearth.npartice');
         WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionhydro', 'mattype', 1, 'format', 'DoubleMat');
         WriteData(fid, prefix, 'data', nparthydro,'format', 'Integer', 'name','md.solidearth.nparthydro');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'partitionocean', 'mattype', 1, 'format', 'DoubleMat');
+        WriteData(fid, prefix, 'data', npartocean,'format', 'Integer', 'name','md.solidearth.npartocean');
 
         self.settings.marshall(prefix, md, fid)
-        self.surfaceload.marshall(prefix, md, fid)
         self.lovenumbers.marshall(prefix, md, fid)
         self.rotational.marshall(prefix, md, fid)
         if self.external:
+            WriteData(fid, prefix, 'data', 1, 'format', 'Integer', 'name', 'md.solidearth.isexternal')
             self.external.marshall(prefix, md, fid)
+        else:
+            WriteData(fid, prefix, 'data', 0, 'format', 'Integer', 'name', 'md.solidearth.isexternal')
 
-        #process requested outputs
+        # Process requested outputs
         outputs = self.requested_outputs
         pos = np.where(np.asarray(outputs) == 'default')[0]
         if len(pos):
-            outputs = np.delete(outputs, pos)  #remove 'default' from outputs
-            outputs = np.append(outputs, self.defaultoutputs(md))  #add defaults
+            outputs = np.delete(outputs, pos) # remove 'default' from outputs
+            outputs = np.append(outputs, self.defaultoutputs(md)) # add defaults
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.solidearth.requested_outputs', 'format', 'StringArray')
-    #}}}
-
-    def extrude(self, md): #{{{
-        self.initialsealevel = project3d(md, 'vector', self.initialsealevel, 'type', 'node')
+    # }}}
+    def extrude(self, md):  # {{{
         return self
-    #}}}
+    # }}}
Index: issm/trunk/src/m/classes/solidearthsettings.js
===================================================================
--- issm/trunk/src/m/classes/solidearthsettings.js	(revision 26744)
+++ issm/trunk/src/m/classes/solidearthsettings.js	(revision 26744)
@@ -0,0 +1,145 @@
+class solidearthsettings {//{{{
+	/**
+	 * SOLIDEARTHSETTINGS class definition
+	 *
+	 * Usage:
+	 *     solidearthsettings = solidearthsettings();
+	 */
+	constructor() {//{{{
+		this.reltol					= 0;
+		this.abstol					= 0;
+		this.maxiter				= 0;
+		this.selfattraction			= 1;
+		this.elastic				= 1;
+		this.viscous				= 1;
+		this.rotation				= 1;
+		this.grdocean				= 1;
+		this.ocean_area_scaling		= 0;
+		this.runfrequency			= 1; // How many time steps will we skip before we run grd_core
+		this.sealevelloading		= 1; // Will sea-level loads be computed?
+		this.isgrd					= 0; // Will GRD patterns be computed?
+		this.compute_bp_grd			= 0; // Will GRD patterns for bottom pressures be computed?
+		this.degacc					= 0; // Degree increment for resolution of Green tables
+		this.timeacc				= 0; // Time step accuracy required to compute Green tables
+		this.horiz					= 0; // Compute horizontal deformation
+		this.grdmodel				= 0; // GRD model (0 by defualt, 1 for (visco-)elastic, 2 for Ivins)
+		this.cross_section_shape	= 0; // Cross section only used when GRD model is Ivins
+
+		if (arguments.length == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
+
+	disp() {//{{{
+		console.log('WARNING: solidearthsettings::disp is not yet implemented');
+	} //}}}
+
+	setdefaultparameters() {//{{{
+		// Convergence criterion: absolute, relative, and residual
+		this.restol = 0.01; // 1 percent
+		this.abstol = NaN;
+
+		// Maximum of non-linear iterations
+		this.maxiter = 5;
+
+		// Computational flags
+		this.selfattraction = 1;
+		this.elastic = 1;
+		this.viscous = 1;
+		this.rotation = 1;
+		this.grdocean = 1;
+		this.ocean_area_scaling = 0;
+		this.compute_bp_grd = 0;
+		this.isgrd = 0;
+		this.sealevelloading = 1;
+
+		// Numerical discretiztion accuracy
+		this.degacc = 0.01;
+		this.timeacc = 1;
+
+		// How many time steps we skip before we run solidearthsettings solver during transient
+		this.runfrequency = 1;
+
+		// Horizontal displacement? (not on by default)
+		this.horiz = 0;
+
+		// Cross section for Ivins model
+		this.cross_section_shape = 1; // Square as default (see idege in GiaDeflectionCorex)
+
+		// No GRD model by default
+		this.grdmodel = 0;
+	} //}}}
+
+	checkconsistency(md, solution, analyses) {//{{{
+		if (!analyses.includes('SealevelchangeAnalysis') || (solution === 'TransientSolution' && !md.transient.isslc)) {
+			return md;
+		}
+
+		md = checkfield(md, 'fieldname', 'solidearth.settings.reltol', 'size', [1]);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.abstol', 'size', [1]);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.maxiter', 'size', [1], '>=', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.runfrequency', 'size', [1], '>=', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.degacc', 'size', [1], '>=', 1e-10);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.timeacc', 'size', [1], '>', 0);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.horiz', 'NaN', 1, 'Inf', 1, 'values', [0, 1]);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.grdmodel', '>=', 0, '<=', 2);
+		md = checkfield(md, 'fieldname', 'solidearth.settings.cross_section_shape', 'numel', [1], 'values', [1, 2]);
+
+		// Checks on computational flags
+		if (this.elastic && !this.rigid) {
+			error('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set');
+		}
+		if (this.viscous && !this.elastic) {
+			error('solidearthsettings checkconsistency error message: need elastic on if viscous flag is set');
+		}
+
+		// A GRD computation has been requested, make some checks on the nature of the meshes provided
+		if (this.isgrd) {
+			if (strcmpi(typeof(md.mesh), 'mesh3dsurface')) {
+				if (this.grdmodel == 2) {
+					error('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)');
+				}
+			} else {
+				if (this.grdmodel == 1) {
+					error('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)');
+				}
+			}
+			
+			if (this.sealevelloading && !this.grdocean) {
+				error('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set');
+			}
+		}
+
+		if (this.compute_bp_grd && !md.solidearth.settings.isgrd) {
+			error('solidearthsettings checkconsistency error message; if bottom pressure grd patterns are requested, solidearth settings class should have isgrd flag on');
+		}
+
+		return md;
+	} //}}}
+
+	marshall(md, prefix, fid) {//{{{
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'reltol', 'name', 'md.solidearth.settings.reltol', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'abstol', 'name', 'md.solidearth.settings.abstol', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'maxiter', 'name', 'md.solidearth.settings.maxiter', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'selfattraction', 'name', 'md.solidearth.settings.selfattraction', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'elastic', 'name', 'md.solidearth.settings.elastic', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'viscous', 'name', 'md.solidearth.settings.viscous', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'rotation', 'name', 'md.solidearth.settings.rotation', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'grdocean', 'name', 'md.solidearth.settings.grdocean', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'ocean_area_scaling', 'name', 'md.solidearth.settings.ocean_area_scaling', 'format', 'Boolean');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'runfrequency', 'name', 'md.solidearth.settings.runfrequency', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'degacc', 'name', 'md.solidearth.settings.degacc', 'format', 'Double');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'timeacc', 'name', 'md.solidearth.settings.timeacc', 'format', 'Double', 'scale', md.constants.yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'horiz', 'name', 'md.solidearth.settings.horiz', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'sealevelloading', 'name', 'md.solidearth.settings.sealevelloading', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'isgrd', 'name', 'md.solidearth.settings.isgrd', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'compute_bp_grd', 'name', 'md.solidearth.settings.compute_bp_grd', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'grdmodel', 'name', 'md.solidearth.settings.grdmodel', 'format', 'Integer');
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'cross_section_shape', 'name', 'md.solidearth.settings.cross_section_shape', 'format', 'Integer');
+	} //}}}
+
+	extrude(md) {//{{{
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/solidearthsettings.m
===================================================================
--- issm/trunk/src/m/classes/solidearthsettings.m	(revision 25994)
+++ issm/trunk/src/m/classes/solidearthsettings.m	(revision 26744)
@@ -5,20 +5,46 @@
 
 classdef solidearthsettings
-	properties (SetAccess=public) 
+	properties (SetAccess=public)
 		reltol                 = 0;
 		abstol                 = 0;
 		maxiter                = 0;
-		rigid                  = 0;
-		elastic                = 0;
-		rotation               = 0;
+		selfattraction         = 1;
+		elastic                = 1;
+		viscous                = 1;
+		rotation               = 1;
+		grdocean               = 1;
 		ocean_area_scaling     = 0;
 		runfrequency           = 1; %how many time steps we skip before we run grd_core
-		computesealevelchange  = 1; %will sea-level be coputed? 
-		isgrd                  = 1; %will GRD patterns be computed? 
-		degacc                 = 0; %degree increment for resolution of Green tables
+		sealevelloading        = 1; %will sea-level loads be computed? 
+		isgrd                  = 0; %will GRD patterns be computed? 
+		compute_bp_grd         = 0; %will GRD patterns for bottom pressures be computed? 
+		degacc                 = 0; %degree increment for resolution of Green tables.
+		timeacc                = 0; %time step accuracy required to compute Green tables
 		horiz                  = 0; %compute horizontal deformation
-		glfraction             = 1; %barystatic contribution full or fractional (default fractional)
+		grdmodel               = 0; %grd model (0 by default, 1 for (visco-)elastic, 2 for Ivins)
+		cross_section_shape    = 0; %cross section only used when grd model is Ivins
+	end
+	methods (Static)
+		function self = loadobj(self) % {{{
+			% 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 isstruct(self)
+				% 2021, Jun 4
+				if isfield(self,'rigid')
+					self.selfattraction = self.rigid;
+				end
+				if isfield(self,'computesealevelchange')
+					self.sealevelloading = self.computesealevelchange;
+				end
+				self = structtoobj(solidearthsettings(),self);
+
+			end
+		end% }}}
 	end
 	methods
+
 		function self = solidearthsettings(varargin) % {{{
 			switch nargin
@@ -30,35 +56,64 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
-		
-		%Convergence criterion: absolute, relative and residual
-		self.reltol=0.01; % 1 per cent 
-		self.abstol=NaN;  % default 
 
-		%maximum of non-linear iterations.
-		self.maxiter=5;
+			%Convergence criterion: absolute, relative and residual
+			self.reltol=0.01; % 1 percent
+			self.abstol=NaN;  % default
 
-		%computational flags: 
-		self.rigid=1;
-		self.elastic=1;
-		self.rotation=1;
-		self.ocean_area_scaling=0;
-		self.isgrd=1;
-		self.computesealevelchange=1;
+			%maximum of non-linear iterations.
+			self.maxiter=5;
 
-		%numerical discretization accuracy
-		self.degacc=.01;
+			%computational flags:
+			self.selfattraction=1;
+			self.elastic=1;
+			self.viscous=1;
+			self.rotation=1;
+			self.grdocean=1;
+			self.ocean_area_scaling=0;
+			self.compute_bp_grd=0;
+			self.isgrd=0;
+			self.sealevelloading=1;
 
-		%how many time steps we skip before we run solidearthsettings solver during transient
-		self.runfrequency=1;
-		
-		%fractional contribution: 
-		self.glfraction=1;
-	
-		%horizontal displacement?  (not by default)
-		self.horiz=0;
+			%numerical discretization accuracy
+			self.degacc=.01;
+			self.timeacc=1; 
+
+			%how many time steps we skip before we run solidearthsettings solver during transient
+			self.runfrequency=1;
+
+			%horizontal displacement? (not on by default)
+			self.horiz=0;
+
+			%cross section for Ivins model
+			self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex)
+
+			%no grd model by default:
+			self.grdmodel=0;
+
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   solidearth settings:'));
+
+			fielddisplay(self,'reltol','sea level change relative convergence criterion (default, NaN: not applied)');
+			fielddisplay(self,'abstol','sea level change absolute convergence criterion(default, NaN: not applied)');
+			fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
+			fielddisplay(self,'grdocean','does this planet have an ocean, if set to 1: global water mass is conserved in GRD module (default: 1)'); 
+			fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area (default: No correction)'); 
+			fielddisplay(self,'sealevelloading','enables surface loading from sea-level change (default: 1)');
+			fielddisplay(self,'isgrd','compute GRD patterns (default: 1)');
+			fielddisplay(self,'compute_bp_grd','compute GRD patterns for bottom pressure loads (default: 1)');
+			fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)');
+			fielddisplay(self,'selfattraction','enables surface mass load to perturb the gravity field');
+			fielddisplay(self,'elastic','enables elastic deformation from surface loading');
+			fielddisplay(self,'viscous','enables viscous deformation from surface loading');
+			fielddisplay(self,'rotation','enables polar motion to feedback on the GRD fields');
+			fielddisplay(self,'degacc','accuracy (default: .01 deg) for numerical discretization of the Green''s functions');
+			fielddisplay(self,'timeacc','time accuracy (default: 1 yr) for numerical discretization of the Green''s functions');
+			fielddisplay(self,'grdmodel','type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)');
+			fielddisplay(self,'cross_section_shape','1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore');
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0), 
 				return; 
 			end
@@ -68,41 +123,36 @@
 			md = checkfield(md,'fieldname','solidearth.settings.runfrequency','size',[1 1],'>=',1);
 			md = checkfield(md,'fieldname','solidearth.settings.degacc','size',[1 1],'>=',1e-10);
+			md = checkfield(md,'fieldname','solidearth.settings.timeacc','size',[1 1],'>',0);
 			md = checkfield(md,'fieldname','solidearth.settings.horiz','NaN',1,'Inf',1,'values',[0 1]);
-			md = checkfield(md,'fieldname','solidearth.settings.glfraction','values',[0 1]);
+			md = checkfield(md,'fieldname','solidearth.settings.grdmodel','>=',0,'<=',2);
+			md = checkfield(md,'fieldname','solidearth.settings.cross_section_shape','numel',[1],'values',[1,2]);
 
-			%checks on computational flags
-			if self.elastic==1 & self.rigid==0,
-				error('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set');
+			if self.elastic==1 & self.selfattraction==0,
+				error('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set');
+			end
+			if self.viscous==1 & self.elastic==0,
+				error('solidearthsettings checkconsistency error message: need elastic on if viscous flag is set');
 			end
 
-			%a coupler to a planet model is provided. 
+			%a GRD computation has been requested, make some checks on the nature of the meshes provided. 
 			if self.isgrd,
-				if md.transient.iscoupler, 
-					%we are good; 
+				if strcmpi(class(md.mesh),'mesh3dsurface'),
+					if self.grdmodel==2,
+						error('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)');
+					end
 				else
-					if strcmpi(class(md.mesh),'mesh3dsurface'),
-						%we are good
-					else
-						error('model is requesting sealevel computations without being a mesh3dsurface, or being coupled to one!');
+					if self.grdmodel==1,
+						error('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)');
 					end
+				end
+				if self.sealevelloading==1 & self.grdocean==0
+					error('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set');
 				end
 			end
 
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   solidearth settings:'));
+			if self.compute_bp_grd==1 & md.solidearth.settings.isgrd==0,
+					error('solidearthsettings checkconsistency error message; if bottom pressure grd patterns are requested, solidearth settings class should have isgrd flag on');
+			end
 
-			fielddisplay(self,'reltol','sea level rise relative convergence criterion, (default, NaN: not applied)');
-			fielddisplay(self,'abstol','sea level rise absolute convergence criterion, NaN: not applied');
-			fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
-			fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]'); 
-			fielddisplay(self,'computesealevelchange','compute sealevel change (default 1)');
-			fielddisplay(self,'isgrd','compute GRD patterns (default 1)');
-			fielddisplay(self,'runfrequency','how many time steps we skip before we run solidearthsettings solver during transient (default: 1)');
-			fielddisplay(self,'rigid','rigid earth graviational potential perturbation');
-			fielddisplay(self,'elastic','elastic earth graviational potential perturbation');
-			fielddisplay(self,'rotation','earth rotational potential perturbation');
-			fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
-			fielddisplay(self,'glfraction','contribute fractionally (default, 1) to barystatic sea level');
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -110,30 +160,38 @@
 			WriteData(fid,prefix,'object',self,'fieldname','abstol','name','md.solidearth.settings.abstol','format','Double');
 			WriteData(fid,prefix,'object',self,'fieldname','maxiter','name','md.solidearth.settings.maxiter','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','rigid','name','md.solidearth.settings.rigid','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','selfattraction','name','md.solidearth.settings.selfattraction','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','elastic','name','md.solidearth.settings.elastic','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','viscous','name','md.solidearth.settings.viscous','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','rotation','name','md.solidearth.settings.rotation','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','grdocean','name','md.solidearth.settings.grdocean','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','ocean_area_scaling','name','md.solidearth.settings.ocean_area_scaling','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','runfrequency','name','md.solidearth.settings.runfrequency','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','degacc','name','md.solidearth.settings.degacc','format','Double');
+			WriteData(fid,prefix,'object',self,'fieldname','timeacc','name','md.solidearth.settings.timeacc','format','Double','scale',md.constants.yts);
 			WriteData(fid,prefix,'object',self,'fieldname','horiz','name','md.solidearth.settings.horiz','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','computesealevelchange','name','md.solidearth.settings.computesealevelchange','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','sealevelloading','name','md.solidearth.settings.sealevelloading','format','Integer');
 			WriteData(fid,prefix,'object',self,'fieldname','isgrd','name','md.solidearth.settings.isgrd','format','Integer');
-			WriteData(fid,prefix,'object',self,'fieldname','glfraction','name','md.solidearth.settings.glfraction','format','Integer');
-		end % }}}
-		function savemodeljs(self,fid,modelname) % {{{
-		
-			writejsdouble(fid,[modelname '.slr.settings.maxiter'],self.maxiter);
-			writejsdouble(fid,[modelname '.slr.settings.reltol'],self.reltol);
-			writejsdouble(fid,[modelname '.slr.settings.abstol'],self.abstol);
-			writejsdouble(fid,[modelname '.slr.settings.rigid'],self.rigid);
-			writejsdouble(fid,[modelname '.slr.settings.elastic'],self.elastic);
-			writejsdouble(fid,[modelname '.slr.settings.rotation'],self.rotation);
-			writejsdouble(fid,[modelname '.slr.settings.ocean_area_scaling'],self.ocean_area_scaling);
-			writejsdouble(fid,[modelname '.slr.settings.run_frequency'],self.run_frequency);
-			writejsdouble(fid,[modelname '.slr.settings.degacc'],self.degacc);
-			writejsdouble(fid,[modelname '.slr.settings.glfraction'],self.glfraction);
+			WriteData(fid,prefix,'object',self,'fieldname','compute_bp_grd','name','md.solidearth.settings.compute_bp_grd','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','grdmodel','name','md.solidearth.settings.grdmodel','format','Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','cross_section_shape','name','md.solidearth.settings.cross_section_shape','format','Integer');
 		end % }}}
 		function self = extrude(self,md) % {{{
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+			% TODO: Update the following fields so that coverage is complete
+			writejsdouble(fid,[modelname '.solidearth.settings.maxiter'],self.maxiter);
+			writejsdouble(fid,[modelname '.solidearth.settings.reltol'],self.reltol);
+			writejsdouble(fid,[modelname '.solidearth.settings.abstol'],self.abstol);
+			writejsdouble(fid,[modelname '.solidearth.settings.selfattraction'],self.selfattraction);
+			writejsdouble(fid,[modelname '.solidearth.settings.elastic'],self.elastic);
+			writejsdouble(fid,[modelname '.solidearth.settings.viscous'],self.viscous);
+			writejsdouble(fid,[modelname '.solidearth.settings.rotation'],self.rotation);
+			writejsdouble(fid,[modelname '.solidearth.settings.grdocean'],self.rotation);
+			writejsdouble(fid,[modelname '.solidearth.settings.ocean_area_scaling'],self.ocean_area_scaling);
+			writejsdouble(fid,[modelname '.solidearth.settings.run_frequency'],self.run_frequency);
+			writejsdouble(fid,[modelname '.solidearth.settings.degacc'],self.degacc);
+			writejsdouble(fid,[modelname '.solidearth.settings.timeacc'],self.timeacc);
+			writejsdouble(fid,[modelname '.solidearth.settings.cross_section_shape'],self.cross_section_shape);
+		end % }}}
 	end
 end
Index: issm/trunk/src/m/classes/solidearthsettings.py
===================================================================
--- issm/trunk/src/m/classes/solidearthsettings.py	(revision 25994)
+++ issm/trunk/src/m/classes/solidearthsettings.py	(revision 26744)
@@ -13,47 +13,56 @@
     """
 
-    def __init__(self, *args):  #{{{
+    def __init__(self, *args):  # {{{
         self.reltol                 = 0
         self.abstol                 = 0
         self.maxiter                = 0
-        self.rigid                  = 0
-        self.elastic                = 0
-        self.rotation               = 0
+        self.selfattraction         = 1
+        self.elastic                = 1
+        self.viscous                = 1
+        self.rotation               = 1
+        self.grdocean               = 1
         self.ocean_area_scaling     = 0
         self.runfrequency           = 1 # How many time steps we skip before we run grd_core
-        self.computesealevelchange  = 1 # Will grd_core compute sea level?
-        self.isgrd                  = 1 # Will GRD patterns be computed?
+        self.sealevelloading        = 1 # Will sea-level loads be computed?
+        self.isgrd                  = 0 # Will GRD patterns be computed?
+        self.compute_bp_grd         = 0 # Will GRD patterns for bottom pressures be computed?
         self.degacc                 = 0 # Degree increment for resolution of Green tables
-        self.horiz                  = 0 # Compute horizontal displacement?
-        self.glfraction             = 1 # Barystatic contribution: full or fractional (default: fractional)
+        self.timeacc                = 0 # Time step accuracy required to compute Green tables
+        self.horiz                  = 0 # Compute horizontal deformation?
+        self.grdmodel               = 0 # GRD model (0 by default, 1 for (visco-)elastic, 2 for Ivins)
+        self.cross_section_shape    = 0 # Cross section only used when GRD model is Ivins
 
-        nargin = len(args)
-
-        if nargin == 0:
+        if len(args) == 0:
             self.setdefaultparameters()
         else:
             raise Exception('constructor not supported')
-    #}}}
+    # }}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  # {{{
         s = '   solidearth settings:\n'
-        s += '{}\n'.format(fielddisplay(self, 'reltol', 'sea level rise relative convergence criterion, (default, NaN: not applied)'))
-        s += '{}\n'.format(fielddisplay(self, 'abstol', 'sea level rise absolute convergence criterion, NaN: not applied'))
+        s += '{}\n'.format(fielddisplay(self, 'reltol', 'sea level change relative convergence criterion (default, NaN: not applied)'))
+        s += '{}\n'.format(fielddisplay(self, 'abstol', 'sea level change absolute convergence criterion (default, NaN: not applied)'))
         s += '{}\n'.format(fielddisplay(self, 'maxiter', 'maximum number of nonlinear iterations'))
-        s += '{}\n'.format(fielddisplay(self, 'ocean_area_scaling', 'correction for model representation of ocean area [default: No correction]'))
-        s += '{}\n'.format(fielddisplay(self, 'computesealevelchange', 'compute sealevel change from GRD in addition to steric?) default 0'))
+        s += '{}\n'.format(fielddisplay(self, 'grdocean', 'does this planet have an ocean, if set to 1: global water mass is conserved in GRD module (default: 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'ocean_area_scaling', 'correction for model representation of ocean area (default: No correction)'))
+        s += '{}\n'.format(fielddisplay(self, 'sealevelloading', 'enables surface loading from sea-level change (default: 1)'))
         s += '{}\n'.format(fielddisplay(self, 'isgrd', 'compute GRD patterns (default: 1'))
+        s += '{}\n'.format(fielddisplay(self, 'compute_bp_grd', 'compute GRD patterns for bottom pressure loads (default 1)'))
         s += '{}\n'.format(fielddisplay(self, 'runfrequency', 'how many time steps we skip before we run solidearthsettings solver during transient (default: 1)'))
-        s += '{}\n'.format(fielddisplay(self, 'rigid', 'rigid earth graviational potential perturbation'))
-        s += '{}\n'.format(fielddisplay(self, 'elastic', 'elastic earth graviational potential perturbation'))
-        s += '{}\n'.format(fielddisplay(self, 'degacc', 'accuracy (default .01 deg) for numerical discretization of the Green\'s functions'))
-        s += '{}\n'.format(fielddisplay(self, 'glfraction', 'contribute fractionally (default, 1) to barystatic sea level'))
+        s += '{}\n'.format(fielddisplay(self, 'selfattraction', 'enables surface mass load to perturb the gravity field'))
+        s += '{}\n'.format(fielddisplay(self, 'elastic', 'enables elastic deformation from surface loading'))
+        s += '{}\n'.format(fielddisplay(self, 'viscous', 'enables viscous deformation from surface loading'))
+        s += '{}\n'.format(fielddisplay(self, 'rotation', 'enables polar motion to feedback on the GRD fields'))
+        s += '{}\n'.format(fielddisplay(self, 'degacc', 'accuracy (default: .01 deg) for numerical discretization of the Green\'s functions'))
+        s += '{}\n'.format(fielddisplay(self, 'timeacc', 'time accuracy (default: 1 year) for numerical discretization of the Green\'s functions'))
+        s += '{}\n'.format(fielddisplay(self, 'grdmodel', 'type of deformation model, 0 for no GRD, 1 for spherical GRD model (SESAW model), 2 for half-space planar GRD (visco-elastic model from Ivins)'))
+        s += '{}\n'.format(fielddisplay(self, 'cross_section_shape', '1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore'))
         return s
-    #}}}
+    # }}}
 
-    def setdefaultparameters(self): # {{{
+    def setdefaultparameters(self):  # {{{
         # Convergence criterion: absolute, relative, and residual
-        self.reltol = 0.01 # 1 percent
-        self.abstol = np.nan # default
+        self.reltol = 0.01  # 1 percent
+        self.abstol = np.nan  # default
 
         # Maximum of non-linear iterations
@@ -61,27 +70,35 @@
 
         # Computational flags
-        self.rigid = 1
+        self.selfattraction = 1
         self.elastic = 1
+        self.viscous = 1
         self.rotation = 1
+        self.grdocean = 1
         self.ocean_area_scaling = 0
-        self.isgrd = 1
-        self.computesealevelchange = 1
+        self.compute_bp_grd = 0
+        self.isgrd = 0
+        self.sealevelloading = 1
 
         # Numerical discretization accuracy
-        self.degacc = .01
+        self.degacc = 0.01
+        self.timeacc = 1
 
         # How many time steps we skip before we run solidearthsettings solver during transient
         self.runfrequency = 1
 
-        # Fractional contribution
-        self.glfraction = 1
-
         # Horizontal displacement? (not on by default)
         self.horiz = 0
-    #}}}
 
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
+        # Cross section for Ivins model
+        self.cross_section_shape = 1 # Square as default (see iedge in GiaDeflectionCorex)
+
+        # No GRD model by default
+        self.grdmodel = 0
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
             return md
+
         md = checkfield(md, 'fieldname', 'solidearth.settings.reltol', 'size', [1])
         md = checkfield(md, 'fieldname', 'solidearth.settings.abstol', 'size', [1])
@@ -89,42 +106,53 @@
         md = checkfield(md, 'fieldname', 'solidearth.settings.runfrequency', 'size', [1], '>=', 1)
         md = checkfield(md, 'fieldname', 'solidearth.settings.degacc', 'size', [1], '>=', 1e-10)
+        md = checkfield(md, 'fieldname', 'solidearth.settings.timeacc', 'size', [1], '>', 0)
         md = checkfield(md, 'fieldname', 'solidearth.settings.horiz', 'NaN', 1, 'Inf', 1, 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'solidearth.settings.glfraction', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'solidearth.settings.grdmodel', '>=', 0, '<=', 2)
+        md = checkfield(md, 'fieldname', 'solidearth.settings.cross_section_shape', 'numel', [1], 'values', [1, 2])
 
-        # Checks on computational flags
-        if self.elastic and not self.rigid:
-            raise Exception('solidearthsettings checkconsistency error message: need rigid on if elastic flag is set')
+        if self.elastic and not self.selfattraction:
+            raise Exception('solidearthsettings checkconsistency error message: need selfattraction on if elastic flag is set')
+        if self.viscous and not self.elastic:
+            raise Exception('solidearthsettings checkconsistency error message: need elastic on if viscous flag is set')
 
-        # A coupler to planet model is provided
+        # A GRD computation has been requested, make some checks on the nature of the meshes provided
         if self.isgrd:
-            if md.transient.iscoupler:
-                # We are good
-                pass
+            if md.mesh.__class__.__name__ == 'mesh3dsurface':
+                if self.grdmodel == 2:
+                    raise RuntimeException('model requires a 2D mesh to run gia Ivins computations (change mesh from mesh3dsurface to mesh2d)')
             else:
-                if md.mesh.__class__.__name__ == 'mesh3dsurface':
-                    # We are good
-                    pass
-                else:
-                    raise Exception('model is requesting sealevel computations without being a mesh3dsurface, or being coupled to one!')
+                if self.grdmodel == 1:
+                    raise RuntimeException('model requires a 3D surface mesh to run GRD computations (change mesh from mesh2d to mesh3dsurface)')
+            if self.sealevelloading and not self.grdocean:
+                raise RuntimeException('solidearthsettings checkconsistency error message: need grdocean on if sealevelloading flag is set')
+
+        if self.compute_bp_grd and not md.solidearth.settings.isgrd:
+            raise RuntimeException('solidearthsettings checkconsistency error message; if bottom pressure grd patterns are requested, solidearth settings class should have isgrd flag on')
+
         return md
-    #}}}
+    # }}}
 
-    def marshall(self, prefix, md, fid): #{{{
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'reltol', 'name', 'md.solidearth.settings.reltol', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'abstol', 'name', 'md.solidearth.settings.abstol', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'maxiter', 'name', 'md.solidearth.settings.maxiter', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'rigid', 'name', 'md.solidearth.settings.rigid', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'elastic', 'name', 'md.solidearth.settings.elastic', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'rotation', 'name', 'md.solidearth.settings.rotation', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'ocean_area_scaling', 'name', 'md.solidearth.settings.ocean_area_scaling', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'runfrequency', 'name', 'md.solidearth.settings.runfrequency', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'degacc', 'name', 'md.solidearth.settings.degacc', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'horiz', 'name', 'md.solidearth.settings.horiz', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'computesealevelchange', 'name', 'md.solidearth.settings.computesealevelchange', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname','isgrd', 'name', 'md.solidearth.settings.isgrd', 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname','glfraction', 'name', 'md.solidearth.settings.glfraction', 'format', 'Integer')
-    #}}}
+    def marshall(self, prefix, md, fid):  # {{{
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'reltol', 'name', 'md.solidearth.settings.reltol', 'format', 'Double');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'abstol', 'name', 'md.solidearth.settings.abstol', 'format', 'Double');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'maxiter', 'name', 'md.solidearth.settings.maxiter', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'selfattraction', 'name', 'md.solidearth.settings.selfattraction', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'elastic', 'name', 'md.solidearth.settings.elastic', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'viscous', 'name', 'md.solidearth.settings.viscous', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'rotation', 'name', 'md.solidearth.settings.rotation', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'grdocean', 'name', 'md.solidearth.settings.grdocean', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'ocean_area_scaling', 'name', 'md.solidearth.settings.ocean_area_scaling', 'format', 'Boolean');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'runfrequency', 'name', 'md.solidearth.settings.runfrequency', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'degacc', 'name', 'md.solidearth.settings.degacc', 'format', 'Double');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'timeacc', 'name', 'md.solidearth.settings.timeacc', 'format', 'Double', 'scale', md.constants.yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'horiz', 'name', 'md.solidearth.settings.horiz', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevelloading', 'name', 'md.solidearth.settings.sealevelloading', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'isgrd', 'name', 'md.solidearth.settings.isgrd', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'compute_bp_grd', 'name', 'md.solidearth.settings.compute_bp_grd', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'grdmodel', 'name', 'md.solidearth.settings.grdmodel', 'format', 'Integer');
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'cross_section_shape', 'name', 'md.solidearth.settings.cross_section_shape', 'format', 'Integer');
+    # }}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  # {{{
         return self
-    #}}}
+    # }}}
Index: issm/trunk/src/m/classes/solidearthsolution.js
===================================================================
--- issm/trunk/src/m/classes/solidearthsolution.js	(revision 26744)
+++ issm/trunk/src/m/classes/solidearthsolution.js	(revision 26744)
@@ -0,0 +1,77 @@
+class solidearthsolution {//{{{
+	/**
+	 * SOLIDEARTHSOLUTION class definition
+	 *
+	 * Usage:
+	 *     solidearthsolution = solidearthsolution();
+	 */
+	constructor() {//{{{
+		this.displacementeast	= [];
+		this.displacementnorth	= [];
+		this.displacementup		= [];
+		this.geoid				= [];
+
+		let nargs = arguments.length;
+		if (nargs == 0) {
+			this.setdefaultparameters();
+		} else {
+			error('constructor not supported');
+		}
+	} //}}}
+
+	setdefaultparameters() {//{{{
+		this.displacementeast	= [];
+		this.displacementnorth	= [];
+		this.displacementup		= [];
+		this.geoid				= [];
+	} //}}}
+
+	checkconsistency(md, solution, analyses) {//{{{
+		md = checkfield(md, 'fieldname', 'solidearth.external.displacementeast', 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.external.displacementnorth', 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.external.displacementup', 'Inf', 1, 'timeseries', 1);
+		md = checkfield(md, 'fieldname', 'solidearth.external.geoid', 'Inf', 1, 'timeseries', 1);
+
+		return md;
+	} //}}}
+
+	disp() {//{{{
+		console.log('WARNING: solidearthsolution::disp is not yet implemented');
+	} //}}}
+
+	marshall(md, prefix, fid) {//{{{
+		let yts = md.constants.yts;
+
+		// Transform our time series into time series rates
+		let displacementeast_rate	= [];
+		let displacementnorth_rate	= [];
+		let displacementup_rate		= [];
+		let geoid_rate				= [];
+		if (size(this.displacementeast, 1) == 1) {
+			disp('External solidearthsolution warning: only one time step provided, assuming the values are rates per year');
+			displacementeast_rate	= [this.displacementeast; 0];
+			displacementnorth_rate	= [this.displacementnorth; 0];
+			displacementup_rate		= [this.displacementup; 0];
+			geoid_rate				= [this.geoid; 0];
+		} else {
+			let time = this.displacementeast[end, :];
+			let dt = diff(time, 1, 2);
+			displacementeast_rate = diff(this.displacementeast[0:-1,:], 1, 2) ./ dt;
+			displacementeast_rate[end + 1, :] = time[0:-1];
+			displacementnorth_rate = diff(this.displacementnorth_rate[0:-1,:], 1, 2) ./ dt;
+			displacementnorth_rate[end + 1, :] = time[0:-1];
+			displacementup_rate = diff(this.displacementup_rate[0:-1,:], 1, 2) ./ dt;
+			displacementup_rate[end + 1, :] = time[0:-1];
+			geoid_rate = diff(this.geoid_rate[0:-1,:], 1, 2) ./ dt;
+			geoid_rate[end + 1, :] = tgeoid_rateime[0:-1];
+		}
+
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'displacementeast', 'data', displacementeast_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementeast', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'displacementup', 'data', displacementup_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementup', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'displacementnorth', 'data', displacementnorth_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementnorth', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+		WriteData(fid, prefix, 'object', this, 'fieldname', 'geoid', 'data', geoid_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.geoid', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+	} //}}}
+
+	extrude(md) {//{{{
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/classes/solidearthsolution.m
===================================================================
--- issm/trunk/src/m/classes/solidearthsolution.m	(revision 25994)
+++ issm/trunk/src/m/classes/solidearthsolution.m	(revision 26744)
@@ -10,5 +10,4 @@
 		displacementup=[];
 		geoid=[];
-		barystaticsealevel=[];
 	end
 	methods
@@ -21,4 +20,12 @@
 			end
 		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('%s','         units for time series is (yr)'));
+			fielddisplay(self,'displacementeast','solid-Earth Eastwards bedrock displacement series (m)');
+			fielddisplay(self,'displacementnorth','solid-Earth Northwards bedrock displacement time series (m)');
+			fielddisplay(self,'displacementup','solid-Earth bedrock uplift time series (m)');
+			fielddisplay(self,'geoid','solid-Earth geoid time series (m)');
+
+		end % }}}
 		function self = setdefaultparameters(self) % {{{
 	
@@ -27,5 +34,4 @@
 			self.displacementup=[];
 			self.geoid=[];
-			self.barystaticsealevel=[];
 	
 		end % }}}
@@ -36,23 +42,35 @@
 			md = checkfield(md,'fieldname','solidearth.external.displacementup','Inf',1,'timeseries',1);
 			md = checkfield(md,'fieldname','solidearth.external.geoid','Inf',1,'timeseries',1);
-			md = checkfield(md,'fieldname','solidearth.external.barystaticsealevel','Inf',1,'timeseries',1);
-
-		end % }}}
-		function disp(self) % {{{
-			fielddisplay(self,'displacementeast','solid-Earth Eastwards bedrock motion (m/yr)');
-			fielddisplay(self,'displacementnorth','solid-Earth Northwards bedrock motion (m/yr)');
-			fielddisplay(self,'displacementup','solid-Earth bedrock uplift rate (m/yr)');
-			fielddisplay(self,'geoid','solid-Earth geoid motion (m/yr)');
-			fielddisplay(self,'barystaticsealevel','barystatic absolute sea-level rate (m/yr)');
 
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
 			yts=md.constants.yts;
-			WriteData(fid,prefix,'object',self,'class','solidearthsolution','fieldname','displacementeast','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','solidearthsolution','fieldname','displacementnorth','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','solidearthsolution','fieldname','displacementup','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','solidearthsolution','fieldname','geoid','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'class','solidearthsolution','fieldname','barystaticsealevel','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
-	
+
+			%transform our time series into time series rates 
+			if size(self.displacementeast,2)==1
+				disp('External solidearthsolution warning: only one time step provided, assuming the values are rates per year');
+				displacementeast_rate=[self.displacementeast;0];
+				displacementnorth_rate=[self.displacementnorth;0];
+				displacementup_rate=[self.displacementup;0];
+				geoid_rate=[self.geoid;0];
+			else
+				time=self.displacementeast(end,:);
+				dt=diff(time,1,2);
+				displacementeast_rate=diff(self.displacementeast(1:end-1,:),1,2)./dt;
+				displacementeast_rate(end+1,:)=time(1:end-1);
+				displacementnorth_rate=diff(self.displacementnorth(1:end-1,:),1,2)./dt;
+				displacementnorth_rate(end+1,:)=time(1:end-1);
+				displacementup_rate=diff(self.displacementup(1:end-1,:),1,2)./dt;
+				displacementup_rate(end+1,:)=time(1:end-1);
+				geoid_rate=diff(self.geoid(1:end-1,:),1,2)./dt;
+				geoid_rate(end+1,:)=time(1:end-1);
+			end
+
+			WriteData(fid, prefix, 'name', 'md.solidearth.external.nature', 'data', 0, 'format', 'Integer');
+			WriteData(fid,prefix,'object',self,'fieldname','displacementeast','data',displacementeast_rate,'format','DoubleMat','name', 'md.solidearth.external.displacementeast','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementup','data',displacementup_rate,'format','DoubleMat','name', 'md.solidearth.external.displacementup','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			WriteData(fid,prefix,'object',self,'fieldname','displacementnorth','data',displacementnorth_rate,'format','DoubleMat','name', 'md.solidearth.external.displacementnorth','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			WriteData(fid,prefix,'object',self,'fieldname','geoid','data',geoid_rate,'format','DoubleMat','name', 'md.solidearth.external.geoid','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
+			
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
@@ -61,5 +79,4 @@
 			writejs1Darray(fid,[modelname '.solidearth.external.displacementup'],self.displacementup);
 			writejs1Darray(fid,[modelname '.solidearth.external.geoid'],self.geoid);
-			writejs1Darray(fid,[modelname '.solidearth.external.barystaticsealevel'],self.barystaticsealevel);
 		end % }}}
 		function self = extrude(self,md) % {{{
Index: issm/trunk/src/m/classes/solidearthsolution.py
===================================================================
--- issm/trunk/src/m/classes/solidearthsolution.py	(revision 26744)
+++ issm/trunk/src/m/classes/solidearthsolution.py	(revision 26744)
@@ -0,0 +1,85 @@
+import numpy as np
+
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+from WriteData import WriteData
+
+
+class solidearthsolution(object):
+    """SOLIDEARTHSOLUTION class definition
+
+    Usage:
+        solidearthsolution = solidearthsolution()
+    """
+
+    def __init__(self, *args):  # {{{
+        self.displacementeast = []
+        self.displacementnorth = []
+        self.displacementup = []
+        self.geoid = []
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise RuntimeError('constructor not supported')
+    # }}}
+
+    def __repr__(self):  # {{{
+        s = '         units for time series is (yr)\n'
+        s += '{}\n'.format(fielddisplay(self, 'displacementeast', 'solid-Earth Eastwards bedrock displacement series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'displacementnorth', 'solid-Earth Northwards bedrock displacement time series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'displacementup', 'solid-Earth bedrock uplift time series (m)'))
+        s += '{}\n'.format(fielddisplay(self, 'geoid', 'solid-Earth geoid time series (m)'))
+
+        return s
+    # }}}
+
+    def setdefaultparameters(self):  # {{{
+        self.displacementeast = []
+        self.displacementnorth = []
+        self.displacementup = []
+        self.geoid = []
+    # }}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementeast', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementnorth', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.displacementup', 'Inf', 1, 'timeseries', 1)
+        md = checkfield(md, 'fieldname', 'solidearth.external.geoid', 'Inf', 1, 'timeseries', 1)
+    # }}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        yts = md.constants.yts
+
+        print('sadjsda')
+        exit()
+
+        # Transform our time series into time series rates
+        if np.shape(self.displacementeast)[1] == 1:
+            print('solidearthsolution.py::marshall: Warning: only one time step provided, assuming the values are rates per year')
+            displacementeast_rate = np.append(np.array(self.displacementeast).reshape(-1, 1), 0)
+            displacementnorth_rate = np.append(np.array(self.displacementnorth).reshape(-1, 1), 0)
+            displacementup_rate = np.append(np.array(self.displacementup).reshape(-1, 1), 0)
+            geoid_rate = np.append(np.array(self.geoid).reshape(-1, 1), 0)
+        else:
+            time = self.displacementeast[-1, :]
+            dt = np.diff(time, axis=0)
+            displacementeast_rate = np.diff(self.displacementeast[0:-2, :], 1, 1) / dt
+            displacementeast_rate = np.append(displacementeast_rate,time[:-1].reshape(1,-1),axis=0)
+            displacementnorth_rate = np.diff(self.displacementnorth[0:-2, :], 1, 1) / dt
+            displacementnorth_rate = np.append(displacementnorth_rate,time[:-1].reshape(1,-1),axis=0)
+            displacementup_rate = np.diff(self.displacementup[0:-2, :], 1, 1) / dt
+            displacementup_rate = np.append(displacementup_rate,time[:-1].reshape(1,-1),axis=0)
+            geoid_rate = np.diff(self.geoid[0:-2, :], 1, 1) / dt
+            geoid_rate = np.append(geoid_rate,time[:-1].reshape(1,-1),axis=0)
+
+        WriteData(fid, prefix, 'name', 'md.solidearth.external.nature', 'data', 0, 'format', 'Integer')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementeast', 'data', displacementeast_rate, 'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementeast', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementup', 'data', displacementup_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementup', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementnorth', 'data', displacementnorth_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementnorth', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'geoid', 'data', geoid_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.geoid', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts);
+    # }}}
+
+    def extrude(self, md):  # {{{
+        return self
+    # }}}
Index: issm/trunk/src/m/classes/stochasticforcing.m
===================================================================
--- issm/trunk/src/m/classes/stochasticforcing.m	(revision 26744)
+++ issm/trunk/src/m/classes/stochasticforcing.m	(revision 26744)
@@ -0,0 +1,210 @@
+%STOCHASTICFORCING class definition
+%
+%   Usage:
+%      stochasticforcing=stochasticforcing();
+
+classdef stochasticforcing
+	properties (SetAccess=public)
+		isstochasticforcing	= 0;
+		fields					= NaN;
+		defaultdimension		= 0;
+		default_id				= NaN;
+		covariance				= NaN;
+		randomflag				= 1;
+	end
+	methods
+		function self = stochasticforcing(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = extrude(self,md) % {{{
+			%Nothing for now
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+			self.isstochasticforcing	= 0; %stochasticforcing is turned off by default
+			self.randomflag				= 1; %true randomness is implemented by default
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			%Early return
+			if ~self.isstochasticforcing, return; end
+
+			num_fields = numel(self.fields);
+
+			%Check that covariance matrix is positive definite
+			try
+				chol(self.covariance);
+			catch
+				error('md.stochasticforcing.covariance is not positive definite');
+			end
+
+			%Check that all fields agree with the corresponding md class and if any field needs the default params
+			checkdefaults	= false; %need to check defaults only if one of the fields does not have its own dimensionality
+			structstoch		= structstochforcing();
+			for field=self.fields
+				%Checking agreement of classes
+				if(contains(field,'SMB'))
+					mdname = structstoch.mdnames(find(strcmp(structstoch.fields,char(field))));
+					if~(isequal(class(md.smb),char(mdname)))
+						error('md.smb does not agree with stochasticforcing field %s', char(field));
+					end
+				end
+				if(contains(field,'FrontalForcings'))
+					mdname = structstoch.mdnames(find(strcmp(structstoch.fields,char(field))));
+					if~(isequal(class(md.frontalforcings),char(mdname)))
+						error('md.frontalforcings does not agree with stochasticforcing field %s', char(field));
+					end
+				end
+				if(contains(field,'Calving'))
+					mdname = structstoch.mdnames(find(strcmp(structstoch.fields,char(field))));
+					if~(isequal(class(md.calving),char(mdname)))
+						error('md.calving does not agree with stochasticforcing field %s', char(field));
+					end
+				end
+				if(contains(field,'BasalforcingsFloatingice'))
+					mdname = structstoch.mdnames(find(strcmp(structstoch.fields,char(field))));
+					if~(isequal(class(md.basalforcings),char(mdname)))
+						error('md.basalforcings does not agree with stochasticforcing field %s', char(field));
+					end
+				end
+				if(contains(field,'WaterPressure'))
+               mdname = structstoch.mdnames(find(strcmp(structstoch.fields,char(field))));
+               if~(isequal(class(md.friction),char(mdname)))
+                  error('stochasticforcing field %s is only implemented for default friction', char(field));
+               end
+               if(md.friction.coupling~=0 && md.friction.coupling~=1 && md.friction.coupling~=2)
+                  error('stochasticforcing field %s is only implemented for cases md.friction.coupling 0 or 1 or 2', char(field));
+               end
+               if(any(md.friction.q==0))
+                  error('stochasticforcing field %s requires non-zero q exponent',char(field));
+               end
+            end
+				%Checking for specific dimensions
+				if ~(strcmp(field,'SMBautoregression') || strcmp(field,'FrontalForcingsRignotAutoregression'))
+					checkdefaults = true; %field with non-specific dimensionality
+				end
+			end
+
+			%Retrieve sum of all the field dimensionalities
+			size_tot	= self.defaultdimension*num_fields;
+			indSMBar	= -1; %about to check for index of SMBautoregression
+			indTFar	= -1; %about to check for index of FrontalForcingsRignotAutoregression
+			if any(contains(self.fields,'SMBautoregression'))
+				size_tot = size_tot-self.defaultdimension+md.smb.num_basins;
+				indSMBar = find(contains(self.fields,'SMBautoregression')); %index of SMBar, now check for consistency with TFar timestep (08Nov2021)
+			end
+			if any(contains(self.fields,'FrontalForcingsRignotAutoregression'))
+				size_tot	= size_tot-self.defaultdimension+md.frontalforcings.num_basins;
+				indTFar	= find(contains(self.fields,'FrontalForcingsRignotAutoregression')); %index of TFar, now check for consistency with SMBar timestep (08Nov2021)
+			end
+
+			if(indSMBar~=-1 && indTFar~=-1) %both autoregressive models are used: check autoregressive time step consistency
+				if((md.smb.ar_timestep~=md.frontalforcings.ar_timestep) && any(self.covariance(1+sum(self.dimensions(1:indSMBar-1)):sum(self.dimensions(1:indSMBar)),1+sum(self.dimensions(1:indTFar-1)):sum(self.dimensions(1:indTFar))))~=0)
+					error('SMBautoregression and FrontalForcingsRignotAutoregression have different ar_timestep and non-zero covariance');
+				end
+			end
+
+			md = checkfield(md,'fieldname','stochasticforcing.isstochasticforcing','values',[0 1]);
+			md = checkfield(md,'fieldname','stochasticforcing.fields','numel',num_fields,'cell',1,'values',supportedstochforcings());
+			md = checkfield(md,'fieldname','stochasticforcing.covariance','NaN',1,'Inf',1,'size',[size_tot,size_tot]); %global covariance matrix
+			md = checkfield(md,'fieldname','stochasticforcing.randomflag','numel',[1],'values',[0 1]);
+			if(checkdefaults) %need to check the defaults
+				md = checkfield(md,'fieldname','stochasticforcing.defaultdimension','numel',1,'NaN',1,'Inf',1,'>',0);
+				md = checkfield(md,'fieldname','stochasticforcing.default_id','Inf',1,'>=',0,'<=',self.defaultdimension,'size',[md.mesh.numberofelements,1]);
+			end
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   stochasticforcing parameters:'));
+			fielddisplay(self,'isstochasticforcing','is stochasticity activated?');
+			fielddisplay(self,'fields','fields with stochasticity applied, ex: {''SMBautoregression''}, or {''FrontalForcingsRignotAutoregression''}');
+			fielddisplay(self,'defaultdimension','dimensionality of the noise terms (does not apply to fields with their specific dimension)');
+			fielddisplay(self,'default_id','id of each element for partitioning of the noise terms (does not apply to fields with their specific partition)');
+			fielddisplay(self,'covariance','covariance matrix for within- and between-fields covariance (units must be squared field units)');
+			fielddisplay(self,'randomflag','whether to apply real randomness (true) or pseudo-randomness with fixed seed (false)');
+			disp('Available fields:');
+			for field=supportedstochforcings()
+				fprintf('   %s\n',string(field));
+			end
+		end % }}}
+		function marshall(self,prefix,md,fid) % {{{
+
+			yts=md.constants.yts;
+			num_fields = numel(self.fields);
+
+			WriteData(fid,prefix,'object',self,'fieldname','isstochasticforcing','format','Boolean');
+			if ~self.isstochasticforcing 
+				return
+			else
+
+				%Retrieve dimensionality of each field
+				dimensions = self.defaultdimension*ones(1,num_fields);
+				ind = 1;
+				for field=self.fields
+					%Checking for specific dimensions
+					if(strcmp(field,'SMBautoregression'))
+						dimensions(ind) = md.smb.num_basins;
+					end
+					if(strcmp(field,'FrontalForcingsRignotAutoregression'))
+						dimensions(ind) = md.frontalforcings.num_basins;
+					end
+					ind = ind+1;
+				end
+
+				%Scaling covariance matrix (scale column-by-column and row-by-row)
+				scaledfields = {'DefaultCalving','FloatingMeltRate','SMBautoregression'}; %list of fields that need scaling *1/yts
+				tempcovariance = self.covariance; %copy of covariance to avoid writing back in member variable
+				for i=1:num_fields
+					if any(strcmp(scaledfields,self.fields(i)))
+						inds = [1+sum(dimensions(1:i-1)):1:sum(dimensions(1:i))];
+						for row=inds %scale rows corresponding to scaled field
+							tempcovariance(row,:) = 1./yts*tempcovariance(row,:);
+						end
+						for col=inds %scale columns corresponding to scaled field
+							tempcovariance(:,col) = 1./yts*tempcovariance(:,col);
+						end
+					end
+				end
+				%Set dummy default_id vector if defaults not used
+				if isnan(self.default_id)
+					self.default_id = zeros(md.mesh.numberofelements,1);
+				end
+				WriteData(fid,prefix,'data',num_fields,'name','md.stochasticforcing.num_fields','format','Integer');
+				WriteData(fid,prefix,'object',self,'fieldname','fields','format','StringArray');
+				WriteData(fid,prefix,'data',dimensions,'name','md.stochasticforcing.dimensions','format','IntMat');
+				WriteData(fid,prefix,'object',self,'fieldname','default_id','data',self.default_id-1,'format','IntMat','mattype',2); %0-indexed
+				WriteData(fid,prefix,'object',self,'fieldname','defaultdimension','format','Integer');
+				WriteData(fid,prefix,'data',tempcovariance,'name','md.stochasticforcing.covariance','format','DoubleMat');
+				WriteData(fid,prefix,'object',self,'fieldname','randomflag','format','Boolean');
+			end
+		end % }}}
+	end
+end
+function list = supportedstochforcings() % {{{
+	% Defines list of fields supported
+	% by the class md.stochasticforcing
+
+	list = structstochforcing();
+	list = list.fields;
+end % }}}
+function structure = structstochforcing() % {{{
+	% Defines structure with list of fields
+	% supported and corresponding md names
+	structure.fields = {...
+		'DefaultCalving',...
+		'FloatingMeltRate',...
+		'FrictionWaterPressure',...
+		'FrontalForcingsRignotAutoregression',...
+		'SMBautoregression'
+		};
+	structure.mdnames = {...
+		'calving',...
+		'basalforcings',...
+		'friction',...
+		'frontalforcingsrignotautoregression',...
+		'SMBautoregression'
+	};
+end % }}}
Index: issm/trunk/src/m/classes/stochasticforcing.py
===================================================================
--- issm/trunk/src/m/classes/stochasticforcing.py	(revision 26744)
+++ issm/trunk/src/m/classes/stochasticforcing.py	(revision 26744)
@@ -0,0 +1,188 @@
+import numpy as np
+from checkfield import checkfield
+from fielddisplay import fielddisplay
+from WriteData import WriteData
+
+
+class stochasticforcing(object):
+    """STOCHASTICFORCING class definition
+
+    Usage:
+        stochasticforcing = stochasticforcing()
+    """
+
+    def __init__(self, *args):  # {{{
+        self.isstochasticforcing = 0
+        self.fields = np.nan
+        self.defaultdimension = 0
+        self.default_id = np.nan
+        self.covariance = np.nan
+        self.randomflag = 1
+
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise RuntimeError('constructor not supported for stochasticforcing')
+
+    def __repr__(self):  # {{{
+        s = '   stochasticforcing parameters:\n'
+        s += '{}\n'.format(fielddisplay(self, 'isstochasticforcing', 'is stochasticity activated?'))
+        s += '{}\n'.format(fielddisplay(self, 'fields', 'fields with stochasticity applied, ex: [\'SMBautoregression\'], or [\'FrontalForcingsRignotAutoregression\']'))
+        s += '{}\n'.format(fielddisplay(self, 'defaultdimension', 'dimensionality of the noise terms (does not apply to fields with their specific dimension)'))
+        s += '{}\n'.format(fielddisplay(self, 'default_id', 'id of each element for partitioning of the noise terms (does not apply to fields with their specific partition)'))
+        s += '{}\n'.format(fielddisplay(self, 'covariance', 'covariance matrix for within- and between-fields covariance (units must be squared field units)'))
+        s += '{}\n'.format(fielddisplay(self, 'randomflag', 'whether to apply real randomness (true) or pseudo-randomness with fixed seed (false)'))
+        s += 'Available fields:\n'
+        s += '   DefaultCalving\n'
+        s += '   FloatingMeltRate\n'
+        s += '   SMBautoregression\n'
+        s += '   FrontalForcingsRignotAutoregression (thermal forcing)\n'
+        return s
+    #}}}
+
+    def setdefaultparameters(self):  # {{{
+        # Type of stabilization used
+        self.isstochasticforcing = 0 # stochasticforcing is turned off by default
+        self.fields = [] # Need to initialize to list to avoid "RuntimeError: object of type 'float' has no len()" on import of class
+        self.randomflag = 1 # true randomness is implemented by default
+        return self
+    #}}}
+
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        # Early return
+        if not self.isstochasticforcing:
+            return md
+
+        num_fields = len(self.fields)
+
+        # Check that covariance matrix is positive definite (this is done internally by linalg)
+        try:
+            np.linalg.cholesky(self.covariance)
+        except:
+            raise TypeError('md.stochasticforcing.covariance is not positive definite')
+
+        # Check that all fields agree with the corresponding md class and if any field needs the default params
+        checkdefaults = False # Need to check defaults only if one of the fields does not have its own dimensionality
+        structstoch = self.structstochforcing()
+        for field in self.fields:
+            # Checking agreement of classes
+            if 'SMB' in field:
+                mdname = structstoch[field]
+                if (type(md.smb).__name__ != mdname):
+                    raise TypeError('md.smb does not agree with stochasticforcing field {}'.format(field))
+            if 'FrontalForcings' in field:
+                mdname = structstoch[field]
+                if (type(md.frontalforcings).__name__ != mdname):
+                    raise TypeError('md.frontalforcings does not agree with stochasticforcing field {}'.format(field))
+            if 'Calving' in field:
+                mdname = structstoch[field]
+                if (type(md.calving).__name__ != mdname):
+                    raise TypeError('md.calving does not agree with stochasticforcing field {}'.format(field))
+            if 'BasalforcingsFloatingice' in field:
+                mdname = structstoch[field]
+                if (type(md.basalforcings).__name__ != mdname):
+                    raise TypeError('md.basalforcings does not agree with stochasticforcing field {}'.format(field))
+            if 'WaterPressure' in field:
+                mdname = structstoch[field]
+                if (type(md.friction).__name__ != mdname):
+                    raise TypeError('stochasticforcing field {} is only implemented for default friction'.format(field))
+                if (md.friction.coupling!=0 and md.friction.coupling!=1 and md.friction.coupling!=2):
+                    raise TypeError('stochasticforcing field {} is only implemented for cases md.friction.coupling 0 or 1 or 2'.format(field))
+                if (np.any(md.friction.q==0)):
+                        raise TypeError('stochasticforcing field {} requires non-zero q exponent'.format(field))
+
+            # Checking for specific dimensions
+            if not (field == 'SMBautoregression' or field == 'FrontalForcingsRignotAutoregression'):
+                checkdefaults = True # field with non-specific dimensionality
+
+        # Retrieve sum of all the field dimensionalities
+        size_tot = self.defaultdimension * num_fields
+        indSMBar = -1 # About to check for index of SMBautoregression
+        indTFar = -1 # About to check for index of FrontalForcingsRignotAutoregression
+        if ('SMBautoregression' in self.fields):
+            size_tot = size_tot - self.defaultdimension + md.smb.num_basins
+            indSMBar = self.fields.index('SMBautoregression') # Index of SMBar, now check for consistency with TFar timestep (08Nov2021)
+        if ('FrontalForcingsRignotAutoregression' in self.fields):
+            size_tot = size_tot - self.defaultdimension + md.frontalforcings.num_basins
+            indTFar = self.fields.index('FrontalForcingsRignotAutoregression') # Index of TFar, now check for consistency with SMBar timestep (08Nov2021)
+        if (indSMBar != -1 and indTFar != -1): # Both autoregressive models are used: check autoregressive time step consistency
+            covsum = self.covariance[np.sum(self.defaultdimensions[0:indSMBar]).astype(int):np.sum(self.defaultdimensions[0:indSMBar + 1]).astype(int), np.sum(self.defaultdimensions[0:indTFar]).astype(int):np.sum(self.defaultdimensions[0:indTFar + 1]).astype(int)]
+            if((md.smb.ar_timestep != md.frontalforcings.ar_timestep) and np.any(covsum != 0)):
+                raise IOError('SMBautoregression and FrontalForcingsRignotAutoregression have different ar_timestep and non-zero covariance')
+
+        md = checkfield(md, 'fieldname', 'stochasticforcing.isstochasticforcing', 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'stochasticforcing.fields', 'numel', num_fields, 'cell', 1, 'values', self.supportedstochforcings())
+        md = checkfield(md, 'fieldname', 'stochasticforcing.covariance', 'NaN', 1, 'Inf', 1, 'size', [size_tot, size_tot])  # global covariance matrix
+        md = checkfield(md, 'fieldname', 'stochasticforcing.randomflag', 'numel', [1], 'values', [0, 1])
+        if (checkdefaults):
+            md = checkfield(md, 'fieldname', 'stochasticforcing.defaultdimension', 'numel', 1, 'NaN', 1, 'Inf', 1, '>', 0)
+            md = checkfield(md, 'fieldname', 'stochasticforcing.default_id','Inf',1,'NaN',1,'>=',0,'<=',self.defaultdimension,'size', [md.mesh.numberofelements])
+        return md
+    # }}}
+
+    def extrude(self, md):  # {{{
+        # Nothing for now
+        return self
+    # }}}
+
+    def marshall(self, prefix, md, fid):  # {{{
+        yts = md.constants.yts
+        num_fields = len(self.fields)
+
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'isstochasticforcing', 'format', 'Boolean')
+        if not self.isstochasticforcing:
+            return md
+        else:
+            # Retrieve dimensionality of each field
+            dimensions = self.defaultdimension * np.ones((num_fields,))
+            for ind, field in enumerate(self.fields):
+                # Checking for specific dimensions
+                if (field == 'SMBautoregression'):
+                    dimensions[ind] = md.smb.num_basins
+                if (field == 'FrontalForcingsRignotAutoregression'):
+                    dimensions[ind] = md.frontalforcings.num_basins
+
+            # Scaling covariance matrix (scale column-by-column and row-by-row)
+            scaledfields = ['DefaultCalving','FloatingMeltRate','SMBautoregression'] # list of fields that need scaling * 1/yts
+            tempcovariance = np.copy(self.covariance)
+            for i in range(num_fields):
+                if self.fields[i] in scaledfields:
+                    inds = range(int(np.sum(dimensions[0:i])), int(np.sum(dimensions[0:i + 1])))
+                    for row in inds:  # scale rows corresponding to scaled field
+                        tempcovariance[row, :] = 1 / yts * tempcovariance[row, :]
+                    for col in inds:  # scale columns corresponding to scaled field
+                        tempcovariance[:, col] = 1 / yts * tempcovariance[:, col]
+            # Set dummy default_id vector if defaults not used
+            if np.any(np.isnan(self.default_id)):
+                self.default_id = np.zeros(md.mesh.numberofelements)
+            # Reshape dimensions as column array for marshalling
+            dimensions = dimensions.reshape(1,len(dimensions))
+
+            WriteData(fid, prefix, 'data', num_fields, 'name', 'md.stochasticforcing.num_fields', 'format', 'Integer')
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'fields', 'format', 'StringArray')
+            WriteData(fid, prefix, 'data', dimensions, 'name', 'md.stochasticforcing.dimensions', 'format', 'IntMat','mattype',2)
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'default_id', 'format', 'IntMat', 'mattype', 2)  #12Nov2021 make sure this is zero-indexed!
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'defaultdimension', 'format', 'Integer')
+            WriteData(fid, prefix, 'data', tempcovariance, 'name', 'md.stochasticforcing.covariance', 'format', 'DoubleMat')
+            WriteData(fid, prefix, 'object', self, 'fieldname', 'randomflag', 'format', 'Boolean')
+    # }}}
+
+    def supportedstochforcings(self):  # {{{
+        """Defines list of fields supported by the class md.stochasticforcing
+        """
+        list1 = self.structstochforcing()
+        list1 = list1.keys()
+        return list(list1)
+    #}}}
+
+    def structstochforcing(self):  # {{{
+        """Defines dictionary with list of fields
+           supported and corresponding md names
+        """
+        structure = {'DefaultCalving': 'calving',
+                     'FloatingMeltRate': 'basalforcings',
+                     'FrictionWaterPressure': 'friction',
+                     'FrontalForcingsRignotAutoregression': 'frontalforcingsrignotautoregression',
+                     'SMBautoregression': 'SMBautoregression'}
+        return structure
+    # }}}
Index: issm/trunk/src/m/classes/stressbalance.js
===================================================================
--- issm/trunk/src/m/classes/stressbalance.js	(revision 25994)
+++ issm/trunk/src/m/classes/stressbalance.js	(revision 26744)
@@ -158,11 +158,9 @@
 		WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','referential','format','DoubleMat','mattype',1);
 
-		var lx=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lx[i]=this.loadingforce[i][0];
-		var ly=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)ly[i]=this.loadingforce[i][1];
-		var lz=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lz[i]=this.loadingforce[i][2];
-
-		WriteData(fid,prefix,'data',lx,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcex');
-		WriteData(fid,prefix,'data',ly,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcey');
-		WriteData(fid,prefix,'data',lz,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcez');
+		if (size(this.loadingforce,1)==3) {
+			WriteData(fid,prefix,'data',ArrayCol(this.loadingforce,0),'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcex');
+			WriteData(fid,prefix,'data',ArrayCol(this.loadingforce,1),'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcey');
+			WriteData(fid,prefix,'data',ArrayCol(this.loadingforce,2),'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcez');
+		}
 
 		//process requested outputs
Index: issm/trunk/src/m/classes/stressbalance.m
===================================================================
--- issm/trunk/src/m/classes/stressbalance.m	(revision 25994)
+++ issm/trunk/src/m/classes/stressbalance.m	(revision 26744)
@@ -8,4 +8,8 @@
 		spcvx                  = NaN;
 		spcvy                  = NaN;
+		spcvx_base             = NaN;
+		spcvy_base             = NaN;
+		spcvx_shear            = NaN;
+		spcvy_shear            = NaN;
 		spcvz                  = NaN;
 		restol                 = 0;
@@ -32,4 +36,11 @@
 			self.loadingforce=project3d(md,'vector',self.loadingforce,'type','node');
 
+			% for MLHO
+			if md.flowequation.isMLHO
+				self.spcvx_base=project3d(md,'vector',self.spcvx_base,'type','node');
+				self.spcvy_base=project3d(md,'vector',self.spcvy_base,'type','node');
+				self.spcvx_shear=project3d(md,'vector',self.spcvx_shear,'type','poly','degree',4);
+				self.spcvy_shear=project3d(md,'vector',self.spcvy_shear,'type','poly','degree',4);
+			end
 		end % }}}
 		function self = stressbalance(varargin) % {{{
@@ -53,28 +64,28 @@
 		function self = setdefaultparameters(self) % {{{
 
-			 %maximum of non-linear iterations.
-			 self.maxiter=100;
-
-			 %Convergence criterion: absolute, relative and residual
-			 self.restol=10^-4;
-			 self.reltol=0.01;
-			 self.abstol=10;
-
-			 self.FSreconditioning=10^13;
-			 self.shelf_dampening=0;
-
-			 %Penalty factor applied kappa=max(stiffness matrix)*10^penalty_factor
-			 self.penalty_factor=3;
-
-			 %Stop the iterations of rift if below a threshold
-			 self.rift_penalty_threshold=0;
-
-			 %in some solutions, it might be needed to stop a run when only
-			 %a few constraints remain unstable. For thermal computation, this
-			 %parameter is often used.
-			 self.rift_penalty_lock=10;
-
-			 %output default:
-			 self.requested_outputs={'default'};
+			%maximum of non-linear iterations.
+			self.maxiter=100;
+
+			%Convergence criterion: absolute, relative and residual
+			self.restol=10^-4;
+			self.reltol=0.01;
+			self.abstol=10;
+
+			self.FSreconditioning=10^13;
+			self.shelf_dampening=0;
+
+			%Penalty factor applied kappa=max(stiffness matrix)*10^penalty_factor
+			self.penalty_factor=3;
+
+			%Stop the iterations of rift if below a threshold
+			self.rift_penalty_threshold=0;
+
+			%in some solutions, it might be needed to stop a run when only
+			%a few constraints remain unstable. For thermal computation, this
+			%parameter is often used.
+			self.rift_penalty_lock=10;
+
+			%output default:
+			self.requested_outputs={'default'};
 
 		end % }}}
@@ -123,4 +134,11 @@
 				md = checkfield(md,'fieldname','stressbalance.FSreconditioning','>',0);
 			end
+			% CHECK THIS ONLY WORKS FOR MLHO
+			if md.flowequation.isMLHO
+				md = checkfield(md,'fieldname','stressbalance.spcvx_base','Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','stressbalance.spcvy_base','Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','stressbalance.spcvx_shear','Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','stressbalance.spcvy_shear','Inf',1,'timeseries',1);
+			end
 		end % }}}
 		function list=defaultoutputs(self,md) % {{{
@@ -150,4 +168,10 @@
 			fielddisplay(self,'spcvy','y-axis velocity constraint (NaN means no constraint) [m/yr]');
 			fielddisplay(self,'spcvz','z-axis velocity constraint (NaN means no constraint) [m/yr]');
+
+			disp(sprintf('\n      %s','MLHO boundary conditions:'));
+			fielddisplay(self,'spcvx_base','x-axis basal velocity constraint (NaN means no constraint) [m/yr]');
+			fielddisplay(self,'spcvy_base','y-axis basal velocity constraint (NaN means no constraint) [m/yr]');
+			fielddisplay(self,'spcvx_shear','x-axis shear velocity constraint (NaN means no constraint) [m/yr]');
+			fielddisplay(self,'spcvy_shear','y-axis shear velocity constraint (NaN means no constraint) [m/yr]');
 
 			disp(sprintf('\n      %s','Rift options:'));
@@ -202,4 +226,11 @@
 			end
 			WriteData(fid,prefix,'data',outputs,'name','md.stressbalance.requested_outputs','format','StringArray');
+			% for MLHO
+			if (md.flowequation.isMLHO)
+				WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','spcvx_base','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+				WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','spcvy_base','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+				WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','spcvx_shear','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+				WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','spcvy_shear','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
+			end
 		end % }}}
 		function savemodeljs(self,fid,modelname) % {{{
@@ -223,4 +254,8 @@
 			writejscellstring(fid,[modelname '.stressbalance.requested_outputs'],self.requested_outputs);
 
+			writejs1Darray(fid,[modelname '.stressbalance.spcvx_base'],self.spcvx_shear);
+			writejs1Darray(fid,[modelname '.stressbalance.spcvy_base'],self.spcvy_shear);
+			writejs1Darray(fid,[modelname '.stressbalance.spcvx_shear'],self.spcvx_shear);
+			writejs1Darray(fid,[modelname '.stressbalance.spcvy_shear'],self.spcvy_shear);
 		end % }}}
 	end
Index: issm/trunk/src/m/classes/stressbalance.py
===================================================================
--- issm/trunk/src/m/classes/stressbalance.py	(revision 25994)
+++ issm/trunk/src/m/classes/stressbalance.py	(revision 26744)
@@ -18,7 +18,11 @@
 
     def __init__(self):  # {{{
-        self.spcvx = float('NaN')
-        self.spcvy = float('NaN')
-        self.spcvz = float('NaN')
+        self.spcvx = np.nan
+        self.spcvy = np.nan
+        self.spcvx_base = np.nan
+        self.spcvy_base = np.nan
+        self.spcvx_shear = np.nan
+        self.spcvy_shear = np.nan
+        self.spcvz = np.nan
         self.restol = 0
         self.reltol = 0
@@ -26,19 +30,20 @@
         self.isnewton = 0
         self.FSreconditioning = 0
-        self.icefront = float('NaN')
+        self.icefront = np.nan
         self.maxiter = 0
         self.shelf_dampening = 0
-        self.vertex_pairing = float('NaN')
-        self.penalty_factor = float('NaN')
-        self.rift_penalty_lock = float('NaN')
+        self.vertex_pairing = np.nan
+        self.penalty_factor = np.nan
+        self.rift_penalty_lock = np.nan
         self.rift_penalty_threshold = 0
-        self.referential = float('NaN')
-        self.loadingforce = float('NaN')
+        self.referential = np.nan
+        self.loadingforce = np.nan
         self.requested_outputs = []
 
-    #set defaults
+        # Set defaults
         self.setdefaultparameters()
 
-    #}}}
+    # }}}
+
     def __repr__(self):  # {{{
         s = '   StressBalance solution parameters:\n'
@@ -47,16 +52,21 @@
         s += '{}\n'.format(fielddisplay(self, 'reltol', 'velocity relative convergence criterion, NaN: not applied'))
         s += '{}\n'.format(fielddisplay(self, 'abstol', 'velocity absolute convergence criterion, NaN: not applied'))
-        s += '{}\n'.format(fielddisplay(self, 'isnewton', "0: Picard's fixed point, 1: Newton's method, 2: hybrid"))
+        s += '{}\n'.format(fielddisplay(self, 'isnewton', '0: Picard\'s fixed point, 1: Newton\'s method, 2: hybrid'))
         s += '{}\n'.format(fielddisplay(self, 'maxiter', 'maximum number of nonlinear iterations'))
         s += '      boundary conditions:\n'
-        s += '{}\n'.format(fielddisplay(self, 'spcvx', 'x - axis velocity constraint (NaN means no constraint) [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'spcvy', 'y - axis velocity constraint (NaN means no constraint) [m / yr]'))
-        s += '{}\n'.format(fielddisplay(self, 'spcvz', 'z - axis velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvx', 'x-axis velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvy', 'y-axis velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvz', 'z-axis velocity constraint (NaN means no constraint) [m / yr]'))
         s += '{}\n'.format(fielddisplay(self, 'icefront', 'segments on ice front list (last column 0: Air, 1: Water, 2: Ice'))
-        s = "%s\n%s" % (s, '\n      Rift options:')
+        s += '      MLHO boundary conditions:\n'
+        s += '{}\n'.format(fielddisplay(self, 'spcvx_base', 'x-axis basal velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvy_base', 'y-axis basal velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvx_shear', 'x-axis shear velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '{}\n'.format(fielddisplay(self, 'spcvy_shear', 'y-axis shear velocity constraint (NaN means no constraint) [m / yr]'))
+        s += '      Rift options:\n'
         s += '{}\n'.format(fielddisplay(self, 'rift_penalty_threshold', 'threshold for instability of mechanical constraints'))
         s += '{}\n'.format(fielddisplay(self, 'rift_penalty_lock', 'number of iterations before rift penalties are locked'))
         s += '      Penalty options:\n'
-        s += '{}\n'.format(fielddisplay(self, 'penalty_factor', 'offset used by penalties: penalty = Kmax * 1.0**offset'))
+        s += '{}\n'.format(fielddisplay(self, 'penalty_factor', 'offset used by penalties: penalty = Kmax * 10^offset'))
         s += '{}\n'.format(fielddisplay(self, 'vertex_pairing', 'pairs of vertices that are penalized'))
         s += '      Other:\n'
@@ -64,8 +74,8 @@
         s += '{}\n'.format(fielddisplay(self, 'FSreconditioning', 'multiplier for incompressibility equation. Only for FS model'))
         s += '{}\n'.format(fielddisplay(self, 'referential', 'local referential'))
-        s += '{}\n'.format(fielddisplay(self, 'loadingforce', 'loading force applied on each point [N / m^3]'))
+        s += '{}\n'.format(fielddisplay(self, 'loadingforce', 'loading force applied on each point [N/m^3]'))
         s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))
         return s
-    #}}}
+    # }}}
 
     def extrude(self, md):  # {{{
@@ -76,28 +86,40 @@
         self.loadingforce = project3d(md, 'vector', self.loadingforce, 'type', 'node')
 
+        if md.flowequation.isMLHO:
+            self.spcvx_base = project3d(md, 'vector', self.spcvx_base, 'type', 'node')
+            self.spcvy_base = project3d(md, 'vector', self.spcvy_base, 'type', 'node')
+            self.spcvx_shear = project3d(md, 'vector', self.spcvx_shear, 'type', 'poly', 'degree', 4)
+            self.spcvy_shear = project3d(md, 'vector', self.spcvy_shear, 'type', 'poly', 'degree', 4)
+
         return self
-    #}}}
+    # }}}
 
     def setdefaultparameters(self):  # {{{
-        #maximum of non - linear iterations.
+        # Maximum of non-linear iterations
         self.maxiter = 100
-        #Convergence criterion: absolute, relative and residual
-        self.restol = 1.0e-4
+
+        # Convergence criterion: absolute, relative and residual
+        self.restol = pow(10, -4)
         self.reltol = 0.01
         self.abstol = 10
-        self.FSreconditioning = 10**13
+
+        self.FSreconditioning = pow(10, 13)
         self.shelf_dampening = 0
-        #Penalty factor applied kappa = max(stiffness matrix) * 1.0**penalty_factor
+
+        # Penalty factor applied kappa = max(stiffness matrix) * 1.0^penalty_factor
         self.penalty_factor = 3
-        #Stop the iterations of rift if below a threshold
+
+        # Stop the iterations of rift if below a threshold
         self.rift_penalty_threshold = 0
-        #in some solutions, it might be needed to stop a run when only
-        #a few constraints remain unstable. For thermal computation, this
-        #parameter is often used.
+
+        # In some solutions, it might be needed to stop a run when only a few 
+        # constraints remain unstable. For thermal computation, this parameter 
+        # is often used.
         self.rift_penalty_lock = 10
-        #output default:
+
+        # Output default
         self.requested_outputs = ['default']
         return self
-    #}}}
+    # }}}
 
     def defaultoutputs(self, md):  # {{{
@@ -107,5 +129,5 @@
             list = ['Vx', 'Vy', 'Vel', 'Pressure']
         return list
-    #}}}
+    # }}}
 
     def checkconsistency(self, md, solution, analyses):  # {{{
@@ -131,13 +153,13 @@
         if not np.any(np.isnan(self.vertex_pairing)) and len(self.vertex_pairing) > 0:
             md = checkfield(md, 'fieldname', 'stressbalance.vertex_pairing', '>', 0)
-        #singular solution
+        # Singular solution
         #        if ~any((~isnan(md.stressbalance.spcvx) + ~isnan(md.stressbalance.spcvy)) == 2),
-        if not np.any(np.logical_and(np.logical_not(np.isnan(md.stressbalance.spcvx)), np.logical_not(np.isnan(md.stressbalance.spcvy)))):
+        if (not np.any(np.logical_or(np.logical_not(np.isnan(md.stressbalance.spcvx)), np.logical_not(np.isnan(md.stressbalance.spcvy))))) & (not np.any(md.mask.ocean_levelset>0)):
             print("\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n")
-        #CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
+        # CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
         #        if any(sum(isnan(md.stressbalance.referential), 2)~=0 & sum(isnan(md.stressbalance.referential), 2)~=6),
         if np.any(np.logical_and(np.sum(np.isnan(md.stressbalance.referential), axis=1) != 0, np.sum(np.isnan(md.stressbalance.referential), axis=1) != 6)):
             md.checkmessage("Each line of stressbalance.referential should contain either only NaN values or no NaN values")
-        #CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
+        # CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
         #        if any(sum(isnan(md.stressbalance.referential), 2) == 0),
         if np.any(np.sum(np.isnan(md.stressbalance.referential), axis=1) == 0):
@@ -149,9 +171,14 @@
                 if np.abs(np.inner(item[0:2], item[3:5])) > sys.float_info.epsilon:
                     md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
-        #CHECK THAT NO rotation specified for FS Grounded ice at base
+        # CHECK THAT NO rotation specified for FS Grounded ice at base
         if m.strcmp(md.mesh.domaintype(), '3D') and md.flowequation.isFS:
             pos = np.nonzero(np.logical_and(md.mask.ocean_levelset, md.mesh.vertexonbase))
             if np.any(np.logical_not(np.isnan(md.stressbalance.referential[pos, :]))):
                 md.checkmessage("no referential should be specified for basal vertices of grounded ice")
+        if md.flowequation.isMLHO:
+            md = checkfield(md, 'fieldname', 'stressbalance.spcvx_base', 'Inf', 1, 'timeseries', 1)
+            md = checkfield(md, 'fieldname', 'stressbalance.spcvy_base', 'Inf', 1, 'timeseries', 1)
+            md = checkfield(md, 'fieldname', 'stressbalance.spcvx_shear', 'Inf', 1, 'timeseries', 1)
+            md = checkfield(md, 'fieldname', 'stressbalance.spcvy_shear', 'Inf', 1, 'timeseries', 1)
         return md
     # }}}
@@ -188,3 +215,9 @@
             outputs = outputscopy
         WriteData(fid, prefix, 'data', outputs, 'name', 'md.stressbalance.requested_outputs', 'format', 'StringArray')
-    # }}}
+        # MLHO
+        if md.flowequation.isMLHO:
+            WriteData(fid, prefix, 'object', self, 'class', 'stressbalance', 'fieldname', 'spcvx_base', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+            WriteData(fid, prefix, 'object', self, 'class', 'stressbalance', 'fieldname', 'spcvy_base', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+            WriteData(fid, prefix, 'object', self, 'class', 'stressbalance', 'fieldname', 'spcvx_shear', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+            WriteData(fid, prefix, 'object', self, 'class', 'stressbalance', 'fieldname', 'spcvy_shear', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1. / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
+    # }}}
Index: issm/trunk/src/m/classes/surfaceload.m
===================================================================
--- issm/trunk/src/m/classes/surfaceload.m	(revision 25994)
+++ issm/trunk/src/m/classes/surfaceload.m	(revision 26744)
@@ -8,5 +8,5 @@
 		icethicknesschange     = [];
 		waterheightchange      = [];
-		other                  = [];
+		otherchange            = [];
 	end
 	methods
@@ -20,13 +20,13 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
-		
+
 			icethicknesschange=[];
 			waterheightchange=[];
-			other=[];
-		
+			otherchange=[];
+
 		end % }}}
-			function md = checkconsistency(self,md,solution,analyses) % {{{
+		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			if ~ismember('SealevelriseAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslr==0), 
+			if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc==0), 
 				return; 
 			end
@@ -43,5 +43,5 @@
 				md = checkfield(md,'fieldname','solidearth.surfaceload.waterheightchange','timeseries',1,'NaN',1,'Inf',1);
 			end
-			if ~isempty(self.other),
+			if ~isempty(self.otherchange),
 				md = checkfield(md,'fieldname','solidearth.surfaceload.other','timeseries',1,'NaN',1,'Inf',1);
 			end
@@ -61,30 +61,95 @@
 			fielddisplay(self,'icethicknesschange','thickness change: ice height equivalent [mIce/yr]');
 			fielddisplay(self,'waterheightchange','water height change: water height equivalent [mWater/yr]');
-			fielddisplay(self,'other','other loads (sediments) [kg/m^2/yr]');
+			fielddisplay(self,'otherchange','other loads (sediments) [kg/m^2/yr]');
 
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
 
+			%deal with ice thickness change: {{{
 			if isempty(self.icethicknesschange),
 				self.icethicknesschange=zeros(md.mesh.numberofelements+1,1);
 			end
+
+			yts=md.constants.yts;
+
+			if isa(self.icethicknesschange,'cell'),
+				%transform our cell array of time series into cell array of time series of rates 
+				nummodels=length(self.icethicknesschange);
+				for i=1:nummodels,
+					icethicknesschange=self.icethicknesschange{i}; 
+					time=icethicknesschange(end,:);
+					dt=diff(time,1,2);
+					icethicknesschange_rate=diff(icethicknesschange(1:end-1,:),1,2)./dt;
+					self.icethicknesschange{i}=icethicknesschange_rate; 
+				end
+				WriteData(fid,prefix,'object',self,'fieldname','icethicknesschange','name','md.solidearth.surfaceload.icethicknesschange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
+			else
+				icethicknesschange=self.icethicknesschange;
+				time=icethicknesschange(end,:);
+				dt=diff(time,1,2);
+				icethicknesschange_rate=diff(icethicknesschange(1:end-1,:),1,2)./dt;
+				self.icethicknesschange=icethicknesschange_rate; 
+
+				WriteData(fid,prefix,'object',self,'fieldname','icethicknesschange','name','md.solidearth.surfaceload.icethicknesschange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
+			end
+			%}}}
+			%deal with water height change: {{{
 			if isempty(self.waterheightchange),
 				self.waterheightchange=zeros(md.mesh.numberofelements+1,1);
 			end
-			if isempty(self.other),
-				self.other=zeros(md.mesh.numberofelements+1,1);
+
+			if isa(self.waterheightchange,'cell'),
+				%transform our cell array of time series into cell array of time series of rates 
+				nummodels=length(self.waterheightchange);
+				for i=1:nummodels,
+					waterheightchange=self.waterheightchange{i}; 
+					time=waterheightchange(end,:);
+					dt=diff(time,1,2);
+					waterheightchange_rate=diff(waterheightchange(1:end-1,:),1,2)./dt;
+					self.waterheightchange{i}=waterheightchange_rate; 
+				end
+				WriteData(fid,prefix,'object',self,'fieldname','waterheightchange','name','md.solidearth.surfaceload.waterheightchange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
+			else
+				waterheightchange=self.waterheightchange;
+				time=waterheightchange(end,:);
+				dt=diff(time,1,2);
+				waterheightchange_rate=diff(waterheightchange(1:end-1,:),1,2)./dt;
+				self.waterheightchange=waterheightchange_rate; 
+
+				WriteData(fid,prefix,'object',self,'fieldname','waterheightchange','name','md.solidearth.surfaceload.waterheightchange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
 			end
-			if isa(self.icethicknesschange,'cell'),
-				WriteData(fid,prefix,'object',self,'fieldname','icethicknesschange','name','md.solidearth.surfaceload.icethicknesschange',...
-				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
-			else
-				WriteData(fid,prefix,'object',self,'fieldname','icethicknesschange','name','md.solidearth.surfaceload.icethicknesschange',...
-				'format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			%}}}
+			%deal with other: {{{
+			if isempty(self.otherchange),
+				self.otherchange=zeros(md.mesh.numberofelements+1,1);
 			end
 
-			WriteData(fid,prefix,'object',self,'fieldname','waterheightchange','name','md.solidearth.surfaceload.waterheightchange',...
-				'format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
-			WriteData(fid,prefix,'object',self,'fieldname','other','name','md.solidearth.surfaceload.other',...
-				'format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts);
+			if isa(self.otherchange,'cell'),
+				%transform our cell array of time series into cell array of time series of rates 
+				nummodels=length(self.otherchange);
+				for i=1:nummodels,
+					otherchange=self.otherchange{i}; 
+					time=otherchange(end,:);
+					dt=diff(time,1,2);
+					otherchange_rate=diff(otherchange(1:end-1,:),1,2)./dt;
+					self.otherchange{i}=otherchange_rate; 
+				end
+				WriteData(fid,prefix,'object',self,'fieldname','otherchange','name','md.solidearth.surfaceload.otherchange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
+			else
+				otherchange=self.otherchange;
+				time=otherchange(end,:);
+				dt=diff(time,1,2);
+				otherchange_rate=diff(otherchange(1:end-1,:),1,2)./dt;
+				self.otherchange=otherchange_rate; 
+
+				WriteData(fid,prefix,'object',self,'fieldname','otherchange','name','md.solidearth.surfaceload.otherchange',...
+				'format','MatArray','timeserieslength',md.mesh.numberofelements+1,'yts',yts,'scale',1/yts);
+			end
+			%}}}
 
 		end % }}}
@@ -93,5 +158,5 @@
 			writejs1Darray(fid,[modelname '.surfaceload.icethicknesschange'],self.icethicknesschange);
 			writejs1Darray(fid,[modelname '.surfaceload.waterheightchange'],self.waterheightchange);
-			writejs1Darray(fid,[modelname '.surfaceload.other'],self.other);
+			writejs1Darray(fid,[modelname '.surfaceload.otherchange'],self.otherchange);
 		end % }}}
 		function self = extrude(self,md) % {{{
Index: issm/trunk/src/m/classes/surfaceload.py
===================================================================
--- issm/trunk/src/m/classes/surfaceload.py	(revision 25994)
+++ issm/trunk/src/m/classes/surfaceload.py	(revision 26744)
@@ -13,9 +13,9 @@
     """
 
-    def __init__(self, *args): #{{{
-        self.icethicknesschange = []
-        self.waterheightchange  = []
-        self.other              = []
-        
+    def __init__(self, *args):  #{{{
+        self.icethicknesschange = np.nan
+        self.waterheightchange = np.nan
+        self.other = np.nan
+
         nargin = len(args)
 
@@ -26,5 +26,5 @@
     #}}}
 
-    def __repr__(self): # {{{
+    def __repr__(self):  #{{{
         s = '   surfaceload:\n'
         s += '{}\n'.format(fielddisplay(self, 'icethicknesschange', 'thickness change: ice height equivalent [mIce/yr]'))
@@ -34,33 +34,48 @@
     #}}}
 
-    def setdefaultparameters(self): # {{{
+    def setdefaultparameters(self):  # {{{
         return self
     #}}}
 
-    def checkconsistency(self, md, solution, analyses): # {{{
-        if ('SealevelriseAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslr):
+    def checkconsistency(self, md, solution, analyses):  # {{{
+        if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc):
             return md
-        if len(self.icethicknesschange):
-            md  = checkfield(md,'fieldname', 'solidearth.surfaceload.icethicknesschange', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
-        if len(self.waterheightchange):
-            md  = checkfield(md,'fieldname', 'solidearth.surfaceload.waterheightchange', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
-        if len(self.other):
-            md  = checkfield(md,'fieldname', 'solidearth.surfaceload.other', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
+        if type(self.icethicknesschange) == np.ndarray:
+            md = checkfield(md, 'fieldname', 'solidearth.surfaceload.icethicknesschange', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
+        if type(self.waterheightchange) == np.ndarray:
+            md = checkfield(md, 'fieldname', 'solidearth.surfaceload.waterheightchange', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
+        if type(self.other) == np.ndarray:
+            md = checkfield(md, 'fieldname', 'solidearth.surfaceload.other', 'timeseries', 1, 'NaN', 1, 'Inf', 1)
         return md
     #}}}
 
-    def marshall(self, prefix, md, fid): #{{{
-        if len(self.icethicknesschange) == 0:
+    def marshall(self, prefix, md, fid):  #{{{
+        # TODO
+        # - When surfaceload class is used eventually, check premarshall 
+        # modifications against those done in MATLAB
+        #
+
+        # Deal with ice thickness change
+        if np.isempty(self.icethicknesschange):
             self.icethicknesschange = np.zeros((md.mesh.numberofelements + 1, ))
-        if len(self.waterheightchange) == 0:
+
+        yts = md.constants.yts
+
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'icethicknesschange', 'name', 'md.solidearth.surfaceload.icethicknesschange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts)
+
+        # Deal with ice thickness change
+        if np.isempty(self.waterheightchange):
             self.waterheightchange = np.zeros((md.mesh.numberofelements + 1, ))
-        if len(self.other) == 0:
-            self.other = np.zeros((md.mesh.numberofelements + 1, ))
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'icethicknesschange', 'name', 'md.solidearth.surfaceload.icethicknesschange', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'waterheightchange', 'name', 'md.solidearth.surfaceload.waterheightchange', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'other', 'name', 'md.solidearth.surfaceload.other', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts)
+
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'waterheightchange', 'name', 'md.solidearth.surfaceload.waterheightchange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts)
+
+        # Deal with ice thickness change
+        if np.isempty(self.otherchange):
+            self.otherchange = np.zeros((md.mesh.numberofelements + 1, ))
+
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'otherchange', 'name', 'md.solidearth.surfaceload.otherchange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts)
     #}}}
 
-    def extrude(self, md): #{{{
+    def extrude(self, md):  #{{{
         return self
     #}}}
Index: issm/trunk/src/m/classes/taoinversion.m
===================================================================
--- issm/trunk/src/m/classes/taoinversion.m	(revision 25994)
+++ issm/trunk/src/m/classes/taoinversion.m	(revision 26744)
@@ -114,6 +114,6 @@
 			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',supportedcostfunctions());
 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
-			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
-			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
+			md = checkfield(md,'fieldname','inversion.min_parameters','size',[NaN num_controls]);
+			md = checkfield(md,'fieldname','inversion.max_parameters','size',[NaN num_controls]);
 
 			if strcmp(solution,'BalancethicknessSolution')
Index: issm/trunk/src/m/classes/thermal.js
===================================================================
--- issm/trunk/src/m/classes/thermal.js	(revision 25994)
+++ issm/trunk/src/m/classes/thermal.js	(revision 26744)
@@ -64,9 +64,9 @@
 		return "thermal";
 	}// }}}
-	this.extrude = function(md) {//{{{
-		this.spctemperature=project3d(md,'vector',this.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',NaN);
-		if (md.initialization.temperature.length===md.mesh.numberofvertices) {
-			this.spctemperature = NewArrayFill(md.mesh.numberofvertices, NaN);
-			var pos=ArrayFindNot(md.mesh.vertexonsurface, 0);
+    this.extrude = function(md) {//{{{
+        this.spctemperature=project3d(md,'vector',this.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',NaN);
+        if (md.initialization.temperature.length===md.mesh.numberofvertices) {
+            this.spctemperature = NewArrayFill(md.mesh.numberofvertices, NaN);
+            var pos=ArrayFindNot(md.mesh.vertexonsurface, 0);
 			// impose observed temperature on surface
 			for (var i=0,posIndex=0,count=0;i<md.initialization.temperature.length;i++){
@@ -89,8 +89,8 @@
 //				}
 //			}
-		}
+        }
 
-		return this;
-	}//}}}
+        return this;
+    }//}}}
 	this.checkconsistency = function(md,solution,analyses){ // {{{
 
@@ -104,5 +104,5 @@
 			checkfield(md,'fieldname','thermal.isdrainicecolumn','numel',[1],'values',[0, 1]);
 			checkfield(md,'fieldname','thermal.watercolumn_upperlimit','>=',0);
-
+			
 			for(var i=0;i<md.mesh.numberofvertices;i++){
 				for(var j=0;j<md.thermal.spctemperature[0].length;j++){
@@ -123,6 +123,6 @@
 					md.checkmessage('for a steadystate computation, thermal.reltol (relative convergence criterion) must be defined!');
 				}
+				checkfield(md,'fieldname','thermal.reltol','>',0.,'message','reltol must be larger than zero');
 			}
-			checkfield(md,'fieldname','thermal.reltol','>',0.,'message','reltol must be larger than zero');
 		}
 		checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1);
@@ -163,18 +163,17 @@
 	//properties 
 	// {{{
-
-	this.spctemperature    = NaN;
-	this.penalty_threshold = 0;
-	this.stabilization     = 0;
-	this.reltol	   = 0;
-	this.maxiter           = 0;
-	this.penalty_lock      = 0;
-	this.penalty_factor    = 0;
-	this.isenthalpy        = 0;
-	this.isdynamicbasalspc = 0;
-	this.isdrainicecolumn  = 0;
-	this.watercolumn_upperlimit=0;
-	this.fe                = 'P1';
-	this.requested_outputs = [];
+	this.spctemperature    		= NaN;
+	this.penalty_threshold 		= 0;
+	this.stabilization     		= 0;
+	this.reltol			   		= 0;
+	this.maxiter           		= 0;
+	this.penalty_lock      		= 0;
+	this.penalty_factor    		= 0;
+	this.isenthalpy        		= 0;
+	this.isdynamicbasalspc 		= 0;
+	this.isdrainicecolumn  		= 0;
+	this.watercolumn_upperlimit = 0;
+	this.fe                		= 'P1';
+	this.requested_outputs 		= [];
 
 	this.setdefaultparameters();
Index: issm/trunk/src/m/classes/timestepping.js
===================================================================
--- issm/trunk/src/m/classes/timestepping.js	(revision 25994)
+++ issm/trunk/src/m/classes/timestepping.js	(revision 26744)
@@ -6,5 +6,5 @@
 function timestepping (){
 	//methods
-	this.setdefaultparameters = function(){// {{{
+	this.setdefaultparameters = function(){ //{{{
 		//time between 2 time steps
 		this.time_step=1./2.;
@@ -14,7 +14,8 @@
 
 		//should we interpolate forcings between timesteps?
-		this.interp_forcings=1;
-	}// }}}
-	this.disp= function(){// {{{
+		this.interp_forcing=1;
+		this.cycle_forcing=0;
+	} //}}}
+	this.disp= function(){ //{{{
 
 		var unit;
@@ -24,12 +25,13 @@
 		fielddisplay(this,'final_time','final time to stop the simulation ['+ unit + ']');
 		fielddisplay(this,'time_step','length of time steps [' +unit+ ']');
-		fielddisplay(this,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
+		fielddisplay(this,'interp_forcing','interpolate in time between requested forcing values ? (0 or 1)');
+		fielddisplay(this,'cycle_forcing','cycle through forcing ? (0 or 1)');
 		fielddisplay(this,'coupling_time','length of coupling time steps with ocean model [' +unit+ ']');
 
-	}// }}}
-	this.classname= function(){// {{{
+	} //}}}
+	this.classname= function(){ //{{{
 		return "timestepping";
 
-	}// }}}
+	} //}}}
 	this.checkconsistency = function(md,solution,analyses) { //{{{
 
@@ -37,8 +39,12 @@
 		checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1,'Inf',1);
 		checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1,'Inf',1);
-		checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0,1]);
+		checkfield(md,'fieldname','timestepping.interp_forcing','numel',[1],'values',[0,1]);
+		checkfield(md,'fieldname','timestepping.cycle_forcing','numel',[1],'values',[0,1]);
 		checkfield(md,'fieldname','timestepping.coupling_time','numel',[1],'>=',0,'NaN',1,'Inf',1);
 		if (this.final_time-this.start_time<0){
 			md.checkmessage('timestepping.final_time should be larger than timestepping.start_time');
+		}
+		if (solution=='TransientSolution'){
+			checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>',0,'NaN',1,'Inf',1);
 		}
 	} // }}}
@@ -52,5 +58,6 @@
 		WriteData(fid,prefix,'object',this,'fieldname','final_time','format','Double','scale',scale);
 		WriteData(fid,prefix,'object',this,'fieldname','time_step','format','Double','scale',scale);
-		WriteData(fid,prefix,'object',this,'fieldname','interp_forcings','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','interp_forcing','format','Boolean');
+		WriteData(fid,prefix,'object',this,'fieldname','cycle_forcing','format','Boolean');
 		WriteData(fid,prefix,'object',this,'fieldname','coupling_time','format','Double','scale',scale);
 
@@ -63,5 +70,6 @@
 	this.final_time      = 0.;
 	this.time_step       = 0.;
-	this.interp_forcings = 1;
+	this.interp_forcing  = 1;
+	this.cycle_forcing   = 1;
 	this.coupling_time   = 0.;
 
Index: issm/trunk/src/m/classes/timestepping.m
===================================================================
--- issm/trunk/src/m/classes/timestepping.m	(revision 25994)
+++ issm/trunk/src/m/classes/timestepping.m	(revision 26744)
@@ -9,5 +9,6 @@
 		final_time      = 0.;
 		time_step       = 0.;
-		interp_forcings = 1;
+		interp_forcing  = 1;
+		cycle_forcing   = 0;
 		coupling_time   = 0.;
 	end
@@ -23,4 +24,16 @@
 			end
 		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   timestepping parameters:'));
+
+			unit = 'yr';
+			fielddisplay(self,'start_time',['simulation starting time [' unit ']']);
+			fielddisplay(self,'final_time',['final time to stop the simulation [' unit ']']);
+			fielddisplay(self,'time_step',['length of time steps [' unit ']']);
+			fielddisplay(self,'interp_forcing','interpolate in time between requested forcing values? (0 or 1)');
+			fielddisplay(self,'cycle_forcing','cycle through forcing? (0 or 1)');
+			fielddisplay(self,'coupling_time',['length of coupling time step with ocean model [' unit ']']);
+
+		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
@@ -31,6 +44,7 @@
 			self.final_time=10.*self.time_step;
 
-			%should we interpolate forcings between timesteps?
-			self.interp_forcings=1;
+			%should we interpolate forcing between timesteps?
+			self.interp_forcing=1;
+			self.cycle_forcing=0;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -39,5 +53,6 @@
 			md = checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1,'Inf',1);
-			md = checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','timestepping.interp_forcing','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','timestepping.cycle_forcing','numel',[1],'values',[0 1]);
 			if self.final_time-self.start_time<0,
 				md = checkmessage(md,'timestepping.final_time should be larger than timestepping.start_time');
@@ -45,17 +60,5 @@
 			if strcmp(solution,'TransientSolution'),
 				md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>',0,'NaN',1,'Inf',1);
-				md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1,'Inf',1);
 			end
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   timestepping parameters:'));
-
-			unit = 'yr';
-			fielddisplay(self,'start_time',['simulation starting time [' unit ']']);
-			fielddisplay(self,'final_time',['final time to stop the simulation [' unit ']']);
-			fielddisplay(self,'time_step',['length of time steps [' unit ']']);
-			fielddisplay(self,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
-			fielddisplay(self,'coupling_time',['length of coupling time step with ocean model  [' unit ']']);
-
 		end % }}}
 		function marshall(self,prefix,md,fid) % {{{
@@ -66,5 +69,6 @@
 			WriteData(fid,prefix,'object',self,'fieldname','final_time','format','Double','scale',scale);
 			WriteData(fid,prefix,'object',self,'fieldname','time_step','format','Double','scale',scale);
-			WriteData(fid,prefix,'object',self,'fieldname','interp_forcings','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','interp_forcing','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','cycle_forcing','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','coupling_time','format','Double','scale',scale);
 		end % }}}
@@ -74,5 +78,6 @@
 			writejsdouble(fid,[modelname '.timestepping.final_time'],self.final_time);
 			writejsdouble(fid,[modelname '.timestepping.time_step'],self.time_step);
-			writejsdouble(fid,[modelname '.timestepping.interp_forcings'],self.interp_forcings);
+			writejsdouble(fid,[modelname '.timestepping.interp_forcing'],self.interp_forcing);
+			writejsdouble(fid,[modelname '.timestepping.cycle_forcing'],self.cycle_forcing);
 
 		end % }}}
Index: issm/trunk/src/m/classes/timestepping.py
===================================================================
--- issm/trunk/src/m/classes/timestepping.py	(revision 25994)
+++ issm/trunk/src/m/classes/timestepping.py	(revision 26744)
@@ -5,65 +5,67 @@
 
 class timestepping(object):
-    """
-    TIMESTEPPING Class definition
+    """TIMESTEPPING Class definition
 
-       Usage:
-          timestepping = timestepping()
+    Usage:
+        timestepping = timestepping()
     """
 
-    def __init__(self):  # {{{
-        self.start_time = 0.
-        self.final_time = 0.
-        self.time_step = 0.
-        self.interp_forcings = 1
-        self.coupling_time = 0.
+    def __init__(self, *args): #{{{
+        self.start_time = 0
+        self.final_time = 0
+        self.time_step = 0
+        self.interp_forcing = 1
+        self.cycle_forcing = 0
+        self.coupling_time = 0
 
-    #set defaults
-        self.setdefaultparameters()
+        if len(args) == 0:
+            self.setdefaultparameters()
+        else:
+            raise RuntimeError('constructor not supported')
+    #}}}
+    def __repr__(self): #{{{
+        s = '   timestepping parameters:\n'
+        unit = 'yr'
+        s += '{}\n'.format(fielddisplay(self, 'start_time', 'simulation starting time [' + unit + ']'))
+        s += '{}\n'.format(fielddisplay(self, 'final_time', 'final time to stop the simulation [' + unit + ']'))
+        s += '{}\n'.format(fielddisplay(self, 'time_step', 'length of time steps [' + unit + ']'))
+        s += '{}\n'.format(fielddisplay(self, 'interp_forcing', 'interpolate in time between requested forcing values? (0 or 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'cycle_forcing', 'cycle through forcing? (0 or 1)'))
+        s += '{}\n'.format(fielddisplay(self, 'coupling_time', 'length of coupling time steps with ocean model [' + unit + ']'))
+        return s
+    #}}}
+    def setdefaultparameters(self): #{{{
+        # Time between 2 time steps
+        self.time_step = 1 / 2
 
-    #}}}
+        # Final time
+        self.final_time = 10 * self.time_step
 
-    def __repr__(self):  # {{{
-        string = "   timestepping parameters:"
-        string = "%s\n%s" % (string, fielddisplay(self, "start_time", "simulation starting time [yr]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "final_time", "final time to stop the simulation [yr]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "time_step", "length of time steps [yr]"))
-        string = "%s\n%s" % (string, fielddisplay(self, "interp_forcings", "interpolate in time between requested forcing values ? (0 or 1)"))
-        string = "%s\n%s" % (string, fielddisplay(self, "coupling_time", "length of coupling time steps with ocean model [yr]"))
-        return string
-    #}}}
-
-    def setdefaultparameters(self):  # {{{
-        #time between 2 time steps
-        self.time_step = 1. / 2.
-        #final time
-        self.final_time = 10. * self.time_step
-        #should we interpolate forcings between timesteps?
-        self.interp_forcings = 1
+        # Should we interpolate forcing between timesteps?
+        self.interp_forcing = 1
+        self.cycle_forcing = 0
 
         return self
     #}}}
-
-    def checkconsistency(self, md, solution, analyses):  # {{{
-
+    def checkconsistency(self, md, solution, analyses): #{{{
         md = checkfield(md, 'fieldname', 'timestepping.start_time', 'numel', [1], 'NaN', 1, 'Inf', 1)
         md = checkfield(md, 'fieldname', 'timestepping.final_time', 'numel', [1], 'NaN', 1, 'Inf', 1)
         md = checkfield(md, 'fieldname', 'timestepping.time_step', 'numel', [1], '>=', 0, 'NaN', 1, 'Inf', 1)
-        if self.final_time - self.start_time < 0:
-            md.checkmessage("timestepping.final_time should be larger than timestepping.start_time")
-            md = checkfield(md, 'fieldname', 'timestepping.coupling_time', 'numel', [1], '>=', 0, 'NaN', 1, 'Inf', 1)
-        md = checkfield(md, 'fieldname', 'timestepping.interp_forcings', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'timestepping.cycle_forcing', 'numel', [1], 'values', [0, 1])
+        if (self.final_time - self.start_time) < 0:
+            md.checkmessage('timestepping.final_time should be larger than timestepping.start_time')
+        if solution == 'TransientSolution':
+            md = checkfield(md, 'fieldname', 'timestepping.time_step', 'numel', [1], '>', 0, 'NaN', 1, 'Inf', 1)
 
         return md
-    # }}}
-
-    def marshall(self, prefix, md, fid):  # {{{
-
-        yts = md.constants.yts
+    #}}}
+    def marshall(self, prefix, md, fid): #{{{
+        scale = md.constants.yts
         WriteData(fid, prefix, 'name', 'md.timestepping.type', 'data', 1, 'format', 'Integer')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'start_time', 'format', 'Double', 'scale', yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'final_time', 'format', 'Double', 'scale', yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'time_step', 'format', 'Double', 'scale', yts)
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'interp_forcings', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'coupling_time', 'format', 'Double', 'scale', yts)
-    # }}}
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'start_time', 'format', 'Double', 'scale', scale)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'final_time', 'format', 'Double', 'scale', scale)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'time_step', 'format', 'Double', 'scale', scale)
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'interp_forcing', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'cycle_forcing', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'coupling_time', 'format', 'Double', 'scale', scale)
+    #}}}
Index: issm/trunk/src/m/classes/timesteppingadaptive.js
===================================================================
--- issm/trunk/src/m/classes/timesteppingadaptive.js	(revision 25994)
+++ issm/trunk/src/m/classes/timesteppingadaptive.js	(revision 26744)
@@ -19,4 +19,5 @@
 		//should we interpolate forcings between timesteps?
 		this.interp_forcings=1;
+		this.cycle_forcing=0;
 	}// }}}
 	this.disp= function(){// {{{
@@ -31,4 +32,5 @@
 		fielddisplay(this,'cfl_coefficient','coefficient applied to cfl condition');
 		fielddisplay(this,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
+		fielddisplay(this,'cycle_forcing','cycle through forcing ? (0 or 1)');
 		fielddisplay(this,'coupling_time','coupling time steps with ocean model [' +unit+ ']');
 
@@ -46,4 +48,5 @@
 		checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
 		checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0,1]);
+		checkfield(md,'fieldname','timestepping.cycle_forcing','numel',[1],'values',[0,1]);
 		if (this.final_time-this.start_time<0){
 			md.checkmessage('timestepping.final_time should be larger than timestepping.start_time');
@@ -63,4 +66,5 @@
 		WriteData(fid,prefix,'object',this,'class','timestepping','fieldname','cfl_coefficient','format','Double');
 		WriteData(fid,prefix,'object',this,'class','timestepping','fieldname','interp_forcings','format','Boolean');
+		WriteData(fid,prefix,'object',this,'class','timestepping','fieldname','cycle_forcing','format','Boolean');
 		WriteData(fid,prefix,'object',this,'class','timestepping','fieldname','coupling_time','format','Double','scale',scale);
 
@@ -76,4 +80,5 @@
 	this.cfl_coefficient = 0.;
 	this.interp_forcings = 1;
+	this.cycle_forcing   = 0;
 	this.coupling_time   = 0.;
 
Index: issm/trunk/src/m/classes/timesteppingadaptive.m
===================================================================
--- issm/trunk/src/m/classes/timesteppingadaptive.m	(revision 25994)
+++ issm/trunk/src/m/classes/timesteppingadaptive.m	(revision 26744)
@@ -11,5 +11,6 @@
 		time_step_max   = 0.;
 		cfl_coefficient = 0.;
-		interp_forcings = 1;
+		interp_forcing = 1;
+		cycle_forcing = 1;
 		coupling_time   = 0.;
 	end
@@ -37,6 +38,7 @@
 			self.cfl_coefficient=0.5;
 
-			%should we interpolate forcings between timesteps?
-			self.interp_forcings=1;
+			%should we interpolate forcing between timesteps?
+			self.interp_forcing=1;
+			self.cycle_forcing=0;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -47,5 +49,6 @@
 			md = checkfield(md,'fieldname','timestepping.time_step_max','numel',[1],'>=',md.timestepping.time_step_min,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
-			md = checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','timestepping.interp_forcing','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','timestepping.cycle_forcing','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','timestepping.coupling_time','numel',[1],'>=',md.timestepping.coupling_time,'NaN',1,'Inf',1);
 			if self.final_time-self.start_time<0,
@@ -62,5 +65,6 @@
 			fielddisplay(self,'time_step_max',['maximum length of time step [' unit ']']);
 			fielddisplay(self,'cfl_coefficient','coefficient applied to cfl condition');
-			fielddisplay(self,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
+			fielddisplay(self,'interp_forcing','interpolate in time between requested forcing values ? (0 or 1)');
+			fielddisplay(self,'cycle_forcing','cycle through forcing ? (0 or 1)');
 			fielddisplay(self,'coupling_time',['coupling time step with ocean model [' unit ']']);
 
@@ -75,5 +79,6 @@
 			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','time_step_max','format','Double','scale',scale);
 			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','cfl_coefficient','format','Double');
-			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','interp_forcings','format','Boolean');
+			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','interp_forcing','format','Boolean');
+			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','cycle_forcing','format','Boolean');
 			WriteData(fid,prefix,'object',self,'class','timestepping','fieldname','coupling_time','format','Double','scale',scale);
 		end % }}}
@@ -85,5 +90,6 @@
 			writejsdouble(fid,[modelname '.timesteppingadaptive.time_step_max'],self.time_step_max);
 			writejsdouble(fid,[modelname '.timesteppingadaptive.cfl_coefficient'],self.cfl_coefficient);
-			writejsdouble(fid,[modelname '.timesteppingadaptive.interp_forcings'],self.interp_forcings);
+			writejsdouble(fid,[modelname '.timesteppingadaptive.interp_forcing'],self.interp_forcing);
+			writejsdouble(fid,[modelname '.timesteppingadaptive.cycle_forcing'],self.cycle_forcing);
 			writejsdouble(fid,[modelname '.timesteppingadaptive.coupling_time'],self.time_step_max);
 
Index: issm/trunk/src/m/classes/timesteppingadaptive.py
===================================================================
--- issm/trunk/src/m/classes/timesteppingadaptive.py	(revision 25994)
+++ issm/trunk/src/m/classes/timesteppingadaptive.py	(revision 26744)
@@ -19,5 +19,6 @@
             self.time_step_max = 0.
             self.cfl_coefficient = 0.
-            self.interp_forcings = 1
+            self.interp_forcing = 1
+            self.cycle_forcing = 0
             self.coupling_time = 0.
 
@@ -31,5 +32,6 @@
             self.start_time = old.start_time
             self.final_time = old.final_time
-            self.interp_forcings = old.interp_forcings
+            self.interp_forcing = old.interp_forcing
+            self.cycle_forcing = old.cycle_forcing
             self.coupling_time = old.coupling_time
 
@@ -45,5 +47,6 @@
         string = "%s\n%s" % (string, fielddisplay(self, "time_step_max", "maximum length of time steps [yr]"))
         string = "%s\n%s" % (string, fielddisplay(self, "cfl_coefficient", "coefficient applied to cfl condition"))
-        string = "%s\n%s" % (string, fielddisplay(self, "interp_forcings", "interpolate in time between requested forcing values ? (0 or 1)"))
+        string = "%s\n%s" % (string, fielddisplay(self, "interp_forcing", "interpolate in time between requested forcing values ? (0 or 1)"))
+        string = "%s\n%s" % (string, fielddisplay(self, "cycle_forcing", "cycle through forcing ? (0 or 1)"))
         string = "%s\n%s" % (string, fielddisplay(self, "coupling_time", "coupling time steps with ocean model [yr]"))
         return string
@@ -58,6 +61,7 @@
         #time adaptation?
         self.cfl_coefficient = 0.5
-        #should we interpolate forcings between timesteps?
-        self.interp_forcings = 1
+        #should we interpolate forcing between timesteps?
+        self.interp_forcing = 1
+        self.cycle_forcing   = 0
         return self
     #}}}
@@ -71,5 +75,6 @@
         if self.final_time - self.start_time < 0:
             md.checkmessage("timestepping.final_time should be larger than timestepping.start_time")
-        md = checkfield(md, 'fieldname', 'timestepping.interp_forcings', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'timestepping.interp_forcing', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'timestepping.cycle_forcing', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'timestepping.coupling_time', 'numel', [1], '>=', 0, 'NaN', 1, 'Inf', 1)
 
@@ -85,5 +90,6 @@
         WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'time_step_max', 'format', 'Double', 'scale', yts)
         WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'cfl_coefficient', 'format', 'Double')
-        WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'interp_forcings', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'interp_forcing', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'cycle_forcing', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'class', 'timestepping', 'fieldname', 'coupling_time', 'format', 'Double', 'scale', yts)
     # }}}
Index: issm/trunk/src/m/classes/toolkits.m
===================================================================
--- issm/trunk/src/m/classes/toolkits.m	(revision 25994)
+++ issm/trunk/src/m/classes/toolkits.m	(revision 26744)
@@ -105,5 +105,5 @@
 					case 'LoveAnalysis'
 					case 'EsaAnalysis'
-					case 'SealevelriseAnalysis'
+					case 'SealevelchangeAnalysis'
 					otherwise
 						md = checkmessage(md,['md.toolkits.' analyses{i} ' not supported yet']);
Index: issm/trunk/src/m/classes/trans.js
===================================================================
--- issm/trunk/src/m/classes/trans.js	(revision 25994)
+++ 	(revision )
@@ -1,132 +1,0 @@
-//TRANS class definition
-//
-//   Usage:
-//      trans =new trans();
-
-function trans (){
-	//methods
-	this.setdefaultparameters = function(){// {{{
-
-		//full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
-		this.issmb             = 1;
-		this.ismasstransport   = 1;
-		this.isstressbalance   = 1;
-		this.isthermal         = 0;
-		this.isgroundingline   = 0;
-		this.isgia             = 0;
-		this.isesa             = 0;
-		this.isdamageevolution = 0;
-		this.ismovingfront     = 0;
-		this.ishydrology       = 0;
-		this.isslr             = 0;
-		this.isoceancoupling   = 0;
-		this.iscoupler         = 0;
-		this.amr_frequency     = 0;
-
-		//default output
-		this.requested_outputs=['default'];
-
-	}// }}}
-	this.disp= function(){// {{{
-
-		console.log(sprintf('   transient solution parameters:'));
-
-		fielddisplay(this,'issmb','indicates whether a surface mass balance solution is used in the transient');
-		fielddisplay(this,'ismasstransport','indicates whether a masstransport solution is used in the transient');
-		fielddisplay(this,'isstressbalance','indicates whether a stressbalance solution is used in the transient');
-		fielddisplay(this,'isthermal','indicates whether a thermal solution is used in the transient');
-		fielddisplay(this,'isgroundingline','indicates whether a groundingline migration is used in the transient');
-		fielddisplay(this,'isgia','indicates whether a postglacial rebound model is used in the transient');
-		fielddisplay(this,'isesa','indicates whether an elastic adjustment model is used in the transient');
-		fielddisplay(this,'isdamageevolution','indicates whether damage evolution is used in the transient');
-		fielddisplay(this,'ismovingfront','indicates whether a moving front capability is used in the transient');
-		fielddisplay(this,'ishydrology','indicates whether an hydrology model is used');
-		fielddisplay(this,'isslr','indicates whether a sea-level rise model is used');
-		fielddisplay(this,'isoceancoupling','indicates whether a coupling with an ocean model is used in the transient');
-		fielddisplay(this,'iscoupler','indicates whether different models are being run with need for coupling');
-		fielddisplay(this,'amr_frequency','frequency at which mesh is refined in simulations with multiple time_steps');
-		fielddisplay(this,'requested_outputs','list of additional outputs requested');
-
-
-	}// }}}
-	this.classname= function(){// {{{
-		return "transient";
-	}// }}}
-		this.checkconsistency = function(md,solution,analyses) { // {{{
-
-			//Early return
-			if (solution!='TransientSolution') return;
-
-			checkfield(md,'fieldname','trans.issmb','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.ismasstransport','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isstressbalance','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isthermal','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isgroundingline','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isgia','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isesa','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isdamageevolution','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.ismovingfront','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.ishydrology','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isslr','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.isoceancoupling','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.iscoupler','numel',[1],'values',[0, 1]);
-			checkfield(md,'fieldname','trans.amr_frequency','numel',[1],'>=',0,'NaN',1,'Inf',1);
-			checkfield(md,'fieldname','trans.requested_outputs','stringrow',1);
-		} // }}}
-		this.marshall=function(md,prefix,fid) { //{{{
-
-			prefix='md.transient';
-			WriteData(fid,prefix,'object',this,'fieldname','issmb','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','ismasstransport','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isstressbalance','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isthermal','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isgroundingline','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isgia','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isesa','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isdamageevolution','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','ishydrology','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','ismovingfront','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isslr','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','isoceancoupling','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','iscoupler','format','Boolean');
-			WriteData(fid,prefix,'object',this,'fieldname','amr_frequency','format','Integer');
-
-			//process requested outputs
-			var outputs = this.requested_outputs;
-			for (var i=0;i<outputs.length;i++){
-				if (outputs[i] == 'default') {
-					outputs.splice(i,1);
-					var newoutputs=this.defaultoutputs(md);
-					for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
-				}
-			}			
-			WriteData(fid,prefix,'data',outputs,'name','md.transient.requested_outputs','format','StringArray');
-		}//}}}
-		this.defaultoutputs = function(md) { //{{{
-			if(this.issmb)return ['SmbMassBalance'];
-			else return [];
-		}//}}}
-		this.fix=function() { //{{{
-		}//}}}
-	//properties 
-	// {{{
-
-	this.issmb             = 0;
-	this.ismasstransport   = 0;
-	this.isstressbalance   = 0;
-	this.isthermal         = 0;
-	this.isgroundingline   = 0;
-	this.isgia             = 0;
-	this.isesa             = 0;
-	this.isdamageevolution = 0;
-	this.ismovingfront     = 0;
-	this.ishydrology       = 0;
-	this.isslr             = 0;
-	this.isoceancoupling   = 0;
-	this.iscoupler         = 0;
-	this.amr_frequency	   = 0;
-	this.requested_outputs = [];
-
-	this.setdefaultparameters();
-	//}}}
-}
Index: issm/trunk/src/m/classes/transient.js
===================================================================
--- issm/trunk/src/m/classes/transient.js	(revision 26744)
+++ issm/trunk/src/m/classes/transient.js	(revision 26744)
@@ -0,0 +1,132 @@
+//TRANSIENT class definition
+//
+//   Usage:
+//      transient =new transient();
+
+function transient (){
+	//methods
+	this.setdefaultparameters = function(){// {{{
+
+		//full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
+		this.issmb             = 1;
+		this.ismasstransport   = 1;
+		this.isstressbalance   = 1;
+		this.isthermal         = 0;
+		this.isgroundingline   = 0;
+		this.isgia             = 0;
+		this.isesa             = 0;
+		this.isdamageevolution = 0;
+		this.ismovingfront     = 0;
+		this.ishydrology       = 0;
+		this.isslr             = 0;
+		this.isoceancoupling   = 0;
+		this.iscoupler         = 0;
+		this.amr_frequency     = 0;
+
+		//default output
+		this.requested_outputs=['default'];
+
+	}// }}}
+	this.disp= function(){// {{{
+
+		console.log(sprintf('   transient solution parameters:'));
+
+		fielddisplay(this,'issmb','indicates whether a surface mass balance solution is used in the transient');
+		fielddisplay(this,'ismasstransport','indicates whether a masstransport solution is used in the transient');
+		fielddisplay(this,'isstressbalance','indicates whether a stressbalance solution is used in the transient');
+		fielddisplay(this,'isthermal','indicates whether a thermal solution is used in the transient');
+		fielddisplay(this,'isgroundingline','indicates whether a groundingline migration is used in the transient');
+		fielddisplay(this,'isgia','indicates whether a postglacial rebound model is used in the transient');
+		fielddisplay(this,'isesa','indicates whether an elastic adjustment model is used in the transient');
+		fielddisplay(this,'isdamageevolution','indicates whether damage evolution is used in the transient');
+		fielddisplay(this,'ismovingfront','indicates whether a moving front capability is used in the transient');
+		fielddisplay(this,'ishydrology','indicates whether an hydrology model is used');
+		fielddisplay(this,'isslr','indicates whether a sea-level rise model is used');
+		fielddisplay(this,'isoceancoupling','indicates whether a coupling with an ocean model is used in the transient');
+		fielddisplay(this,'iscoupler','indicates whether different models are being run with need for coupling');
+		fielddisplay(this,'amr_frequency','frequency at which mesh is refined in simulations with multiple time_steps');
+		fielddisplay(this,'requested_outputs','list of additional outputs requested');
+
+
+	}// }}}
+	this.classname= function(){// {{{
+		return "transient";
+	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { // {{{
+
+			//Early return
+			if (solution!='TransientSolution') return;
+
+			checkfield(md,'fieldname','transient.issmb','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.ismasstransport','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isstressbalance','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isesa','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.ismovingfront','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isslr','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isoceancoupling','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.iscoupler','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.amr_frequency','numel',[1],'>=',0,'NaN',1,'Inf',1);
+			checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+		} // }}}
+		this.marshall=function(md,prefix,fid) { //{{{
+
+			prefix='md.transient';
+			WriteData(fid,prefix,'object',this,'fieldname','issmb','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','ismasstransport','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isoceantransport','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isstressbalance','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isthermal','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isgroundingline','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isesa','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isdamageevolution','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','ishydrology','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','ismovingfront','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','issampling','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isslc','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','isoceancoupling','format','Boolean');
+			WriteData(fid,prefix,'object',this,'fieldname','amr_frequency','format','Integer');
+
+			//process requested outputs
+			var outputs = this.requested_outputs;
+			for (var i=0;i<outputs.length;i++){
+				if (outputs[i] == 'default') {
+					outputs.splice(i,1);
+					var newoutputs=this.defaultoutputs(md);
+					for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
+				}
+			}			
+			WriteData(fid,prefix,'data',outputs,'name','md.transient.requested_outputs','format','StringArray');
+		}//}}}
+		this.defaultoutputs = function(md) { //{{{
+			if(this.issmb)return ['SmbMassBalance'];
+			else return [];
+		}//}}}
+		this.fix=function() { //{{{
+		}//}}}
+	//properties 
+	// {{{
+
+	this.issmb             = 0;
+	this.ismasstransport   = 0;
+	this.isstressbalance   = 0;
+	this.isthermal         = 0;
+	this.isgroundingline   = 0;
+	this.isgia             = 0;
+	this.isesa             = 0;
+	this.isdamageevolution = 0;
+	this.ismovingfront     = 0;
+	this.ishydrology       = 0;
+	this.isslr             = 0;
+	this.isoceancoupling   = 0;
+	this.iscoupler         = 0;
+	this.amr_frequency	   = 0;
+	this.requested_outputs = [];
+
+	this.setdefaultparameters();
+	//}}}
+}
Index: issm/trunk/src/m/classes/transient.m
===================================================================
--- issm/trunk/src/m/classes/transient.m	(revision 25994)
+++ issm/trunk/src/m/classes/transient.m	(revision 26744)
@@ -8,14 +8,14 @@
 		issmb             = 0;
 		ismasstransport   = 0;
+		isoceantransport  = 0;
 		isstressbalance   = 0;
 		isthermal         = 0;
 		isgroundingline   = 0;
-		isgia             = 0;
 		isesa             = 0;
 		isdamageevolution = 0;
 		ismovingfront     = 0;
 		ishydrology       = 0;
-		isslr             = 0;
-		iscoupler         = 0;
+		issampling        = 0;
+		isslc             = 0;
 		amr_frequency     = 0;
 		isoceancoupling   = 0;
@@ -34,18 +34,18 @@
 
 			%full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
-			self.issmb           = 0;
-			self.ismasstransport = 0;
-			self.isstressbalance = 0;
-			self.isthermal       = 0;
-			self.isgroundingline = 0;
-			self.isgia           = 0;
-			self.isesa           = 0;
+			self.issmb             = 0;
+			self.ismasstransport   = 0;
+			self.isoceantransport  = 0;
+			self.isstressbalance   = 0;
+			self.isthermal         = 0;
+			self.isgroundingline   = 0;
+			self.isesa             = 0;
 			self.isdamageevolution = 0;
-			self.ismovingfront   =0;
-			self.ishydrology     = 0;
-			self.isslr           = 0;
-			self.isoceancoupling = 0;
-			self.iscoupler       = 0;
-			self.amr_frequency	= 0;
+			self.ismovingfront     = 0;
+			self.ishydrology       = 0;
+			self.issampling        = 0;
+			self.isslc             = 0;
+			self.isoceancoupling   = 0;
+			self.amr_frequency     = 0;
 
 			%default output
@@ -55,18 +55,18 @@
 
 			%full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
-			self.issmb           = 1;
-			self.ismasstransport = 1;
-			self.isstressbalance = 1;
-			self.isthermal       = 1;
-			self.isgroundingline = 0;
-			self.isgia           = 0;
-			self.isesa           = 0;
+			self.issmb             = 1;
+			self.ismasstransport   = 1;
+			self.isoceantransport  = 0;
+			self.isstressbalance   = 1;
+			self.isthermal         = 1;
+			self.isgroundingline   = 0;
+			self.isesa             = 0;
 			self.isdamageevolution = 0;
-			self.ismovingfront   = 0;
-			self.ishydrology     = 0;
-			self.isslr           = 0;
-			self.isoceancoupling = 0;
-			self.iscoupler       = 0;
-			self.amr_frequency	= 0;
+			self.ismovingfront     = 0;
+			self.ishydrology       = 0;
+			self.issampling        = 0;
+			self.isslc             = 0;
+			self.isoceancoupling   = 0;
+			self.amr_frequency     = 0;
 
 			%default output
@@ -87,8 +87,8 @@
 			md = checkfield(md,'fieldname','transient.issmb','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.ismasstransport','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','transient.isoceantransport','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isstressbalance','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0 1]);
-			md = checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isesa','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0 1]);
@@ -96,7 +96,7 @@
 			md = checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
-			md = checkfield(md,'fieldname','transient.isslr','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','transient.isslc','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','transient.isoceancoupling','numel',[1],'values',[0 1]);
-			md = checkfield(md,'fieldname','transient.iscoupler','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','transient.issampling','numel',[1],'values',[0 1]);  
 			md = checkfield(md,'fieldname','transient.amr_frequency','numel',[1],'>=',0,'NaN',1,'Inf',1);
 
@@ -113,15 +113,15 @@
 			fielddisplay(self,'issmb','indicates whether a surface mass balance solution is used in the transient');
 			fielddisplay(self,'ismasstransport','indicates whether a masstransport solution is used in the transient');
+			fielddisplay(self,'isoceantransport','indicates whether an ocean masstransport solution is used in the transient');
 			fielddisplay(self,'isstressbalance','indicates whether a stressbalance solution is used in the transient');
 			fielddisplay(self,'isthermal','indicates whether a thermal solution is used in the transient');
 			fielddisplay(self,'isgroundingline','indicates whether a groundingline migration is used in the transient');
-			fielddisplay(self,'isgia','indicates whether a postglacial rebound model is used in the transient');
 			fielddisplay(self,'isesa','indicates whether an elastic adjustment model is used in the transient');
 			fielddisplay(self,'isdamageevolution','indicates whether damage evolution is used in the transient');
 			fielddisplay(self,'ismovingfront','indicates whether a moving front capability is used in the transient');
 			fielddisplay(self,'ishydrology','indicates whether an hydrology model is used');
-			fielddisplay(self,'isslr','indicates whether a sea-level rise solution is used in the transient');
+			fielddisplay(self,'issampling','indicates whether sampling is used in the transient')
+			fielddisplay(self,'isslc','indicates whether a sea-level change solution is used in the transient');
 			fielddisplay(self,'isoceancoupling','indicates whether a coupling with an ocean model is used in the transient');
-			fielddisplay(self,'iscoupler','indicates whether different models are being run with need for coupling');
 			fielddisplay(self,'amr_frequency','frequency at which mesh is refined in simulations with multiple time_steps');
 			fielddisplay(self,'requested_outputs','list of additional outputs requested');
@@ -131,15 +131,15 @@
 			WriteData(fid,prefix,'object',self,'fieldname','issmb','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','ismasstransport','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','isoceantransport','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isstressbalance','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isthermal','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isgroundingline','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','isgia','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isesa','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isdamageevolution','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','ishydrology','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','ismovingfront','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','isslr','format','Boolean');
+			WriteData(fid,prefix,'object',self,'fieldname','issampling','format','Boolean'); 
+			WriteData(fid,prefix,'object',self,'fieldname','isslc','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','isoceancoupling','format','Boolean');
-			WriteData(fid,prefix,'object',self,'fieldname','iscoupler','format','Boolean');
 			WriteData(fid,prefix,'object',self,'fieldname','amr_frequency','format','Integer');
 
@@ -157,15 +157,15 @@
 			writejsdouble(fid,[modelname '.trans.issmb'],self.issmb);
 			writejsdouble(fid,[modelname '.trans.ismasstransport'],self.ismasstransport);
+			writejsdouble(fid,[modelname '.trans.isoceantransport'],self.isoceantransport);
 			writejsdouble(fid,[modelname '.trans.isstressbalance'],self.isstressbalance);
 			writejsdouble(fid,[modelname '.trans.isthermal'],self.isthermal);
 			writejsdouble(fid,[modelname '.trans.isgroundingline'],self.isgroundingline);
-			writejsdouble(fid,[modelname '.trans.isgia'],self.isgia);
 			writejsdouble(fid,[modelname '.trans.isesa'],self.isesa);
 			writejsdouble(fid,[modelname '.trans.isdamageevolution'],self.isdamageevolution);
 			writejsdouble(fid,[modelname '.trans.ismovingfront'],self.ismovingfront);
 			writejsdouble(fid,[modelname '.trans.ishydrology'],self.ishydrology);
-			writejsdouble(fid,[modelname '.trans.isslr'],self.isslr);
+			writejsdouble(fid,[modelname '.trans.issampling'],self.issampling); 
+			writejsdouble(fid,[modelname '.trans.isslc'],self.isslc);
 			writejsdouble(fid,[modelname '.trans.isoceancoupling'],self.isoceancoupling);
-			writejsdouble(fid,[modelname '.trans.iscoupler'],self.iscoupler);
 			writejsdouble(fid,[modelname '.trans.amr_frequency'],self.amr_frequency);
 			writejscellstring(fid,[modelname '.trans.requested_outputs'],self.requested_outputs);
Index: issm/trunk/src/m/classes/transient.py
===================================================================
--- issm/trunk/src/m/classes/transient.py	(revision 25994)
+++ issm/trunk/src/m/classes/transient.py	(revision 26744)
@@ -14,14 +14,14 @@
         self.issmb = 0
         self.ismasstransport = 0
+        self.isoceantransport = 0
         self.isstressbalance = 0
         self.isthermal = 0
         self.isgroundingline = 0
-        self.isgia = 0
         self.isesa = 0
         self.isdamageevolution = 0
         self.ismovingfront = 0
         self.ishydrology = 0
-        self.isslr = 0
-        self.iscoupler = 0
+        self.issampling = 0
+        self.isslc = 0
         self.amr_frequency = 0
         self.isoceancoupling = 0
@@ -29,5 +29,5 @@
 
         self.setdefaultparameters()
-    #}}}
+    # }}}
 
     def __repr__(self):  # {{{
@@ -35,19 +35,19 @@
         s += '{}\n'.format(fielddisplay(self, 'issmb', 'indicates if a surface mass balance solution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'ismasstransport', 'indicates if a masstransport solution is used in the transient'))
+        s += '{}\n'.format(fielddisplay(self, 'isoceantransport', 'indicates whether an ocean masstransport solution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isstressbalance', 'indicates if a stressbalance solution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isthermal', 'indicates if a thermal solution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isgroundingline', 'indicates if a groundingline migration is used in the transient'))
-        s += '{}\n'.format(fielddisplay(self, 'isgia', 'indicates if a postglacial rebound is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isesa', 'indicates whether an elastic adjustment model is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isdamageevolution', 'indicates whether damage evolution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'ismovingfront', 'indicates whether a moving front capability is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'ishydrology', 'indicates whether an hydrology model is used'))
-        s += '{}\n'.format(fielddisplay(self, 'isslr', 'indicates if a sea level rise solution is used in the transient'))
+        s += '{}\n'.format(fielddisplay(self, 'issampling', 'indicates whether sampling is used in the transient'))
+        s += '{}\n'.format(fielddisplay(self, 'isslc', 'indicates if a sea level change solution is used in the transient'))
         s += '{}\n'.format(fielddisplay(self, 'isoceancoupling', 'indicates whether coupling with an ocean model is used in the transient'))
-        s += '{}\n'.format(fielddisplay(self, 'iscoupler', 'indicates whether different models are being run with need for coupling'))
         s += '{}\n'.format(fielddisplay(self, 'amr_frequency', 'frequency at which mesh is refined in simulations with multiple time_steps'))
         s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'list of additional outputs requested'))
         return s
-    #}}}
+    # }}}
 
     def defaultoutputs(self, md):  # {{{
@@ -56,20 +56,20 @@
         else:
             return []
-    #}}}
+    # }}}
 
     def deactivateall(self):  #{{{
         self.issmb = 0
         self.ismasstransport = 0
+        self.isoceantransport = 0
         self.isstressbalance = 0
         self.isthermal = 0
         self.isgroundingline = 0
-        self.isgia = 0
         self.isesa = 0
         self.isdamageevolution = 0
         self.ismovingfront = 0
         self.ishydrology = 0
-        self.isslr = 0
+        self.issampling = 0
+        self.isslc = 0
         self.isoceancoupling = 0
-        self.iscoupler = 0
         self.amr_frequency = 0
 
@@ -77,21 +77,22 @@
         self.requested_outputs = []
         return self
-    #}}}
+    # }}}
 
     def setdefaultparameters(self):  # {{{
-        #full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
+        # Full analysis: Stressbalance, Masstransport and Thermal but no 
+        # groundingline migration for now
         self.issmb = 1
         self.ismasstransport = 1
+        self.isoceantransport = 0
         self.isstressbalance = 1
         self.isthermal = 1
         self.isgroundingline = 0
-        self.isgia = 0
         self.isesa = 0
         self.isdamageevolution = 0
         self.ismovingfront = 0
         self.ishydrology = 0
-        self.isslr = 0
+        self.issampling = 0
+        self.isslc = 0
         self.isoceancoupling = 0
-        self.iscoupler = 0
         self.amr_frequency = 0
 
@@ -99,5 +100,5 @@
         self.requested_outputs = ['default']
         return self
-    #}}}
+    # }}}
 
     def checkconsistency(self, md, solution, analyses):  # {{{
@@ -108,15 +109,15 @@
         md = checkfield(md, 'fieldname', 'transient.issmb', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.ismasstransport', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'transient.isoceantransport', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isstressbalance', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isthermal', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isgroundingline', 'numel', [1], 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'transient.isgia', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isesa', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isdamageevolution', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.ishydrology', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'transient.issampling', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.ismovingfront', 'numel', [1], 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'transient.isslr', 'numel', [1], 'values', [0, 1])
+        md = checkfield(md, 'fieldname', 'transient.isslc', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.isoceancoupling', 'numel', [1], 'values', [0, 1])
-        md = checkfield(md, 'fieldname', 'transient.iscoupler', 'numel', [1], 'values', [0, 1])
         md = checkfield(md, 'fieldname', 'transient.amr_frequency', 'numel', [1], '>=', 0, 'NaN', 1, 'Inf', 1)
 
@@ -131,15 +132,15 @@
         WriteData(fid, prefix, 'object', self, 'fieldname', 'issmb', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'ismasstransport', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'isoceantransport', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isstressbalance', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isthermal', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isgroundingline', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'isgia', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isesa', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isdamageevolution', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'ishydrology', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'ismovingfront', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'isslr', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'issampling', 'format', 'Boolean')
+        WriteData(fid, prefix, 'object', self, 'fieldname', 'isslc', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'isoceancoupling', 'format', 'Boolean')
-        WriteData(fid, prefix, 'object', self, 'fieldname', 'iscoupler', 'format', 'Boolean')
         WriteData(fid, prefix, 'object', self, 'fieldname', 'amr_frequency', 'format', 'Integer')
 
Index: issm/trunk/src/m/classes/verbose.js
===================================================================
--- issm/trunk/src/m/classes/verbose.js	(revision 25994)
+++ issm/trunk/src/m/classes/verbose.js	(revision 26744)
@@ -25,4 +25,9 @@
 	//methods
 	this.setdefaultparameters = function(){// {{{
+		//switch(nargin),
+			//case 0,
+		this.verbose.solution=true;
+		this.verbose.qmu=true;
+		this.verbose.control=true;
 	}// }}}
 	this.disp= function(){// {{{
@@ -67,5 +72,4 @@
 	//properties 
 	// {{{
-	//BEGINFIELDS
 	this.mprocessor=false;
 	this.module=false;
@@ -77,7 +81,6 @@
 	this.autodiff=false;
 	this.smb=false;
-	//ENDFIELDS
+
+	this.setdefaultparameters();
 	// }}}
-	this.setdefaultparameters();
-	//}}}
 }
Index: issm/trunk/src/m/classes/verbose.py
===================================================================
--- issm/trunk/src/m/classes/verbose.py	(revision 25994)
+++ issm/trunk/src/m/classes/verbose.py	(revision 26744)
@@ -4,26 +4,27 @@
 
 class verbose(object):
-    """
-    VERBOSE class definition
+    """VERBOSE class definition
 
-       Available verbosity levels:
-          mprocessor  : model processing
-          module      : modules
-          solution    : solution sequence
-          solver      : solver info (extensive)
-          convergence : convergence criteria
-          control     : control method
-          qmu         : sensitivity analysis
-          autodiff    : AD analysis
-          smb         : SMB analysis
+    Available verbosity levels:
+        mprocessor  : model processing
+        module      : modules
+        solution    : solution sequence
+        solver      : solver info (extensive)
+        convergence : convergence criteria
+        control     : control method
+        qmu         : sensitivity analysis
+        autodiff    : AD analysis
+        smb         : SMB analysis
 
-       Usage:
-          verbose = verbose()
-          verbose = verbose(3)
-          verbose = verbose('001100')
-          verbose = verbose('module', True, 'solver', False)
+    Usage:
+        verbose = verbose()
+        verbose = verbose(3)
+        verbose = verbose('001100')
+        verbose = verbose('module', True, 'solver', False)
 
-    WARNING: some parts of this file are Synchronized with src/c/shared/Numerics/Verbosity.h
-             Do not modify these sections. See src/c/shared/Numerics/README for more info
+    NOTE:
+    - Some parts of this file are Synchronized with 
+    src/c/shared/Numerics/Verbosity.h. Do not modify these sections. See 
+    src/c/shared/Numerics/README for more info.
     """
 
@@ -42,5 +43,5 @@
 
         if not len(args):
-            #Don't do anything
+            # Don't do anything
             self.solution = True
             self.qmu = True
@@ -52,7 +53,7 @@
             if isinstance(binary, str):
                 if binary.lower() == 'all':
-                    binary = 2**11 - 1  #all ones
+                    binary = pow(2, 11) - 1  # all ones
                     self.BinaryToVerbose(binary)
-                    self.solver = False  #Do not use by default
+                    self.solver = False  # Do not use by default
                 else:
                     binary = int(binary, 2)
@@ -62,8 +63,8 @@
 
         else:
-            #Use options to initialize object
+            # Use options to initialize object
             self = pairoptions(*args).AssignObjectFields(self)
 
-            #Cast to logicals
+            # Cast to logicals
             listproperties = vars(self)
             for fieldname, fieldvalue in list(listproperties.items()):
Index: issm/trunk/src/m/consistency/checkfield.py
===================================================================
--- issm/trunk/src/m/consistency/checkfield.py	(revision 25994)
+++ issm/trunk/src/m/consistency/checkfield.py	(revision 26744)
@@ -11,14 +11,13 @@
 
     Used to check model consistency
-        
     Requires:
-        'field' or 'fieldname' option. If 'fieldname' is provided, it will 
+        'field' or 'fieldname' option. If 'fieldname' is provided, it will
         retrieve it from the model md. (md.(fieldname))
-        If 'field' is provided, it will assume the argument following 'field' 
+        If 'field' is provided, it will assume the argument following 'field'
         is a numeric array.
 
     Available options:
         - NaN: 1 if check that there is no NaN
-        - size: [lines cols], NaN for non checked dimensions, or 'universal' 
+        - size: [lines cols], NaN for non checked dimensions, or 'universal'
         for any input type (nodal, element, time series, etc)
         - > :  greater than provided value
@@ -72,6 +71,5 @@
         fieldsize = options.getfieldvalue('size')
         if type(fieldsize) == str:
-            if m.strcmp(fieldsize, 'universal'):
-
+            if fieldsize == 'universal':
                 #Check that vector size will not be confusing for ModelProcessorx
                 if (md.mesh.numberofvertices == md.mesh.numberofelements):
Index: issm/trunk/src/m/consistency/ismodelselfconsistent.m
===================================================================
--- issm/trunk/src/m/consistency/ismodelselfconsistent.m	(revision 25994)
+++ issm/trunk/src/m/consistency/ismodelselfconsistent.m	(revision 26744)
@@ -3,5 +3,5 @@
 %
 %   Usage:
-%      ismodelselfconsistent(md),
+%      ismodelselfconsistent(md);
 
 %initialize consistency as true
@@ -52,4 +52,6 @@
 	elseif strcmp(solutiontype,'MasstransportSolution')
 		analyses={'MasstransportAnalysis'};
+	elseif strcmp(solutiontype,'OceantransportSolution')
+		analyses={'OceantransportAnalysis'};
 	elseif strcmp(solutiontype,'BalancethicknessSolution')
 		analyses={'BalancethicknessAnalysis'};
@@ -71,11 +73,13 @@
 		analyses={'EsaAnalysis'};
 	elseif strcmp(solutiontype,'TransientSolution')
-		analyses={'StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis','MasstransportAnalysis','HydrologyShaktiAnalysis','HydrologyGladsAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis','SealevelriseAnalysis'};
-	elseif strcmp(solutiontype,'SealevelriseSolution')
-		analyses={'SealevelriseAnalysis'};
+		analyses={'StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis','MasstransportAnalysis','OceantransportAnalysis','HydrologyShaktiAnalysis','HydrologyGladsAnalysis','HydrologyShreveAnalysis','HydrologyTwsAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis','SealevelchangeAnalysis'};
+	elseif strcmp(solutiontype,'SealevelchangeSolution')
+		analyses={'SealevelchangeAnalysis'};
 	elseif strcmp(solutiontype,'HydrologySolution')
-		analyses={'L2ProjectionBaseAnalysis','HydrologyShreveAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis'};
+		analyses={'L2ProjectionBaseAnalysis','HydrologyShreveAnalysis','HydrologyDCInefficientAnalysis','HydrologyDCEfficientAnalysis','HydrologyGladsAnalysis','HydrologyShaktiAnalysis','HydrologyTwsAnalysis'};
 	elseif strcmp(solutiontype,'DamageEvolutionSolution')
 		analyses={'DamageEvolutionAnalysis'};
+    elseif strcmp(solutiontype,'SamplingSolution')
+		analyses={'SamplingAnalysis'};    
 	else
 		error(' solution type: %s' , solutiontype, ' not supported yet!');
Index: issm/trunk/src/m/consistency/ismodelselfconsistent.py
===================================================================
--- issm/trunk/src/m/consistency/ismodelselfconsistent.py	(revision 25994)
+++ issm/trunk/src/m/consistency/ismodelselfconsistent.py	(revision 26744)
@@ -1,11 +1,10 @@
 def ismodelselfconsistent(md):  #{{{
-    '''
-    ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
+    """ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem.
 
-       Usage:
-          ismodelselfconsistent(md),
-    '''
+    Usage:
+        ismodelselfconsistent(md)
+    """
 
-    #initialize consistency as true
+    # Initialize consistency as true
     md.private.isconsistent = True
 
@@ -13,35 +12,34 @@
     # exit()
 
-    #Get solution and associated analyses
+    # Get solution and associated analyses
     solution = md.private.solution
     analyses = AnalysisConfiguration(solution)
-    #Go through a model fields, check that it is a class, and call checkconsistency
+    # Go through a model fields, check that it is a class, and call checkconsistency
     #fields = vars(md)
     #for field in fields.iterkeys():
     for field in md.properties():
-        #Some properties do not need to be checked
+        # Some properties do not need to be checked
         if field in ['results', 'debug', 'radaroverlay']:
             continue
 
-        #Check that current field is an object
+        # Check that current field is an object
         if not hasattr(getattr(md, field), 'checkconsistency'):
             md.checkmessage('field {} is not an object.'.format(field))
 
-        #Check consistency of the object
-        exec("md.{}.checkconsistency(md, '{}', {})".format(field, solution, analyses))
+        # Check consistency of the object
+        exec('md.{}.checkconsistency(md, \'{}\', {})'.format(field, solution, analyses))
 
-    #error message if mode is not consistent
+    # Error message if mode is not consistent
     if not md.private.isconsistent:
         raise RuntimeError('Model not consistent, see messages above.')
-#}}}
+# }}}
 
 
 def AnalysisConfiguration(solutiontype):  #{{{
-    '''
-    ANALYSISCONFIGURATION - return type of analyses, number of analyses
+    """ANALYSISCONFIGURATION - return type of analyses, number of analyses
 
-        Usage:
-                [analyses] = AnalysisConfiguration(solutiontype)
-    '''
+    Usage:
+        [analyses] = AnalysisConfiguration(solutiontype)
+    """
 
     if solutiontype == 'StressbalanceSolution':
@@ -53,4 +51,6 @@
     elif solutiontype == 'MasstransportSolution':
         analyses = ['MasstransportAnalysis']
+    elif solutiontype == 'OceantransportSolution':
+        analyses = ['OceantransportAnalysis']
     elif solutiontype == 'BalancethicknessSolution':
         analyses = ['BalancethicknessAnalysis']
@@ -72,14 +72,16 @@
         analyses = ['EsaAnalysis']
     elif solutiontype == 'TransientSolution':
-        analyses = ['StressbalanceAnalysis', 'StressbalanceVerticalAnalysis', 'StressbalanceSIAAnalysis', 'L2ProjectionBaseAnalysis', 'ThermalAnalysis', 'MeltingAnalysis', 'EnthalpyAnalysis', 'MasstransportAnalysis', 'HydrologyShaktiAnalysis', 'HydrologyGladsAnalysis', 'HydrologyDCInefficientAnalysis', 'HydrologyDCEfficientAnalysis', 'SealevelriseAnalysis']
-    elif solutiontype == 'SealevelriseSolution':
-        analyses = ['SealevelriseAnalysis']
+        analyses = ['StressbalanceAnalysis', 'StressbalanceVerticalAnalysis', 'StressbalanceSIAAnalysis', 'L2ProjectionBaseAnalysis', 'ThermalAnalysis', 'MeltingAnalysis', 'EnthalpyAnalysis', 'MasstransportAnalysis', 'OceantransportAnalysis', 'HydrologyShaktiAnalysis', 'HydrologyGladsAnalysis', 'HydrologyShreveAnalysis', 'HydrologyTwsAnalysis', 'HydrologyDCInefficientAnalysis', 'HydrologyDCEfficientAnalysis', 'SealevelchangeAnalysis']
+    elif solutiontype == 'SealevelchangeSolution':
+        analyses = ['SealevelchangeAnalysis']
     elif solutiontype == 'HydrologySolution':
-        analyses = ['L2ProjectionBaseAnalysis', 'HydrologyShreveAnalysis', 'HydrologyDCInefficientAnalysis', 'HydrologyDCEfficientAnalysis']
+        analyses = ['L2ProjectionBaseAnalysis', 'HydrologyShreveAnalysis', 'HydrologyDCInefficientAnalysis', 'HydrologyDCEfficientAnalysis', 'HydrologyGladsAnalysis', 'HydrologyShaktiAnalysis', 'HydrologyTwsAnalysis']
     elif 'DamageEvolutionSolution':
         analyses = ['DamageEvolutionAnalysis']
+    elif 'SamplingSolution':
+        analyses = ['SamplingAnalysis']
     else:
         raise TypeError('solution type: {} not supported yet!'.format(solutiontype))
 
     return analyses
-#}}}
+# }}}
Index: issm/trunk/src/m/contrib/adhikari/wahr.m
===================================================================
--- issm/trunk/src/m/contrib/adhikari/wahr.m	(revision 26744)
+++ issm/trunk/src/m/contrib/adhikari/wahr.m	(revision 26744)
@@ -0,0 +1,58 @@
+function [vert, horz] = wahr(disc_rad,xi,love_h,love_l); 
+% a function to compute vertical and horizontal crustal motion... 
+% ...for a disc load, inspired by Figure 1 of Wahr et al., 2013. 
+% 
+% usage: 
+%		[vert, horz] = wahr(disc_rad,xi,love_h,love_l); 
+%		
+%		vert = vertical crustal motion [m] 
+%		horz = horizontal crustal motion [m] 
+%		disc_rad = disc radius [m] => set to 20 km to replicate the Wahr experiment. 
+%		xi = grid points along the distance away from the disc center [m] 
+%		love_h = load Love numbers h for the vertical crustal motion. 
+%		love_l = load Love numbers l for the horizontal crustal motion. 
+%		
+
+	disc_rad = disc_rad/1000; % km 
+	% compute P(x), dP(x)/dx, d2P(x)/dx2
+	%---------------------------------------------------------------------
+	% compute p_value 
+	theta=km2deg(xi/1000)';
+	ang = theta/180*pi; 
+	alpha=cos(ang);
+	m=length(alpha);
+	n=length(love_h)-1; 
+	p_value = p_polynomial_value(m,n,alpha);
+	p_prime = p_polynomial_prime(m,n,alpha);
+	%---------------------------------------------------------------------
+	nn=[0:n];
+	nn_plus_1=nn+1; 
+
+	% disc radius in degree 
+	disc_rad = km2deg(disc_rad)/180*pi; 
+	tau=zeros(size(love_h)); 
+	tau(1) = 0.5*(1-cos(disc_rad)); % tau_0 
+	p_value_disc = p_polynomial_value(1,n+1,cos(disc_rad));
+	p_prime_disc = p_polynomial_prime(1,n,cos(disc_rad));
+	for jj=2:n+1
+		nnn = jj-1; 
+		tau(jj) = 0.5 * (p_value_disc(jj-1) - p_value_disc(jj+1)); 
+	end
+
+	const=zeros(size(love_h)); 
+	for jj=1:n+1
+		const(jj) = 1/(2*(jj-1)+1); 
+	end
+
+	disc=sum(bsxfun(@times,p_value,tau'),2); 
+
+	g1 = -sum(bsxfun(@times,p_value,(tau.*love_h.*const)'),2); 
+	g5 = -sum(bsxfun(@times,-sin(ang),bsxfun(@times,p_prime,(tau.*love_l.*const)')),2); 
+
+	% coeff 
+	coeff = 1000*4*pi*(6.67408*10^-11)*(6.3781*10^6)/9.81; 
+
+	% vertical and horizontal solutions
+	vert = g1*coeff; % m 
+	horz = g5*coeff; % m 
+
Index: issm/trunk/src/m/contrib/chenggong/interpFromMEaSUREsGeotiff.m
===================================================================
--- issm/trunk/src/m/contrib/chenggong/interpFromMEaSUREsGeotiff.m	(revision 26744)
+++ issm/trunk/src/m/contrib/chenggong/interpFromMEaSUREsGeotiff.m	(revision 26744)
@@ -0,0 +1,40 @@
+% This function calls src/m/contrib/morlighem/modeldata/interpFromGeotiff.m for multiple times to load all avaliable 
+% tif data in  /totten_1/ModelData/Greenland/VelMEaSUREs/Jakobshavn_2008_2021/ within the given time period (in decimal years)
+% For some reason, each .tif file in this folder contains two sets of data, only the first dataset is useful
+
+function dataout = interpFromMEaSUREsGeotiff(X,Y,Tstart,Tend)
+
+foldername = '/totten_1/ModelData/Greenland/VelMEaSUREs/Jakobshavn_2008_2021/';
+
+% get the time info from file names
+templist = dir([foldername,'*.meta']);
+Ndata = length(templist);
+dataTstart = zeros(Ndata,1);
+dataTend = zeros(Ndata,1);
+
+for i = 1:Ndata
+	tempConv = split(templist(i).name, '_');
+	% follow the naming convention
+	dataPrefix(i) = join(tempConv(1:5), '_');
+	dataTstart(i) = date2decyear(datenum(tempConv{3}));
+	dataTend(i) = date2decyear(datenum(tempConv{4}));
+end
+disp(['  Found ', num2str(Ndata), ' records in ', foldername]);
+disp(['    from ', datestr(decyear2date(min(dataTstart)),'yyyy-mm-dd'), ' to ', datestr(decyear2date(max(dataTend)),'yyyy-mm-dd') ]);
+
+
+% find all the data files with Tstart<=t<=Tend
+dataInd = (dataTend>=Tstart) & (dataTstart<=Tend);
+disp([' For the selected period: ', datestr(decyear2date((Tstart)),'yyyy-mm-dd'), ' to ', datestr(decyear2date((Tend)),'yyyy-mm-dd'), ', there are ', num2str(sum(dataInd)), ' records' ]);
+
+dataToLoad = dataPrefix(dataInd);
+TstartToload = dataTstart(dataInd);
+TendToload = dataTend(dataInd);
+
+for i = 1:length(dataToLoad)
+	dataout(i).vx = interpFromGeotiff([foldername, dataToLoad{i}, '_vx_v04.0.tif'], X, Y, 2e9);
+	dataout(i).vy = interpFromGeotiff([foldername, dataToLoad{i}, '_vy_v04.0.tif'], X, Y, 2e9);
+	dataout(i).vel = interpFromGeotiff([foldername, dataToLoad{i}, '_vv_v04.0.tif'], X, Y, -1);
+	dataout(i).Tstart = TstartToload(i);
+	dataout(i).Tend = TendToload(i);
+end
Index: issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.py
===================================================================
--- issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.py	(revision 25994)
+++ issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.py	(revision 26744)
@@ -3,23 +3,55 @@
 import time
 import collections
-from inspect import isclass, getmodule
+from inspect import isclass
 from os import path, remove
 
 
 class ResTable:
-
     def __init__(self):
         self.data = []
-
-    def update(self, row):
-        if len(np.shape(row)) == 0:
-            self.data.append(row)
-        else:
-            for r in row:
+        self.sizes = []
+
+    def update(self, stepvar):
+        #if we have a scalar we just add it to the en
+        #we save the size of the current step for further treatment
+        if len(np.shape(stepvar)) == 0:
+            self.sizes.append(1)
+            self.data.append(stepvar)
+        # if it is an array we add the values one by one
+        #we save the size of the current step for further treatment
+        else:
+            self.sizes.append(len(stepvar))
+            for r in stepvar:
                 self.data.append(r)
 
     def finalize(self, rows):
+        #we have more scalars than steps, so we have an array
         if len(self.data) > rows:
-            return np.reshape(self.data, newshape=(rows, int(len(self.data) / rows)))
+            #first check if all steps are the same size
+            SameSize = np.sum(np.asarray(self.sizes) - self.sizes[0]) == 0
+            if SameSize:
+                #same size for all steps, just reshape
+                return np.reshape(self.data, newshape=(rows, int(len(self.data) / rows)))
+            else:
+                #different sizes at each steps, first create a table big enough for the biggest step
+                startpoint = 0
+                datadim = len(np.shape(self.data))
+                if datadim == 1:
+                    outdat = np.nan * np.ones((rows, np.nanmax(self.sizes)))
+                    for step in range(rows):
+                        curlen = self.sizes[step]
+                        outdat[step, :curlen] = self.data[startpoint: startpoint + curlen]
+                        startpoint += curlen
+                elif datadim == 2:
+                    outdat = np.nan * np.ones((rows, np.nanmax(self.sizes), np.shape(self.data)[1]))
+                    for step in range(rows):
+                        curlen = self.sizes[step]
+                        outdat[step, :curlen, :] = self.data[startpoint: startpoint + curlen]
+                        startpoint += curlen
+
+                else:
+                    print("ERROR, reult treatment cant cope with dimensions above 2")
+                return outdat
+        #as much scalars as stpes (or less) so just one value per step
         else:
             return np.asarray(self.data)
@@ -47,4 +79,6 @@
     except AttributeError:  #no transient so just one timestep
         StepNum = 1
+    except TypeError:  #this isnot a result so no results in there
+        StepNum = 0
     TimeDim = NCData.createDimension('Time', StepNum)  # time is first
     DimDict = {len(TimeDim): 'Time'}
@@ -64,5 +98,5 @@
             DimDict[len(NewDim)] = dimnames[i]
 
-    typelist = [bool, str, str, int, float, complex,
+    typelist = [bool, str, int, float, complex,
                 collections.OrderedDict,
                 np.int64, np.ndarray, np.float64]
@@ -80,5 +114,9 @@
         NCgroup = NCData.createGroup(str(group))
         # In each group gather the fields of the class
-        fields = dict.keys(md.__dict__[group].__dict__)
+        try:
+            fields = dict.keys(md.__dict__[group].__dict__)
+        except AttributeError:
+            print("WARNING: md.{} as no fields, we skip it.".format(group))
+            continue
         # looping on fields in each group
         for field in fields:
@@ -119,4 +157,5 @@
                             if subfield not in['errlog', 'outlog']:
                                 StackedVar = ResTable()
+                                #first loop over the field (result type) to find the index of the last subfield (variable)
                                 for listindex in range(0, Listsize):
                                     try:
@@ -129,4 +168,5 @@
                                         lastindex = listindex
                                         continue
+                                    #Add the  subfield at the current step
                                     Var = SqueezeVar(Var)
                                     StackedVar.update(Var)
@@ -220,4 +260,16 @@
                             if ncvar is not None:
                                 FillVar(ncvar, StackedVar)
+                elif type(md.__dict__[group].__dict__[field]).__name__ == 'dict':
+                    # designed for a dict in dummy but might be used elsewhere
+                    # there is no subgroup
+                    klass = type(md.__dict__[group]).__module__ + '.' + type(md.__dict__[group]).__name__
+                    NCgroup.__setattr__('classtype', klass)
+                    Var = md.__dict__[group].__dict__[field]
+                    Var = SqueezeVar(Var)
+                    if verbose > 4:
+                        print("=WW=creating var for {}.{}".format(group, field))
+                    DimDict, ncvar = CreateVar(NCData, Var, field, NCgroup, DimDict)
+                    if ncvar is not None:
+                        FillVar(ncvar, Var)
                 else:
                     klass = type(md.__dict__[group]).__module__ + '.' + type(md.__dict__[group]).__name__
@@ -258,5 +310,5 @@
     # grab dimension
     if val_type in [collections.OrderedDict, dict]:
-        val_shape = len(var)
+        val_shape = len(var.keys())
         val_dim = 2
     else:
@@ -304,5 +356,5 @@
             ncvar = Group.createVariable(str(field), nctype, dimensions=dimensions, zlib=True)
     # treating bool tables and dict as string tables
-    elif val_type in ['bool', collections.OrderedDict, dict]:
+    elif val_type in [collections.OrderedDict, dict, 'bool']:
         if val_shape in [(), (0,), 0]:
             ncvar = Group.createVariable(str(field), str, zlib=True)
@@ -310,5 +362,5 @@
             dimensions, DimDict = GetDim(NCData, val_shape, val_type, DimDict, val_dim)
             ncvar = Group.createVariable(str(field), str, dimensions=dimensions, zlib=True)
-        # Now dealing with numeric variables
+    # Now dealing with numeric variables
     elif val_type in [float, 'float64', np.float64, int, 'int64']:
         if val_shape in [(), (0,), 0] and not SupDim:
Index: issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.py
===================================================================
--- issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.py	(revision 25994)
+++ issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.py	(revision 26744)
@@ -67,9 +67,12 @@
         for solution in solnames:
             #looking for multiple time steps
-            if (np.size(res_struct.__dict__[solution]) > num_of_timesteps):
-                num_of_timesteps = np.size(res_struct.__dict__[solution])
-                num_of_timesteps = int(num_of_timesteps)
-                if 'Surface' in dict.keys(res_struct.__dict__[solution][0].__dict__):
-                    moving_mesh = True
+            try:
+                if len(res_struct.__dict__[solution]) > num_of_timesteps:
+                    num_of_timesteps = len(res_struct.__dict__[solution])
+                    num_of_timesteps = int(num_of_timesteps)
+                    if 'Surface' in dict.keys(res_struct.__dict__[solution][0].__dict__):
+                        moving_mesh = True
+            except TypeError:
+                continue
     else:
         num_of_timesteps = 1
@@ -92,4 +95,5 @@
         raise BadDimension('exportVTK does not support your element type')
 
+    #only keep the envelope and not the bulk of the results.
     if enveloppe:
         if dim == 3:
@@ -252,28 +256,42 @@
             for sol in solnames:
                 treated_res = []
-    #dealing with results on different timesteps
-                if(np.size(res_struct.__dict__[sol]) > timestep):
-                    timestep = step
-                else:
-                    timestep = np.size(res_struct.__dict__[sol])
-
-    #getting the  fields in the solution
-                if(type(res_struct.__dict__[sol]) == list):
+                #dealing with results on different timesteps
+                try:
+                    if(len(res_struct.__dict__[sol]) > timestep):
+                        timestep = step
+                    else:
+                        timestep = np.size(res_struct.__dict__[sol])
+                except TypeError:
+                    #result as no len() so no timesteps
+                    timestep = 1
+
+                #getting the  fields in the solution
+                if(type(res_struct.__dict__[sol]).__name__ == 'solution'):
                     spe_res_struct = res_struct.__dict__[sol].__getitem__(timestep)
                     fieldnames = dict.keys(spe_res_struct.__dict__)
-                else:
+                elif(type(res_struct.__dict__[sol]).__name__ == 'solutionstep'):
                     spe_res_struct = res_struct.__dict__[sol]
                     fieldnames = dict.keys(spe_res_struct.__dict__)
-
-    #Sorting scalars, vectors and tensors
+                elif(type(res_struct.__dict__[sol]).__name__ == 'results'):  #this is a result without steps
+                    spe_res_struct = res_struct.__dict__[sol]
+                    fieldnames = dict.keys(spe_res_struct.__dict__)
+                else:
+                    print("WARNING, solution type '{}' is not recognise, exported results might be wrong".format(type(res_struct.__dict__[sol])))
+                    spe_res_struct = res_struct.__dict__[sol]
+                    fieldnames = dict.keys(spe_res_struct.__dict__)
+
+                #Sorting scalars, vectors and tensors
                 tensors = [field for field in fieldnames if field[-2:] in ['xx', 'yy', 'xy', 'zz', 'xz', 'yz']]
                 non_tensor = [field for field in fieldnames if field not in tensors]
                 vectors = [field for field in non_tensor if field[-1] in ['x', 'y', 'z'] and field[-4:] not in ['Flux']]
 
-    #check which field is a real result and print
+                #check which field is a real result and print
                 for field in fieldnames:
+                    print("Treating {}".format(field))
                     if field in treated_res:
+                        print("{} is already done".format(field))
                         continue
                     elif field in vectors:
+                        print("{} is a vector".format(field))
                         try:
                             Vxstruct = np.squeeze(spe_res_struct.__dict__[field[:-1] + 'x'])
@@ -299,4 +317,5 @@
 
                     elif field in tensors:
+                        print("{} is a tensor".format(field))
                         try:
                             Txxstruct = np.squeeze(spe_res_struct.__dict__[field[:-2] + 'xx'])
@@ -346,5 +365,4 @@
                         else:
                             print("format for field {}.{} is not suported, field is skipped".format(sol, field))
-                            continue
     # }}}
     # loop on arguments, if something other than result is asked, do it now {{{
Index: issm/trunk/src/m/contrib/dlcheng/zoneaverage.m
===================================================================
--- issm/trunk/src/m/contrib/dlcheng/zoneaverage.m	(revision 26744)
+++ issm/trunk/src/m/contrib/dlcheng/zoneaverage.m	(revision 26744)
@@ -0,0 +1,79 @@
+function avg=zoneaverage(md,field,parameter,width,distweight,areaweight,iter)
+%ZONEAVERAGE - averages the field over the elements within the distance specified by parameter .* width. 
+%               Average is weighted by the element area using model's triangulation.
+%               Width determines distance multiplier of parameter when calculating a node's distance for inclusion in an average.
+%               Distweight and Areaweight control how the node distance and area affect the weighted average.
+%               Iteration is the number of iterations to run the zone averaging.
+%
+%   Usage:
+%      avg=zone_average(md,field,parameter,width,distweight,areaweight)
+
+%TODO: HANDLE NARGINS/PAIROPTION STYLE ARGS FOR WIDTH, DISTWEIGHT, AREAWEIGHT, ITER
+
+if (dimension(md.mesh)==2),
+	numberofelements=md.mesh.numberofelements;
+	numberofnodes=md.mesh.numberofvertices;
+	index=md.mesh.elements;
+	x=md.mesh.x; y=md.mesh.y;
+else
+	numberofelements=md.mesh.numberofelements2d;
+	numberofnodes=md.mesh.numberofvertices2d;
+	index=md.mesh.elements2d;
+	x=md.mesh.x2d; y=md.mesh.y2d;
+end
+
+%node
+if numel(field)==numberofnodes,
+    areas=GetAreas(md.mesh.elements,md.mesh.x,md.mesh.y);
+
+    %calculate distances between nodes and reshape into addressable matrix
+    nodes=[md.mesh.x, md.mesh.y];
+    dist=pdist([nodes;nodes]);
+    dist=squareform(dist);
+    dist=dist(1:numberofnodes,numberofnodes+1:end);
+
+    %calculate max distance to average each vertex using parameter * width and mask distances
+    maxdist = parameter * width;
+    flags=dist<=maxdist;
+    
+    %calculate average area per node
+    nodeareas=zeros(numberofnodes,1);
+    elementspernode=zeros(numberofnodes,1);
+    for i=1:numberofelements,
+        for j=1:3,
+            node=index(i,j);
+            nodeareas(node)=nodeareas(node)+areas(i);
+            elementspernode(node)=elementspernode(node)+1;
+        end
+    end
+    nodeareas=nodeareas./elementspernode;
+    
+    %get distance/area weighted average of field within specified parameter width
+    avg=zeros(numberofnodes,1);
+    totalweight=distweight+areaweight;
+    distweight=distweight/totalweight;
+    areaweight=areaweight/totalweight;
+    for iter=1:iter,
+%     for iter=1:1,
+        for i=1:numberofnodes,
+            %distance weighting
+            distsum = sum(dist(i,flags(i,:))) + eps;
+            distmax = max(dist(i,flags(i,:)));
+            distweights = ones(sum(flags(i,:)),1);
+            distweights = distweights + 1 - distweight*(dist(i,(flags(i,:)))'/distsum); %inverse linear distance weight
+            distweights = distweights / sum(distweights);
+
+            %area weighting
+            areasum = sum(nodeareas(flags(i,:))) + eps;
+            areaweights = areaweight*nodeareas(flags(i,:))/areasum;
+            weights=distweights+areaweights;
+            avg(i)=nansum(weights.*field(flags(i,:)));
+            %avg(i)=nanmean(field(flags(i,:)),1);
+
+    %         areasum = sum(nodeareas(flags));
+    %         weights = nodeareas(flags)/areasum;
+    %         avg=nanmean(weights.*field(flags),2);
+        end
+        field=avg;
+    end
+end
Index: issm/trunk/src/m/contrib/morlighem/ad/rescalegradient.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/ad/rescalegradient.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/ad/rescalegradient.m	(revision 26744)
@@ -14,7 +14,7 @@
 	disp('Constructing mass matrix...');
 	tic
-	row   = zeros(10*md.mesh.numberofvertices);
-	col   = zeros(10*md.mesh.numberofvertices);
-	value = zeros(10*md.mesh.numberofvertices);
+	row   = zeros(10*md.mesh.numberofvertices,1);
+	col   = zeros(10*md.mesh.numberofvertices,1);
+	value = zeros(10*md.mesh.numberofvertices,1);
 
 	%Construct mass matrix using MATLAB's sparse function
Index: issm/trunk/src/m/contrib/morlighem/modeldata/InterpFromGrid.cpp
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/InterpFromGrid.cpp	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/InterpFromGrid.cpp	(revision 26744)
@@ -243,5 +243,5 @@
 
 				if(n0<0 || n3>=dataN || m0<0 || m3>=dataM){
-					interp[idx] = -9999;
+					interp[idx] = -9999.;
 					continue;
 				}
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineAntarctica.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineAntarctica.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineAntarctica.m	(revision 26744)
@@ -1,57 +1,64 @@
-function output = interpBedmachineAntarctica(X,Y,string,method,ncdate),
+function output = interpBedmachineAntarctica(X,Y,string,method,ncdate)
+%INTERPBEDMACHINEANTARCTICA - interpolate BedMachine data onto X and Y
+%
+%   Examples:
+%      bed       = interpBedmachineAntarctica(X,Y,'bed');
+%      surface   = interpBedmachineAntarctica(X,Y,'surface');
+%      thickness = interpBedmachineAntarctica(X,Y,'thickness');
+%      mask      = interpBedmachineAntarctica(X,Y,'mask');
+%      mask      = interpBedmachineAntarctica(X,Y,'mask','nearest','../Data/BedMachineAntarctica_2020-07-15_v02.nc');
+%
+%   - mask:   0 ocean, 1 land (ice free), 2 grounded ice, 3 floating ice
+%   - source: 1 IBCSO/RTopo-2, 2 MC, 3 interpolation, 4 hydrostatic eq, 
+%             5 Streamline diffusion, 6 Gravity inversion
+%   - optional 4th input argument: interpolation method.
+%             Supported interpolation methos: 'linear','cubic','nearest'
+%   - optional 5th input argument: path to dataset.
+%
+% Version 11/30/2018 Mathieu Morlighem mmorligh@uci.edu
 
 if nargin<3, string = 'bed'; end
 if nargin<4
 	if strcmp(string,'mask') | strcmp(string,'source')
-      method='nearest'; % default method
-   else
-      method='cubic'; % default method
-   end
+		method='nearest'; % default method
+	else
+		method='cubic'; % default method
+	end
 end
 if nargin<5
-	%ncdate='2014-03-12';
-	%ncdate='2014-04-28';
-	%ncdate='2014-07-31';
-	%ncdate='2014-09-23';
-	%ncdate='2015-11-06';
-	%ncdate='2015-12-09';
-	ncdate='2016-06-10';
-	ncdate='2016-08-26';
-	ncdate='2016-11-17';
-	ncdate='2017-01-05';
-	ncdate='2017-03-10';
-	ncdate='2018-02-02';
-	ncdate='2018-03-20';
-	ncdate='2018-05-18';
-	ncdate='2018-06-08';
-	ncdate='2018-09-26';
-	ncdate='2018-11-14';
-	ncdate='2019-01-30';
-	ncdate='2019-03-12';
-	ncdate='2019-04-02';
-	ncdate='2019-04-15'; % no need of firn correction
-	ncdate='2020-06-18';
-	ncdate='2020-07-15'; %BedMachine v2?
+	ncdate='2020-07-15'; %BedMachine v2
+	ncdate='2021-11-16'; %BedMachine v2
 end
-
 basename = 'BedMachineAntarctica';
 
-%read data
-switch (oshostname()),
-	case {'ronne'}
-		nc=['/home/ModelData/Antarctica/BedMachine/' basename '-' ncdate '.nc'];
-	case {'thwaites','murdo','astrid'}
-		nc=['/u/astrid-r1b/ModelData/BedMachine/' basename '-' ncdate '.nc'];
-	otherwise
-		error('hostname not supported yet');
-end
+if nargin==5
+	ncfile = ncdate;
+else
+	%List of common paths to try
+	paths = {...
+		['/u/astrid-r1b/ModelData/BedMachine/' basename '-' ncdate '.nc'],...
+		['/home/ModelData/Antarctica/BedMachine/' basename '-' ncdate '.nc'],...
+		['/totten_1/ModelData/Antarctica/BedMachine/' basename '-' ncdate '.nc'],...
+		['/Users/larour/ModelData/BedMachine/' basename '-' ncdate '.nc'],...
+		['./' basename '-' ncdate '.nc'],...
+		};
 
-if nargout==2,
-	string = 'bed';
+	found = 0;
+	for i=1:numel(paths)
+		if exist(paths{i},'file')
+			ncfile = paths{i};
+			found = 1;
+			break;
+		end
+	end
+
+	if ~found
+		error(['Could not find ' basename '-' ncdate '.nc, you can add the path to the list or provide its path as a 5th argument']);
+	end
 end
 
 disp(['   -- BedMachine Antarctica version: ' ncdate]);
-xdata = double(ncread(nc,'x'));
-ydata = double(ncread(nc,'y'));
+xdata = double(ncread(ncfile,'x'));
+ydata = double(ncread(ncfile,'y'));
 
 offset=2;
@@ -59,4 +66,5 @@
 xmin=min(X(:)); xmax=max(X(:));
 posx=find(xdata<=xmax);
+if isempty(posx), posx=numel(xdata); end
 id1x=max(1,find(xdata>=xmin,1)-offset);
 id2x=min(numel(xdata),posx(end)+offset);
@@ -64,4 +72,5 @@
 ymin=min(Y(:)); ymax=max(Y(:));
 posy=find(ydata>=ymin);
+if isempty(posy), posy=numel(ydata); end
 id1y=max(1,find(ydata<=ymax,1)-offset);
 id2y=min(numel(ydata),posy(end)+offset);
@@ -69,6 +78,6 @@
 if strcmp(string,'icemask'),
 	disp(['   -- BedMachine Antarctica: loading ' string]);
-	%data  = double(ncread(nc,'mask'))';
-	data  = double(ncread(nc,'mask',[id1x id1y],[id2x-id1x+1 id2y-id1y+1],[1 1]))';
+	%data  = double(ncread(ncfile,'mask'))';
+	data  = double(ncread(ncfile,'mask',[id1x id1y],[id2x-id1x+1 id2y-id1y+1],[1 1]))';
 	xdata=xdata(id1x:id2x);
 	ydata=ydata(id1y:id2y);
@@ -77,6 +86,6 @@
 else
 	disp(['   -- BedMachine Antarctica: loading ' string]);
-	%data  = double(ncread(nc,string))';
-	data  = double(ncread(nc,string,[id1x id1y],[id2x-id1x+1 id2y-id1y+1],[1 1]))';
+	%data  = double(ncread(ncfile,string))';
+	data  = double(ncread(ncfile,string,[id1x id1y],[id2x-id1x+1 id2y-id1y+1],[1 1]))';
 	xdata=xdata(id1x:id2x);
 	ydata=ydata(id1y:id2y);
@@ -87,7 +96,5 @@
 if strcmp(string,'mask') | strcmp(string,'source'),
 	%Need nearest neighbor to avoid interpolation between 0 and 2
-	tic
 	output = InterpFromGrid(xdata,ydata,data,double(X),double(Y),'nearest');
-	toc
 	%tic
 	%output = FastInterp(xdata,ydata,data,X,Y,'nearest');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineGreenland.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineGreenland.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmachineGreenland.m	(revision 26744)
@@ -1,34 +1,61 @@
-function output = interpBedmachineGreenland(X,Y,string,ncdate),
+function output = interpBedmachineGreenland(X,Y,string,method,ncdate)
+%INTERPBEDMACHINEGREENLAND - interpolate BedMachine data onto X and Y
+%
+%   Examples:
+%      bed       = interpBedmachineGreenland(X,Y,'bed');
+%      surface   = interpBedmachineGreenland(X,Y,'surface');
+%      thickness = interpBedmachineGreenland(X,Y,'thickness');
+%      mask      = interpBedmachineGreenland(X,Y,'mask');
+%      mask      = interpBedmachineGreenland(X,Y,'mask','nearest','../Data/BedMachineGreenland_2020-07-15_v03.nc');
+%
+%   - mask:   0 ocean, 1 land (ice free), 2 grounded ice, 3 floating ice
+%   - source: 1 IBCSO/RTopo-2, 2 MC, 3 interpolation, 4 hydrostatic eq, 
+%             5 Streamline diffusion, 6 Gravity inversion
+%   - optional 4th input argument: interpolation method.
+%             Supported interpolation methos: 'linear','cubic','nearest'
+%   - optional 5th input argument: path to dataset.
+%
+% Version 11/30/2018 Mathieu Morlighem mmorligh@uci.edu
 
 if nargin<3, string = 'bed'; end
-if nargin<4,
+if nargin<4
+	if strcmp(string,'mask') | strcmp(string,'source')
+		method='nearest'; % default method
+	else
+		method='cubic'; % default method
+	end
+end
+if nargin<5
 	%ncdate='2015-04-27'; %BedMachine v2
 	ncdate='2017-09-25'; %BedMachine v3
 	ncdate='2020-04-14';
 end
-
 basename = 'BedMachineGreenland';
 
-%List of common paths to try
-paths = {...
-	['/u/astrid-r1b/ModelData/ModelData/MCdataset-' ncdate '.nc'],...
-	['/home/ModelData/Greenland/BedMachine/' basename '-' ncdate '.nc'],...
-	['/Users/larour/ModelData/BedMachine/' basename '-' ncdate '.nc'],...
-	['./' basename '-' ncdate '.nc'],...
-	};
+if nargin==5
+	ncfile = ncdate;
+else
+	%List of common paths to try
+	paths = {...
+		['/u/astrid-r1b/ModelData/ModelData/MCdataset-' ncdate '.nc'],...
+		['/home/ModelData/Greenland/BedMachine/' basename '-' ncdate '.nc'],...
+		['/totten_1/ModelData/Greenland/BedMachine/' basename '-' ncdate '.nc'],...
+		['/Users/larour/ModelData/BedMachine/' basename '-' ncdate '.nc'],...
+		['./' basename '-' ncdate '.nc'],...
+		};
 
-found = 0;
-for i=1:numel(paths)
-	if exist(paths{i},'file')
-		ncfile = paths{i};
-		found = 1;
-		break;
+	found = 0;
+	for i=1:numel(paths)
+		if exist(paths{i},'file')
+			ncfile = paths{i};
+			found = 1;
+			break;
+		end
+	end
+
+	if ~found
+		error(['Could not find ' basename '-' ncdate '.nc, you can add the path to the list or provide its path as a 5th argument']);
 	end
 end
-
-if ~found
-	error(['Could not find ' basename '-' ncdate '.nc, you can add the path to the list']);
-end
-
 
 disp(['   -- BedMachine Greenland version: ' ncdate]);
@@ -57,4 +84,5 @@
 
 disp(['   -- BedMachine Greenland: interpolating ' string]);
+disp(['       -- Interpolation method: ' method]);
 if strcmp(string,'mask') | strcmp(string,'source'),
 	%Need nearest neighbor to avoid interpolation between 0 and 2
@@ -64,3 +92,54 @@
 end
 
-%TEST https://www.mathworks.com/matlabcentral/fileexchange/10772-fast-2-dimensional-interpolation
+end
+function zi = FastInterp(x,y,data,xi,yi,method)
+
+	%get data size
+	[M N] = size(data);
+
+	% Get X and Y library array spacing
+	ndx = 1/(x(2)-x(1));    ndy = 1/(y(2)-y(1));
+	% Begin mapping xi and yi vectors onto index space by subtracting library
+	% array minima and scaling to index spacing
+
+	xi = (xi - x(1))*ndx;       yi = (yi - y(1))*ndy;
+
+	% Fill Zi with NaNs
+	zi = NaN(size(xi));
+
+	if strcmpi(method,'nearest'),
+		% Find the nearest point in index space
+		rxi = round(xi)+1;  ryi = round(yi)+1;
+		% Find points that are in X,Y range
+		flag = rxi>0 & rxi<=N & ~isnan(rxi) & ryi>0 & ryi<=M & ~isnan(ryi);
+		% Map subscripts to indices
+		ind = ryi + M*(rxi-1);
+		zi(flag) = data(ind(flag));
+
+	else %Bilinear
+
+		% Transform to unit square
+		fxi = floor(xi)+1;  fyi = floor(yi)+1; % x_i and y_i
+		dfxi = xi-fxi+1;    dfyi = yi-fyi+1;   % Location in unit square
+
+		% flagIn determines whether the requested location is inside of the data arrays
+		flagIn = fxi>0 & fxi<N & ~isnan(fxi) & fyi>0 & fyi<M & ~isnan(fyi);
+
+		%Toss all out-of-bounds variables now to save time
+		fxi  = fxi(flagIn);  fyi  = fyi(flagIn);
+		dfxi = dfxi(flagIn); dfyi = dfyi(flagIn);
+
+		%Find bounding vertices
+		ind1 = fyi + M*(fxi-1);     % indices of (  x_i  ,  y_i  )
+		ind2 = fyi + M*fxi;         % indices of ( x_i+1 ,  y_i  )
+		ind3 = fyi + 1 + M*fxi;     % indices of ( x_i+1 , y_i+1 )
+		ind4 = fyi + 1 + M*(fxi-1); % indices of (  x_i  , y_i+1 )
+
+		% Bilinear interpolation
+		zi(flagIn) = ...
+			data(ind1).*(1-dfxi).*(1-dfyi) + ...
+			data(ind2).*dfxi.*(1-dfyi) + ...
+			data(ind4).*(1-dfxi).*dfyi + ...
+			data(ind3).*dfxi.*dfyi;
+	end
+end
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmap2.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmap2.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpBedmap2.m	(revision 26744)
@@ -18,5 +18,12 @@
 %      [dataout] = interpBedmap2(X,Y,string)
 
-nc = '/home/ModelData/Antarctica/BedMap2/bedmap2_bin/Bedmap2.nc';
+switch (oshostname()),
+	case {'ronne'}
+		nc = '/home/ModelData/Antarctica/BedMap2/bedmap2_bin/Bedmap2.nc';
+	case {'totten'}
+		nc = '/totten_1/ModelData/Antarctica/BedMap2/bedmap2_bin/Bedmap2.nc';
+	otherwise
+		error('hostname not supported yet');
+end
 if exist(nc,'file')
 	if strcmp(string,'thickness_uncertainty_5km')
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpDTU19MDT.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpDTU19MDT.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpDTU19MDT.m	(revision 26744)
@@ -4,4 +4,6 @@
 	case {'ronne'}
 		rootname='/ronne_2/home/ModelData/Global/DTU19MDT/dtu19mdt.mat';
+	case {'totten'}
+		rootname='/totten_1/ModelData/Global/DTU19MDT/dtu19mdt.mat';
 	otherwise
 		error('machine not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpFromGeotiff.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpFromGeotiff.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpFromGeotiff.m	(revision 26744)
@@ -1,3 +1,7 @@
-function dataout = interpFromGeotiff(geotiffname,X,Y),
+function dataout = interpFromGeotiff(geotiffname,X,Y,nanValue),
+
+if nargin < 4
+	nanValue = 10^30;
+end
 
 usemap = 0;
@@ -21,10 +25,10 @@
 	%Get image info
 	Tinfo = imfinfo(geotiffname);
-	N     = Tinfo.Width;
-	M     = Tinfo.Height;
-	dx    = Tinfo.ModelPixelScaleTag(1);
-	dy    = Tinfo.ModelPixelScaleTag(2);
-	minx  = Tinfo.ModelTiepointTag(4);
-	maxy  = Tinfo.ModelTiepointTag(5);
+	N     = Tinfo(1).Width;
+	M     = Tinfo(1).Height;
+	dx    = Tinfo(1).ModelPixelScaleTag(1);
+	dy    = Tinfo(1).ModelPixelScaleTag(2);
+	minx  = Tinfo(1).ModelTiepointTag(4);
+	maxy  = Tinfo(1).ModelTiepointTag(5);
 
 	%Generate vectors
@@ -55,5 +59,9 @@
 		data=double(flipud(imread(geotiffname)));
 	end
-	data(find(abs(data)>10^30))=NaN;
+	if nanValue > 0
+		data(find(abs(data)>=nanValue))=NaN;
+	else 
+		data(find(data<=nanValue))=NaN;
+	end
 
 end
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpGeoid.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpGeoid.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpGeoid.m	(revision 26744)
@@ -6,4 +6,6 @@
 	case {'ronne'}
 		rootname='/home/ModelData/Global/Geoid/eigen-6c4-1970.mat';
+	case {'totten'}
+		rootname='/totten_1/ModelData/Global/Geoid/eigen-6c4-1970.mat';
 	otherwise
 		error('machine not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpIBCSO.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpIBCSO.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpIBCSO.m	(revision 26744)
@@ -6,4 +6,7 @@
 		ncpath='/home/ModelData/Antarctica/IBCSO/ibcso_v1_bed.grd';
 		sidpath='/home/ModelData/Antarctica/IBCSO/ibcso_v1_sid.grd';
+	case {'totten'}
+		ncpath='/totten_1/ModelData/Antarctica/IBCSO/ibcso_v1_bed.grd';
+		sidpath='/totten_1/ModelData/Antarctica/IBCSO/ibcso_v1_sid.grd';
 	otherwise
 		error('hostname not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinCompositeGreenland.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinCompositeGreenland.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinCompositeGreenland.m	(revision 26744)
@@ -2,5 +2,5 @@
 
 %data=load(['/u/astrid-r1b/morlighe/issmjpl/proj-morlighem/DatasetGreenland/Data/VelJoughin/IanGreenVel.mat']);
-filename = '/home/ModelData/Greenland/VelJoughin/IanGreenVel.mat';
+filename = '/totten_1/ModelData/Greenland/VelJoughin/IanGreenVel.mat';
 
 %Figure out what subset of the matrix should be read
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinMosaic.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinMosaic.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpJoughinMosaic.m	(revision 26744)
@@ -4,4 +4,6 @@
 	case {'ronne'}
 		filename = '/home/ModelData/Greenland/VelJoughin/IanGreenVel.mat';
+	case {'totten'}
+		filename = '/totten_1/ModelData/Greenland/VelJoughin/IanGreenVel.mat';
 	otherwise
 		error('machine not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAnt2017.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAnt2017.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAnt2017.m	(revision 26744)
@@ -5,4 +5,6 @@
 	case {'ronne'}
 		nc = '/home/ModelData/Antarctica/MouginotVel/vel_nsidc.CF16_2.nc';
+	case {'totten'}
+		nc = '/totten_1/ModelData/Antarctica/MouginotVel/vel_nsidc.CF16_2.nc';
 	otherwise
 		error('hostname not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m	(revision 26744)
@@ -54,4 +54,6 @@
 	case {'ronne'}
 		nc = '/home/ModelData/Antarctica/MouginotVel/ASE_TimeSeries_1973-2018.nc';
+	case {'totten'}
+		nc = '/totten_1/ModelData/Antarctica/MouginotVel/ASE_TimeSeries_1973-2018.nc';
 	otherwise
 		error('hostname not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpRACMOant.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpRACMOant.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpRACMOant.m	(revision 26744)
@@ -1,5 +1,12 @@
 function smb = interpRACMOant(x,y);
 
-	smbfile = '/home/ModelData/Antarctica/RACMO2SMB/SMB_RACMO2.3_1979_2011.nc';
+switch oshostname(),
+	case {'ronne'}
+		smbfile = '/home/ModelData/Antarctica/RACMO2SMB/SMB_RACMO2.3_1979_2011.nc';
+	case {'totten'}
+		smbfile = '/totten_1/ModelData/Antarctica/RACMO2SMB/SMB_RACMO2.3_1979_2011.nc';
+	otherwise
+		error('machine not supported yet');
+end
 	LAT=ncread(smbfile,'lat2d')';
 	LON=ncread(smbfile,'lon2d')';
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpREMA.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpREMA.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpREMA.m	(revision 26744)
@@ -4,4 +4,6 @@
 	case {'ronne'}
 		remapath='/home/ModelData/Antarctica/REMA/REMA_200m_dem_filled.tif';
+	case {'totten'}
+		remapath='/totten_1/ModelData/Antarctica/REMA/REMA_200m_dem_filled.tif';
 	otherwise
 		error('machine not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpRTopo2.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpRTopo2.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpRTopo2.m	(revision 26744)
@@ -11,4 +11,6 @@
 	case {'ronne'}
 		rootname='/home/ModelData/Global/RTopo-2/RTopo-2.0.1_30sec_bedrock_topography.nc';
+	case {'totten'}
+		rootname='/totten_1/ModelData/Global/RTopo-2/RTopo-2.0.1_30sec_bedrock_topography.nc';
 	otherwise
 		error('machine not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpRignot2012.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpRignot2012.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpRignot2012.m	(revision 26744)
@@ -1,5 +1,5 @@
 function [vxout vyout]= interpRignot2012(X,Y),
 
-filename = '/home/ModelData/Greenland/VelMouginot/RignotGreenland2012Vel.mat';
+filename = '/totten_1/ModelData/Greenland/VelMouginot/RignotGreenland2012Vel.mat';
 
 
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpSeaRISE.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpSeaRISE.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpSeaRISE.m	(revision 26744)
@@ -52,4 +52,10 @@
 			searisenc='/u/astrid-r1b/ModelData/SeaRISE/Antarctica5km_shelves_v1.0/Antarctica_5km_dev1.0.nc';
 		end
+	case {'totten'}
+		if hemisphere==1,
+			searisenc='/totten_1/ModelData/SeaRISE/Greenland_5km_dev1.2.nc';
+		elseif hemisphere==-1,
+			searisenc='/totten_1/ModelData/SeaRISE/Antarctica_5km_dev1.0.nc';
+		end
 	otherwise
 		error('hostname not supported yet');
Index: issm/trunk/src/m/contrib/morlighem/modeldata/interpSmith2020.m
===================================================================
--- issm/trunk/src/m/contrib/morlighem/modeldata/interpSmith2020.m	(revision 25994)
+++ issm/trunk/src/m/contrib/morlighem/modeldata/interpSmith2020.m	(revision 26744)
@@ -33,4 +33,10 @@
 			path='/home/ModelData/Antarctica/DHDTSmith/';
 		end
+	case {'totten'}
+		if strcmp(string,'gris_filt') | strcmp(string,'gris')
+			path='/totten_1/ModelData/Greenland/DHDTSmith/';
+		else
+			path='/totten_1/ModelData/Antarctica/DHDTSmith/';
+		end
 	case {'recruta'}
 		path='/home/santos/ModelData/ICESat1_ICESat2_mass_change/';
Index: issm/trunk/src/m/contrib/tsantos/integrate_field.m
===================================================================
--- issm/trunk/src/m/contrib/tsantos/integrate_field.m	(revision 26744)
+++ issm/trunk/src/m/contrib/tsantos/integrate_field.m	(revision 26744)
@@ -0,0 +1,22 @@
+function total=integrate_field(index,x,y,field)
+%INTEGRATE_FIELD: integrate a field over a 2D mesh
+%
+%   Usage:
+%      total=integrate_field(index,x,y,field);
+%
+%   Examples:
+%      volume=integrate_field(md.mesh.elements,md.mesh.x,md.mesh.y,md.geometry.thickness);
+
+% areas of each element
+x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3));
+y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3));
+areas=(0.5*((x2-x1).*(y3-y1)-(y2-y1).*(x3-x1)));
+
+% element-wise integration
+v1=index(:,1);	v2=index(:,2);	v3=index(:,3);
+elem_int=areas.*mean(field([v1 v2 v3]),2);
+
+% compute integration
+total=sum(elem_int);
+
+end
Index: issm/trunk/src/m/coordsystems/gdaltransform.m
===================================================================
--- issm/trunk/src/m/coordsystems/gdaltransform.m	(revision 25994)
+++ issm/trunk/src/m/coordsystems/gdaltransform.m	(revision 26744)
@@ -20,5 +20,5 @@
 %			+proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs
 %
-%	To get proj.4 string from EPSG, use gdalsrsinfo. Example:
+%	To get PROJ.4 string from EPSG, use gdalsrsinfo. Example:
 %		gdalsrsinfo epsg:4326 | grep "PROJ.4" | sed "s/PROJ.4 : //"
 
Index: issm/trunk/src/m/coordsystems/gmtmask.m
===================================================================
--- issm/trunk/src/m/coordsystems/gmtmask.m	(revision 25994)
+++ issm/trunk/src/m/coordsystems/gmtmask.m	(revision 26744)
@@ -35,35 +35,10 @@
 	dlmwrite(filename_all,[long lat (1:nv)'],'delimiter','\t','precision',10);
 
-	%Avoid bypassing of the ld library path by Matlab (:()
-	%
-	% TODO: Do we really need this (we can/already set it in etc/environment.sh)?
-	if ismac,
-		dyld_library_path_old=getenv('DYLD_LIBRARY_PATH');
-		setenv('DYLD_LIBRARY_PATH',[ issmdir '/externalpackages/curl/install/lib:' issmdir '/externalpackages/hdf5/install/lib:' issmdir '/externalpackages/netcdf/install/lib' ]);
-	end
-
-	%Find path to gmt, list all possible known paths to gmt (you may need to add yours to the list)
-   gmtpaths = {[issmdir '/bin/gmt'],[issmdir '/externalpackages/gmt/install/bin/gmt'],'/Applications/GMT-5.4.3.app/Contents/Resources/bin/gmt'};
-   gmtpath = '';
-   for i=gmtpaths
-      if exist(i{1},'file'),
-         gmtpath = i{1};
-			break;
-      end
-   end
-   if isempty(gmtpath),
-      error('gmt not found! Make sure it is properly installed, or add its path to this file.');
-   end
-   
 	%figure out which vertices are on the ocean, which one on the continent:
-	[status,result] = system([gmtpath ' gmtselect ./' filename_all ' -h0 -Df -R0/360/-90/90  -A0 -JQ180/200 -Nk/s/s/k/s > ./' filename_oce]);
+	[status,result] = system(['gmtselect ./' filename_all ' -h0 -Df -R0/360/-90/90  -A0 -JQ180/200 -Nk/s/s/k/s > ./' filename_oce]);
 	if status~=0,
 		error(result);
 	end
 
-	%reset DYLD_LIBRARY_PATH to what it was: 
-	if ismac,
-		setenv('DYLD_LIBRARY_PATH',dyld_library_path_old);
-	end
 	%read the con_vertices.txt file and flag our mesh vertices on the continent
 	fid=fopen(['./' filename_oce],'r');
Index: issm/trunk/src/m/coordsystems/gmtmask.py
===================================================================
--- issm/trunk/src/m/coordsystems/gmtmask.py	(revision 25994)
+++ issm/trunk/src/m/coordsystems/gmtmask.py	(revision 26744)
@@ -44,41 +44,6 @@
     np.savetxt('./all_vertices.txt', np.transpose([long, lat, np.arange(1, nv + 1)]), delimiter='\t', fmt='%.10f')
 
-    #Avoid bypassing of the ld library path by Matlab (:()
-    issm_dir = issmdir()
-
-    try:
-        ismac
-    except NameError:
-        ismac = False
-
-    # TODO: Do we really need this (we can/already set it in etc/environment.sh)?
-    if ismac:
-        dyld_library_path_old = os.getenv('DYLD_LIBRARY_PATH')
-        os.putenv('DYLD_LIBRARY_PATH', issm_dir + '/externalpackages/curl/install/lib:' + issm_dir + '/externalpackages/hdf5/install/lib:' + issm_dir + '/externalpackages/netcdf/install/lib')
-
-    #Find path to gmt (you may need to add yours to the list).
-    #
-    # NOTE: Assumes gmtselect is also in this directory.
-    #
-    gmtpaths = [
-        issm_dir + '/bin/gmt',
-        issm_dir + '/externalpackages/gmt/install/bin/gmt',
-        '/Applications/GMT-5.4.3.app/Contents/Resources/bin/gmt'
-    ]
-    gmtpath = ''
-    for i in range(len(gmtpaths)):
-        if os.path.isfile(gmtpaths[i]):
-            gmtpath = gmtpaths[i]
-            break
-
-    if gmtpath == '':
-        raise Exception('gmt not found! Make sure it is properly installed, or add its path to this file.')
-
     #figure out which vertices are on the ocean, which one on the continent:
-    subprocess.call(gmtpath + ' gmtselect ./ all_vertices.txt -h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s > ./oce_vertices.txt', shell=True)
-
-    #reset DYLD_LIBRARY_PATH to what it was:
-    if ismac:
-        os.putenv('DYLD_LIBRARY_PATH', dyld_library_path_old)
+    subprocess.call('gmtselect ./ all_vertices.txt -h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s > ./oce_vertices.txt', shell=True)
 
     #read the con_vertices.txt file and flag our mesh vertices on the continent
Index: issm/trunk/src/m/coordsystems/laea.py
===================================================================
--- issm/trunk/src/m/coordsystems/laea.py	(revision 25994)
+++ issm/trunk/src/m/coordsystems/laea.py	(revision 26744)
@@ -1,5 +1,4 @@
 def laea(lat, long): #{{{
-    '''
-    LAEA - Lambert Azimuthal Equal Area projection at lat, long projection 
+    """LAEA - Lambert Azimuthal Equal Area projection at lat, long projection 
     center.
 
@@ -10,5 +9,5 @@
             string = laea(45, -90)
             return string = '+proj=laea +lat_0=45 +lon_0=-90 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs'
-    '''
+    """
 
     return '+proj=laea +lat_0={} +lon_0={} +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs'.format(lat, long)
Index: issm/trunk/src/m/coordsystems/laea_inv.m
===================================================================
--- issm/trunk/src/m/coordsystems/laea_inv.m	(revision 26744)
+++ issm/trunk/src/m/coordsystems/laea_inv.m	(revision 26744)
@@ -0,0 +1,63 @@
+function [lat,lon] = laea_inv(x,y,lat1,lon0,falseeasting,falsenorthing)
+% laea_inv performs an inverse Lambert Azimuthal Equal Area projection
+% for a simple spherical Earth of radius 6371000 meters. 
+% 
+%% Syntax 
+% 
+%  [lat,lon] = laea_inv(x,y,lat1,lon0)
+%  [lat,lon] = laea_inv(x,y,lat1,lon0,falseeasting,falsenorthing)
+% 
+%% Description 
+% 
+% [lat,lon] = laea_inv(x,y,lat1,lon0) transforms the coordinates x,y (in 
+% meters) into geographic coordinates lat,lon. Inputs lat1 and lon0 specify 
+% the origin.
+%
+% [lat,lon] = laea_inv(x,y,lat1,lon0,falseeasting,falsenorthing) also allows
+% inclusion of false eastings and northings in meters. 
+% 
+%% Author Info 
+% Function written by Chad A. Greene of NASA Jet Propulsion Laboratory. 
+% December 2020. 
+% Formulas taken directly from Snyder 1987's classic tome, "Map Projections 
+% A Working Manual" starting around page 185. 
+
+%% Parse inputs: 
+
+narginchk(4,6)
+assert(isequal(size(lat1),size(lon0),[1 1]),'Error: Inputs lat1 and lon0 must both be scalars.')
+assert(abs(lat1)<=90,'lat1 cannot exceed +/-90 degrees.') 
+assert(abs(lon0)<=360,'lon0 cannot exceed +/-360 degrees.') 
+assert(isequal(size(x),size(y)),'Dimensions of x and y must match.') 
+
+if nargin<5
+   falseeasting = 0; 
+   falsenorthing = 0; 
+end
+
+%% 
+% Projection formulas:
+% From Snyder 1987, MAP PROJECTIONS-A WORKING MANUAL, page 185: https://pubs.usgs.gov/pp/1395/report.pdf
+
+% Account for false easting, northing: 
+x = x - falseeasting; 
+y = y - falsenorthing; 
+
+% Define constants: 
+R = 6371000; % earth radius (meters) 
+rho = hypot(x,y); 
+c = 2*asind(rho./(2*R)); 
+
+% Unproject: 
+lat = asind(cosd(c) .* sind(lat1) + (y .* sind(c) .* cosd(lat1))./rho); 
+
+switch lon0
+   case 90
+      lon = lon0 + atand(-x./y);
+   case -90
+      lon = lon0 + atand(x./y); 
+   otherwise
+      lon = lon0 + atand((x .* sind(c))./(rho.*cosd(lat1) .*cosd(c) - y.*sind(lat1).*sind(c))); 
+end
+
+end
Index: issm/trunk/src/m/coordsystems/ll2xy.m
===================================================================
--- issm/trunk/src/m/coordsystems/ll2xy.m	(revision 25994)
+++ issm/trunk/src/m/coordsystems/ll2xy.m	(revision 26744)
@@ -36,5 +36,5 @@
 
 if nargout~=3 & nargout~=2,
-	help xy2ll
+	help ll2xy
 	error('bad usage');
 end
Index: issm/trunk/src/m/coordsystems/ll2xy.py
===================================================================
--- issm/trunk/src/m/coordsystems/ll2xy.py	(revision 25994)
+++ issm/trunk/src/m/coordsystems/ll2xy.py	(revision 26744)
@@ -2,38 +2,50 @@
 
 
-def ll2xy(lat, lon, sgn=-1, central_meridian=0, standard_parallel=71):
-    '''
-    LL2XY - converts lat lon to polar stereographic
+def ll2xy(lat, lon, sgn, *args):
+    """LL2XY - converts lat lon to polar stereographic
 
-   Converts from geodetic latitude and longitude to Polar
-   Stereographic (X, Y) coordinates for the polar regions.
-   Author: Michael P. Schodlok, December 2003 (map2ll)
+    Converts from geodetic latitude and longitude to Polar
+    Stereographic (X, Y) coordinates for the polar regions.
+    Author: Michael P. Schodlok, December 2003 (map2ll)
 
-   Usage:
-      x, y = ll2xy(lat, lon, sgn)
-      x, y = ll2xy(lat, lon, sgn, central_meridian, standard_parallel)
+    Usage:
+        x, y = ll2xy(lat, lon, sgn)
+        x, y = ll2xy(lat, lon, sgn, central_meridian, standard_parallel)
 
- - sgn = Sign of latitude	1 : north latitude (default is mer = 45 lat = 70)
- 						   -1 : south latitude (default is mer = 0  lat = 71)
-    '''
+    - sgn = Sign of latitude	1 : north latitude (default is mer = 45 lat = 70)
+    						   -1 : south latitude (default is mer = 0  lat = 71)
+    """
+    assert sgn == 1 or sgn == -1, 'error: sgn should be either 1 or -1'
+	 
+	 # Get central_meridian and standard_parallel depending on hemisphere
+    if len(args) == 2:
+       delta = args[0]
+       slat = args[1]
+    elif len(args) == 0:
+       if sgn == 1:
+          delta = 45.
+          slat = 70.
+          print('        ll2xy: creating coordinates in north polar stereographic (Std Latitude: 70degN Meridian: 45deg)')
+       elif sgn == -1:
+          delta = 0.
+          slat = 71.
+          print('        ll2xy: creating coordinates in south polar stereographic (Std Latitude: 71degS Meridian: 0deg)')
+       else:
+          raise ValueError('sgn should be either 1 or -1')
+    else:
+       raise Exception('bad usage: type "help(ll2xy)" for details')
 
-    assert sgn == 1 or sgn == -1, 'error: sgn should be either 1 or -1'
-
-    #Get central_meridian and standard_parallel depending on hemisphere
-    if sgn == 1:
-        delta = 45
-        slat = 70
-        print('        ll2xy: creating coordinates in north polar stereographic (Std Latitude: 70N Meridian: 45)')
-    else:
-        delta = central_meridian
-        slat = standard_parallel
-        print('        ll2xy: creating coordinates in south polar stereographic (Std Latitude: 71S Meridian: 0)')
+    # if lat, lon passed as lists, convert to np.arrays
+    if type(lat) != "np.ndarray":
+       lat = np.array(lat)
+    if type(lon) != "np.ndarray":
+       lon = np.array(lon)
 
     # Conversion constant from degrees to radians
     #cde = 57.29577951
     # Radius of the earth in meters
-    re = 6378.273 * 10**3
+    re = 6378.273 * pow(10, 3)
     # Eccentricity of the Hughes ellipsoid squared
-    ex2 = .006693883
+    ex2 = 0.006693883
     # Eccentricity of the Hughes ellipsoid
     ex = np.sqrt(ex2)
@@ -58,6 +70,7 @@
     cnt1 = np.nonzero(latitude >= np.pi / 2.)[0]
 
-    if cnt1:
-        x[cnt1, 0] = 0.0
-        y[cnt1, 0] = 0.0
+    if len(cnt1)>0:
+        x[cnt1] = 0.0
+        y[cnt1] = 0.0
+
     return x, y
Index: issm/trunk/src/m/coordsystems/xy2ll.py
===================================================================
--- issm/trunk/src/m/coordsystems/xy2ll.py	(revision 25994)
+++ issm/trunk/src/m/coordsystems/xy2ll.py	(revision 26744)
@@ -4,6 +4,5 @@
 
 def xy2ll(x, y, sgn, *args):
-    '''
-    XY2LL - converts xy to lat long
+    """XY2LL - converts xy to lat long
 
     Converts Polar  Stereographic (X, Y) coordinates for the polar regions to
@@ -13,12 +12,12 @@
 
     Usage:
-       [lat, lon] = xy2ll(x, y, sgn)
-       [lat, lon] = xy2ll(x, y, sgn, central_meridian, standard_parallel)
+        [lat, lon] = xy2ll(x, y, sgn)
+        [lat, lon] = xy2ll(x, y, sgn, central_meridian, standard_parallel)
 
-     - sgn = Sign of latitude	1 : north latitude (default is mer = 45 lat = 70)
-     						   -1 : south latitude (default is mer = 0  lat = 71)
-    '''
+    - sgn = Sign of latitude	1 : north latitude (default is mer = 45 lat = 70)
+    						   -1 : south latitude (default is mer = 0  lat = 71)
+    """
 
-    #Get central_meridian and standard_parallel depending on hemisphere
+    # Get central_meridian and standard_parallel depending on hemisphere
     if len(args) == 2:
         delta = args[0]
@@ -47,11 +46,11 @@
     #cde = 57.29577951
     # Radius of the earth in meters
-    re = 6378.273 * 10**3
+    re = 6378.273 * pow(10, 3)
     # Eccentricity of the Hughes ellipsoid squared
-    ex2 = .006693883
+    ex2 = 0.006693883
     # Eccentricity of the Hughes ellipsoid
     ex = np.sqrt(ex2)
 
-    sl = slat * pi / 180.
+    sl = slat * pi / 180.0
     rho = np.sqrt(x**2 + y**2)
     cm = np.cos(sl) / np.sqrt(1.0 - ex2 * (np.sin(sl)**2))
Index: issm/trunk/src/m/dev/ISSM.py
===================================================================
--- issm/trunk/src/m/dev/ISSM.py	(revision 25994)
+++ issm/trunk/src/m/dev/ISSM.py	(revision 26744)
@@ -4,5 +4,4 @@
 import scipy.io as spio
 from model import *
-from socket import gethostname
 from triangle import *
 from setmask import *
@@ -10,5 +9,6 @@
 from setflowequation import *
 from solve import *
-from IssmConfing import *
+from IssmConfig import *
+from MatlabFuncs import *
 
 #Secondary imports
Index: issm/trunk/src/m/dev/devpath.m
===================================================================
--- issm/trunk/src/m/dev/devpath.m	(revision 25994)
+++ issm/trunk/src/m/dev/devpath.m	(revision 26744)
@@ -3,9 +3,10 @@
 
 %Recover ISSM_DIR , or if on a Windows machine, ISSM_DIR_WIN
-if ~ispc,
+if ispc,
+	ISSM_DIR=getenv('ISSM_DIR_WIN');
+else
 	ISSM_DIR=getenv('ISSM_DIR');
-else
-	ISSM_DIR=getenv('ISSM_DIR_WIN');
 end
+
 if (isempty(ISSM_DIR)),
 	error('''ISSM_DIR'' environment variable is empty! You should define ISSM_DIR in your .cshrc or .bashrc!');
@@ -18,5 +19,5 @@
 %ISSM path
 addpath([ISSM_DIR '/src/m/os/']); %load recursivepath
-addpath([ISSM_DIR '/lib']);       %load mex
+addpath([ISSM_DIR '/lib']);       %load MEX files
 addpath(recursivepath([ISSM_DIR '/src/m']));
 addpath(recursivepath([ISSM_DIR '/externalpackages/scotch']));
@@ -28,4 +29,5 @@
 addpath(recursivepath([ISSM_DIR '/externalpackages/dem']));
 addpath(recursivepath([ISSM_DIR '/externalpackages/mealpix']));
+addpath(recursivepath([ISSM_DIR '/externalpackages/pcatool']));
 clear ISSM_DIR;
 
Index: issm/trunk/src/m/dev/devpath.py
===================================================================
--- issm/trunk/src/m/dev/devpath.py	(revision 25994)
+++ issm/trunk/src/m/dev/devpath.py	(revision 26744)
@@ -2,5 +2,4 @@
 import os
 import sys
-import warnings
 
 #Recover ISSM_DIR and USERNAME
@@ -16,6 +15,6 @@
         dirs.remove('.svn')
     for file in files:
-        if file.find(".py") != -1:
-            if file.find(".pyc") == -1:
+        if file.find('.py') != -1:
+            if file.find('.pyc') == -1:
                 if root not in sys.path:
                     sys.path.append(root)
@@ -36,5 +35,5 @@
             sys.path.append(jpl_path)
     else:
-        warnings.warn('cluster settings should be in, {}/usr/{}'.format(JPL_SVN, USERNAME))
+        print('Warning: devpath.py: cluster settings should be in {}'.format(jpl_path))
 
 from runme import runme  #first because plotmodel may fail
@@ -47,4 +46,4 @@
 #c.InteractiveShellApp.exec_lines.append('print "Warning: disable autoreload in startup.py to improve performance." ')
 
-print("\n  ISSM development path correctly loaded")
-print("Current path is {}\n\n".format(ISSM_DIR))
+# print("\n  ISSM development path correctly loaded")
+# print("Current path is {}\n\n".format(ISSM_DIR))
Index: issm/trunk/src/m/dev/issmversion.m
===================================================================
--- issm/trunk/src/m/dev/issmversion.m	(revision 25994)
+++ issm/trunk/src/m/dev/issmversion.m	(revision 26744)
@@ -17,5 +17,5 @@
 disp(['Compiled on ' IssmConfig('HOST_VENDOR') ' ' IssmConfig('HOST_OS') ' ' IssmConfig('HOST_ARCH') ' by ' IssmConfig('USER_NAME')]);
 disp([' ']);
-disp(['Copyright (c) 2009-2020 California Institute of Technology']);
+disp(['Copyright (c) 2009-2021 California Institute of Technology']);
 disp([' ']);
 disp(['    to get started type: issmdoc']);
Index: issm/trunk/src/m/dev/issmversion.py
===================================================================
--- issm/trunk/src/m/dev/issmversion.py	(revision 25994)
+++ issm/trunk/src/m/dev/issmversion.py	(revision 26744)
@@ -16,5 +16,5 @@
 print(' ')
 print(('Build date: ' + IssmConfig('PACKAGE_BUILD_DATE')[0]))
-print('Copyright (c) 2009 - 2020 California Institute of Technology')
+print('Copyright (c) 2009-2021 California Institute of Technology')
 print(' ')
 print('    to get started type: issmdoc')
Index: issm/trunk/src/m/exp/contourlevelzero.m
===================================================================
--- issm/trunk/src/m/exp/contourlevelzero.m	(revision 25994)
+++ issm/trunk/src/m/exp/contourlevelzero.m	(revision 26744)
@@ -1,6 +1,6 @@
 function contours=contourlevelzero(md,mask,level)
-%CONTOURLEVELZERO - figure out the zero level (or offset thereof, specified by 
-%the level value) of a vectorial mask, and vectorialize it into an exp or shp 
-%compatible structure.
+%CONTOURLEVELZERO - figure out the zero level (or offset thereof, specified by the level value) 
+%                   of a vectorial mask, and vectorialize it into an exp or shp compatible 
+%structure.
 %
 %   Usage:
@@ -9,10 +9,7 @@
 %   See also: PLOT_CONTOUR
 
-if isempty(mask)
-	error('mask provided is empty');
-end
-
 %process data 
 if dimension(md.mesh)==3,
+% 	error('contourlevelzero error message: routine not supported for 3d meshes, project on a layer');
 	x = md.mesh.x2d;
 	y = md.mesh.y2d;
@@ -24,5 +21,5 @@
 end
 
-if isfield(md.mesh,'z'),
+if isprop(md.mesh,'z'),
 	z=md.mesh.z;
 else
@@ -30,6 +27,7 @@
 end
 
+if isempty(mask), error('mask provided is empty'); end
 if dimension(md.mesh)==3,
-	if length(mask)~=md.mesh.numberofvertices2d, error('Since this is a 3d model, you need to project the mask on a layer (e.g. project2d(md,mask,0))'); end
+	if length(mask)~=md.mesh.numberofvertices2d, error('mask provided should be specified at the vertices of the mesh'); end
 else
 	if length(mask)~=md.mesh.numberofvertices, error('mask provided should be specified at the vertices of the mesh'); end
Index: issm/trunk/src/m/exp/contourlevelzero.py
===================================================================
--- issm/trunk/src/m/exp/contourlevelzero.py	(revision 26744)
+++ issm/trunk/src/m/exp/contourlevelzero.py	(revision 26744)
@@ -0,0 +1,237 @@
+import os.path
+import numpy as np
+from collections import OrderedDict
+
+def contourlevelzero(md,mask,level):
+    """CONTOURLEVELZERO - figure out the zero level (or offset thereof, specified by the level value)
+                       of a vectorial mask, and vectorialize it into an exp or shp compatible structure.
+    
+       Usage:
+          contours=contourlevelzero(md,mask,level)
+    
+       See also: PLOT_CONTOUR
+    """
+    
+    #process data 
+    if md.mesh.dimension()==3:
+        x = md.mesh.x2d
+        y = md.mesh.y2d
+        z=md.mesh.z
+        index=md.mesh.elements2d-1
+    else:
+        x=md.mesh.x
+        y=md.mesh.y
+        index=md.mesh.elements-1
+        z=np.zeros((md.mesh.numberofvertices,1))
+        
+    if len(mask)==0:
+        raise OSError("mask provided is empty")
+    
+    if md.mesh.dimension()==3:
+        if len(mask)!=md.mesh.numberofvertices2d: 
+            raise OSError("mask provided should be specified at the vertices of the mesh")
+    else:
+        if len(mask)!=md.mesh.numberofvertices:
+            raise OSError("mask provided should be specified at the vertices of the mesh")
+        
+    #initialization of some variables
+    numberofelements=np.size(index,0)
+    elementslist=np.c_[0:numberofelements]
+    c=[]
+    h=[]
+    
+    #get unique edges in mesh
+    #1: list of edges
+    edges=np.vstack((np.vstack((index[:,(0,1)],index[:,(1,2)])),index[:,(2,0)]))
+
+    #2: find unique edges
+    [edges,J]=np.unique(np.sort(edges,1),axis=0,return_inverse=True)
+    #3: unique edge numbers
+    vec=J
+    #4: unique edges numbers in each triangle (2 triangles sharing the same edge will have
+    #   the same edge number)
+    edges_tria=np.hstack((np.hstack((vec[elementslist],vec[elementslist+numberofelements])),vec[elementslist+2*numberofelements]))
+    
+    #segments [nodes1 nodes2]
+    Seg1=index[:,(0,1)]
+    Seg2=index[:,(1,2)]
+    Seg3=index[:,(2,0)]
+    
+    #segment numbers [1;4;6;...]
+    Seg1_num=edges_tria[:,0]
+    Seg2_num=edges_tria[:,1]
+    Seg3_num=edges_tria[:,2]
+    
+    #value of data on each tips of the segments
+    Data1=mask[Seg1]
+    Data2=mask[Seg2]
+    Data3=mask[Seg3]
+    
+    #get the ranges for each segment
+    Range1=np.sort(Data1,1)
+    Range2=np.sort(Data2,1)
+    Range3=np.sort(Data3,1)
+    
+    #find the segments that contain this value
+    pos1=(Range1[:,0]<level) & (Range1[:,1]>=level)
+    pos2=(Range2[:,0]<level) & (Range2[:,1]>=level)
+    pos3=(Range3[:,0]<level) & (Range3[:,1]>=level)
+    
+    #get elements
+    poselem12=(pos1) & (pos2)
+    poselem13=(pos1) & (pos3)
+    poselem23=(pos2) & (pos3)
+    poselem=np.where((poselem12) | (poselem13) | (poselem23))
+    poselem=poselem[0]
+    numelems=len(poselem)
+    
+    #if no element has been flagged, skip to the next level
+    if numelems==0:
+        raise Exception('contourlevelzero warning message: no elements found with corresponding level value in mask')
+        contours=[]
+        return contours
+    
+    #go through the elements and build the coordinates for each segment (1 by element)
+    x1=np.zeros((numelems,1))
+    x2=np.zeros((numelems,1))
+    y1=np.zeros((numelems,1))
+    y2=np.zeros((numelems,1))
+    z1=np.zeros((numelems,1))
+    z2=np.zeros((numelems,1))
+    
+    edge_l=np.zeros((numelems,2))
+    
+    for j in range(0,numelems):
+        
+        with np.errstate(divide='ignore', invalid='ignore'):
+            weight1=np.divide(level-Data1[poselem[j],0],Data1[poselem[j],1]-Data1[poselem[j],0])
+            weight2=np.divide(level-Data2[poselem[j],0],Data2[poselem[j],1]-Data2[poselem[j],0])
+            weight3=np.divide(level-Data3[poselem[j],0],Data3[poselem[j],1]-Data3[poselem[j],0])
+        
+        if poselem12[poselem[j]]==True:
+            
+            x1[j]=x[Seg1[poselem[j],0]]+weight1*[x[Seg1[poselem[j],1]]-x[Seg1[poselem[j],0]]]
+            x2[j]=x[Seg2[poselem[j],0]]+weight2*[x[Seg2[poselem[j],1]]-x[Seg2[poselem[j],0]]]
+            y1[j]=y[Seg1[poselem[j],0]]+weight1*[y[Seg1[poselem[j],1]]-y[Seg1[poselem[j],0]]]
+            y2[j]=y[Seg2[poselem[j],0]]+weight2*[y[Seg2[poselem[j],1]]-y[Seg2[poselem[j],0]]]
+            z1[j]=z[Seg1[poselem[j],0]]+weight1*[z[Seg1[poselem[j],1]]-z[Seg1[poselem[j],0]]]
+            z2[j]=z[Seg2[poselem[j],0]]+weight2*[z[Seg2[poselem[j],1]]-z[Seg2[poselem[j],0]]]
+            
+            edge_l[j,0]=Seg1_num[poselem[j]]
+            edge_l[j,1]=Seg2_num[poselem[j]]
+        elif poselem13[poselem[j]]==True:
+            
+            x1[j]=x[Seg1[poselem[j],0]]+weight1*[x[Seg1[poselem[j],1]]-x[Seg1[poselem[j],0]]]
+            x2[j]=x[Seg3[poselem[j],0]]+weight3*[x[Seg3[poselem[j],1]]-x[Seg3[poselem[j],0]]]
+            y1[j]=y[Seg1[poselem[j],0]]+weight1*[y[Seg1[poselem[j],1]]-y[Seg1[poselem[j],0]]]
+            y2[j]=y[Seg3[poselem[j],0]]+weight3*[y[Seg3[poselem[j],1]]-y[Seg3[poselem[j],0]]]
+            z1[j]=z[Seg1[poselem[j],0]]+weight1*[z[Seg1[poselem[j],1]]-z[Seg1[poselem[j],0]]]
+            z2[j]=z[Seg3[poselem[j],0]]+weight3*[z[Seg3[poselem[j],1]]-z[Seg3[poselem[j],0]]]
+            
+            edge_l[j,0]=Seg1_num[poselem[j]]
+            edge_l[j,1]=Seg3_num[poselem[j]]
+        elif poselem23[poselem[j]]==True:
+            
+            x1[j]=x[Seg2[poselem[j],0]]+weight2*[x[Seg2[poselem[j],1]]-x[Seg2[poselem[j],0]]]
+            x2[j]=x[Seg3[poselem[j],0]]+weight3*[x[Seg3[poselem[j],1]]-x[Seg3[poselem[j],0]]]
+            y1[j]=y[Seg2[poselem[j],0]]+weight2*[y[Seg2[poselem[j],1]]-y[Seg2[poselem[j],0]]]
+            y2[j]=y[Seg3[poselem[j],0]]+weight3*[y[Seg3[poselem[j],1]]-y[Seg3[poselem[j],0]]]
+            z1[j]=z[Seg2[poselem[j],0]]+weight2*[z[Seg2[poselem[j],1]]-z[Seg2[poselem[j],0]]]
+            z2[j]=z[Seg3[poselem[j],0]]+weight3*[z[Seg3[poselem[j],1]]-z[Seg3[poselem[j],0]]]
+
+            edge_l[j,0]=Seg2_num[poselem[j]]
+            edge_l[j,1]=Seg3_num[poselem[j]]
+
+        #else:
+	    #it shoud not go here
+            
+    #now that we have the segments, we must try to connect them...
+    
+    #loop over the subcontours
+    contours=[]
+    
+    while len(edge_l)>0:
+        
+        #take the right edge of the second segment and connect it to the next segments if any
+        e1=edge_l[0,0]
+        e2=edge_l[0,1]
+        xc=np.vstack((x1[0],x2[0]))
+        yc=np.vstack((y1[0],y2[0]))
+        zc=np.vstack((z1[0],z2[0]))
+        #erase the lines corresponding to this edge
+        edge_l=np.delete(edge_l,0,axis=0)
+        x1=np.delete(x1,0,axis=0)
+        x2=np.delete(x2,0,axis=0)
+        y1=np.delete(y1,0,axis=0)
+        y2=np.delete(y2,0,axis=0)
+        z1=np.delete(z1,0,axis=0)
+        z2=np.delete(z2,0,axis=0)
+        pos1=np.where(edge_l==e1)
+        
+        while len(pos1[0])>0:
+            
+            if np.all(pos1[1]==0):
+                xc=np.vstack((x2[pos1[0]],xc))
+                yc=np.vstack((y2[pos1[0]],yc))
+                zc=np.vstack((z2[pos1[0]],zc))
+                #next edge:
+                e1=edge_l[pos1[0],1]
+            else:
+                xc=np.vstack((x1[pos1[0]],xc))
+                yc=np.vstack((y1[pos1[0]],yc))
+                zc=np.vstack((z1[pos1[0]],zc))
+                #next edge:
+                e1=edge_l[pos1[0],0]
+                
+            #erase the lines of this
+            edge_l=np.delete(edge_l,pos1[0],axis=0)
+            x1=np.delete(x1,pos1[0],axis=0)
+            x2=np.delete(x2,pos1[0],axis=0)
+            y1=np.delete(y1,pos1[0],axis=0)
+            y2=np.delete(y2,pos1[0],axis=0)
+            z1=np.delete(z1,pos1[0],axis=0)
+            z2=np.delete(z2,pos1[0],axis=0)
+            #next connection
+            pos1=np.where(edge_l==e1)
+            
+        #same thing the other way (to the right)
+        pos2=np.where(edge_l==e2)
+
+        while len(pos2[0])>0:
+            
+            if np.all(pos2[1]==0):
+                xc=np.vstack((xc,x2[pos2[0]]))
+                yc=np.vstack((yc,y2[pos2[0]]))
+                zc=np.vstack((zc,z2[pos2[0]]))
+                #next edge:
+                e2=edge_l[pos2[0],1]
+            else:
+                xc=np.vstack((xc,x1[pos2[0]]))
+                yc=np.vstack((yc,y1[pos2[0]]))
+                zc=np.vstack((zc,z1[pos2[0]]))
+                #next edge:
+                e2=edge_l[pos2[0],0]
+                
+            #erase the lines of this
+            edge_l=np.delete(edge_l,pos2[0],axis=0)
+            x1=np.delete(x1,pos2[0],axis=0)
+            x2=np.delete(x2,pos2[0],axis=0)
+            y1=np.delete(y1,pos2[0],axis=0)
+            y2=np.delete(y2,pos2[0],axis=0)
+            z1=np.delete(z1,pos2[0],axis=0)
+            z2=np.delete(z2,pos2[0],axis=0)
+            #next connection
+            pos2=np.where(edge_l==e2)
+            
+        #save xc,yc contour: 
+        newcontour = OrderedDict()
+        newcontour['nods'] = np.size(xc)
+        newcontour['density'] = 1 
+        newcontour['closed'] = 0
+        newcontour['x'] = np.ma.filled(xc.astype(float), np.nan)
+        newcontour['y'] = np.ma.filled(yc.astype(float), np.nan)
+        newcontour['z'] = np.ma.filled(zc.astype(float), np.nan)
+        newcontour['name'] = ''
+        contours.append(newcontour)
+        
+    return contours
Index: issm/trunk/src/m/exp/expcontourlevelzero.m
===================================================================
--- issm/trunk/src/m/exp/expcontourlevelzero.m	(revision 25994)
+++ issm/trunk/src/m/exp/expcontourlevelzero.m	(revision 26744)
@@ -6,5 +6,6 @@
 % 
 %   Example:
-%      expcontourlevelzero(md,md.geometry.thickness,0, 'Level0.exp');
+%      expcontourlevelzero(md,md.geometry.thickness,10, 'Level0.exp');
+%      expcontourlevelzero(md,md.mask.ocean_levelset,0, 'Level0.exp');
 %
 %   See also CONTOURLEVELZERO, EXPWRITE
Index: issm/trunk/src/m/exp/expwrite.py
===================================================================
--- issm/trunk/src/m/exp/expwrite.py	(revision 25994)
+++ issm/trunk/src/m/exp/expwrite.py	(revision 26744)
@@ -3,45 +3,43 @@
 
 def expwrite(contours, filename):
-    """
-    EXPWRITE - write an Argus file from a dictionary given in input
+    """EXPWRITE - write an Argus file from a dictionary given in input
 
-       This routine writes an Argus file from a dict containing the fields:
-       x and y of the coordinates of the points.
-       The first argument is the list containing the points coordinates
-       and the second one the file to be written.
+    This routine writes an Argus file from a dict containing the fields:
+    x and y of the coordinates of the points.
+    The first argument is the list containing the points coordinates and the 
+    second one the file to be written.
 
-       Usage:
-          expwrite(contours, filename)
+    Usage:
+        expwrite(contours, filename)
 
-       Example:
-          expwrite(coordstruct, 'domainoutline.exp')
+    Example:
+        expwrite(coordstruct, 'domainoutline.exp')
 
-       See also EXPDOC, EXPREAD, EXPWRITEASVERTICES
+    See also EXPDOC, EXPREAD, EXPWRITEASVERTICES
     """
 
     fid = open(filename, 'w')
     for x, y in zip(contours['x'], contours['y']):
-        #if np.size(contour['x']) != np.size(contour['y']):
         if len(x) != len(y):
-            raise RuntimeError("contours x and y coordinates must be of identical size")
+            raise RuntimeError('contours x and y coordinates must be of identical size')
+
         if 'name' in contours:
-            fid.write("%s%s\n" % ('  # Name:', contours['name']))
+            fid.write('{}{}\n'.format('# Name:', contours['name']))
         else:
-            fid.write("%s%s\n" % ('  # Name:', filename))
+            fid.write('{}{}\n'.format('# Name:', filename))
 
-        #Add density if it's not there FIXME what is this ever used for?
-        #if 'density' not in contours:
-        #    contours['density'] = 1
-        density = 1
-
-        fid.write("%s\n" % '  # Icon:0')
-        fid.write("%s\n" % '  # Points Count Value')
-    #fid.write("%i %f\n" % (np.size(contour['x']), contour['density']))
-        fid.write("%i %f\n" % (np.size(x), density))
-        fid.write("%s\n" % '  # X pos Y pos')
-    #for x, y in zip(contour['x'], contour['y']):
+        fid.write('{}\n'.format('## Icon:0'))
+        fid.write('{}\n'.format('# Points Count Value'))
+        if 'density' in contours:
+            if isinstance(contours['density'], int):
+                fid.write('{} {}\n'.format(np.size(x), contours['density']))
+            else:
+                fid.write('{} {}\n'.format(np.size(x), 1.))
+        else:
+            fid.write('{} {}\n'.format(np.size(x), 1.))
+        fid.write('{}\n'.format('# X pos Y pos'))
         for xi, yi in zip(x, y):
-            fid.write("%10.10f %10.10f\n" % (xi, yi))
-        fid.write("\n")
+            fid.write('%10.10f %10.10f\n' % (xi, yi))
+        fid.write('\n')
 
     fid.close()
Index: issm/trunk/src/m/extrusion/project3d.m
===================================================================
--- issm/trunk/src/m/extrusion/project3d.m	(revision 25994)
+++ issm/trunk/src/m/extrusion/project3d.m	(revision 26744)
@@ -7,9 +7,10 @@
 %   arguments: 
 %      'vector': 2d vector
-%      'type': 'element' or 'node'. 
+%      'type': 'element' or 'node' or 'poly'
 %   options: 
 %      'layer' a layer number where vector should keep its values. If not specified, all layers adopt the 
 %             value of the 2d vector.
 %      'padding': default to 0 (value adopted by other 3d layers not being projected0
+%		 'degree': degree of polynomials when extrude from bottom to the top
 %
 %   Egs:
@@ -33,4 +34,5 @@
 layer        = getfieldvalue(options,'layer',0);    %optional (do all layers otherwise)
 paddingvalue = getfieldvalue(options,'padding',0);  %0 by default
+polyexponent = getfieldvalue(options,'degree',0);   %0 by default, 0-degree polynomial
 
 if length(vector2d)==1,
@@ -80,4 +82,27 @@
 	end
 
+elseif strcmpi(type,'poly'), % interpolate values from 0 to 1 with a polynomial degree n
+	%Initialize 3d vector
+	if size(vector2d,1)==md.mesh.numberofvertices2d
+		projected_vector=paddingvalue*ones(md.mesh.numberofvertices, size(vector2d,2));
+	elseif size(vector2d,1)==md.mesh.numberofvertices2d+1
+		projected_vector=paddingvalue*ones(md.mesh.numberofvertices+1,size(vector2d,2));
+		projected_vector(end,:)=vector2d(end,:);
+		vector2d=vector2d(1:end-1,:);
+	else
+		error('vector length not supported')
+	end
+
+	polycoeff = [0:1./(md.mesh.numberoflayers-1):1];
+
+	%Fill in
+	if layer==0,
+		for i=1:md.mesh.numberoflayers,
+			projected_vector(((i-1)*md.mesh.numberofvertices2d+1):(i*md.mesh.numberofvertices2d),:)=vector2d*(1-(1-polycoeff(i)).^polyexponent);
+		end
+	else
+		projected_vector(((layer-1)*md.mesh.numberofvertices2d+1):(layer*md.mesh.numberofvertices2d),:)=vector2d*(1-(1-polycoeff(layer)).^polyexponent);
+	end
+
 else
 	error('project3d error message: unknown projection type');
Index: issm/trunk/src/m/extrusion/project3d.py
===================================================================
--- issm/trunk/src/m/extrusion/project3d.py	(revision 25994)
+++ issm/trunk/src/m/extrusion/project3d.py	(revision 26744)
@@ -1,4 +1,3 @@
 import numpy as np
-
 from pairoptions import pairoptions
 
@@ -8,19 +7,20 @@
     PROJECT3D - vertically project a vector from 2d mesh
 
-        vertically project a vector from 2d mesh (split in noncoll and coll 
+        vertically project a vector from 2d mesh (split in noncoll and coll
         areas) into a 3d mesh.
-        This vector can be a node vector of size (md.mesh.numberofvertices2d, 
+        This vector can be a node vector of size (md.mesh.numberofvertices2d,
         N/A) or an element vector of size (md.mesh.numberofelements2d, N/A).
 
         arguments:
             'vector': 2d vector
-            'type': 'element' or 'node'
+            'type': 'element' or 'node' or 'poly'
 
         options:
-            'layer'     a layer number where vector should keep its values. If 
-                        not specified, all layers adopt the value of the 2d 
+            'layer'     a layer number where vector should keep its values. If
+                        not specified, all layers adopt the value of the 2d
                         vector.
-            'padding':  default to 0 (value adopted by other 3d layers not 
+            'padding':  default to 0 (value adopted by other 3d layers not
                         being projected.
+            'degree':   degree of polynomials when extrude from bottom to the top
 
         Examples:
@@ -42,4 +42,5 @@
     layer = options.getfieldvalue('layer', 0)  #optional (do all layers otherwise)
     paddingvalue = options.getfieldvalue('padding', 0)  #0 by default
+    polyexponent = options.getfieldvalue('degree', 0)  #0 by default, 0-degree polynomial
 
     #Handle special case where vector2d is single element (differs from representation in MATLAB)
@@ -115,5 +116,36 @@
             else:
                 projected_vector[((layer - 1) * md.mesh.numberofelements2d):(layer * md.mesh.numberofelements2d), :] = vector2d
-
+    elif vectype.lower() == 'poly':
+        #Initialize 3d vector
+        if np.ndim(vector2d) == 1:
+            if vector2d.shape[0] == md.mesh.numberofvertices2d:
+                projected_vector = (paddingvalue * np.ones((md.mesh.numberofvertices))).astype(vector2d.dtype)
+            elif vector2d.shape[0] == md.mesh.numberofvertices2d + 1:
+                projected_vector = (paddingvalue * np.ones((md.mesh.numberofvertices + 1))).astype(vector2d.dtype)
+                projected_vector[-1] = vector2d[-1]
+                vector2d = vector2d[:-1]
+            else:
+                raise TypeError("vector length not supported")
+            #Fill in
+            if layer == 0:
+                for i in range(md.mesh.numberoflayers - 1):
+                    projected_vector[(i * md.mesh.numberofvertices2d):((i + 1) * md.mesh.numberofvertices2d)] = vector2d * (1.0 - (1.0 - i / (md.mesh.numberoflayers - 1.0))**polyexponent)
+            else:
+                projected_vector[((layer - 1) * md.mesh.numberofvertices2d):(layer * md.mesh.numberofvertices2d)] = vector2d * (1.0 - (1.0 - layer / (md.mesh.numberoflayers - 1.0))**polyexponent)
+        else:
+            if vector2d.shape[0] == md.mesh.numberofvertices2d:
+                projected_vector = (paddingvalue * np.ones((md.mesh.numberofvertices, np.size(vector2d, axis=1)))).astype(vector2d.dtype)
+            elif vector2d.shape[0] == md.mesh.numberofvertices2d + 1:
+                projected_vector = (paddingvalue * np.ones((md.mesh.numberofvertices + 1, np.size(vector2d, axis=1)))).astype(vector2d.dtype)
+                projected_vector[-1, :] = vector2d[-1, :]
+                vector2d = vector2d[:-1, :]
+            else:
+                raise TypeError("vector length not supported")
+            #Fill in
+            if layer == 0:
+                for i in range(md.mesh.numberoflayers - 1):
+                    projected_vector[(i * md.mesh.numberofvertices2d):((i + 1) * md.mesh.numberofvertices2d), :] = vector2d * (1.0 - (1.0 - i / (md.mesh.numberoflayers - 1.0))**polyexponent)
+            else:
+                projected_vector[((layer - 1) * md.mesh.numberofvertices2d):(layer * md.mesh.numberofvertices2d), :] = vector2d * (1.0 - (1.0 - layer / (md.mesh.numberoflayers - 1.0))**polyexponent)
     else:
         raise TypeError("project3d error message: unknown projection type")
Index: issm/trunk/src/m/geometry/planetradius.js
===================================================================
--- issm/trunk/src/m/geometry/planetradius.js	(revision 26744)
+++ issm/trunk/src/m/geometry/planetradius.js	(revision 26744)
@@ -0,0 +1,20 @@
+function planetradius(planet) {//{{{
+	/**
+	 * PLANETRADIUS - return planet radius according to planetary body name
+	 *
+	 * Usage:
+	 *     radius = planetradius(planet);
+	 *
+	 * Examples:
+	 * earthradius = planetradius('earth');
+	 */
+
+	let radius = 0;
+	if (planet === 'earth') {
+		radius = 6.371012e6;
+	} else if (planet === 'europa') {
+		radius = 1.5008e6;
+	} else {
+		error('planet type ' + planet + ' not supported yet!');
+	}
+} //}}}
Index: issm/trunk/src/m/interp/averaging.m
===================================================================
--- issm/trunk/src/m/interp/averaging.m	(revision 25994)
+++ issm/trunk/src/m/interp/averaging.m	(revision 26744)
@@ -73,5 +73,5 @@
 linesize=rep*numberofelements;
 
-%update weights that holds the volume of all the element holding the node i
+%update weights that hold the volume of all the element holding the node i
 weights=sparse(line,ones(linesize,1),repmat(areas,rep,1),numberofnodes,1);
 
Index: issm/trunk/src/m/interp/averaging.py
===================================================================
--- issm/trunk/src/m/interp/averaging.py	(revision 25994)
+++ issm/trunk/src/m/interp/averaging.py	(revision 26744)
@@ -29,8 +29,8 @@
     """
 
-    if len(data) != md.mesh.numberofelements and len(data) != md.mesh.numberofvertices:
+    if (len(data) != md.mesh.numberofelements) & (len(data) != md.mesh.numberofvertices):
         raise Exception('averaging error message: data not supported yet')
-    if md.mesh.dimension() == 3 and layer != 0:
-        if layer <= 0 or layer > md.mesh.numberoflayers:
+    if (md.mesh.dimension() == 3) & (layer != 0):
+        if (layer <= 0) | (layer > md.mesh.numberoflayers):
             raise ValueError('layer should be between 1 and md.mesh.numberoflayers')
     else:
@@ -39,9 +39,9 @@
     # Initialization
     if layer == 0:
-        weights = np.zeros(md.mesh.numberofvertices, )
-        data = data.flatten(1)
+        weights = np.zeros((md.mesh.numberofvertices, ))
+        data = np.asarray(data).flatten()
     else:
-        weights = np.zeros(md.mesh.numberofvertices2d, )
-        data = data[(layer - 1) * md.mesh.numberofvertices2d + 1:layer * md.mesh.numberofvertices2d, :]
+        weights = np.zeros((md.mesh.numberofvertices2d, ))
+        data = data[(layer - 1) * md.mesh.numberofvertices2d + 1:layer * md.mesh.numberofvertices2d - 1, :]
 
     # Load some variables (it is much faster if the variables are loaded from md once for all)
@@ -56,5 +56,5 @@
 
     # Build some variables
-    if md.mesh.dimension() == 3 and layer == 0:
+    if (md.mesh.dimension() == 3) & (layer == 0):
         rep = 6
         areas = GetAreas(index, md.mesh.x, md.mesh.y, md.mesh.z)
@@ -67,16 +67,16 @@
 
     index = index - 1  # Python indexes from zero
-    line = index.flatten(1)
+    line=index.T.flatten()
     areas = np.vstack(areas).reshape(-1, )
-    summation = 1. / rep * np.ones(rep, )
+    summation = 1. / rep * np.ones((rep,1) )
     linesize = rep * numberofelements
 
-    # Update weights that holds the volume of all the element holding the node i
-    weights = csc_matrix((np.tile(areas, (rep, 1)).reshape(-1, ), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
+    # Update weights that hold the volume of all the element holding the node i
+    weights = csc_matrix((np.tile(areas, (1, rep)).reshape(-1,), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
 
     # Initialization
     if len(data) == numberofelements:
-        average_node = csc_matrix((np.tile(areas * data, (rep, 1)).reshape(-1, ), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
-        average_node = average_node / weights
+        average_node = csc_matrix((np.tile(np.multiply(areas,data), (1, rep)).reshape(-1, ), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
+        average_node = np.divide(average_node,weights)
         average_node = csc_matrix(average_node)
     else:
@@ -85,11 +85,11 @@
     # Loop over iteration
     for i in np.arange(1, iterations + 1):
-        average_el = np.asarray(np.dot(average_node.todense()[index].reshape(numberofelements, rep), np.vstack(summation))).reshape(-1, )
-        average_node = csc_matrix((np.tile(areas * average_el.reshape(-1), (rep, 1)).reshape(-1, ), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
-        average_node = average_node / weights
+        average_el = np.asarray(average_node.todense()[index].reshape(numberofelements, rep)*summation).reshape(-1, )
+        average_node = csc_matrix((np.tile(np.multiply(areas,average_el.reshape(-1)), (1, rep)).reshape(-1, ), (line, np.zeros(linesize, ))), shape=(numberofnodes, 1))
+        average_node = np.divide(average_node,weights)
         average_node = csc_matrix(average_node)
 
     # Return output as a full matrix (C code does not like sparse matrices)
-    average = np.asarray(average_node.todense()).reshape(-1, )
+    average = np.expand_dims(np.asarray(average_node.todense()).reshape(-1, ),axis=1)
 
     return average
Index: issm/trunk/src/m/io/loadvars.py
===================================================================
--- issm/trunk/src/m/io/loadvars.py	(revision 25994)
+++ issm/trunk/src/m/io/loadvars.py	(revision 26744)
@@ -52,5 +52,5 @@
         raise TypeError("Unrecognized input arguments.")
 
-    onlylast = True
+    onlylast = False
 
     for key, value in kwargs.items():
@@ -88,17 +88,17 @@
             #==== First we create the model structure  {{{
             if debug:
-                print(' - Now treating classtype {}'.format(mod))
-            if np.size(classtree[mod]) > 1:
+                print(' ==== Now treating classtype {}'.format(mod))
+            if mod not in classtree.keys():
+                print("WARNING: {} classe is not in the model anymore and will be omited.".format(mod))
+            elif np.size(classtree[mod]) > 1:
                 # this points to a subclass (results.TransientSolution for example)
                 curclass = NCFile.groups[classtree[mod][0]].groups[classtree[mod][1]]
                 if debug:
-                    print("===> {} is of class {}".format(mod, classtype[mod]))
+                    print("    ==> {} is of class {}".format(mod, classtype[mod]))
                 if classtype[mod][0] == 'results.solutionstep':  #Treating results {{{
                     keylist = [key for key in curclass.groups]
-                    # this is related to the old structure of NC files where every steps of results had its own group
                     #that is the current treatment
                     #here we have a more NC approach with time being a dimension
                     listtype = split(r'\.', classtype[mod][0])[0]
-                    print("listtype is {}".format(listtype))
                     if len(NCFile.dimensions['Time']) == 1:
                         nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(classtype[mod][1], listtype)()
@@ -110,12 +110,31 @@
                             Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
                         else:
-                            #nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(classtype[mod][1], listtype)() for i in range(max(1, len(NCFile.dimensions['Time'])))]
-                            #Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
                             setattr(nvdict['md'].__dict__[classtree[mod][0]], classtree[mod][1], getattr(classtype[mod][1], 'solution')([]))
                             for i in range(max(1, len(NCFile.dimensions['Time']))):
                                 nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]].steps.append(getattr(classtype[mod][1], 'solutionstep')())
                             Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
-                            print(nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]].steps[0])
                 # }}}
+                elif "results" in mod and classtype[mod][0] == 'list':  #this is the old style of results where every step has a group{{{
+                    keylist = [key for key in curclass.groups]
+                    #one group per step so use that in place of time
+                    stepnum = len(NCFile.groups[classtree[mod][0]].groups[classtree[mod][1]].groups)
+                    #we need to redefine classtype from list to result
+                    listtype = 'results'
+                    classtype[mod].append(__import__(listtype))
+                    if stepnum == 1:
+                        nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(classtype[mod][1], listtype)()
+                        Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
+                    else:
+                        if onlylast:   #we load only the last result to save on time and memory
+                            nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(classtype[mod][1], listtype)()]
+                            Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]]
+                        else:
+                            #nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = [getattr(classtype[mod][1], listtype)() for i in range(max(1, len(NCFile.dimensions['Time'])))]
+                            #Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
+                            setattr(nvdict['md'].__dict__[classtree[mod][0]], classtree[mod][1], getattr(classtype[mod][1], 'solution')([]))
+                            for i in range(max(1, stepnum)):
+                                nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]].steps.append(getattr(classtype[mod][1], 'solutionstep')())
+                            Tree = nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]][:]
+                    #}}}
                 elif classtype[mod][0] == 'massfluxatgate':  #this is for output definitions {{{
                     defname = split('Output|[0-9]+', classtree[mod][1])[1] + 's'
@@ -126,9 +145,9 @@
                 else:
                     if debug:
-                        print("Using the default for md.{}.{}, is that right??".format(classtree[mod][0], classtree[mod][1]))
+                        print("    Using the default for md.{}.{}, is that right??".format(classtree[mod][0], classtree[mod][1]))
                     try:
                         modulename = split(r'\.', classtype[mod][0])[0]
                         if debug:
-                            print("trying to import {} from {}".format(classtype[mod][0], modulename))
+                            print("    trying to import {} from {}".format(classtype[mod][0], modulename))
                         nvdict['md'].__dict__[classtree[mod][0]].__dict__[classtree[mod][1]] = getattr(classtype[mod][1], modulename)()
                     except AttributeError:
@@ -141,68 +160,75 @@
                 Tree = nvdict['md'].__dict__[classtree[mod][0]]
             if debug:
-                print("for {} Tree is a {}".format(mod, Tree.__class__.__name__))
+                print("    for {} Tree is a {} with len {}".format(mod, Tree.__class__.__name__, len(curclass.groups)))
             # }}}
             #==== Then we populate it {{{
-            for i in range(0, max(1, len(curclass.groups))):
-                if len(curclass.groups) > 0:
-                    listclass = curclass.groups[keylist[i]]
+            #for i in range(0, max(1, len(curclass.groups))):
+            if len(curclass.groups) > 0:  #that is presumably only for old style NC where each result step had its own group
+                if onlylast:
+                    groupclass = [curclass.groups[keylist[len(curclass.groups) - 1]]]
                 else:
-                    listclass = curclass
-                #==== We deal with Variables {{{
+                    groupclass = [curclass.groups[key] for key in keylist]
+            else:
+                groupclass = [curclass]
+            #==== We deal with Variables {{{
+            for groupindex, listclass in enumerate(groupclass):
                 for var in listclass.variables:
-                    if debug:
-                        print("treating var {}".format(var))
                     if var not in ['errlog', 'outlog']:
                         varval = listclass.variables[str(var)]
                         vardim = varval.ndim
+                        if debug:
+                            print("    ==> treating var {} of dimension {}".format(var, vardim))
                         #There is a special treatment for results to account for its specific structure
                         #that is the new export version where time is a named dimension
                         NewFormat = 'Time' in NCFile.dimensions
-                        if type(Tree) == list and NewFormat:
+                        if type(Tree) == list:  # and NewFormat:
                             if onlylast:
-                                if vardim == 1:
-                                    Tree[0].__dict__[str(var)] = varval[-1].data
-                                elif vardim == 2:
-                                    Tree[0].__dict__[str(var)] = varval[-1, :].data
-                                elif vardim == 3:
-                                    Tree[0].__dict__[str(var)] = varval[-1, :, :].data
+                                if NewFormat:
+                                    if vardim == 1:
+                                        Tree[0].__dict__[str(var)] = varval[-1].data
+                                    elif vardim == 2:
+                                        Tree[0].__dict__[str(var)] = varval[-1, :].data
+                                    elif vardim == 3:
+                                        Tree[0].__dict__[str(var)] = varval[-1, :, :].data
+                                    else:
+                                        print('table dimension greater than 3 not implemented yet')
+                                else:  #old format had step sorted in difeerent group so last group is last time
+                                    Tree[0].__dict__[str(var)] = varval[:].data
+                            else:
+                                if NewFormat:
+                                    incomplete = 'Time' not in varval.dimensions and NewFormat
+                                    if incomplete:
+                                        chosendim = varval.dimensions[0]
+                                        timelist = np.arange(0, len(NCFile.dimensions[chosendim]))
+                                        print('WARNING, {} is not present on every times, we chose {}({}) as the dimension to write it with'.format(var, chosendim, len(NCFile.dimensions[chosendim])))
+                                    else:
+                                        timelist = np.arange(0, len(NCFile.dimensions['Time']))
+                                    for t in timelist:
+                                        if debug:
+                                            print("filing step {} for {}".format(t, var))
+                                        if vardim == 0:
+                                            Tree[t].__dict__[str(var)] = varval[:].data
+                                        elif vardim == 1:
+                                            Tree[t].__dict__[str(var)] = varval[t].data
+                                        elif vardim == 2:
+                                            Tree[t].__dict__[str(var)] = varval[t, :].data
+                                        elif vardim == 3:
+                                            Tree[t].__dict__[str(var)] = varval[t, :, :].data
+                                        else:
+                                            print('table dimension greater than 3 not implemented yet')
                                 else:
-                                    print('table dimension greater than 3 not implemented yet')
-                            else:
-                                incomplete = 'Time' not in varval.dimensions
-                                if incomplete:
-                                    chosendim = varval.dimensions[0]
-                                    timelist = np.arange(0, len(NCFile.dimensions[chosendim]))
-                                    print('WARNING, {} is not present on every times, we chose {}({}) as the dimension to write it with'.format(var, chosendim, len(NCFile.dimensions[chosendim])))
-                                else:
-                                    timelist = np.arange(0, len(NCFile.dimensions['Time']))
-                                for t in timelist:
-                                    if vardim == 0:
-                                        Tree[t].__dict__[str(var)] = varval[:].data
-                                    if vardim == 1:
-                                        Tree[t].__dict__[str(var)] = varval[t].data
-                                    elif vardim == 2:
-                                        Tree[t].__dict__[str(var)] = varval[t, :].data
-                                    elif vardim == 3:
-                                        Tree[t].__dict__[str(var)] = varval[t, :, :].data
-                                    else:
-                                        print('table dimension greater than 3 not implemented yet')
+                                    if debug:
+                                        print("filing step {} for {}".format(groupindex, var))
+                                    Tree[groupindex].__dict__[str(var)] = varval[:].data
                         else:
                             if vardim == 0:  #that is a scalar
-                                if type(Tree) == list:
-                                    t = indexlist[i]
-                                    if listtype == 'dict':
-                                        Tree[t][str(var)] = varval[0].data
-                                    else:
-                                        Tree[t].__dict__[str(var)] = varval[0].data
+                                if str(varval[0]) == '':  #no value
+                                    Tree.__dict__[str(var)] = []
+                                elif varval[0] == 'True':  #treatin bool
+                                    Tree.__dict__[str(var)] = True
+                                elif varval[0] == 'False':  #treatin bool
+                                    Tree.__dict__[str(var)] = False
                                 else:
-                                    if str(varval[0]) == '':  #no value
-                                        Tree.__dict__[str(var)] = []
-                                    elif varval[0] == 'True':  #treatin bool
-                                        Tree.__dict__[str(var)] = True
-                                    elif varval[0] == 'False':  #treatin bool
-                                        Tree.__dict__[str(var)] = False
-                                    else:
-                                        Tree.__dict__[str(var)] = varval[0].item()
+                                    Tree.__dict__[str(var)] = varval[0].item()
 
                             elif vardim == 1:  #that is a vector
@@ -215,24 +241,17 @@
                                         Tree.__dict__[str(var)] = [str(vallue) for vallue in varval[:]]
                                 else:
-                                    if type(Tree) == list:
-                                        t = indexlist[i]
-                                        if listtype == 'dict':
-                                            Tree[t][str(var)] = varval[:].data
-                                        else:
-                                            Tree[t].__dict__[str(var)] = varval[:].data
-                                    else:
-                                        try:
-                                            #some thing specifically require a list
-                                            mdtype = type(Tree.__dict__[str(var)])
-                                        except KeyError:
-                                            mdtype = float
-                                        if mdtype == list:
-                                            Tree.__dict__[str(var)] = [mdval for mdval in varval[:]]
-                                        else:
-                                            Tree.__dict__[str(var)] = varval[:].data
+                                    try:
+                                        #some thing specifically require a list
+                                        mdtype = type(Tree.__dict__[str(var)])
+                                    except KeyError:
+                                        mdtype = float
+                                    if mdtype == list:
+                                        Tree.__dict__[str(var)] = [mdval for mdval in varval[:]]
+                                    else:
+                                        Tree.__dict__[str(var)] = varval[:].data
 
                             elif vardim == 2:
                                 #dealling with dict
-                                if varval.dtype == str:  #that is for toolkits wich needs to be ordered
+                                if varval.dtype == str:  #that is for dictionaries
                                     if any(varval[:, 0] == 'toolkit'):  #toolkit definition have to be first
                                         Tree.__dict__[str(var)] = OrderedDict([('toolkit', str(varval[np.where(varval[:, 0] == 'toolkit')[0][0], 1]))])
@@ -240,4 +259,8 @@
                                         strings2 = [str(arg[1]) for arg in varval if arg[0] != 'toolkits']
                                         Tree.__dict__[str(var)].update(list(zip(strings1, strings2)))
+                                    else:
+                                        strings1 = [str(arg[0]) for arg in varval]
+                                        strings2 = [str(arg[1]) for arg in varval]
+                                        Tree.__dict__[str(var)] = OrderedDict(list(zip(strings1, strings2)))
                                 else:
                                     if type(Tree) == list:
@@ -250,38 +273,23 @@
                                         Tree.__dict__[str(var)] = varval[:, :].data
                             elif vardim == 3:
-                                if type(Tree) == list:
-                                    t = int(indexlist[i])
-                                    if listtype == 'dict':
-                                        Tree[t][str(var)] = varval[:, :, :].data
-                                    else:
-                                        Tree[t].__dict__[str(var)] = varval[:, :, :]
-                                else:
-                                    Tree.__dict__[str(var)] = varval[:, :, :].data
+                                Tree.__dict__[str(var)] = varval[:, :, :].data
                             else:
                                 print('table dimension greater than 3 not implemented yet')
-                    # }}}
+                # }}}
                 #==== And with atribute {{{
                 for attr in listclass.ncattrs():
                     if debug:
-                        print("treating attribute {}".format(attr))
+                        print("      ==> treating attribute {}".format(attr))
                     if attr != 'classtype':  #classtype is for treatment, don't get it back
                         attribute = str(attr).swapcase()  #there is a reason for swapcase, no sure what it isanymore
                         if attr == 'VARNAME':
                             attribute = 'name'
-                        if type(Tree) == list and NewFormat:
+                        if type(Tree) == list:
                             if debug:
-                                print("printing with index 0")
+                                print("        printing with index 0")
                             if listtype == 'dict':
                                 Tree[0][attribute] = str(listclass.getncattr(attr))
                             else:
                                 Tree[0].__dict__[attribute] = str(listclass.getncattr(attr))
-                        elif type(Tree) == list:
-                            t = int(indexlist[i])
-                            if debug:
-                                print("printing with index {]".format(t))
-                            if listtype == 'dict':
-                                Tree[t][attribute] = str(listclass.getncattr(attr))
-                            else:
-                                Tree[t].__dict__[attribute] = str(listclass.getncattr(attr))
                         else:
                             Tree.__dict__[attribute] = str(listclass.getncattr(attr))
@@ -320,5 +328,4 @@
                     try:
                         modulename = split(r'\.', class_dict[classe][0])[0]
-                        #class_dict[classe].append(__import__(class_dict[classe][0]))
                         class_dict[classe].append(__import__(modulename))
                     except ModuleNotFoundError:
@@ -334,6 +341,9 @@
                 if class_dict[classe][0] not in ['dict', 'list', 'cell']:
                     modulename = split(r'\.', class_dict[classe][0])[0]
-                    class_dict[classe].append(__import__(modulename))
-                    class_tree[classe] = [group, ]
+                    if modulename == "giaivins":
+                        print("WARNING: module {} does not exist anymore and is skipped".format(modulename))
+                    else:
+                        class_dict[classe].append(__import__(modulename))
+                        class_tree[classe] = [group, ]
             except AttributeError:
                 print(('group {} is empty'.format(group)))
Index: issm/trunk/src/m/materials/cuffey.py
===================================================================
--- issm/trunk/src/m/materials/cuffey.py	(revision 25994)
+++ issm/trunk/src/m/materials/cuffey.py	(revision 26744)
@@ -3,17 +3,17 @@
 
 def cuffey(temperature):
-    """
-    CUFFEY - calculates ice rigidity as a function of temperature
+    """CUFFEY - calculates ice rigidity as a function of temperature
 
-       rigidity (in s^(1 / 3)Pa) is the flow law parameter in the flow law sigma = B * e(1 / 3)
-        (Cuffey and Paterson, p75).
-       temperature is in Kelvin degrees
+    rigidity (in s^(1/3)Pa) is the flow law parameter in the flow law 
+    sigma = B * e(1/3) (Cuffey and Paterson, p75).
 
-       Usage:
-          rigidity = cuffey(temperature)
+    temperature is in Kelvin degrees
+
+    Usage:
+        rigidity = cuffey(temperature)
     """
 
-    if np.any(temperature < 0.):
-        raise RuntimeError("input temperature should be in Kelvin (positive)")
+    if np.any(temperature < 0.0):
+        raise RuntimeError('input temperature should be in Kelvin (positive)')
 
     if np.ndim(temperature) == 2:
@@ -28,39 +28,39 @@
     pos = np.nonzero(T <= -45)
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000396645116301 * (T[pos] + 50)**3 + 0.013345579471334 * (T[pos] + 50)**2 - 0.356868703259105 * (T[pos] + 50) + 7.272363035371383)
+        rigidity[pos] = pow(10, 8) * (-0.000396645116301 * (T[pos] + 50)**3 + 0.013345579471334 * (T[pos] + 50)**2 - 0.356868703259105 * (T[pos] + 50) + 7.272363035371383)
     pos = np.nonzero(np.logical_and(-45 <= T, T < -40))
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000396645116301 * (T[pos] + 45)**3 + 0.007395902726819 * (T[pos] + 45)**2 - 0.253161292268336 * (T[pos] + 45) + 5.772078366321591)
+        rigidity[pos] = pow(10, 8) * (-0.000396645116301 * (T[pos] + 45)**3 + 0.007395902726819 * (T[pos] + 45)**2 - 0.253161292268336 * (T[pos] + 45) + 5.772078366321591)
     pos = np.nonzero(np.logical_and(-40 <= T, T < -35))
     if len(pos):
-        rigidity[pos] = 10**8 * (0.000408322072669 * (T[pos] + 40)**3 + 0.001446225982305 * (T[pos] + 40)**2 - 0.208950648722716 * (T[pos] + 40) + 4.641588833612773)
+        rigidity[pos] = pow(10, 8) * (0.000408322072669 * (T[pos] + 40)**3 + 0.001446225982305 * (T[pos] + 40)**2 - 0.208950648722716 * (T[pos] + 40) + 4.641588833612773)
     pos = np.nonzero(np.logical_and(-35 <= T, T < -30))
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000423888728124 * (T[pos] + 35)**3 + 0.007571057072334 * (T[pos] + 35)**2 - 0.163864233449525 * (T[pos] + 35) + 3.684031498640382)
+        rigidity[pos] = pow(10, 8) * (-0.000423888728124 * (T[pos] + 35)**3 + 0.007571057072334 * (T[pos] + 35)**2 - 0.163864233449525 * (T[pos] + 35) + 3.684031498640382)
     pos = np.nonzero(np.logical_and(-30 <= T, T < -25))
     if len(pos):
-        rigidity[pos] = 10**8 * (0.000147154327025 * (T[pos] + 30)**3 + 0.001212726150476 * (T[pos] + 30)**2 - 0.119945317335478 * (T[pos] + 30) + 3.001000667185614)
+        rigidity[pos] = pow(10, 8) * (0.000147154327025 * (T[pos] + 30)**3 + 0.001212726150476 * (T[pos] + 30)**2 - 0.119945317335478 * (T[pos] + 30) + 3.001000667185614)
     pos = np.nonzero(np.logical_and(-25 <= T, T < -20))
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000193435838672 * (T[pos] + 25)**3 + 0.003420041055847 * (T[pos] + 25)**2 - 0.096781481303861 * (T[pos] + 25) + 2.449986525148220)
+        rigidity[pos] = pow(10, 8) * (-0.000193435838672 * (T[pos] + 25)**3 + 0.003420041055847 * (T[pos] + 25)**2 - 0.096781481303861 * (T[pos] + 25) + 2.449986525148220)
     pos = np.nonzero(np.logical_and(-20 <= T, T < -15))
     if len(pos):
-        rigidity[pos] = 10**8 * (0.000219771255067 * (T[pos] + 20)**3 + 0.000518503475772 * (T[pos] + 20)**2 - 0.077088758645767 * (T[pos] + 20) + 2.027400665191131)
+        rigidity[pos] = pow(10, 8) * (0.000219771255067 * (T[pos] + 20)**3 + 0.000518503475772 * (T[pos] + 20)**2 - 0.077088758645767 * (T[pos] + 20) + 2.027400665191131)
     pos = np.nonzero(np.logical_and(-15 <= T, T < -10))
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000653438900191 * (T[pos] + 15)**3 + 0.003815072301777 * (T[pos] + 15)**2 - 0.055420879758021 * (T[pos] + 15) + 1.682390865739973)
+        rigidity[pos] = pow(10, 8) * (-0.000653438900191 * (T[pos] + 15)**3 + 0.003815072301777 * (T[pos] + 15)**2 - 0.055420879758021 * (T[pos] + 15) + 1.682390865739973)
     pos = np.nonzero(np.logical_and(-10 <= T, T < -5))
     if len(pos):
-        rigidity[pos] = 10**8 * (0.000692439419762 * (T[pos] + 10)**3 - 0.005986511201093 * (T[pos] + 10)**2 - 0.066278074254598 * (T[pos] + 10) + 1.418983411970382)
+        rigidity[pos] = pow(10, 8) * (0.000692439419762 * (T[pos] + 10)**3 - 0.005986511201093 * (T[pos] + 10)**2 - 0.066278074254598 * (T[pos] + 10) + 1.418983411970382)
     pos = np.nonzero(np.logical_and(-5 <= T, T < -2))
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000132282004110 * (T[pos] + 5)**3 + 0.004400080095332 * (T[pos] + 5)**2 - 0.074210229783403 * (T[pos] + 5) + 1.024485188140279)
+        rigidity[pos] = pow(10, 8) * (-0.000132282004110 * (T[pos] + 5)**3 + 0.004400080095332 * (T[pos] + 5)**2 - 0.074210229783403 * (T[pos] + 5) + 1.024485188140279)
     pos = np.nonzero(-2 <= T)
     if len(pos):
-        rigidity[pos] = 10**8 * (-0.000132282004110 * (T[pos] + 2)**3 + 0.003209542058346 * (T[pos] + 2)**2 - 0.051381363322371 * (T[pos] + 2) + 0.837883605537096)
+        rigidity[pos] = pow(10, 8) * (-0.000132282004110 * (T[pos] + 2)**3 + 0.003209542058346 * (T[pos] + 2)**2 - 0.051381363322371 * (T[pos] + 2) + 0.837883605537096)
 
-    #Now make sure that rigidity is positive
+    # Now make sure that rigidity is positive
     pos = np.nonzero(rigidity < 0)
-    rigidity[pos] = 1**6
+    rigidity[pos] = pow(1, 6)
 
     return rigidity
Index: issm/trunk/src/m/materials/nye.m
===================================================================
--- issm/trunk/src/m/materials/nye.m	(revision 25994)
+++ issm/trunk/src/m/materials/nye.m	(revision 26744)
@@ -13,11 +13,11 @@
 	if (ice_type==1)
 		if (any(temperature>200&temperature<220))
-			warning('CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.\nLook at indexes: %s', mat2str(find(temperature>200 & temperature<220))');
+			warning('nye.m: CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.\nLook at indexes: %s', mat2str(find(temperature>200 & temperature<220))');
 		end
 		if (any(temperature>=220))
-			warning('CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.\nLook at indexes: %s', mat2str(find(temperature>=220))');
+			warning('nye.m: CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.\nLook at indexes: %s', mat2str(find(temperature>=220))');
 		end
 	elseif ((ice_type==2)&&(any(temperature>273.15)))
-		warning('H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.\nLook at indexes: %s', mat2str(find(temperature>273.15))');
+		warning('nye.m: H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.\nLook at indexes: %s', mat2str(find(temperature>273.15))');
 	end
 
Index: issm/trunk/src/m/materials/nye.py
===================================================================
--- issm/trunk/src/m/materials/nye.py	(revision 25994)
+++ issm/trunk/src/m/materials/nye.py	(revision 26744)
@@ -1,15 +1,13 @@
 import numpy as np
-from warnings import warn
 
 
 def nye(temperature, ice_type):
+    """NYE - figure out the rigidity of ice (either CO2 or H2O) for a given 
+    temperature rigidity (in s^(1/n)Pa) is the flow law parameter in the flow 
+    law sigma=B*e(1/n) (Nye, p2000). Temperature is in Kelvin degrees.
+
+    Usage:
+        rigidity=nye(temperature,ice_type) % ice_type = 1: CO2 ice // ice_type = 2: H2O ice
     """
-    NYE - figure out the rigidity of ice (either CO2 or H2O) for a given temperature
-        rigidity (in s^(1/n)Pa) is the flow law parameter in the flow law sigma=B*e(1/n) (Nye, p2000).
-        temperature is in Kelvin degrees
-
-   Usage:
-           rigidity=nye(temperature,ice_type) % ice_type = 1: CO2 ice // ice_type = 2: H2O ice
-        """
 
     # Declaring temperature and rigidity arrays
@@ -26,10 +24,10 @@
         for i in range(len(T)):
             if (200 < T[i] < 220):
-                warn('CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.')
+                print('Warning: nye.py: CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.')
             break
         if ((T >= 220).any()):
-            warn('CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.')
+            print('Warning: nye.py: CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.')
     elif (ice_type == 2) and ((T > 273.15).any()):
-        warn('H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.')
+        print('Warning: nye.py: H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.')
 
     Rg = 8.3144598              # J mol^-1 K^-1
Index: issm/trunk/src/m/materials/paterson.py
===================================================================
--- issm/trunk/src/m/materials/paterson.py	(revision 25994)
+++ issm/trunk/src/m/materials/paterson.py	(revision 26744)
@@ -3,16 +3,17 @@
 
 def paterson(temperature):
-    """
-    PATERSON - figure out the rigidity of ice for a given temperature
+    """PATERSON - figure out the rigidity of ice for a given temperature
 
-       rigidity (in s^(1 / 3)Pa) is the flow law paramter in the flow law sigma = B * e(1 / 3) (Paterson, p97).
-       temperature is in Kelvin degrees
+    rigidity (in s^(1/3)Pa) is the flow law paramter in the flow law 
+    sigma = B * e(1/3) (Paterson, p97).
 
-       Usage:
-          rigidity = paterson(temperature)
+    temperature is in Kelvin degrees
+
+    Usage:
+        rigidity = paterson(temperature)
     """
 
-    if np.any(temperature < 0.):
-        raise RuntimeError("input temperature should be in Kelvin (positive)")
+    if np.any(temperature < 0.0):
+        raise RuntimeError('input temperature should be in Kelvin (positive)')
 
     if np.ndim(temperature) == 2:
@@ -24,5 +25,5 @@
         T = temperature - 273.15
 
-    #The routine below is equivalent to:
+    # The routine below is equivalent to:
 
     # n = 3; T = temperature-273
@@ -40,40 +41,40 @@
     pos1 = np.nonzero(T <= -45)[0]
     if len(pos1):
-        rigidity[pos1] = 10**8 * (-0.000292866376675 * (T[pos1] + 50)**3 + 0.011672640664130 * (T[pos1] + 50)**2 - 0.325004442485481 * (T[pos1] + 50) + 6.524779401948101)
+        rigidity[pos1] = pow(10, 8) * (-0.000292866376675 * (T[pos1] + 50)**3 + 0.011672640664130 * (T[pos1] + 50)**2 - 0.325004442485481 * (T[pos1] + 50) + 6.524779401948101)
     pos2 = np.nonzero(np.logical_and(-45 <= T, T < -40))[0]
     if len(pos2):
-        rigidity[pos2] = 10**8 * (-0.000292866376675 * (T[pos2] + 45)**3 + 0.007279645014004 * (T[pos2] + 45)**2 - 0.230243014094813 * (T[pos2] + 45) + 5.154964909039554)
+        rigidity[pos2] = pow(10, 8) * (-0.000292866376675 * (T[pos2] + 45)**3 + 0.007279645014004 * (T[pos2] + 45)**2 - 0.230243014094813 * (T[pos2] + 45) + 5.154964909039554)
     pos3 = np.nonzero(np.logical_and(-40 <= T, T < -35))[0]
     if len(pos3):
-        rigidity[pos3] = 10**8 * (0.000072737147457 * (T[pos3] + 40)**3 + 0.002886649363879 * (T[pos3] + 40)**2 - 0.179411542205399 * (T[pos3] + 40) + 4.149132666831214)
+        rigidity[pos3] = pow(10, 8) * (0.000072737147457 * (T[pos3] + 40)**3 + 0.002886649363879 * (T[pos3] + 40)**2 - 0.179411542205399 * (T[pos3] + 40) + 4.149132666831214)
     pos4 = np.nonzero(np.logical_and(-35 <= T, T < -30))[0]
     if len(pos4):
-        rigidity[pos4] = 10**8 * (-0.000086144770023 * (T[pos4] + 35)**3 + 0.003977706575736 * (T[pos4] + 35)**2 - 0.145089762507325 * (T[pos4] + 35) + 3.333333333333331)
+        rigidity[pos4] = pow(10, 8) * (-0.000086144770023 * (T[pos4] + 35)**3 + 0.003977706575736 * (T[pos4] + 35)**2 - 0.145089762507325 * (T[pos4] + 35) + 3.333333333333331)
     pos5 = np.nonzero(np.logical_and(-30 <= T, T < -25))[0]
     if len(pos5):
-        rigidity[pos5] = 10**8 * (-0.000043984685769 * (T[pos5] + 30)**3 + 0.002685535025386 * (T[pos5] + 30)**2 - 0.111773554501713 * (T[pos5] + 30) + 2.696559088937191)
+        rigidity[pos5] = pow(10, 8) * (-0.000043984685769 * (T[pos5] + 30)**3 + 0.002685535025386 * (T[pos5] + 30)**2 - 0.111773554501713 * (T[pos5] + 30) + 2.696559088937191)
     pos6 = np.nonzero(np.logical_and(-25 <= T, T < -20))[0]
     if len(pos6):
-        rigidity[pos6] = 10**8 * (-0.000029799523463 * (T[pos6] + 25)**3 + 0.002025764738854 * (T[pos6] + 25)**2 - 0.088217055680511 * (T[pos6] + 25) + 2.199331606342181)
+        rigidity[pos6] = pow(10, 8) * (-0.000029799523463 * (T[pos6] + 25)**3 + 0.002025764738854 * (T[pos6] + 25)**2 - 0.088217055680511 * (T[pos6] + 25) + 2.199331606342181)
     pos7 = np.nonzero(np.logical_and(-20 <= T, T < -15))[0]
     if len(pos7):
-        rigidity[pos7] = 10**8 * (0.000136920904777 * (T[pos7] + 20)**3 + 0.001578771886910 * (T[pos7] + 20)**2 - 0.070194372551690 * (T[pos7] + 20) + 1.805165505978111)
+        rigidity[pos7] = pow(10, 8) * (0.000136920904777 * (T[pos7] + 20)**3 + 0.001578771886910 * (T[pos7] + 20)**2 - 0.070194372551690 * (T[pos7] + 20) + 1.805165505978111)
     pos8 = np.nonzero(np.logical_and(-15 <= T, T < -10))[0]
     if len(pos8):
-        rigidity[pos8] = 10**8 * (-0.000899763781026 * (T[pos8] + 15)**3 + 0.003632585458564 * (T[pos8] + 15)**2 - 0.044137585824322 * (T[pos8] + 15) + 1.510778053489523)
+        rigidity[pos8] = pow(10, 8) * (-0.000899763781026 * (T[pos8] + 15)**3 + 0.003632585458564 * (T[pos8] + 15)**2 - 0.044137585824322 * (T[pos8] + 15) + 1.510778053489523)
     pos9 = np.nonzero(np.logical_and(-10 <= T, T < -5))[0]
     if len(pos9):
-        rigidity[pos9] = 10**8 * (0.001676964325070 * (T[pos9] + 10)**3 - 0.009863871256831 * (T[pos9] + 10)**2 - 0.075294014815659 * (T[pos9] + 10) + 1.268434288203714)
+        rigidity[pos9] = pow(10, 8) * (0.001676964325070 * (T[pos9] + 10)**3 - 0.009863871256831 * (T[pos9] + 10)**2 - 0.075294014815659 * (T[pos9] + 10) + 1.268434288203714)
     pos10 = np.nonzero(np.logical_and(-5 <= T, T < -2))[0]
     if len(pos10):
-        rigidity[pos10] = 10**8 * (-0.003748937622487 * (T[pos10] + 5)**3 + 0.015290593619213 * (T[pos10] + 5)**2 - 0.048160403003748 * (T[pos10] + 5) + 0.854987973338348)
+        rigidity[pos10] = pow(10, 8) * (-0.003748937622487 * (T[pos10] + 5)**3 + 0.015290593619213 * (T[pos10] + 5)**2 - 0.048160403003748 * (T[pos10] + 5) + 0.854987973338348)
     pos11 = np.nonzero(-2 <= T)[0]
     if len(pos11):
-        rigidity[pos11] = 10**8 * (-0.003748937622488 * (T[pos11] + 2)**3 - 0.018449844983174 * (T[pos11] + 2)**2 - 0.057638157095631 * (T[pos11] + 2) + 0.746900791092860)
+        rigidity[pos11] = pow(10, 8) * (-0.003748937622488 * (T[pos11] + 2)**3 - 0.018449844983174 * (T[pos11] + 2)**2 - 0.057638157095631 * (T[pos11] + 2) + 0.746900791092860)
 
     #Now make sure that rigidity is positive
     pos = np.nonzero(rigidity < 0)[0]
     if len(pos):
-        rigidity[pos] = 1.e6
+        rigidity[pos] = 1.0e6
 
     return rigidity
Index: issm/trunk/src/m/mech/mechanicalproperties.m
===================================================================
--- issm/trunk/src/m/mech/mechanicalproperties.m	(revision 25994)
+++ issm/trunk/src/m/mech/mechanicalproperties.m	(revision 26744)
@@ -1,4 +1,4 @@
 function md=mechanicalproperties(md,vx,vy,varargin)
-%MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
+%MECHANICALPROPERTIES - compute stress and strain rate for a given velocity
 %
 %   this routine computes the components of the (deviatoric) stress tensor,
Index: issm/trunk/src/m/mech/mechanicalproperties.py
===================================================================
--- issm/trunk/src/m/mech/mechanicalproperties.py	(revision 25994)
+++ issm/trunk/src/m/mech/mechanicalproperties.py	(revision 26744)
@@ -5,17 +5,17 @@
 
 def mechanicalproperties(md, vx, vy, **kwargs):
-    """
-    MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
+    """MECHANICALPROPERTIES - compute stress and strain rate for a given 
+    velocity
 
-   this routine computes the components of the stress tensor
-   strain rate tensor and their respective principal directions.
-   the results are in the model md: md.results
+    This routine computes the components of the stress tensor strain rate 
+    tensor and their respective principal directions. The results are in the 
+    model md: md.results
 
-   Usage:
-      md = mechanicalproperties(md, vx, vy)
+    Usage:
+        md = mechanicalproperties(md, vx, vy)
 
-   Example:
-      md = mechanicalproperties(md, md.initialization.vx, md.initialization.vy)
-      md = mechanicalproperties(md, md.inversion.vx_obs, md.inversion.vy_obs)
+    Example:
+        md = mechanicalproperties(md, md.initialization.vx, md.initialization.vy)
+        md = mechanicalproperties(md, md.inversion.vx_obs, md.inversion.vy_obs)
     """
 
@@ -75,5 +75,5 @@
     #some corrections
     location = np.nonzero(np.logical_and(second_inv == 0, power != 0))
-    nu[location] = 10**18  #arbitrary maximum viscosity to apply where there is no effective shear
+    nu[location] = pow(10, 18) #arbitrary maximum viscosity to apply where there is no effective shear
 
     if 'matice' in md.materials.__module__:
@@ -83,5 +83,5 @@
         nu[location] = B_bar[location]
         location = np.nonzero(np.logical_and(second_inv == 0, power != 0))
-        nu[location] = 10**18
+        nu[location] = pow(10, 18)
     elif 'matdamageice' in md.materials.__module__ and damage is not None:
         print('computing damage-dependent properties!')
Index: issm/trunk/src/m/mech/steadystateiceshelftemp.py
===================================================================
--- issm/trunk/src/m/mech/steadystateiceshelftemp.py	(revision 25994)
+++ issm/trunk/src/m/mech/steadystateiceshelftemp.py	(revision 26744)
@@ -49,5 +49,5 @@
         temperature[pos] = -((Tb[pos] - Ts[pos]) * ki / wi[pos] + Hi[pos] * Tb[pos] - (Hi[pos] * Ts[pos] + (Tb[pos] - Ts[pos]) * ki / wi[pos]) * np.exp(Hi[pos] * wi[pos] / ki)) / (Hi[pos] * (np.exp(Hi[pos] * wi[pos] / ki) - 1))
     except FloatingPointError:
-        print('steadystateiceshelf warning: overflow encountered in multipy / divide / exp, trying another formulation.')
+        print('Warning: steadystateiceshelf.py: overflow encountered in multipy/divide/exp, trying another formulation.')
         temperature[pos] = -(((Tb[pos] - Ts[pos]) * ki / wi[pos] + Hi[pos] * Tb[pos]) / np.exp(Hi[pos] * wi[pos] / ki) - Hi[pos] * Ts[pos] + (Tb[pos] - Ts[pos]) * ki / wi[pos]) / (Hi[pos] * (1 - np.exp(-Hi[pos] * wi[pos] / ki)))
 
Index: issm/trunk/src/m/mesh/bamg.py
===================================================================
--- issm/trunk/src/m/mesh/bamg.py	(revision 25994)
+++ issm/trunk/src/m/mesh/bamg.py	(revision 26744)
@@ -23,47 +23,93 @@
     Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
 
-    - domain :            followed by an ARGUS file that prescribes the domain outline
-    - holes :             followed by an ARGUS file that prescribes the holes
-    - subdomains :        followed by an ARGUS file that prescribes the list of
-                        subdomains (that need to be inside domain)
-
-    - hmin :              minimum edge length (default is 1.0e - 100)
-    - hmax :              maximum edge length (default is 1.0e100)
-    - hVertices :         imposed edge length for each vertex (geometry or mesh)
-    - hminVertices :      minimum edge length for each vertex (mesh)
-    - hmaxVertices :      maximum edge length for each vertex (mesh)
-
-    - anisomax :          maximum ratio between the smallest and largest edges (default is 1.0e30)
-    - coeff :             coefficient applied to the metric (2 -> twice as many elements, default is 1)
-    - cutoff :            scalar used to compute the metric when metric type 2 or 3 are applied
-    - err :               error used to generate the metric from a field
-    - errg :              geometric error (default is 0.1)
-    - field :             field of the model that will be used to compute the metric
-                                   to apply several fields, use one column per field
-    - gradation :         maximum ratio between two adjacent edges
-    - Hessiantype :       0 -> use double P2 projection (default)
-                            1 -> use Green formula
-    - KeepVertices :      try to keep initial vertices when adaptation is done on an existing mesh (default 1)
-    - NoBoundaryRefinement: do not refine boundary, only follow contour provided (default 0). Allow subdomain boundary refinement though
-    - NoBoundaryRefinementAllBoundaries: do not refine boundary, only follow contour provided (default 0)
-    - maxnbv :            maximum number of vertices used to allocate memory (default is 1.0e6)
-    - maxsubdiv :         maximum subdivision of exisiting elements (default is 10)
-    - metric :            matrix (numberofnodes x 3) used as a metric
-    - Metrictype :        1 -> absolute error          c / (err coeff^2) * Abs(H)        (default)
-                                   2 -> relative error          c / (err coeff^2) * Abs(H) / max(s, cutoff * max(s))
-                                   3 -> rescaled absolute error c / (err coeff^2) * Abs(H) / (smax - smin)
-    - nbjacoby :          correction used by Hessiantype = 1 (default is 1)
-    - nbsmooth :          number of metric smoothing procedure (default is 3)
-    - omega :             relaxation parameter of the smoothing procedure (default is 1.8)
-    - power :             power applied to the metric (default is 1)
-    - splitcorners :      split triangles whuch have 3 vertices on the outline (default is 1)
-    - verbose :           level of verbosity (default is 1)
-
-    - rifts :             followed by an ARGUS file that prescribes the rifts
-    - toltip :            tolerance to move tip on an existing point of the domain outline
-    - tracks :            followed by an ARGUS file that prescribes the tracks that the mesh will stick to
-    - RequiredVertices :  mesh vertices that are required. [x, y, ref]; ref is optional
-    - tol :               if the distance between 2 points of the domain outline is less than tol, they
-                             will be merged
+    - domain :                              followed by an ARGUS file that 
+                                            prescribes the domain outline
+    - holes :                               followed by an ARGUS file that 
+                                            prescribes the holes
+    - subdomains :                          followed by an ARGUS file that 
+                                            prescribes the list of subdomains 
+                                            (that need to be inside domain)
+
+    - hmin :                                minimum edge length (default is 
+                                            1.0e-100)
+    - hmax :                                maximum edge length (default is 
+                                            1.0e100)
+    - hVertices :                           imposed edge length for each vertex 
+                                            (geometry or mesh)
+    - hminVertices :                        minimum edge length for each vertex 
+                                            (mesh)
+    - hmaxVertices :                        maximum edge length for each vertex 
+                                            (mesh)
+
+    - anisomax :                            maximum ratio between the smallest 
+                                            and largest edges (default is 
+                                            1.0e30)
+    - coeff :                               coefficient applied to the metric 
+                                            (2 -> twice as many elements, 
+                                            default is 1)
+    - cutoff :                              scalar used to compute the metric 
+                                            when metric type 2 or 3 are applied
+    - err :                                 error used to generate the metric 
+                                            from a field
+    - errg :                                geometric error (default is 0.1)
+    - field :                               field of the model that will be 
+                                            used to compute the metric to apply 
+                                            several fields, use one column per 
+                                            field
+    - gradation :                           maximum ratio between two adjacent 
+                                            edges
+    - Hessiantype :                         0 -> use double P2 projection 
+                                            (default)
+                                            1 -> use Green formula
+    - KeepVertices :                        try to keep initial vertices when 
+                                            adaptation is done on an existing 
+                                            mesh (default 1)
+    - NoBoundaryRefinement :                do not refine boundary, only follow 
+                                            contour provided (default 0). Allow 
+                                            subdomain boundary refinement 
+                                            though
+    - NoBoundaryRefinementAllBoundaries :   do not refine boundary, only follow 
+                                            contour provided (default 0)
+    - maxnbv :                              maximum number of vertices used to 
+                                            allocate memory (default is 1.0e6)
+    - maxsubdiv :                           maximum subdivision of exisiting 
+                                            elements (default is 10)
+    - metric :                              matrix (numberofnodes x 3) used as 
+                                            a metric
+    - Metrictype :                          1 -> absolute error 
+                                            c/(err coeff^2) * Abs(H) (default)
+                                            2 -> relative error 
+                                            c / (err coeff^2) * Abs(H) / 
+                                            max(s, cutoff * max(s))
+                                            3 -> rescaled absolute error 
+                                            c / (err coeff^2) * Abs(H) / 
+                                            (smax - smin)
+    - nbjacoby :                            correction used by Hessiantype = 1 
+                                            (default is 1)
+    - nbsmooth :                            number of metric smoothing 
+                                            procedure (default is 3)
+    - omega :                               relaxation parameter of the 
+                                            smoothing procedure (default is 
+                                            1.8)
+    - power :                               power applied to the metric 
+                                            (default is 1)
+    - splitcorners :                        split triangles which have 3 
+                                            vertices on the outline (default is 
+                                            1)
+    - verbose :                             level of verbosity (default is 1)
+
+    - rifts :                               followed by an ARGUS file that 
+                                            prescribes the rifts
+    - toltip :                              tolerance to move tip on an 
+                                            existing point of the domain 
+                                            outline
+    - tracks :                              followed by an ARGUS file that 
+                                            prescribes the tracks that the mesh 
+                                            will stick to
+    - RequiredVertices :                    mesh vertices that are required. 
+                                            [x, y, ref]; ref is optional
+    - tol :                                 if the distance between 2 points of 
+                                            the domain outline is less than 
+                                            tol, they will be merged
 
     Examples:
@@ -76,9 +122,9 @@
     """
 
-    #process options
+    # Process options
     options = pairoptions(*args)
     #options = deleteduplicates(options, 1)
 
-    #initialize the structures required as input of Bamg
+    # Initialize the structures required as input of Bamg
     bamg_options = OrderedDict()
     bamg_geometry = bamggeom()
@@ -138,5 +184,5 @@
                         holes = holesfile
                     else:
-                        raise Exception("bamg error message: if 'holes' is a list, its elements must be of type dict or OrderedDict")
+                        raise Exception('bamg error message: if \'holes\' is a list, its elements must be of type dict or OrderedDict')
                 else:
                     holes = holesfile
@@ -144,5 +190,5 @@
                 holes = [holesfile]
             else:
-                raise Exception("'holes' type {} not supported yet".format(type(holesfile)))
+                raise Exception('\'holes\' type {} not supported yet'.format(type(holesfile)))
 
         subdomains = []
@@ -151,5 +197,5 @@
             if type(subdomainsfile) == str:
                 if not os.path.exists(subdomainsfile):
-                    raise IOError("bamg error message: file {} not found".format(subdomainsfile))
+                    raise IOError('bamg error message: file {} not found'.format(subdomainsfile))
 
                 # Read subdomains accoridng to its extension
@@ -166,5 +212,5 @@
                         subdomains = subdomainsfile
                     else:
-                        raise Exception("bamg error message: if 'subdomains' is a list, its elements must be of type dict or OrderedDict")
+                        raise Exception('bamg error message: if \'subdomains\' is a list, its elements must be of type dict or OrderedDict')
                 else:
                     subdomains = subdomainsfile
@@ -172,5 +218,5 @@
                 subdomains = [subdomainsfile]
             else:
-                raise Exception("'subdomains' type {} not supported yet".format(type(subdomainsfile)))
+                raise Exception('\'subdomains\' type {} not supported yet'.format(type(subdomainsfile)))
 
         # Build geometry
@@ -179,5 +225,5 @@
             # Check that the domain is closed
             if (domain[i]['x'][0] != domain[i]['x'][-1] or domain[i]['y'][0] != domain[i]['y'][-1]):
-                raise RuntimeError("bamg error message: all contours provided in ''domain'' should be closed")
+                raise RuntimeError('bamg error message: all contours provided in \'domain\' should be closed')
 
             # Check that all holes are INSIDE the principle domain outline
@@ -185,5 +231,5 @@
                 flags = ContourToNodes(domain[i]['x'], domain[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]'
                 if np.any(np.logical_not(flags)):
-                    raise RuntimeError("bamg error message: All holes should be strictly inside the principal domain")
+                    raise RuntimeError('bamg error message: All holes should be strictly inside the principal domain')
 
             # Check orientation
@@ -221,10 +267,10 @@
             # heck that the hole is closed
             if (holes[i]['x'][0] != holes[i]['x'][-1] or holes[i]['y'][0] != holes[i]['y'][-1]):
-                raise RuntimeError("bamg error message: all contours provided in ''hole'' should be closed")
+                raise RuntimeError('bamg error message: all contours provided in \'hole\' should be closed')
 
             # Check that all holes are INSIDE the principal domain (principal domain should be index 0)
             flags = ContourToNodes(holes[i]['x'], holes[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]'
             if np.any(np.logical_not(flags)):
-                raise RuntimeError("bamg error message: All holes should be strictly inside the principal domain")
+                raise RuntimeError('bamg error message: All holes should be strictly inside the principal domain')
 
             # Check that hole is correctly oriented
@@ -249,10 +295,10 @@
             # Check that the subdomain is closed
             if (subdomains[i]['x'][0] != subdomains[i]['x'][-1] or subdomains[i]['y'][0] != subdomains[i]['y'][-1]):
-                raise RuntimeError("bamg error message: all contours provided in ''subdomains'' should be closed")
+                raise RuntimeError('bamg error message: all contours provided in \'subdomains\' should be closed')
 
             # Check that all subdomains are INSIDE the principal domain (principal domain should be index 0)
             flags = ContourToNodes(subdomains[i]['x'], subdomains[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]'
             if np.any(np.logical_not(flags)):
-                raise RuntimeError("bamg error message: All subdomains should be strictly inside the principal domain")
+                raise RuntimeError('bamg error message: All subdomains should be strictly inside the principal domain')
 
             # Check that subdomain is correctly oriented
@@ -277,5 +323,5 @@
         if options.getfieldvalue('vertical', 0):
             if np.size(options.getfieldvalue('Markers', [])) != np.size(bamg_geometry.Edges, 0):
-                raise RuntimeError('for 2d vertical mesh, ''Markers'' option is required, and should be of size ' + str(np.size(bamg_geometry.Edges, 0)))
+                raise RuntimeError('for 2d vertical mesh, \'Markers\' option is required, and should be of size {}'.format(str(np.size(bamg_geometry.Edges, 0))))
         if np.size(options.getfieldvalue('Markers', [])) == np.size(bamg_geometry.Edges, 0):
             bamg_geometry.Edges[:, 2] = options.getfieldvalue('Markers')
@@ -291,5 +337,5 @@
                 rift = shpread(riftfile)
             else:
-                raise IOError("bamg error message: file '{}' format not supported (.exp or .shp)".format(riftfile))
+                raise IOError('bamg error message: file \'{}\' format not supported (.exp or .shp)'.format(riftfile))
 
             for i in range(len(rift)):
@@ -297,12 +343,12 @@
                 flags = ContourToNodes(rift[i]['x'], rift[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]'
                 if np.all(np.logical_not(flags)):
-                    raise RuntimeError("one rift has all its points outside of the domain outline")
+                    raise RuntimeError('one rift has all its points outside of the domain outline')
                 elif np.any(np.logical_not(flags)):
                     # We have LOTS of work to do
-                    print("Rift tip outside of or on the domain has been detected and is being processed...")
+                    print('Rift tip outside of or on the domain has been detected and is being processed...')
 
                     # Check that only one point is outside (for now)
                     if np.sum(np.logical_not(flags).astype(int)) != 1:
-                        raise RuntimeError("bamg error message: only one point outside of the domain is supported at this time")
+                        raise RuntimeError('bamg error message: only one point outside of the domain is supported at this time')
 
                     # Move tip outside to the first position
@@ -314,5 +360,5 @@
                         rift[i]['y'] = np.flipud(rift[i]['y'])
                     else:
-                        raise RuntimeError("bamg error message: only a rift tip can be outside of the domain")
+                        raise RuntimeError('bamg error message: only a rift tip can be outside of the domain')
 
                     # Get coordinate of intersection point
@@ -341,5 +387,5 @@
 
                             if np.min(tipdis) / segdis < options.getfieldvalue('toltip', 0):
-                                print("moving tip-domain intersection point")
+                                print('moving tip-domain intersection point')
 
                                 # Get position of the closer point
@@ -370,5 +416,5 @@
                                 pos = np.nonzero(np.logical_and(bamg_geometry.Edges[:, 0] == i1, bamg_geometry.Edges[:, 1] == i2))[0]
                                 if not pos:
-                                    raise RuntimeError("bamg error message: a problem occurred...")
+                                    raise RuntimeError('bamg error message: a problem occurred...')
                                 bamg_geometry.Edges = np.vstack((
                                     bamg_geometry.Edges[0:pos - 1, :],
@@ -507,7 +553,7 @@
     # Bamg options {{{
     bamg_options['Crack'] = options.getfieldvalue('Crack', 0)
-    bamg_options['anisomax'] = options.getfieldvalue('anisomax', 10.**18)
-    bamg_options['coeff'] = options.getfieldvalue('coeff', 1.)
-    bamg_options['cutoff'] = options.getfieldvalue('cutoff', 10.**-5)
+    bamg_options['anisomax'] = options.getfieldvalue('anisomax', pow(10.0, 18))
+    bamg_options['coeff'] = options.getfieldvalue('coeff', 1.0)
+    bamg_options['cutoff'] = options.getfieldvalue('cutoff', pow(10.0, -5))
     bamg_options['err'] = options.getfieldvalue('err', np.array([[0.01]]))
     bamg_options['errg'] = options.getfieldvalue('errg', 0.1)
@@ -515,12 +561,12 @@
     bamg_options['gradation'] = options.getfieldvalue('gradation', 1.5)
     bamg_options['Hessiantype'] = options.getfieldvalue('Hessiantype', 0)
-    bamg_options['hmin'] = options.getfieldvalue('hmin', 10.**-100)
-    bamg_options['hmax'] = options.getfieldvalue('hmax', 10.**100)
+    bamg_options['hmin'] = options.getfieldvalue('hmin', pow(10.0, -100))
+    bamg_options['hmax'] = options.getfieldvalue('hmax', pow(10.0, 100))
     bamg_options['hminVertices'] = options.getfieldvalue('hminVertices', np.empty((0, 1)))
     bamg_options['hmaxVertices'] = options.getfieldvalue('hmaxVertices', np.empty((0, 1)))
     bamg_options['hVertices'] = options.getfieldvalue('hVertices', np.empty((0, 1)))
     bamg_options['KeepVertices'] = options.getfieldvalue('KeepVertices', 1)
-    bamg_options['maxnbv'] = options.getfieldvalue('maxnbv', 10**6)
-    bamg_options['maxsubdiv'] = options.getfieldvalue('maxsubdiv', 10.)
+    bamg_options['maxnbv'] = options.getfieldvalue('maxnbv', pow(10, 6))
+    bamg_options['maxsubdiv'] = options.getfieldvalue('maxsubdiv', 10.0)
     bamg_options['metric'] = options.getfieldvalue('metric', np.empty((0, 1)))
     bamg_options['Metrictype'] = options.getfieldvalue('Metrictype', 0)
@@ -528,5 +574,5 @@
     bamg_options['nbsmooth'] = options.getfieldvalue('nbsmooth', 3)
     bamg_options['omega'] = options.getfieldvalue('omega', 1.8)
-    bamg_options['power'] = options.getfieldvalue('power', 1.)
+    bamg_options['power'] = options.getfieldvalue('power', 1.0)
     bamg_options['splitcorners'] = options.getfieldvalue('splitcorners', 1)
     bamg_options['verbose'] = options.getfieldvalue('verbose', 1)
@@ -595,7 +641,7 @@
     md.mesh.elementconnectivity = md.mesh.elementconnectivity.astype(int)
 
-    #Check for orphan
+    # Check for orphan
     if np.any(np.logical_not(np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat))):
-        raise RuntimeError("Output mesh has orphans. Check your Domain and / or RequiredVertices")
+        raise RuntimeError('Output mesh has orphans. Check your Domain and/or RequiredVertices')
 
     return md
@@ -603,8 +649,8 @@
 
 def processgeometry(geom, tol, outline):  # {{{
-    raise RuntimeError("bamg.py::processgeometry is not complete.")
+    raise RuntimeError('bamg.py::processgeometry is not complete.')
 
     # Deal with edges
-    print("Checking Edge crossing...")
+    print('Checking Edge crossing...')
     i = 0
     while (i < np.size(geom.Edges, axis=0)):
@@ -659,5 +705,5 @@
 
     # Check point outside
-    print("Checking for points outside the domain...")
+    print('Checking for points outside the domain...')
     i = 0
     num = 0
@@ -687,5 +733,5 @@
 
     if num:
-        print(("WARNING: %d points outside the domain outline have been removed" % num))
+        print(('WARNING: {} points outside the domain outline have been removed'.format(num)))
 
     """
Index: issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.js
===================================================================
--- issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.js	(revision 26744)
+++ issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.js	(revision 26744)
@@ -0,0 +1,60 @@
+//GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
+//
+//   Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
+//
+//   - radius:             radius of the planet in km
+//   - resolution:         resolution in km
+//   - refine:             provide mesh
+//   - refinemetric:       mesh quantity to specify resolution
+//
+//   Returns 'mesh3dsurface' type mesh
+//
+//   Examples:
+//      md.mesh=gmshplanet('radius',6000,'resolution',100);
+//      md.mesh=gmshplanet('radius',6000,'resolution',100);
+async function gmshplanet(md) {
+	let args = Array.prototype.slice.call(arguments, 1);
+	let options = new pairoptions(args);
+	let radius = options.getfieldvalue('radius', planetradius('earth')); //warning: planetradius in m, not km
+	let resolution = options.getfieldvalue('resolution', 700);
+
+	md.cluster = cluster;
+	md = await solve(md, 'gmsh', 'checkconsistency', 'false', 'hmin', resolution);
+
+	//methods 
+	let results = md.results[0];
+	let mesh = new mesh3dsurface();
+	let elements = [];
+	for (let i = 0; i < results.Elements.length; i=i+3){
+		elements.push(results.Elements.slice(i, i+3));
+	}
+	mesh.numberofelements = results.NumberOfElements;
+	mesh.numberofvertices =  results.NumberOfVertices;
+	mesh.x = results.X;
+	mesh.y = results.Y;
+	mesh.z = results.Z;
+	mesh.r = results.R;
+	mesh.elements = elements;
+	mesh.lat = results.Lat;
+	mesh.long = results.Long;
+	mesh.average_vertex_connectivity = results.AverageVertexConnectivity;
+
+	//a little technicality here. the mesh generate is not exactly on the 
+	//sphere. we create lat,long coordinates, and reproject on an exact sphere. 
+	mesh.r=ArraySqrt(ArrayAdd(ArrayAdd(ArrayPow(mesh.x,2),ArrayPow(mesh.y,2)),ArrayPow(mesh.z,2)));
+
+	//make sure we don't have south and north pole: 
+	let pos=find(ArrayAnd(ArrayEqual(mesh.x,0), ArrayEqual(mesh.y,0)));
+	mesh.lat = asind(ArrayDivide(mesh.z,mesh.r));
+	mesh.long = atan2d(mesh.y,mesh.x);
+	pos=find(ArrayEqual(mesh.lat,90)); ArrayIndex(mesh.lat,pos,90-.01);
+	pos=find(ArrayEqual(mesh.lat,-90)); ArrayIndex(mesh.lat,pos,-90+.01);
+
+	let radius = planetradius('earth');
+	mesh.r=NewArrayFill(mesh.numberofvertices,radius);
+	mesh.x=ArrayMultiply(radius,ArrayMultiply(cosd(mesh.lat),cosd(mesh.long)));
+	mesh.y=ArrayMultiply(radius,ArrayMultiply(cosd(mesh.lat),sind(mesh.long)));
+	mesh.z=ArrayMultiply(radius,sind(mesh.lat));
+
+	return mesh;
+}
Index: issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.m
===================================================================
--- issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 25994)
+++ issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 26744)
@@ -15,23 +15,6 @@
 %      md.mesh=gmshplanet('radius',6000,'resolution',100);
 
-	%Find path to gmsh
-	paths = {...
-		[issmdir() 'bin/gmsh'],...
-		[issmdir() 'externalpackages/gmsh/install/gmsh']...
-	};
-	disp(paths{1})
-	gmshpath = '';
-	for i=paths
-		if exist(i{1},'file'),
-			gmshpath = i{1};
-			break;
-		end
-	end
-	if isempty(gmshpath),
-		error('gmsh not found, make sure it is properly installed');
-	end
-
 	% Get Gmsh version
-	[s,r]=system([gmshpath ' -info 2>&1 | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);
+	[s,r]=system(['gmsh -info 2>&1 | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);
 	if s~=0,
 		error(r);
@@ -56,10 +39,21 @@
 	fid=fopen('sphere.geo','w');
 
-	fprintf(fid,'Mesh.Algorithm = 1;\n');
+	% NOTE:
+	% - The default format in Gmsh 3 is "msh2". Rather than conditionally 
+	% modifying our parsing scheme for Gmsh 4, for now, we simply set the 
+	% 'Mesh.MshFileVersion' option.
+	% - Decreasing the value of the 'Mesh.RandomFactor' option leads to an 
+	% equal number of nodes and elements being produced under macOS and Linux 
+	% at certain resolutions using certain meshing algorithms.
+	%
+	fprintf(fid,'Mesh.Algorithm = 1;\n'); % MeshAdapt
+	fprintf(fid,'Mesh.MshFileVersion = 2;\n');
+	fprintf(fid,'Mesh.RandomFactor = 1e-10;\n');
 	if  exist(options,'refine'),
-		fprintf(fid,'Mesh.Algorithm = 7;\n');
-		fprintf(fid,'Mesh.CharacteristicLengthFromPoints= 0;\n');
-		fprintf(fid,'Mesh.SmoothRatio= 3;\n');
-		fprintf(fid,'Mesh.RemeshAlgorithm= 1;\n');
+		fprintf(fid,'Mesh.Algorithm = 7;\n'); % BAMG
+		fprintf(fid,'Mesh.CharacteristicLengthFromPoints = 0;\n');
+		if gmshmajorversion == 3,
+			fprintf(fid,'Mesh.RemeshAlgorithm = 1;\n');
+		end
 	end
 	fprintf(fid,'resolution=%g;\n',resolution);
@@ -137,13 +131,8 @@
 
 	% Call gmsh
-	%
-	% NOTE: The default format in Gmsh 3 is "msh2". Rather than conditionally 
-	%		modifying our parsing scheme for Gmsh 4, for now, we simply set the 
-	%		"-format" option.
-	%
 	if  exist(options,'refine'),
-		system([gmshpath ' -tol 1e-8 -2 -format msh2 sphere.geo -bgm sphere.pos']);
+		system(['gmsh -2 sphere.geo -bgm sphere.pos']);
 	else
-		system([gmshpath ' -tol 1e-8 -2 -format msh2 sphere.geo']);
+		system(['gmsh -2 sphere.geo']);
 	end
 
@@ -195,8 +184,19 @@
 	%}}}
 
-	%figure out other fields in mesh3dsurface:
+	%a little technicality here. the mesh generate is not exactly on the 
+	%sphere. we create lat,long coordinates, and reproject on an exact sphere. 
 	mesh.r=sqrt(mesh.x.^2+mesh.y.^2+mesh.z.^2);
-	mesh.lat = asin(mesh.z./mesh.r)/pi*180;
-	mesh.long = atan2(mesh.y,mesh.x)/pi*180;
+
+	%make sure we don't have south and north pole: 
+	pos=find(mesh.x==0 & mesh.y==0);
+	mesh.lat = asind(mesh.z./mesh.r);
+	mesh.long = atan2d(mesh.y,mesh.x);
+	pos=find(mesh.lat==90); mesh.lat(pos)=90-.01;
+	pos=find(mesh.lat==-90); mesh.lat(pos)=-90+.01;
+
+	mesh.r=radius*ones(mesh.numberofvertices,1);
+	mesh.x=radius*cosd(mesh.lat).*cosd(mesh.long);
+	mesh.y=radius*cosd(mesh.lat).*sind(mesh.long);
+	mesh.z=radius*sind(mesh.lat);
 
 	%erase files:
Index: issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.py
===================================================================
--- issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 25994)
+++ issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 26744)
@@ -9,6 +9,5 @@
 
 def gmshplanet(*args):
-    '''
-    GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
+    """GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
 
     Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
@@ -18,40 +17,53 @@
     - refinemetric:       mesh quantity to specify resolution
 
-        Returns 'mesh3dsurface' type mesh
-
-        Examples:
-            md.mesh = gmshplanet('radius', 6000, 'resolution', 100);
-            md.mesh = gmshplanet('radius', 6000, 'resolution', 100);
-    '''
+    Returns 'mesh3dsurface' type mesh
+
+    Examples:
+        md.mesh = gmshplanet('radius', 6000, 'resolution', 100);
+        md.mesh = gmshplanet('radius', 6000, 'resolution', 100);
+    """
 
     # Get Gmsh version
-    subproc_args = "gmsh -info 2>&1 | command grep 'Version' | sed -e 's/Version[[:blank:]]*:[[:blank:]]//' | cut -d '.' -f1"
+    subproc_args = 'gmsh -info 2>&1 | command grep \'Version\' | sed -e \'s/Version[[:blank:]]*:[[:blank:]]//\' | cut -d \'.\' -f1'
     subproc = subprocess.Popen(subproc_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     outs, errs = subproc.communicate()
-    if errs != '':
-        raise Exception("gmshplanet: call to gmsh failed: {}".format(errs))
+
+    if ((not isinstance(errs,bytes)) & (errs != '')) or (isinstance(errs,bytes) & (errs.decode() != '')):
+        raise Exception('gmshplanet: call to gmsh failed: {}'.format(errs))
     gmshmajorversion = int(outs)
     if gmshmajorversion not in [3, 4]:
-        raise RuntimeError("gmshplanet: Gmsh major version {} not supported!".format(gmshmajorversion))
-
-    #process options
+        raise RuntimeError('gmshplanet: Gmsh major version {} not supported!'.format(gmshmajorversion))
+
+    # Process options
     options = pairoptions(*args)
     #options = deleteduplicates(options, 1)
 
-    #recover parameters:
+    # Recover parameters
     radius = options.getfieldvalue('radius') * 1000
     resolution = options.getfieldvalue('resolution') * 1000
 
-    #initialize mesh:
+    # Initialize mesh
     mesh = mesh3dsurface()
-    #create .geo file:  {{{
+    # Create .geo file:  {{{
     fid = open('sphere.geo', 'w')
 
-    fid.write('Mesh.Algorithm = 1;\n')
+    # Call gmsh
+    #
+    # NOTE:
+    # - The default format in Gmsh 3 is "msh2". Rather than conditionally 
+    # modifying our parsing scheme for Gmsh 4, for now, we simply set the 
+    # 'Mesh.MshFileVersion' option.
+    # - Decreasing the value of the 'Mesh.RandomFactor' option leads to an 
+    # equal number of nodes and elements being produced under macOS and Linux 
+    # at certain resolutions using certain meshing algorithms.
+    #
+    fid.write('Mesh.Algorithm = 1;\n') # MeshAdapt
+    fid.write('Mesh.MshFileVersion = 2;\n')
+    fid.write('Mesh.RandomFactor = 1e-10;\n')
     if options.exist('refine'):
-        fid.write('Mesh.Algorithm = 7;\n')
+        fid.write('Mesh.Algorithm = 7;\n') # BAMG
         fid.write('Mesh.CharacteristicLengthFromPoints = 0;\n')
-        fid.write('Mesh.SmoothRatio = 3;\n')
-        fid.write('Mesh.RemeshAlgorithm = 1;\n')
+        if gmshmajorversion == 3:
+            fid.write('Mesh.RemeshAlgorithm = 1;\n')
     fid.write('resolution = %g;\n' % resolution)
     fid.write('radius = %g;\n' % radius)
@@ -81,23 +93,23 @@
         curvename = 'Curve Loop'
 
-    fid.write('%s(13) = {2, 8, -10};\n' % curvename)
+    fid.write('%s(13) = {2,8,-10};\n' % curvename)
     fid.write('Surface(14) = {13};\n')
-    fid.write('%s(15) = {10, 3, 7};\n' % curvename)
+    fid.write('%s(15) = {10,3,7};\n' % curvename)
     fid.write('Surface(16) = {15};\n')
-    fid.write('%s(17) = {-8, -9, 1};\n' % curvename)
+    fid.write('%s(17) = {-8,-9,1};\n' % curvename)
     fid.write('Surface(18) = {17};\n')
-    fid.write('%s(19) = {-11, -2, 5};\n' % curvename)
+    fid.write('%s(19) = {-11,-2,5};\n' % curvename)
     fid.write('Surface(20) = {19};\n')
-    fid.write('%s(21) = {-5, -12, -1};\n' % curvename)
+    fid.write('%s(21) = {-5,-12,-1};\n' % curvename)
     fid.write('Surface(22) = {21};\n')
-    fid.write('%s(23) = {-3, 11, 6};\n' % curvename)
+    fid.write('%s(23) = {-3,11,6};\n' % curvename)
     fid.write('Surface(24) = {23};\n')
-    fid.write('%s(25) = {-7, 4, 9};\n' % curvename)
+    fid.write('%s(25) = {-7,4,9};\n' % curvename)
     fid.write('Surface(26) = {25};\n')
-    fid.write('%s(27) = {-4, 12, -6};\n' % curvename)
+    fid.write('%s(27) = {-4,12,-6};\n' % curvename)
     fid.write('Surface(28) = {27};\n')
-    fid.write('Surface Loop(29) = {28, 26, 16, 14, 20, 24, 22, 18};\n')
+    fid.write('Surface Loop(29) = {28,26,16,14,20,24,22,18};\n')
     fid.write('Volume(30) = {29};\n')
-    fid.write('Physical Surface(1) = {28, 26, 16, 14, 20, 24, 22, 18};\n')
+    fid.write('Physical Surface(1) = {28,26,16,14,20,24,22,18};\n')
     fid.write('Physical Volume(2) = 30;\n')
     fid.close()
@@ -108,33 +120,27 @@
         metric = options.getfieldvalue('refinemetric')
 
-    #create .pos file with existing mesh and refining metric:  {{{
+        # Create .pos file with existing mesh and refining metric:  {{{
         fid = open('sphere.pos', 'w')
 
-        fid.write('View "background mesh" [;\n')
+        fid.write('View "background mesh" {\n')
         for i in range(meshini.numberofelements):
-            fid.write('ST(%g, %g, %g, %g, %g, %g, %g, %g, %g)[%g, %g, %g];\n',
-                      meshini.x(meshini.elements(i, 0)), meshini.y(meshini.elements(i, 0)), meshini.z(meshini.elements(i, 0)),
-                      meshini.x(meshini.elements(i, 1)), meshini.y(meshini.elements(i, 1)), meshini.z(meshini.elements(i, 1)),
-                      meshini.x(meshini.elements(i, 2)), meshini.y(meshini.elements(i, 2)), meshini.z(meshini.elements(i, 2)),
-                      metric(meshini.elements(i, 0)), metric(meshini.elements(i, 1)), metric(meshini.elements(i, 2)))
-        fid.write('];\n')
+            fid.write('ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n'
+                % (meshini.x[meshini.elements[i, 0]-1], meshini.y[meshini.elements[i, 0]-1], meshini.z[meshini.elements[i, 0]-1],
+                meshini.x[meshini.elements[i, 1]-1], meshini.y[meshini.elements[i, 1]-1], meshini.z[meshini.elements[i, 1]-1],
+                meshini.x[meshini.elements[i, 2]-1], meshini.y[meshini.elements[i, 2]-1], meshini.z[meshini.elements[i, 2]-1],
+                metric[meshini.elements[i, 0]-1], metric[meshini.elements[i, 1]-1], metric[meshini.elements[i, 2]-1]))
+        fid.write('};\n')
         fid.close()
-    # }}}
-
-    # Call gmsh
-    #
-    # NOTE: The default format in Gmsh 3 is "msh2". Rather than conditionally 
-    #       modifying our parsing scheme for Gmsh 4, for now, we simply set the 
-    #       "-format" option.
-    #
+        #}}}
+
     if options.exist('refine'):
-        subprocess.call('gmsh -tol 1e-8 -2 -format msh2 sphere.geo -bgm sphere.pos', shell=True)
+        subprocess.call('gmsh -2 sphere.geo -bgm sphere.pos', shell=True)
     else:
-        subprocess.call('gmsh -tol 1e-8 -2 -format msh2 sphere.geo', shell=True)
-
-    #import mesh:  {{{
+        subprocess.call('gmsh -2 sphere.geo', shell=True)
+
+    # Import mesh  {{{
     fid = open('sphere.msh', 'r')
 
-    #Get Mesh format
+    # Get mesh format
     A = fid.readline().strip()
     if A != '$MeshFormat':
@@ -146,5 +152,5 @@
         raise RuntimeError(['Expecting $EndMeshFormat (', A, ')'])
 
-    #Nodes
+    # Nodes
     A = fid.readline().strip()
     if A != '$Nodes':
@@ -165,5 +171,5 @@
         raise RuntimeError(['Expecting $EndNodes (', A, ')'])
 
-    #Elements
+    # Elements
     A = fid.readline().strip()
     if A != '$Elements':
@@ -181,12 +187,25 @@
     #}}}
 
-    #figure out other fields in mesh3dsurface:
-    mesh.r = np.sqrt(mesh.x**2 + mesh.y**2 + mesh.z**2)
-    mesh.lat = np.arcsin(mesh.z / mesh.r) / np.pi * 180
-    mesh.long = np.arctan2(mesh.y, mesh.x) / np.pi * 180
-
-    #erase files:
+    # A little technicality here. The mesh is not exactly on the sphere. We 
+    # create lat,long coordiantes, and reproject onto an exact sphere.
+    mesh.r = np.sqrt(mesh.x ** 2 + mesh.y ** 2 + mesh.z ** 2)
+
+    # Make sure we don't have south and north pole
+    pos = np.where(np.logical_and.reduce((mesh.x == 0, mesh.y == 0)))[0]
+    mesh.lat = asind(mesh.z / mesh.r)
+    mesh.long = atan2d(mesh.y, mesh.x)
+    pos = np.where(mesh.lat == 90)[0]
+    mesh.lat[pos] = 90 - 0.01
+    pos = np.where(mesh.lat == -90)[0]
+    mesh.lat[pos] = -90 + 0.01
+
+    mesh.r = radius * np.ones((mesh.numberofvertices, ))
+    mesh.x = radius * cosd(mesh.lat) * cosd(mesh.long)
+    mesh.y = radius * cosd(mesh.lat) * sind(mesh.long)
+    mesh.z = radius * sind(mesh.lat)
+
+    # Erase files
     subprocess.call('rm -rf sphere.geo sphere.msh sphere.pos', shell=True)
 
-    #return mesh:
+    # Return mesh
     return mesh
Index: issm/trunk/src/m/miscellaneous/MatlabFuncs.js
===================================================================
--- issm/trunk/src/m/miscellaneous/MatlabFuncs.js	(revision 26744)
+++ issm/trunk/src/m/miscellaneous/MatlabFuncs.js	(revision 26744)
@@ -0,0 +1,566 @@
+/*
+A collection of functions that replicate the behavior of MATLAB built-in
+functions of the same, respective name.
+
+Where possible, users are encouraged to use native and/or the most efficient 
+methods in JavaScript, but we provide these functions as a way to make 
+translations from the MATLAB to the JavaScript ISSM API more seamless.
+
+NOTE:
+- We cannot implement the following MATLAB built-in functions by name as their
+names are reserved keywords in JavaScript,
+    class
+
+TODO:
+- Implement,
+    sort
+    unique
+
+Sources:
+- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords
+*/
+
+/**
+ * FUNCTION any - Determine if any array elements are nonzero
+ *
+ * Replicates behavior of MATLAB's 'any' function.
+ *
+ * Usage:
+ *     B = any(A);
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/any.html
+ *
+ * NOTE:
+ * - Only basic functionality is implemented
+ */
+function any(A) {//{{{
+    for (let i = 0; i < A.length; ++i) {
+        if (A[i] !== 0) {
+            return true;
+        }
+    }
+    return false;
+} //}}}
+
+/**
+ * FUNCTION diff - Differences and approximate derivatives
+ *
+ * Replicates behavior of MATLAB's 'diff' function.
+ * 
+ * Y = diff(X) calculates differences between adjacent elements of X.
+ *
+ * Usage:
+ *     Y = diff(X);
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/diff.html
+ *
+ * NOTE:
+ * - Not all functionality is implemented
+ */
+function diff(X) {//{{{
+    let diffs = [];
+    for (let i = 0; i < (X.length - 1); ++i) {
+        diffs[i] = X[i + 1] - X[i];
+    }
+    return diffs;
+} //}}}
+
+/**
+ * FUNCTION disp - Display value of variable
+ *
+ * Replicates behavior of MATLAB's 'disp' function.
+ *
+ * Output is logged to console.
+ *
+ * Usage:
+ *     disp(X);
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/disp.html
+ */
+function disp(X) {//{{{
+    console.log(X);
+} //}}}
+
+/**
+ * FUNCTION error - Throw error and display message
+ *
+ * Replicates behavior of MATLAB's 'error' function
+ *
+ * Usage:
+ *     error(msg);
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/error.html
+ *
+ * NOTE:
+ * - Only basic functionality is implemented
+ */
+function error(msg) {//{{{
+    throw new Error(msg);
+} //}}}
+
+/**
+ * FUNCTION find - Find indices and values of nonzero elements
+ *
+ * Replicates behavior of MATLAB's 'find' function
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/find.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ * - Implement 'n' parameter
+ * - Implement 'direction' parameter
+ */
+function find(X, n, direction) {//{{{
+    if (typeof(X[0]) == 'number') {
+        let indices = [];
+        for (let i = 0; i < X.length; ++i) {
+            if (X[i] != 0) {
+                indices.push(i);
+            }
+        }
+        return indices;
+    } else { //TODO: If 2d array, assume return rows & cols - try to find a way to not always return rows/cols
+        let rowindices = [];
+        let colindices = [];
+        for (let i = 0; i < X.length; ++i) {
+            for (let j = 0; j < X[i].length; ++j) {
+                if (X[i][j] != 0) {
+                    rowindices.push(i);
+                    colindices.push(j);
+                }
+            }
+        }
+        return [rowindices, colindices];
+    }
+} //}}}
+
+/**
+ * FUNCTION isempty - Determine whether array is empty
+ *
+ * Replicates behavior of MATLAB's 'isempty' function
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/isempty.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ */
+function isempty(A) {//{{{
+    //NOTE: Expanded for clarity/debugging. Can reduce later.
+    if (A === undefined) {
+        return 1; //TODO: Fix this: for now, treat undefined as empty
+    } else {
+        return A.length == 0;
+    }
+} //}}}
+
+/**
+ * FUNCTION ismember - Array elements that are members of set array
+ *
+ * Replicates basic behavior of MATLAB's 'ismember' function with an important 
+ * modification: because of the way we use ismember under MATLAB (to determine 
+ * if *any* element of A is in B) and because the truthiness of an empty array 
+ * in JavaScript is true, we return 0 if the A is not in B.
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/double.ismember.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ */
+function ismember(A, B) {//{{{
+    let b = B;
+    if (typeof(B) == 'number' || typeof(B) == 'string') {
+        b = [B];
+    }
+    let indices = zeros(A.length);
+    for (let i = 0; i < A.length; ++i) {
+        for (let j = 0; j < b.length; ++j) {
+            if (A[i] === b[j]) {
+                indices[i] = 1;
+            }
+        }
+    }
+    if (indices.length) {
+        return indices;
+    } else {
+        return 0;
+    }
+} //}}}
+
+/**
+ * FUNCTION isnan - Determine which array elements are NaN
+ *
+ * Replicates behavior of MATLAB's 'isnan' function
+ *
+ * Usage:
+ *     TF = isnan(A)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/isnan.html
+ * - https://medium.com/coding-in-simple-english/how-to-check-for-nan-in-javascript-4294e555b447
+ * 
+ * NOTE:
+ * - Not to be confused with JavaScript built-in function isNaN
+ * - Not to be confused with function Number.isNaN
+ */
+function isnan(A) {//{{{
+    if (A.constructor !== Array) {
+        error('isnan: argument must be an array')
+    }
+    is_nan = [];
+    for (let i = 0; i < A.length; ++i) {
+        if (Number.isNaN(A[i])) {
+            is_nan.push(1);
+        } else {
+            is_nan.push(0);
+        }
+    }
+    return is_nan;
+} //}}}/*
+
+/**
+ * FUNCTION length - Length of largest array dimension
+ *
+ * Replicates behavior of MATLAB's 'length' function
+ *
+ * Usage:
+ *     L = length(X)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/length.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ */
+function length(A) {//{{{
+    return A.length;
+} //}}}/*
+
+/**
+ * FUNCTION max - Maximum elements of an array
+ *
+ * Replicates behavior of MATLAB's 'max' function
+ *
+ * Usage:
+ *     M = max(A)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/max.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ * - Implement 'nanflag' parameter
+ */
+function max(A) {//{{{
+    return Math.max.apply(null, A);
+} //}}}/*
+
+/**
+ * FUNCTION min - Minimum elements of an array
+ *
+ * Replicates behavior of MATLAB's 'min' function
+ *
+ * Usage:
+ *     M = min(A)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/min.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ * - Implement 'nanflag' parameter
+ */
+function min(A) {//{{{
+    return Math.min.apply(null, A);
+} //}}}/*
+
+/**
+ * FUNCTION ones - Create array of all ones
+ *
+ * Replicates behavior of MATLAB's 'zeros' function
+ * 
+ * Usage:
+ *     X = ones
+ *     X = ones(n)
+ *     X = ones(sz1,...,szN)
+ *     X = ones(sz)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/ones.html
+ *
+ * TODO:
+ * - Create lower-level function to handle both ones and zeros functions as 
+ * they are essentially the same
+ * - Implement functionality for more than 2 dimensions
+ */
+function ones() {//{{{
+    nargs = arguments.length;
+    if (nargs == 0) {
+        return 1;
+    } else if (nargs == 1) {
+        let arg = arguments[0];
+        if (typeof(arg) == 'number') {
+            return NewArrayFill(arg, 1);
+        } else if (arg.constructor == Array) {
+            return ones(...arg); // spread array of sizes
+        } else {
+            error('ones: functionality for greater than 2 dimensions is not currently implemented')
+        }
+    } else if (nargs == 2) {
+        return NewArrayFill2D(arguments[0], arguments[1], 1);
+    } else {
+        error('ones: functionality for greater than 2 dimensions is not currently implemented')
+    }
+} //}}}
+
+/**
+ * FUNCTION size - Array size
+ *
+ * Replicates behavior of MATLAB's 'size' function
+ * 
+ * Usage:
+ *     sz = size(A);
+ *     szdim = size(A, dim);
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/size.html
+ * 
+ * NOTE:
+ * - Not all functionality is implemented
+ * - In a 2D array, if length of all columns are not equal, unexpected behavior 
+ * may result from subsequent processing based on the values returned from this 
+ * function.
+ */
+function size(A, dim) {//{{{
+    let nargs = arguments.length;
+    if (nargs == 0) {
+        error('size: at least one argument is required');
+    } else if (nargs == 1) {
+        if (typeof(A) == 'number') { // scalar numbers are of size [1, 1]
+            return [1, 1];
+        } else if (A.constructor != Array) {
+            error('size: A argument must be a number or an Array');
+        }
+        if (typeof(A) == 'undefined' || isNaN(A)) {
+            return [0];
+        } else if (A.length && A[0].constructor == Array) {
+            return [A.length, A[0].length];
+        } else {
+            return [A.length];
+        }
+    } else if (nargs == 2) {
+        if (typeof(dim) != 'number' || dim < 0 || dim > 1) {
+            error('size: dim argument must be a number between 0 and 1, inclusive');
+        }
+        if (dim == 0) {
+            if (typeof(A) == 'number') { // scalar numbers are of size [1, 1]
+                return 1;
+            } else {
+                return A.length;
+            }
+        } else {
+            if (typeof(A) == 'number') { // scalar numbers are of size [1, 1]
+                return 1;
+            } else if (typeof(A) == 'undefined' || isNaN(A)) {
+                return 0;
+            } else if (A[0].constructor != Array) {
+                error('size: A[0] is not an Array');
+            }
+            return A[0].length;
+        }
+    } else {
+        error('size: functionality for more than 2 arguments is not currently implemented');
+    }
+} //}}}
+
+/**
+ * FUNCTION strcmpi - Compare strings (case insensitive)
+ *
+ * Replicates behavior of MATLAB's 'strcmpi' function
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/strcmpi.html
+ */
+function strcmpi(s1, s2) {//{{{
+    return s1.toLowerCase() == s2.toLowerCase();
+} //}}}
+
+/**
+ * FUNCTION sum - Sum of elements of an array
+ *
+ * Replicates behavior of MATLAB's 'sum' function
+ *
+ * Usage:
+ *     S = sum(A)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/sum.html
+ *
+ * TODO:
+ * - Implement support for multidimensional arrays
+ * - Implement 'nanflag' parameter
+ */
+function sum(A) {//{{{
+    return ArraySum(A);
+} //}}}
+
+/**
+ * FUNCTION zeros - Create array of all zeros
+ *
+ * Replicates behavior of MATLAB's 'zeros' function
+ * 
+ * Usage:
+ *     X = zeros
+ *     X = zeros(n)
+ *     X = zeros(sz1,...,szN)
+ *     X = zeros(sz)
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/ref/zeros.html
+ *
+ * TODO:
+ * - Create lower-level function to handle both ones and zeros functions as 
+ * they are essentially the same
+ * - Implement functionality for more than 2 dimensions
+ */
+function zeros() {//{{{
+    nargs = arguments.length;
+    if (nargs == 0) {
+        return 0;
+    } else if (nargs == 1) {
+        let arg = arguments[0];
+        if (typeof(arg) == 'number') {
+            return NewArrayFill(arg, 0);
+        } else if (arg.constructor == Array) {
+            return zeros(...arg); // spread array of sizes
+        } else {
+            error('zeros: functionality for greater than 2 dimensions is not currently implemented')
+        }
+    } else if (nargs == 2) {
+        return NewArrayFill2D(arguments[0], arguments[1], 0);
+    } else {
+        error('zeros: functionality for greater than 2 dimensions is not currently implemented')
+    }
+} //}}}
+
+/**
+ * FUNCTIONS sin, cos, tan, asin, acos, atan2 - trig functions that work with radians
+ *
+ * Replicates behavior of MATLAB's trig functions
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/trigonometry.html
+ *
+ */
+function sin(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.sin(X[i]);
+    }
+    return result;
+} //}}}
+
+function cos(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.cos(X[i]);
+    }
+    return result;
+} //}}}
+
+function tan(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.tan(X[i]);
+    }
+    return result;
+} //}}}
+
+function asin(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.asin(X[i]);
+    }
+    return result;
+} //}}}
+
+function acos(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.acos(X[i]);
+    }
+    return result;
+} //}}}
+
+// TODO: Test that the arguments do not need to be reversed, as they are in MATLAB and Python
+function atan2(X, Y) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.atan2(X[i], Y[i]);
+    }
+    return result;
+} //}}}
+
+/**
+ * FUNCTIONS sind, cosd, tand, asind, acosd, atan2d - trig functions that work with degrees
+ *
+ * Replicates behavior of MATLAB's trig functions
+ *
+ * Sources:
+ * - https://www.mathworks.com/help/matlab/trigonometry.html
+ *
+ */
+function sind(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.sin(X[i] * DEG2RAD);
+    }
+    return result;
+} //}}}
+
+function cosd(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.cos(X[i] * DEG2RAD);
+    }
+    return result;
+} //}}}
+
+function tand(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = Math.tan(X[i] * DEG2RAD);
+    }
+    return result;
+} //}}}
+
+function asind(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = RAD2DEG * Math.asin(X[i]);
+    }
+    return result;
+} //}}}
+
+function acosd(X) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = RAD2DEG * Math.acos(X[i]);
+    }
+    return result;
+} //}}}
+
+// TODO: Test that the arguments do not need to be reversed, as they are in MATLAB and Python
+function atan2d(X, Y) {//{{{
+    let result = NewArrayFill(size, X.length);
+    for (let i = 0; i < X.length; ++i) {
+        result[i] = RAD2DEG * Math.atan2(X[i], Y[i]);
+    }
+    return result;
+} //}}}
Index: issm/trunk/src/m/miscellaneous/MatlabFuncs.py
===================================================================
--- issm/trunk/src/m/miscellaneous/MatlabFuncs.py	(revision 25994)
+++ issm/trunk/src/m/miscellaneous/MatlabFuncs.py	(revision 26744)
@@ -1,59 +1,206 @@
-def oshostname():
-    import socket
-
-    return socket.gethostname()
-
-
-def ispc():
+"""A collection of functions that replicate the behavior of MATLAB built-in
+functions of the same, respective name.
+
+Where possible, users are encouraged to use native and/or the most efficient 
+methods in Python, but we provide these functions as a way to make translations 
+from the MATLAB to the Python ISSM API more seamless.
+"""
+
+def acosd(X):  # {{{
+    """function acosd - Inverse cosine in degrees
+
+    Usage:
+        Y = acosd(X)
+    """
+    import numpy as np
+
+    return np.degrees(np.arccos(X))
+# }}}
+
+def asind(X):  # {{{
+    """function asind - Inverse sine in degrees
+
+    Usage:
+        Y = asind(X)
+    """
+    import numpy as np
+
+    return np.degrees(np.arcsin(X))
+# }}}
+
+def atand(X):  # {{{
+    """function atand - Inverse tangent in degrees
+
+    Usage:
+        Y = atand(X)
+    """
+    import numpy as np
+
+    return np.degrees(np.arctan(X))
+# }}}
+
+
+def atan2d(Y, X):  # {{{
+    """function atan2d - Four-quadrant inverse tangent in degrees
+
+    Usage:
+        D = atan2d(Y, X)
+    """
+    import numpy as np
+
+    return np.degrees(np.arctan2(Y, X))
+# }}}
+
+def contains(str, pat):  #{{{
+    """function contains - Determine if pattern is in strings
+
+    Usage:
+        TF = contains(str, pat)
+
+    TODO:
+    - Implement 'IgnoreCase' option
+    """
+
+# }}}
+
+def cosd(X):  # {{{
+    """function cosd - Cosine of argument in degrees
+
+    Usage:
+        Y = cosd(X)
+    """
+    import numpy as np
+
+    if type(X) == np.ndarray:
+        Y = np.array([])
+        for x in X:
+            Y = np.append(Y, cosdsingle(x))
+        return Y
+    else:
+        return cosdsingle(X)
+# }}}
+
+def cosdsingle(x):  # {{{
+    """function cosdsingle - Helper function for cosd to reduce repetition of 
+    logic
+
+    Usage:
+        y = cosdsingle(x)
+    """
+    import numpy as np
+
+    while x >= 360:
+        x = x - 360
+
+    if x == 0:
+        return 1
+    elif x == 90 or x == 270:
+        return 0
+    elif x == 180:
+        return -1
+    else:
+        return np.cos(np.radians(x))
+# }}}
+
+def det(a):  # {{{
+    if a.shape == (1, ):
+        return a[0]
+    elif a.shape == (1, 1):
+        return a[0, 0]
+    elif a.shape == (2, 2):
+        return a[0, 0] * a[1, 1] - a[0, 1] * a[1, 0]
+    else:
+        raise TypeError('MatlabFunc.det only implemented for shape (2, 2), not for shape {}.'.format(a.shape))
+# }}}
+
+def error(msg):  # {{{
+    raise Exception(msg)
+# }}}
+
+def etime(t2, t1):  # {{{
+    return t2 - t1
+# }}}
+
+def find(*args):  # {{{
+    nargs = len(args)
+    if nargs >= 1 or nargs <= 2:
+        X = args[0]
+        n = len(args[0])
+        if nargs == 2:
+            n = args[1]
+        indices=[]
+        for i in range(n):
+            if X[i] != 0:
+                indices.push(i)
+        return indices
+    else:
+        raise Exception('find: must have 1 or 2 arguments')
+# }}}
+
+def floor(X):  # {{{
+    import math
+
+    return int(math.floor(X))
+# }}}
+
+def heaviside(x):  # {{{
+    import numpy as np
+
+    y = np.zeros_like(x)
+    y[np.nonzero(x > 0.)] = 1.
+    y[np.nonzero(x == 0.)] = 0.5
+
+    return y
+# }}}
+
+def intersect(A, B):  # {{{
+    """function intersect - Set intersection of two arrays
+
+    Usage:
+        C = intersect(A, B)
+
+    NOTE:
+    - Only the following functionality is currently implemented:
+        - C = intersect(A,B) returns the data common to both A and B, with no 
+        repetitions. C is in sorted order.
+
+    """
+    import numpy as np
+
+    return np.intersect1d(A, B)
+#}}}
+
+def isa(A, dataType):  # {{{
+    """function isa
+
+    NOTE:
+    - Takes a type as its second argument (in contrast to the MATLAB function 
+    that it replicates, which takes a string representing the name of a type)
+    """
+    return type(A) == dataType
+# }}}
+
+# NOTE: Conflicts with definition of isempty in $ISSM_DIR/src/m/qmu/helpers.py
+#
+# def isempty(A):  # {{{
+#     return len(A) > 0
+# # }}}
+
+def isfile(fileName):  # {{{
+    import os
+
+    return os.path.exists(fileName)
+# }}}
+
+def ismac():  # {{{
     import platform
 
-    if 'Windows' in platform.system():
-        return True
-    else:
-        return False
-
-
-def ismac():
-    import platform
-
     if 'Darwin' in platform.system():
         return True
     else:
         return False
-
-
-def strcmp(s1, s2):
-
-    if s1 == s2:
-        return True
-    else:
-        return False
-
-
-def strncmp(s1, s2, n):
-
-    if s1[0:n] == s2[0:n]:
-        return True
-    else:
-        return False
-
-
-def strcmpi(s1, s2):
-
-    if s1.lower() == s2.lower():
-        return True
-    else:
-        return False
-
-
-def strncmpi(s1, s2, n):
-
-    if s1.lower()[0:n] == s2.lower()[0:n]:
-        return True
-    else:
-        return False
-
-
-def ismember(a, s):
+# }}}
+
+def ismember(a, s):  # {{{
     import numpy as np
 
@@ -66,5 +213,4 @@
     if not isinstance(a, np.ndarray):
         b = [item in s for item in a]
-
     else:
         if not isinstance(s, np.ndarray):
@@ -76,19 +222,102 @@
 
     return b
-
-
-def det(a):
-
-    if a.shape == (1, ):
-        return a[0]
-    elif a.shape == (1, 1):
-        return a[0, 0]
-    elif a.shape == (2, 2):
-        return a[0, 0] * a[1, 1] - a[0, 1] * a[1, 0]
-    else:
-        raise TypeError("MatlabFunc.det only implemented for shape (2, 2), not for shape %s." % str(a.shape))
-
-
-def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0):
+# }}}
+
+def isnan(A):  # {{{
+    import numpy as np
+
+    return np.isnan(A)
+# }}}
+
+def ispc():  # {{{
+    import platform
+
+    if 'Windows' in platform.system():
+        return True
+    else:
+        return False
+# }}}
+
+def isprop(obj, PropertyName):  # {{{
+    return hasattr(obj, PropertyName)
+# }}}
+
+def mod(a, m):  # {{{
+    return a % m
+# }}}
+
+def numel(A):  # {{{
+    """function numel - Number of array elements
+
+    Usage:
+        n = numel(A))
+    """
+    import numpy as np
+
+    return np.size(A)
+# }}}
+
+def pause(n):  # {{{
+    import time
+
+    time.sleep(n)
+# }}}
+
+def pwd():  # {{{
+    import os
+
+    return os.getcwd()
+# }}}
+
+def oshostname():  # {{{
+    import socket
+
+    return socket.gethostname()
+# }}}
+
+def rem(a, b):  # {{{
+    return a % b
+# }}}
+
+def sind(X):  # {{{
+    """function sind - Sine of argument in degrees
+
+    Usage:
+        Y = sind(X)
+    """
+    import numpy as np
+
+    if type(X) == np.ndarray:
+        Y = np.array([])
+        for x in X:
+            Y = np.append(Y, sindsingle(x))
+        return Y
+    else:
+        return sindsingle(X)
+# }}}
+
+def sindsingle(x):  # {{{
+    """function sindsingle - Helper function for sind to reduce repetition of 
+    logic
+
+    Usage:
+        y = sindsingle(x)
+    """
+    import numpy as np
+
+    while x >= 360:
+        x = x - 360
+
+    if x == 0 or x == 180:
+        return 0
+    elif x == 90:
+        return 1
+    elif x == 270:
+        return -1
+    else:
+        return np.sin(np.radians(x))
+# }}}
+
+def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0):  # {{{
     import numpy as np
 
@@ -104,12 +333,42 @@
 
     return a
-
-
-def heaviside(x):
-    import numpy as np
-
-    y = np.zeros_like(x)
-    y[np.nonzero(x > 0.)] = 1.
-    y[np.nonzero(x == 0.)] = 0.5
-
-    return y
+# }}}
+
+def strcmp(s1, s2):  # {{{
+    if s1 == s2:
+        return True
+    else:
+        return False
+# }}}
+
+def strcmpi(s1, s2):  # {{{
+    if s1.lower() == s2.lower():
+        return True
+    else:
+        return False
+# }}}
+
+def strjoin(*args):  # {{{
+    nargs = len(args)
+    if nargs >= 1 or nargs <= 2:
+        sep = ' '
+        if nargs == 2:
+            sep = args[1]
+        return sep.join(args[0])
+    else:
+        raise Exception('strjoin: must have 1 or 2 arguments')
+# }}}
+
+def strncmp(s1, s2, n):  # {{{
+    if s1[0:n] == s2[0:n]:
+        return True
+    else:
+        return False
+# }}}
+
+def strncmpi(s1, s2, n):  # {{{
+    if s1.lower()[0:n] == s2.lower()[0:n]:
+        return True
+    else:
+        return False
+# }}}
Index: issm/trunk/src/m/miscellaneous/PythonFuncs.py
===================================================================
--- issm/trunk/src/m/miscellaneous/PythonFuncs.py	(revision 25994)
+++ issm/trunk/src/m/miscellaneous/PythonFuncs.py	(revision 26744)
@@ -2,6 +2,5 @@
 
 
-def logical_and_n(*arg):
-
+def logical_and_n(*arg): #{{{
     if len(arg):
         result = arg[0]
@@ -9,11 +8,9 @@
             result = np.logical_and(result, item)
         return result
-
     else:
         return None
+#}}}
 
-
-def logical_or_n(*arg):
-
+def logical_or_n(*arg): #{{{
     if len(arg):
         result = arg[0]
@@ -21,5 +18,5 @@
             result = np.logical_or(result, item)
         return result
-
     else:
         return None
+#}}}
Index: issm/trunk/src/m/miscellaneous/prctile_issm.py
===================================================================
--- issm/trunk/src/m/miscellaneous/prctile_issm.py	(revision 25994)
+++ issm/trunk/src/m/miscellaneous/prctile_issm.py	(revision 26744)
@@ -41,5 +41,8 @@
         #  if one value, just copy it
         elif n == 1:
-            y = np.tile(x[0, :], (len(p), 1))
+            if isinstance(p, int):
+                y = x[0, :]
+            else:
+                y = np.tile(x[0, :], (len(p), 1))
 
         #  if no values, use NaN
Index: issm/trunk/src/m/miscellaneous/pretty_print.m
===================================================================
--- issm/trunk/src/m/miscellaneous/pretty_print.m	(revision 25994)
+++ issm/trunk/src/m/miscellaneous/pretty_print.m	(revision 26744)
@@ -30,10 +30,10 @@
 		if shape(2)>6
 			output=sprintf('[[%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(1,1),data(1,2),data(1,3),data(1,end-2),data(1,end-1),data(1,end));
-			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(2,1),data(2,2),data(2,3),data(2,end-2),data(2,end-1),data(2,end));
-			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(3,1),data(3,2),data(3,3),data(3,end-2),data(3,end-1),data(3,end));
+			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(2,1),data(2,2),data(2,3),data(2,end-2),data(2,end-1),data(2,end));
+			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(3,1),data(3,2),data(3,3),data(3,end-2),data(3,end-1),data(3,end));
 			output=sprintf('%s ...\n',output);
-			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(end-2,1),data(end-2,2),data(end-2,3),data(end-2,end-2),data(end-2,end-1),data(end-2,end));
-			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(end-1,1),data(end-1,2),data(end-1,3),data(end-1,end-2),data(end-1,end-1),data(end-1,end));
-			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]]',data(end,1),data(end,2),data(end,3),data(end,end-2),data(end,end-1),data(end,end));
+			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(end-2,1),data(end-2,2),data(end-2,3),data(end-2,end-2),data(end-2,end-1),data(end-2,end));
+			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(end-1,1),data(end-1,2),data(end-1,3),data(end-1,end-2),data(end-1,end-1),data(end-1,end));
+			output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]]',output,data(end,1),data(end,2),data(end,3),data(end,end-2),data(end,end-1),data(end,end));
 		else
 			output=sprintf('[[%.8f]\n',data(1,:));
Index: issm/trunk/src/m/modules/CoordTransform.m
===================================================================
--- issm/trunk/src/m/modules/CoordTransform.m	(revision 25994)
+++ issm/trunk/src/m/modules/CoordTransform.m	(revision 26744)
@@ -10,8 +10,8 @@
 %
 %   Example of Projections:
-%      
+%
 %   lat/lon = '+init=epsg:4326'
 %   lat/lon = '+proj=longlat +datum=WGS84'
-%   
+%
 %   ll2xy default equivalent (uses with Hugues Ellispoid S)
 %   Greenland = '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs'
@@ -19,7 +19,9 @@
 %   Bamber Greenland = '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
 %
-%   for latitude/longitude, x is longitude and y latitude and the angles are in rad
+%   For latitude/longitude, x is longitude and y latitude and the angles are in 
+%   rad
 %
-%   This function will only work of PROJ has been installed in externalpackages
+%   This function will only work if PROJ has been installed and --with-proj-dir 
+%   option has been set to its location in ISSM configuration
 
 % Check usage
Index: issm/trunk/src/m/modules/ExpToLevelSet.m
===================================================================
--- issm/trunk/src/m/modules/ExpToLevelSet.m	(revision 25994)
+++ issm/trunk/src/m/modules/ExpToLevelSet.m	(revision 26744)
@@ -18,12 +18,35 @@
 end
 
+multipleShp = 0;
+
 if ischar(contourname),
-	[path,name,ext]=fileparts(contourname); 
+	[path,name,ext]=fileparts(contourname);
 	if strcmpi(ext,'.shp'),
 		%read contour from shapefile
-		contourname=shpread(contourname); 
+		contourname=shpread(contourname);
+		if isstruct(contourname)
+			multipleShp = size(contourname, 2);
+		end
 	end
 end
 
 % Call mex module
-distance = ExpToLevelSet_matlab(x,y,contourname);
+if multipleShp>0 
+	% shp file contains multiple contours
+	distance = zeros(length(x)+1, multipleShp);
+	for i = 1:multipleShp
+		distance(1:end-1, i) = ExpToLevelSet_matlab(x,y,contourname(i));
+		% append the NAME information at the end of the distance
+		if isfield(contourname(i),'NAME')
+			distance(end, i) = contourname(i).NAME;
+		elseif isfield(contourname(i),'Date')
+			distance(end, i) = date2decyear(datenum(contourname(i).Date));
+			% to deal with 
+		else
+			distance(end, i) = i;
+		end        
+	end
+else
+	% single shape or exp file
+	distance = ExpToLevelSet_matlab(x,y,contourname);
+end
Index: issm/trunk/src/m/modules/ExpToLevelSet.py
===================================================================
--- issm/trunk/src/m/modules/ExpToLevelSet.py	(revision 25994)
+++ issm/trunk/src/m/modules/ExpToLevelSet.py	(revision 26744)
@@ -1,2 +1,3 @@
+from ExpToLevelSet_python import ExpToLevelSet_python
 from helpers import fileparts
 from shpread import shpread
@@ -23,5 +24,5 @@
     """
 
-    if isinstance(contourname, basestring):
+    if isinstance(contourname, str):
         path, name, ext = fileparts(contourname)
         if ext == '.shp':
@@ -29,5 +30,5 @@
             contourname = shpread(contourname)
 
-    # NOTE: This library does not currently exist! See TODO list in function 
+    # NOTE: This module does not currently exist! See TODO list in function 
     #       header.
     distance = ExpToLevelSet_python(x, y, contourname)
Index: issm/trunk/src/m/modules/InterpFromGridToMesh.py
===================================================================
--- issm/trunk/src/m/modules/InterpFromGridToMesh.py	(revision 25994)
+++ issm/trunk/src/m/modules/InterpFromGridToMesh.py	(revision 26744)
@@ -1,2 +1,3 @@
+import numpy as np
 from InterpFromGridToMesh_python import InterpFromGridToMesh_python
 
@@ -21,3 +22,3 @@
     data_mesh = InterpFromGridToMesh_python(x, y, data, x_mesh, y_mesh, default_value)
     # Return
-    return data_mesh
+    return np.squeeze(data_mesh)
Index: issm/trunk/src/m/modules/ShpRead.m
===================================================================
--- issm/trunk/src/m/modules/ShpRead.m	(revision 25994)
+++ issm/trunk/src/m/modules/ShpRead.m	(revision 26744)
@@ -1,3 +1,3 @@
-function ShpRead(filename);
+function structout = ShpRead(filename);
 %	SHPREAD - Read shapefile
 %	
@@ -5,9 +5,8 @@
 %	
 %	   Usage:
-%	      ShpRead(filename);
-%	      filexp:      file name of exp file to be written
+%	      structout = ShpRead(filename);
 %	
 %	   Examples:
-%	      ShpRead('file.shp');
+%	      structout = ShpRead('file.shp');
 
 % Check usage
@@ -18,3 +17,3 @@
 
 % Call mex module
-ShpRead_matlab(filename);
+structout = ShpRead_matlab(filename);
Index: issm/trunk/src/m/os/ismingw.m
===================================================================
--- issm/trunk/src/m/os/ismingw.m	(revision 26744)
+++ issm/trunk/src/m/os/ismingw.m	(revision 26744)
@@ -0,0 +1,11 @@
+function result=ismingw()
+%ISMINGW - Returns 1 if machine is running MinGW.
+%
+%   Usage:
+%      if ismingw,
+%         [...]
+%      end
+%
+
+[status,result]=system('uname -rs | grep "MINGW" | wc -l');
+result=str2num(result);
Index: issm/trunk/src/m/os/issmscpin.m
===================================================================
--- issm/trunk/src/m/os/issmscpin.m	(revision 25994)
+++ issm/trunk/src/m/os/issmscpin.m	(revision 26744)
@@ -18,12 +18,9 @@
 %if hostname and host are the same, do a simple copy
 if strcmpi(hostname,host),
-
-    for i=1:numel(packages),
+	for i=1:numel(packages),
 		success=copyfile([path '/' packages{i}]); %keep going, even if success=0
 	end
-
 else
-
-	if ispc(),
+	if ispc & ~ismingw,
 		%use the putty project pscp.exe: it should be in the path.
 
Index: issm/trunk/src/m/os/issmscpin.py
===================================================================
--- issm/trunk/src/m/os/issmscpin.py	(revision 25994)
+++ issm/trunk/src/m/os/issmscpin.py	(revision 26744)
@@ -1,17 +1,17 @@
-from socket import gethostname
-import subprocess
 import os
 import shutil
-import MatlabFuncs as m
+import subprocess
+from MatlabFuncs import *
 
 
 def issmscpin(host, login, port, path, packages):
-    """
-    ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
-       usage: issmscpin(host, packages, path)
+    """ISSMSCPIN get packages from host, using scp on unix, and pscp on windows
+
+    Usage:
+        issmscpin(host, packages, path)
     """
 
     #first get hostname
-    hostname = gethostname()
+    hostname = oshostname()
     #first be sure packages are not in the current directory, this could conflict with pscp on windows.
     #remove warnings in case the files do not exist
@@ -29,5 +29,5 @@
                 pass
     else:
-        if m.ispc():
+        if ispc():
             #use the putty project pscp.exe: it should be in the path.
             #get ISSM_DIR variable
Index: issm/trunk/src/m/os/issmscpout.m
===================================================================
--- issm/trunk/src/m/os/issmscpout.m	(revision 25994)
+++ issm/trunk/src/m/os/issmscpout.m	(revision 26744)
@@ -9,5 +9,5 @@
 hostname=oshostname();
 
-%are we dis-allowing symbolic links? 
+%are we disallowing symbolic links? 
 if nargin==6,
 	no_symlinks=1;
@@ -24,5 +24,5 @@
 		system(['rm -rf ' packages{i} ]);
 		if no_symlinks,
-			system(['cp  ' here '/' packages{i} ' .']);
+			system(['cp ' here '/' packages{i} ' .']);
 		else
 			system(['ln -s ' here '/' packages{i} ' .']);
@@ -31,5 +31,5 @@
 	end
 else 
-	if ispc(),
+	if ispc & ~ismingw,
 		%use the putty project pscp.exe: it should be in the path.
 
Index: issm/trunk/src/m/os/issmscpout.py
===================================================================
--- issm/trunk/src/m/os/issmscpout.py	(revision 25994)
+++ issm/trunk/src/m/os/issmscpout.py	(revision 26744)
@@ -1,17 +1,17 @@
+import os
 from socket import gethostname
 import subprocess
-import os
-import MatlabFuncs as m
+from MatlabFuncs import *
 
 
 def issmscpout(host, path, login, port, packages):
-    """
-    ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows
+    """ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows
 
-       usage: issmscpout(host, path, packages)
+    Usage:
+        issmscpout(host, path, packages)
     """
 
     #get hostname
-    hostname = gethostname()
+    hostname = oshostname()
 
     #if hostname and host are the same, do a simple copy
@@ -28,5 +28,5 @@
             os.chdir(here)
     else:
-        if m.ispc():
+        if ispc():
             #use the putty project pscp.exe: it should be in the path.
             #get ISSM_DIR variable
Index: issm/trunk/src/m/os/issmssh.m
===================================================================
--- issm/trunk/src/m/os/issmssh.m	(revision 25994)
+++ issm/trunk/src/m/os/issmssh.m	(revision 26744)
@@ -12,5 +12,5 @@
 	system(command);
 else
-	if ispc(),
+	if ispc & ~ismingw,
 		%use the putty project plink.exe: it should be in the path.
 
Index: issm/trunk/src/m/os/issmssh.py
===================================================================
--- issm/trunk/src/m/os/issmssh.py	(revision 25994)
+++ issm/trunk/src/m/os/issmssh.py	(revision 26744)
@@ -1,25 +1,23 @@
-from socket import gethostname
+import os
+import subprocess
 from sys import platform as _platform
-import subprocess
-import os
-import MatlabFuncs as m
+from MatlabFuncs import *
 
 
 def issmssh(host, login, port, command):
-    """
-    ISSMSSH - wrapper for OS independent ssh command.
+    """ISSMSSH - wrapper for OS independent ssh command.
 
-       usage:
-          issmssh(host, command)
+    Usage:
+        issmssh(host, command)
     """
 
     #first get hostname
-    hostname = gethostname()
+    hostname = oshostname()
 
     #if same as host, just run the command.
-    if m.strcmpi(host, hostname):
+    if strcmpi(host, hostname):
         subprocess.call(command, shell=True)
     else:
-        if m.ispc():
+        if ispc():
             #use the putty project plink.exe: it should be in the path.
             #get ISSM_DIR variable
Index: issm/trunk/src/m/os/oshostname.m
===================================================================
--- issm/trunk/src/m/os/oshostname.m	(revision 25994)
+++ issm/trunk/src/m/os/oshostname.m	(revision 26744)
@@ -22,5 +22,5 @@
 %Method 3, last chance
 if isempty(hostname),
-	if ispc
+	if ispc % If OS is MinGW, $COMPUTERNAME and $HOSTNAME are identical
 		hostname = getenv('COMPUTERNAME');
 	else
Index: issm/trunk/src/m/parameterization/parameterize.py
===================================================================
--- issm/trunk/src/m/parameterization/parameterize.py	(revision 25994)
+++ issm/trunk/src/m/parameterization/parameterize.py	(revision 26744)
@@ -4,17 +4,16 @@
 
 def parameterize(md, parametername):
-    '''
-    PARAMETERIZE - parameterize a model
+    """PARAMETERIZE - parameterize a model
 
-        From a parameter Python file, start filling in all the model fields 
-        that were not filled in by the mesh.py and mask.py model methods.
-        Warning: the parameter file must be able to be run in Python
+    From a parameter Python file, start filling in all the model fields that 
+    were not filled in by the mesh.py and mask.py model methods. Warning: the 
+    parameter file must be able to be run in Python
 
-        Usage:
-            md = parameterize(md, parametername)
+    Usage:
+        md = parameterize(md, parametername)
 
-        Example:
-            md = parameterize(md, 'Square.par')
-    '''
+    Example:
+        md = parameterize(md, 'Square.py')
+    """
 
     #some checks
Index: issm/trunk/src/m/parameterization/reinitializelevelset.py
===================================================================
--- issm/trunk/src/m/parameterization/reinitializelevelset.py	(revision 26744)
+++ issm/trunk/src/m/parameterization/reinitializelevelset.py	(revision 26744)
@@ -0,0 +1,39 @@
+import numpy as np
+from model import model
+from contourlevelzero import *
+from ExpToLevelSet import *
+
+def reinitializelevelset(md,levelset):
+    """REINITIALIZELEVELSET - reinitialize levelset as a signed distance function
+
+    Usage:
+       levelsetnew = reinitializelevelset(md,levelset)
+    """
+    
+    # if md is 3d, levelset should be projected on a 2d mesh 
+    if len(levelset) == 0:
+        raise IOError("levelset provided is empty")
+    
+    if md.mesh.dimension() == 3:
+        if len(levelset)!=md.mesh.numberofvertices2d:
+            raise IOError("levelset provided should be specified at the 2d vertices of the mesh")
+        else:
+            if len(levelset)!=md.mesh.numberofvertices:
+                raise IOError("levelset provided should be specified at the vertices of the mesh")
+            
+    #First: extract segments
+    contours=contourlevelzero(md,levelset,0)
+    
+    #Now, make this a distance field (might not be closed)
+    levelsetnew=np.abs(ExpToLevelSet(md.mesh.x,md.mesh.y,contours)).T # levelsetnew comes on the 3d vertices, if mesh is 3d
+    
+    #Finally, change sign
+    pos=np.where(levelset<0) # if mesh is 3d, it refers to the vertices on the base
+    if md.mesh.dimension()==3:
+        for i in range(md.mesh.numberoflayers):
+            pos3d=pos[0]+i*md.mesh.numberofvertices2d
+            levelsetnew[pos3d]=-levelsetnew[pos3d]
+    else:
+        levelsetnew[pos[0]]=-1*levelsetnew[pos[0]]
+        
+    return levelsetnew
Index: issm/trunk/src/m/parameterization/setflowequation.m
===================================================================
--- issm/trunk/src/m/parameterization/setflowequation.m	(revision 25994)
+++ issm/trunk/src/m/parameterization/setflowequation.m	(revision 26744)
@@ -60,5 +60,5 @@
 %check that each element has only one flag
 if any(SIAflag+SSAflag+HOflag+L1L2flag+MLHOflag+FSflag>1),
-	disp('setflowequation warning message: some elements have several types, higher order type is used for them')
+	disp('setflowequation.m: Warning: some elements have several types, higher order type is used for them')
 	SIAflag(find(SIAflag & SSAflag))=0;
 	SIAflag(find(SIAflag & HOflag))=0;
Index: issm/trunk/src/m/parameterization/setflowequation.py
===================================================================
--- issm/trunk/src/m/parameterization/setflowequation.py	(revision 25994)
+++ issm/trunk/src/m/parameterization/setflowequation.py	(revision 26744)
@@ -6,22 +6,23 @@
 
 def setflowequation(md, *args):
-    """
-    SETFLOWEQUATION - associate a solution type to each element
-
-       This routine works like plotmodel: it works with an even number of inputs
-       'SIA', 'SSA', 'HO', 'L1L2', 'MLHO', 'FS' and 'fill' are the possible options
-       that must be followed by the corresponding exp file or flags list
-       It can either be a domain file (argus type, .exp extension), or an array of element flags.
-       If user wants every element outside the domain to be
-       setflowequationd, add '~' to the name of the domain file (ex: '~HO.exp')
-       an empty string '' will be considered as an empty domain
-       a string 'all' will be considered as the entire domain
-       You can specify the type of coupling, 'penalties' or 'tiling', to use with the input 'coupling'
-
-       Usage:
-          md = setflowequation(md, varargin)
-
-       Example:
-          md = setflowequation(md, 'HO', 'HO.exp', fill', 'SIA', 'coupling', 'tiling')
+    """SETFLOWEQUATION - associate a solution type to each element
+
+    This routine works like plotmodel: it works with an even number of inputs
+    'SIA', 'SSA', 'HO', 'L1L2', 'MLHO', 'FS' and 'fill' are the possible 
+    options that must be followed by the corresponding exp file or flags list. 
+    It can either be a domain file (argus type, .exp extension), or an array of 
+    element flags.
+    If user wants every element outside the domain to be setflowequationd, add 
+    '~' to the name of the domain file (ex: '~HO.exp') an empty string '' will 
+    be considered as an empty domain a string 'all' will be considered as the 
+    entire domain.
+    You can specify the type of coupling, 'penalties' or 'tiling', to use with 
+    the input 'coupling'.
+
+    Usage:
+        md = setflowequation(md, varargin)
+
+    Example:
+        md = setflowequation(md, 'HO', 'HO.exp', fill', 'SIA', 'coupling', 'tiling')
     """
 
@@ -61,5 +62,5 @@
     #check that each element has only one flag
     if any(SIAflag + SSAflag + L1L2flag + MLHOflag + HOflag + FSflag > 1):
-        print("setflowequation warning message: some elements have several types, higher order type is used for them")
+        print('Warning: setflowequation.py: some elements have several types, higher order type is used for them')
         SIAflag[np.where(np.logical_and(SIAflag, SSAflag))] = False
         SIAflag[np.where(np.logical_and(SIAflag, HOflag))] = False
Index: issm/trunk/src/m/partition/partitioner.m
===================================================================
--- issm/trunk/src/m/partition/partitioner.m	(revision 25994)
+++ issm/trunk/src/m/partition/partitioner.m	(revision 26744)
@@ -1,3 +1,3 @@
-function [partitionvector, md]=partitioner(md,varargin)
+function [partitionvector,md]=partitioner(md,varargin)
 %PARTITIONER - partition mesh 
 %
Index: issm/trunk/src/m/plot/applyoptions.js
===================================================================
--- issm/trunk/src/m/plot/applyoptions.js	(revision 25994)
+++ issm/trunk/src/m/plot/applyoptions.js	(revision 26744)
@@ -1,3 +1,5 @@
-function applyoptions(md, data, options, canvas){ //{{{
+'use strict';
+
+function applyoptions(md, data, options, canvas) {
 	//APPLYOPTIONS - apply colobar, text, cloud, and expdisp options to current plot
 	//
@@ -8,471 +10,358 @@
 
 	//{{{ colorbar
-	var gl = canvas.gl;
-	if (options.exist('colorbar')) {
-		if (options.getfieldvalue('colorbar')==1) {
-			//{{{ Variable options initialization
-			var caxis = options.getfieldvalue('caxis');
-			var ccanvasid, ctitleid, clabelsid, ccanvas, ctitle, clabels, ccontext, cmap, colorbar, cwidth, cheight, cgradient, color, y, x;
-			//}}}
-			//{{{ Create colorbar labels
-			var labels = [];
-			var cdivisions = options.getfieldvalue('colorbarnticks', 6);
-			var caxisdelta = caxis[1] - caxis[0];
-			var precision = options.getfieldvalue('colorbarprecision', 3);
-			var format = options.getfieldvalue('colorbarformat', 'f').toLowerCase();
-			if (options.getfieldvalue('log','off')!='off') {
-				for (var i=cdivisions; i >= 0; i--) {
-					var scale = (Math.log10(caxis[1])-Math.log10(caxis[0]))/Math.log10(options.getfieldvalue('log', 10));
-					if (format === 'f') {
-						labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(caxis[0])/Math.log10(options.getfieldvalue('log', 10))+scale*(cdivisions-i)/cdivisions)).toFixed(precision);
-					}
-					else if (format === 'e') {
-						labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(caxis[0])/Math.log10(options.getfieldvalue('log', 10))+scale*(cdivisions-i)/cdivisions)).toPrecision(precision);
-					}
-					else {
-						labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(caxis[0])/Math.log10(options.getfieldvalue('log', 10))+scale*(cdivisions-i)/cdivisions)).toFixed(precision);
-					}
+	let gl = canvas.gl;
+	
+	if (options.getfieldvalue('colorbar', false)) {
+		//{{{ Create colorbar labels
+		let cAxis = options.getfieldvalue('caxis');
+		let labels = [];
+		let divisions = options.getfieldvalue('colorbarnticks', 6);
+		let cAxisDelta = cAxis[1] - cAxis[0];
+		let precision = options.getfieldvalue('colorbarprecision', 3);
+		let format = options.getfieldvalue('colorbarformat', 'f').toLowerCase();
+		if (options.getfieldvalue('log','off') !== 'off') {
+			for (let i = divisions; i >= 0; i--) {
+				let scale = (Math.log10(cAxis[1]) - Math.log10(cAxis[0])) / Math.log10(options.getfieldvalue('log', 10));
+				if (format === 'f') {
+					labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(cAxis[0]) / Math.log10(options.getfieldvalue('log', 10)) + scale * (divisions - i) / divisions)).toFixed(precision);
+				} else if (format === 'e') {
+					labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(cAxis[0]) / Math.log10(options.getfieldvalue('log', 10)) + scale * (divisions - i) / divisions)).toPrecision(precision);
+				} else {
+					labels[i] = (Math.pow(options.getfieldvalue('log', 10), Math.log10(cAxis[0]) / Math.log10(options.getfieldvalue('log', 10)) + scale * (divisions - i) / divisions)).toFixed(precision);
+				}
+			}
+		} else {
+			for (let i = divisions; i >= 0; i--) {
+				if (format === 'f') {
+					labels[i] = (cAxisDelta * (divisions - i) / divisions + cAxis[0]).toFixed(precision);
+				} else if (format === 'e') {
+					labels[i] = (cAxisDelta * (divisions - i) / divisions + cAxis[0]).toPrecision(precision);
+				} else {
+					labels[i] = (cAxisDelta * (divisions - i) / divisions + cAxis[0]).toFixed(precision);
+				}
+			}
+		} //}}}
+		//{{{ Initialize colorbar canvas
+		let cCanvasId = options.getfieldvalue('colorbarid', options.getfieldvalue('canvasid') + ('-colorbar-canvas'));
+		let cCanvasIdBase = cCanvasId.substring(0, cCanvasId.lastIndexOf('-canvas'));
+		let cCanvas = document.getElementById(cCanvasId);
+		let cWidth = cCanvas.width * options.getfieldvalue('colorbarwidth', 1);
+		let cHeight = cCanvas.height * options.getfieldvalue('colorbarheight', 1);
+		let cContext = cCanvas.getContext('2d');
+		let cMap = options.getfieldvalue('colormap', 'amp');
+		
+		// If value of cMap is of type array, assume we have a custom colorbar; otherwise, look up colormap by name from global letiable "colorbars"
+		let colorbar = null;
+		
+		if (vesl.arrays.isArray(cMap)) {
+			colorbar = cMap;
+		} else {
+    		for (let colormap in colorbars) {
+        		if (colormap === cMap) {
+			        colorbar = colorbars[cMap];
+			        break;
+                }
+            }
+            
+            if (colorbar === null) {
+                for (let colormap in cmoceanColormaps) {
+            		if (colormap === cMap) {
+    			        colorbar = cmoceanColormaps[cMap];
+    			        break;
+                    }
+                }
+            }
+		}
+		
+		let gradient = cContext.createLinearGradient(0, 0, 0, cHeight);
+		//}}}
+		//{{{ Draw colorbar gradient
+		// TODO: Allow for passing the opacity in as a fourth value of each array of a colormap?
+		let applyOpacityToColorbar  = options.getfieldvalue('applyOpacityToColorbar', false);
+		let color                   = null;
+		let background              = options.getfieldvalue('colorbarBackground', null);
+		let offset                  = 1 / (colorbar.length - 1) / 2;
+		let opacity                 = options.getfieldvalue('opacity', 1.0);
+		let position                = null;
+		let scaling                 = 1 - 2 * offset;
+		
+		if (!applyOpacityToColorbar) {
+    		opacity = 1.0;
+		}
+		
+		if (background !== null) {
+    		background = [background[0] * 255, background[1] * 255, background[2] * 255];
+    		$('#' + cCanvasId).css('background', 'rgba(' + background.toString() + ', 1.0');
+		}
+		
+		for (let i = 0; i < colorbar.length; i++) {
+			color = colorbar[colorbar.length - i - 1];
+			color = [Math.round(color[0] * 255), Math.round(color[1] * 255), Math.round(color[2] * 255)];
+			position = (i / (colorbar.length - 1) * scaling) + offset;
+			gradient.addColorStop(position, 'rgba(' + color.toString() + ', ' + opacity + ')');
+		}
+		
+		cContext.clearRect(0, 0, cWidth, cHeight);
+		cContext.beginPath();
+		cContext.fillStyle = gradient;
+		cContext.fillRect(0, 0, cWidth, cHeight);
+		//}}}
+		//{{{ Draw colorbar border
+		cContext.beginPath();
+		cContext.lineWidth = '1';
+		cContext.strokeStyle=options.getfieldvalue('colorbarfontcolor','black');
+		cContext.rect(0, 0, cWidth, cHeight);
+		cContext.stroke();
+		//}}}
+		//{{{ Draw colorbar labels
+		let cLabelsId = cCanvasIdBase + '-labels';
+		let cLabels = $('#' + cLabelsId);
+		let cLabelString = '';
+		let x, y;
+		cLabels.empty();
+		for (let i = 0; i <= divisions; i++) {
+			y = (i + 0.5) / (divisions + 1) * cHeight;
+			x = 0.2 * cWidth;
+			cLabelString += '<li><span>' + labels[i] + '</span></li>';
+			cContext.beginPath();
+			cContext.moveTo(0, y);
+			cContext.lineTo(x, y);
+			cContext.moveTo(cWidth - x, y);
+			cContext.lineTo(cWidth, y);
+			cContext.stroke();
+		}
+		cLabels.append(cLabelString);
+		//}}}
+		//{{{ Draw colorbar title
+		let cTitleId = cCanvasIdBase + '-heading';
+		let cTitle = $('#' + cTitleId);
+		if (options.exist('colorbartitle')) { cTitle.html(options.getfieldvalue('colorbartitle')); }
+		//}}}
+		//{{{ Setup texture/alpha canvases
+		let $canvas 	= $(canvas);
+		let tCanvasId 	= options.getfieldvalue('texturecanvasid', 'texturecanvas');
+		let aCanvasId 	= options.getfieldvalue('alphacanvasid', 'alphacanvas');
+		let tCanvas 	= document.getElementById(tCanvasId);
+		let aCanvas 	= document.getElementById(aCanvasId);
+		
+		if (tCanvas == null) {
+			$('<canvas id="' + tCanvasId + '" width="256" height="256" style="display: none;"></canvas>').insertAfter($canvas);
+			tCanvas = document.getElementById(tCanvasId);
+		}
+		
+		if (aCanvas == null) {
+			$('<canvas id="' + aCanvasId + '" width="256" height="256" style="display: none;"></canvas>').insertAfter($canvas);
+			aCanvas = document.getElementById(aCanvasId);
+		}
+	
+		//Set up canvas drawing contexes and gradients.
+		let tContext = tCanvas.getContext('2d');
+		let aContext = aCanvas.getContext('2d');
+		let tGradient = tContext.createLinearGradient(0, 0, 0, 256);
+		let aGradient = aContext.createLinearGradient(0, 0, 0, 256);
+		
+		//Determine where in gradient to start unit mesh transparency
+		let maskAlphaEnabled = options.getfieldvalue('maskAlphaEnabled', false);
+		let maskAlphaTolerance = options.getfieldvalue('maskAlphaTolerance', 0.1);
+		let maskAlphaValue = options.getfieldvalue('maskAlphaValue', 1.1);
+		let maskAlphaUseColor = options.getfieldvalue('maskAlphaUseColor', false);
+		let maskAlphaColor = options.getfieldvalue('maskAlphaColor', 'rgba(0.0, 0.0, 255, 1.0)');
+		let alphaValue = (maskAlphaValue - cAxis[0]) / cAxisDelta;
+		
+		//Apply transparency to alpha map that enables alpha to be read from texture, and to actual texture alpha.
+		for (let i = 0; i < colorbar.length; i++) {
+			color = colorbar[colorbar.length - i - 1];
+			color = [Math.round(color[0] * 255), Math.round(color[1] * 255), Math.round(color[2] * 255)];
+			let colorStop = i / (colorbar.length - 1);
+			if (maskAlphaEnabled && (colorStop > 1 - alphaValue || colorStop == colorbar.length - 1)) {
+				if (maskAlphaUseColor) {
+					tGradient.addColorStop(colorStop, maskAlphaColor);
+					aGradient.addColorStop(colorStop, 'rgb(255, 255, 255)');
+				} else {
+					tGradient.addColorStop(colorStop, 'rgba(' + color.toString() + ', 0.0)');
+					aGradient.addColorStop(colorStop, 'rgb(0, 0, 0)');
 				}
 			} else {
-				for (var i=cdivisions; i >= 0; i--) {
-					if (format === 'f') {
-						labels[i] = (caxisdelta*(cdivisions-i)/cdivisions+caxis[0]).toFixed(precision);
-					}
-					else if (format === 'e') {
-						labels[i] = (caxisdelta*(cdivisions-i)/cdivisions+caxis[0]).toPrecision(precision);
-					}
-					else {
-						labels[i] = (caxisdelta*(cdivisions-i)/cdivisions+caxis[0]).toFixed(precision);
-					}
-				}
-			} //}}}
-			//{{{ Initialize colorbar canvas
-			let colorbarSlug = options.getfieldvalue('colorbarSlug', options.getfieldvalue('canvasid') + '-colorbar');
-			ccanvasid = colorbarSlug + '-canvas';
-			ccanvas = $('#'+ccanvasid)[0];
-			cwidth = ccanvas.width*options.getfieldvalue('colorbarwidth', 1);
-			cheight = ccanvas.height*options.getfieldvalue('colorbarheight', 1);
-			ccontext = ccanvas.getContext('2d');
-			ccontext.clearRect(0, 0, cwidth, cheight);
-			ccontext.beginPath();
-			cmap = options.getfieldvalue('colormap','jet');
-			colorbar = colorbars[cmap];
-			cgradient = ccontext.createLinearGradient(0, 0, 0, cheight);
-			//}}}
-			//{{{ Draw colorbar gradient
-			var position;
-			var offset = 1 / (colorbar.length - 1) / 2;
-			var scaling = 1 - 2 * offset;
-			for (var i=0; i < colorbar.length; i++) {
-				color = colorbar[colorbar.length-i-1];
-				color = [Math.round(color[0]*255), Math.round(color[1]*255), Math.round(color[2]*255)];
-				position = (i / (colorbar.length - 1) * scaling) + offset;
-				cgradient.addColorStop(position, 'rgba(' + color.toString() + ', 1.0)');
-			}
-			ccontext.fillStyle=cgradient;
-			ccontext.fillRect(0, 0, cwidth, cheight);
-			//}}}
-			//{{{ Draw colorbar border
-			ccontext.beginPath();
-			ccontext.lineWidth='1';
-			ccontext.strokeStyle=options.getfieldvalue('colorbarfontcolor','black');
-			ccontext.rect(0, 0, cwidth, cheight);
-			ccontext.stroke();
-			//}}}
-			//{{{ Draw colorbar labels
-			clabelsid = colorbarSlug + '-labels';
-			clabels = $('#'+clabelsid);
-			var clabelstring = '';
-			clabels.empty();
-			for (var i=0; i <= cdivisions; i++) {
-				y = (i+0.5)/(cdivisions+1)*cheight;
-				x = 0.2*cwidth;
-				clabelstring += '<li><span>'+labels[i]+'</span></li>';
-				ccontext.beginPath();
-				ccontext.moveTo(0, y);
-				ccontext.lineTo(x, y);
-				ccontext.moveTo(cwidth-x, y);
-				ccontext.lineTo(cwidth, y);
-				ccontext.stroke();
-			}
-			clabels.append(clabelstring);
-			//}}}
-			//{{{ Draw colorbar title
-			ctitleid = colorbarSlug + '-heading';
-			ctitle = $('#'+ctitleid);
-			if (options.exist('colorbarHeader')) { ctitle.html(options.getfieldvalue('colorbarHeader')); }
-			//}}}
+				tGradient.addColorStop(colorStop, 'rgba(' + color.toString() + ', 1.0)');
+				aGradient.addColorStop(colorStop, 'rgb(255, 255, 255)');
+			}
+		}
+		
+		//Draw gradients to canvaes.
+		tContext.fillStyle = tGradient;
+		aContext.fillStyle = aGradient;
+		tContext.fillRect(0, 0, 256, 256);
+		aContext.fillRect(0, 0, 256, 256);
+		
+		//Allow for special texture colors, drawing each color in equal width vertical rectangles. The last rectanglar section is reserved for the colormap.
+		if (options.exist('maskregion')) {
+			let maskObject = options.getfieldvalue('maskregion',{'enabled':false});
+			if (maskObject.enabled && !vesl.helpers.isEmptyOrUndefined(maskObject.colors)) {
+				let x = 0;
+				let sections = Object.keys(maskObject.colors).length + 1;
+				let size = 256;
+				let width = Math.floor(1 / sections * size);
+				for (let color in maskObject.colors) {
+					tContext.fillStyle = maskObject.colors[color];
+					tContext.fillRect(x++ * width, 0, width, size);
+				}
+			}
+		}
+		
+		//Read canvases as images, and load as textures in Three.js
+		let tURL            = tCanvas.toDataURL();
+		let aURL            = aCanvas.toDataURL();
+		let textureMap      = new THREE.TextureLoader().load(tURL);
+		let alphaMap        = new THREE.TextureLoader().load(aURL);
+		let unitOptions 	= options.getfieldvalue('unitOptions', {'name' : 'unit'});
+		let unitName 		= unitOptions.name;
+		let unitSceneNode 	= canvas.unitNodes[unitName].sceneNode;
+		unitSceneNode.material.map          = textureMap;
+		unitSceneNode.material.emissiveMap  = textureMap;
+		unitSceneNode.material.color        = new THREE.Color(0xffffff);
+		unitSceneNode.material.needsUpdate  = true;
+		
+		//Only apply alpha map if enabled.
+		if (maskAlphaEnabled) {
+			unitSceneNode.material.alphaMap = alphaMap;
 		}
 	} //}}}
-	//{{{ texture canvas
-	var tcontext, tcanvas, tcanvasid, tURL, tgradient;
-	tcanvasid = 'texturecanvas';
-	var tcanvas = document.getElementById(tcanvasid);
-	if (tcanvas == null) {
-		$('<canvas id="texturecanvas" width="256" height="256" style="display: none;"></canvas>').insertAfter('#'+String(options.getfieldvalue('canvasid')));
-		tcanvas = document.getElementById(tcanvasid);
-	}
-	tcontext = tcanvas.getContext('2d');
-	tgradient = tcontext.createLinearGradient(0, 0, 0, 256);
-
-	var cmap = options.getfieldvalue('colormap','jet');
-	var colorbar = colorbars[cmap];
-	for (var i = 0; i < colorbar.length; i++) {
-		color = colorbar[colorbar.length - i - 1];
-		color = [Math.round(color[0] * 255), Math.round(color[1] * 255), Math.round(color[2] * 255)];
-		tgradient.addColorStop(i / (colorbar.length - 1), 'rgba(' + color.toString() + ', 1.0)');
-	}
-	tcontext.fillStyle = tgradient;
-	tcontext.fillRect(0, 0, 256, 256);
-
-	//Allow for special texture colors, drawing each color in equal width vertical rectangles. The last rectanglar section is reserved for the colormap.
-	if (options.exist('maskregion')) {
-		var maskObject = options.getfieldvalue('maskregion',{'enabled':false});
-		if (maskObject.enabled && !vesl.helpers.isEmptyOrUndefined(maskObject.colors)) {
-			var x = 0;
-			var sections = Object.keys(maskObject.colors).length + 1;
-			var size = 256;
-			var width = Math.floor(1 / sections * size);
-			for (var color in maskObject.colors) {
-				tcontext.fillStyle = maskObject.colors[color];
-				tcontext.fillRect(x++ * width, 0, width, size);
-			}
-		}
-	}
-
-	tURL = tcanvas.toDataURL();
-	if (options.getfieldvalue('clf','on')=='off') {
-		canvas.nodes['unit' + (Object.keys(canvas.nodes).length - 1)].texture = initTexture(canvas.gl, tURL);
-	} else {
-		canvas.nodes.unit.texture = initTexture(canvas.gl, tURL);
-	}
 	//}}}
-	//{{{ text display
-	var ctx;
-	var overlaycanvasid;
-	var overlaycanvas;
-	//Only intialize overlay canvas once by checking if it's already been defined
-	if (vesl.helpers.isEmptyOrUndefined(canvas.overlaycanvas)) {
-		//Get drawing context and save reference on main WebGL canvas
-		overlaycanvasid = options.getfieldvalue('overlayid', options.getfieldvalue('canvasid') + '-overlay')
-		overlaycanvas = $('#' + overlaycanvasid)[0];
-		ctx = overlaycanvas.getContext('2d');
-		canvas.overlaycanvas = overlaycanvas;
-	}
-	overlaycanvas = canvas.overlaycanvas;
-	ctx = overlaycanvas.getContext('2d');
-
-	if (options.exist('textlabels')) {//{{{
-		//Attatch new overlay handler to display text labels
-		var textLabels = options.getfieldvalue('textlabels',[]);
-		canvas.overlayHandlers['text'] = function(canvas) {
-			for (var i = 0; i < textLabels.length; i++) {
-				//Get text label to display
-				var textLabel = textLabels[i];
-				textLabel = {
-					position: defaultFor(textLabel.position, vec3.create()),
-					text: defaultFor(textLabel.text, ''),
-					fontSize: defaultFor(textLabel.fontSize, 18),
-					fontColor: defaultFor(textLabel.fontColor, 'black'),
-
-				};
-
-				// function declared in slr-gfm sim-front-end-controller.js
-				// if labels are behind the globe sphere then skip iteartion and do not display them
-				if (vesl.ui.isLabelVisible(textLabel)) {
-					//Transform from world space to viewport space
-					var screenPoint = vec3.transformMat4(vec3.create(), textLabel.position, canvas.camera.vpMatrix);
-					var x = (screenPoint[0] + 1.0) * (canvas.width / 2) + canvas.selector.offset().left;
-					var y = (-screenPoint[1] + 1.0) * (canvas.height / 2) + canvas.selector.offset().top;
-
-					//Draw text
-					ctx.font = 'bold ' + String(textLabel.fontSize) + 'px Arial Black, sans-serif';
-					ctx.fillStyle = textLabel.fontColor;
-					ctx.strokeStyle = 'white';
-					ctx.textAlign = 'center';
-					ctx.textBaseline = 'middle';
-					ctx.fillText(textLabel.text, x, y);
-					ctx.strokeText(textLabel.text, x, y);
-				}
-			}
-		}
-	}//}}}
-
-	//{{{ additional rendering nodes
-	if (options.exist('render')) {
-		var meshresults = processmesh(md, data, options);
-		var x = meshresults[0];
-		var y = meshresults[1];
-		var z = meshresults[2];
-		var elements = meshresults[3];
-		var is2d = meshresults[4];
-		var isplanet = meshresults[5];
-
-		var xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
-		var ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
-		var zlim = options.getfieldvalue('zlim', [ArrayMin(z), ArrayMax(z)]);
-
-		var global = vec3.length([(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2]) < 6371000/10; //tolerance for global models = center is 637100 meters away from center of earth
-		var translation = global ? [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2] : canvas.view.position;
-
-		var renderObjects = options.getfieldvalue('render',{});
-
-		for (var renderObject in renderObjects) {
-			//Modify renderObejct?
-			var object = renderObjects[renderObject];
-			object = {
-				enabled: defaultFor(object.enabled, true),					//Toggle display of the render object node
-				scale: defaultFor(object.scale, 1),							//Model matrix scaling
-				x: defaultFor(object.x, [0.0, 1.0, 0.0, 0.0, 0.0, 0.0]),	//x coordinate array
-				y: defaultFor(object.y, [0.0, 0.0, 0.0, 1.0, 0.0, 0.0]),	//y coordinate array
-				z: defaultFor(object.z, [0.0, 0.0, 0.0, 0.0, 0.0, 1.0]),	//z coordinate array
-				indices: defaultFor(object.indices, []),					//indices array
-				name: defaultFor(object.name, 'NY'),						//Text to display for cities.
-				size: defaultFor(object.size, 1),							//Physical size of the object in meters
-				color: defaultFor(object.color, 'black'),					//Diffuse color of object
-				height: defaultFor(object.height, 25000),					//Height of object along y axis, currently for clouds only
-				range: defaultFor(object.range, 120000),					//Range of sz plane to spawn object, currently for clouds only
-				quantity: defaultFor(object.quantity, 15),					//Quantity of objects to display, currently for clouds only
-				source: defaultFor(object.source, 'NY'),					//Quantity of objects to display, currently for clouds only
-				targets: defaultFor(object.targets, ['NY'])					//Quantity of objects to display, currently for clouds only
-			};
-			if (!object.enabled) { continue; }
-			if ('sky' === renderObject && !('sky' in canvas.nodes)) {
-				var mesh = GL.Mesh.icosahedron({size: 6371000 * canvas.atmosphere.scaleHeight, subdivisions: 5});
-				var texture = initTexture(gl, canvas.assetsPath + '/textures/TychoSkymapII_t4_2k.jpg');
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'sky',
-					'shaderName', 'SkyFromSpace',
-					'cullFace', gl.FRONT,
-					'mesh', mesh,
-					'texture',texture,
-					'translation',translation
-				);
-			}
-			if ('space' === renderObject && !('space' in canvas.nodes)) {
-				var mesh = GL.Mesh.sphere({size: 6371000 * 20});
-				var texture = initTexture(gl, canvas.assetsPath + '/textures/TychoSkymapII_t4_2k.jpg');
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'space',
-					'shaderName', 'Textured',
-					'cullFace', gl.FRONT,
-					'drawOrder', 2,
-					'mesh', mesh,
-					'texture',texture,
-					'translation',translation
-				);
-			}
-			if ('coastlines' === renderObject) {
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'coastlines',
-					'shaderName', 'Colored',
-					'drawMode', gl.LINE_STRIP,
-					'lineWidth', options.getfieldvalue('linewidth', 1),
-					'scale', [object.scale, object.scale, object.scale],
-					'rotation', [-90, 0, 0]
-				);
-				node.patch('Vertices', [object.x, object.y, object.z], 'FaceColor', 'none');
-			}
-			if ('graticule' === renderObject && !('graticule' in canvas.nodes)) {
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'graticule',
-					'shaderName', 'Colored',
-					'drawMode', gl.LINE_STRIP,
-					'lineWidth', options.getfieldvalue('linewidth', 1),
-					'scale', [object.scale, object.scale, object.scale],
-					'rotation', [-90, 180, 0]
-				);
-				node.patch('Vertices', [object.x, object.y, object.z], 'FaceColor', 'none');
-			}
-			if ('cities' === renderObject && !('cities' in canvas.nodes)) {
-				var mesh = GL.Mesh.icosahedron({size: object.size, subdivisions: 1});
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'cities',
-					'shaderName', 'ColoredDiffuse',
-					'diffuseColor', object.color,
-					'lineWidth', options.getfieldvalue('linewidth', 1),
-					'scale', [object.scale, object.scale, object.scale],
-					'rotation', [-90, 0, 0]
-				);
-				node.geometryShader('Mesh', mesh, 'Vertices', [object.x, object.y, object.z], 'Indices', object.indices);
-			}
-			if ('axis' === renderObject && !('axis' in canvas.nodes)) {
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'axis',
-					'shaderName', 'Colored',
-					'drawMode', gl.LINES,
-					'diffuseColor', [1.0, 0.0, 0.0, 1.0],
-					'lineWidth', options.getfieldvalue('linewidth', 1),
-					'scale', [object.scale, object.scale, object.scale],
-					'rotation', [0, 0, 0]
-				);
-				node.patch('Vertices', [object.x, object.y, object.z], 'FaceColor', 'none');
-			}
-			if ('city' === renderObject && !vesl.helpers.isEmptyOrUndefined(overlaycanvas)) {
-				//city
-				var mesh = GL.Mesh.sphere({size: object.size});
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'city',
-					'shaderName', 'ColoredDiffuse',
-					'diffuseColor', object.color,
-					'mesh', mesh,
-					'translation', [object.x, object.z, -object.y]
-				);
-				//Attatch new overlay handler to display city name
-				canvas.overlayHandlers['city'] = function(canvas) {
-					var node = canvas.nodes['city'];
-					var object = node.renderObject;
-					var screenPoint = vec3.transformMat4(vec3.create(), node.translation, canvas.camera.vpMatrix);
-					var x = (screenPoint[0] + 1.0) * (canvas.width / 2) + canvas.selector.offset().left;
-					var y = (-screenPoint[1] + 1.0) * (canvas.height / 2) + canvas.selector.offset().top;
-
-					ctx.font = 'bold ' + String(options.getfieldvalue('colorbarfontsize', 22))+'px Arial Black, sans-serif';
-					ctx.fillStyle = options.getfieldvalue('colorbarfontcolor','black');
-					ctx.strokeStyle = 'white';
-					ctx.textAlign = 'center';
-					ctx.textBaseline = 'middle';
-					ctx.fillText(object.name, x, y);
-					ctx.strokeText(object.name, x, y);
-				}
-			}
-			if ('clouds' === renderObject && !('clouds0' in canvas.nodes)) {
-				//clouds
-				var mesh = GL.Mesh.fromURL(canvas.assetsPath + '/obj/cloud.obj');
-				for (var i = 0; i < object.quantity; i++) {
-					//TODO: More options, less magic numbers. Add animation. Better shading.
-					var offset = [randomizeAxis(translation[0], object.range),
-												randomizeCloudHeight(translation[1], object),
-												randomizeAxis(translation[2], object.range)];
-					var randomSize = randomizeCloudSize(object.scale);
-					var randomColor = randomizeCloudColor();
-					node = new Node(
-						'canvas', canvas,
-						'options', options,
-						'renderObject', object,
-						'name', 'clouds' + i,
-						'shaderName', 'ColoredDiffuse',
-						'diffuseColor', [randomColor, randomColor, randomColor, 1.0],
-						'specularColor', [0.1, 0.1, 0.1, 1.0],
-						'mesh', mesh,
-						'scale', [randomSize, randomSize, randomSize],
-						'translation', offset
-					);
-				}
-			}
-			if ('citylines' === renderObject) {
-				//city
-				node = new Node(
-					'canvas', canvas,
-					'options', options,
-					'renderObject', object,
-					'name', 'citylines',
-					'shaderName', 'ColoredDiffuse',
-					'drawMode', gl.LINES,
-					'diffuseColor', object.color,
-					'lineWidth', options.getfieldvalue('linewidth', 1),
-					'scale', [object.scale, object.scale, object.scale],
-					'rotation', [0, 0, 0]
-				);
-
-				//For each target city, calculate the shortest line across the earth by performing a quaternion slerp.
-				//Treat source and target city as vectors to rotate to from the north pole.
-				//Then, slerp between the two rotations, and generate points across equidistance points on the earth to create the line.
-				var north = vec3.fromValues(0, 1, 0);
-				var source = object.source;
-				var sourceXYZ = vec3.fromValues(xcity[source], zcity[source], -ycity[source]);
-				var radius = vec3.length(sourceXYZ);
-				var lineSteps = 50;
-				var lineX = [];
-				var lineY = [];
-				var lineZ = [];
-				var lineXYZ = vec3.create();
-
-				for (var i = 0; i < object.targets.length; i++) {
-					var target = object.targets[i];
-					var targetXYZ = vec3.fromValues(xcity[target], zcity[target], -ycity[target]);
-					var axis = vec3.cross(vec3.create(), sourceXYZ, targetXYZ);
-					vec3.normalize(axis, axis);
-
-					//Get the total angle between the two cities.
-					var sourceXYZAxis = vec3.normalize(vec3.create(), sourceXYZ);
-					var targetXYZAxis = vec3.normalize(vec3.create(), targetXYZ);
-					var dotProduct = vec3.dot(sourceXYZAxis, targetXYZAxis);
-					var totalAngle = Math.acos(dotProduct); //theta = arccos(u . v / (||u|| * ||v||); in this case, ||u|| and ||v|| are 1, since u and v are unit vectors.
-
-					var lineQuat = quat.create();
-					for (var j = 1; j <= lineSteps; j++) {
-						//Calculate the partial rotation to obtain points on the line between the two cities.
-						var angle = j / lineSteps * totalAngle;
-						quat.setAxisAngle(lineQuat, axis, angle);
-						quat.normalize(lineQuat, lineQuat);
-						vec3.transformQuat(lineXYZ, sourceXYZ, lineQuat);
-						//GL.LINES needs 2 points for each line - at the beginning, just use the sourceXYZ.
-						//TODO: Eliminate this if statement.
-						if (j === 1) {
-							lineX.push(sourceXYZ[0]);
-							lineY.push(sourceXYZ[1]);
-							lineZ.push(sourceXYZ[2]);
-						} else {
-							lineX.push(lineX[lineX.length - 1]);
-							lineY.push(lineY[lineY.length - 1]);
-							lineZ.push(lineZ[lineZ.length - 1]);
-						}
-						lineX.push(lineXYZ[0]);
-						lineY.push(lineXYZ[1]);
-						lineZ.push(lineXYZ[2]);
-					}
-				}
-				node.patch('Vertices', [lineX, lineY, lineZ]);
-			}
-		}
-	} //}}}
+	//{{{ Data marker
+	// TODO: Default parameters are already being handled by /js/vesl/DataMarker.js::constructor, so perhaps we should be initializing this elsewhere and/or by some other manner	
+	if (vesl.helpers.isEmptyOrUndefined(canvas.dataMarker)) { // Only define data marker once
+		let dataMarker 			= {};
+		let dataMarkerOptions 	= options.getfieldvalue('dataMarker', {});
+		
+		dataMarker = {
+			enabled: defaultFor(dataMarkerOptions.enabled, false)
+		};
+		
+		// Only initialize data marker object if we have enabled data markers for this canvas
+		if (dataMarker.enabled) {
+			dataMarker.object = new vesl.DataMarker(
+				{
+					canvas 			: canvas,
+					hasMarker 		: defaultFor(dataMarkerOptions.hasMarker, true),
+					markerImgPath 	: defaultFor(dataMarkerOptions.markerImgPath, '/canvas/data-markers/data-marker.svg'),
+					hasTooltip		: defaultFor(dataMarkerOptions.hasTooltip, false),
+					tooltipFormat	: defaultFor(dataMarkerOptions.tooltipFormat, ''),
+					tooltipFields	: defaultFor(dataMarkerOptions.tooltipFields, null),
+					width			: defaultFor(dataMarkerOptions.width, 32),
+					height			: defaultFor(dataMarkerOptions.height, 32)
+				}
+			);
+		}
+		
+		canvas.dataMarker = dataMarker;
+	}
+	//}}}
+	//contours
+	if (options.exist('contourlevels')) {
+		plot_contour(md,data,options,canvas);
+	}
 } //}}}
-
-function randomizeCloudHeight(canvasGroundHeight, object) {
-		// -+7000 seems a reasonable range
-		var maxHeight = object.height + 7000;
-		var minHeigth = object.height - 7000;
-		var randomHeight = (Math.random() * (maxHeight - minHeigth)) + minHeigth;
-
-		return canvasGroundHeight + randomHeight;
-}
-
-// assumes that originAxisValue is the mid-value between min and max.
-function randomizeAxis(originAxisValue, range) {
-		return originAxisValue + (Math.random() - 0.5) * (range * 2);
-}
-
-function randomizeCloudSize(scale) {
-	var maxResize = 1.3;
-	var minResize = 0.5;
-	var randomizationFactor = Math.random() * (maxResize - minResize) + minResize;
-	return scale * randomizationFactor;
-}
-
-function randomizeCloudColor() {
-	var lighestColor = 1;
-	var darkestColor = 0.9;
-	var randomColor = Math.random() * (lighestColor - darkestColor) + darkestColor;
-	return randomColor;
-}
+function drawGroundingLines(md, canvas, options, renderObject, lines, colors) { //{{{
+	let renderObjects = options.getfieldvalue('render',{});
+	let state = canvas.state;
+	let scene = state.scene;
+	
+	let group = scene.getObjectByName('groundingLines');
+	if (group !== undefined) {
+		scene.remove(group); //Remove old group if already exists
+	}
+	group = new THREE.Group();
+	group.name = 'groundingLines';
+	
+	//Plot multiple grounding lines, each consisting of multiple polygons. 
+	for (let i = 0; i < lines.length; i++) {
+		let groundingLine = lines[i]; //of type Proxy (not object or array), thus must iterate without length attribute
+		let color = processColor(colors[i]);
+		let x = [];
+		let y = [];
+		let z = [];
+		//In order to show polygons correctly, must convert from line strip to line segments
+		for (let j in groundingLine) {
+			let polygon = groundingLine[j]
+			let lineStripX = polygon['x'];
+			let lineStripY = polygon['y'];
+			let lineStripZ = polygon['z'];
+			let lineSegmentsX = [lineStripX[0]];
+			let lineSegmentsY = [lineStripY[0]];
+			let lineSegmentsZ = [lineStripZ[0]];
+			//Must push same coordinates as end of previous segment and beginning of next segment
+			for (let k = 1; k < lineStripX.length - 1; k++) {
+				lineSegmentsX.push(lineStripX[k], lineStripX[k]);
+				lineSegmentsY.push(lineStripY[k], lineStripY[k]);
+				lineSegmentsZ.push(lineStripZ[k], lineStripZ[k]);
+			}
+			//Cap off last coordinate
+			lineSegmentsX.push(lineStripX[lineStripX.length - 1]);
+			lineSegmentsY.push(lineStripY[lineStripY.length - 1]);
+			lineSegmentsZ.push(lineStripZ[lineStripZ.length - 1]);
+			//Add polygon coordinates to existing groundingLine
+			x = x.concat(lineSegmentsX);
+			y = y.concat(lineSegmentsY);
+			if (renderObject.followsBed) {
+				z = z.concat(lineSegmentsZ);
+			} else {
+				z = z.concat(NewArrayFill(lineSegmentsX.length, 10 * i));
+			}
+		}
+		z = ArrayScale(z, options.getfieldvalue('heightscale', 1));
+		let vertices = [x, y, z];
+		//console.log('ArrayMin(x):', ArrayMin(x), 'ArrayMax(x):', ArrayMax(x), 'ArrayMin(y):', ArrayMin(y), 'ArrayMax(y):', ArrayMax(y));
+			
+		let node = new Node(
+			'canvas', canvas,
+			'options', options,
+			'renderObject', renderObject,
+			'name', 'groundingLine_' + String(i),
+			'shaderName', 'lines',
+			//'dashed', dashed,
+			'depthTest', false,
+			'diffuseColor', color,
+			'lineWidth', renderObject.lineWidth,
+			//'lineWidth', options.getfieldvalue('linewidth', 3),
+			'scale', [renderObject.scale, renderObject.scale, renderObject.scale]
+		);
+		node.patch('Vertices', vertices, 'group', group, 'ViewReset', false);
+	}
+	scene.add(group);
+	return group;
+} //}}}
+function drawText(state, options, textLabels) { //{{{
+	let camera = state.camera;
+	let overlayCanvas = state.overlayCanvas;
+	let ctx = overlayCanvas.getContext('2d');
+	let widthHalf = overlayCanvas.width / 2
+	let heightHalf = overlayCanvas.height / 2;
+	
+	for (let i = 0; i < textLabels.length; i++) {
+		let textLabel = textLabels[i];
+		let position = textLabel.position.clone();
+		let text = textLabel.text;
+		
+		//Project world coordinates to screenspace coordinates
+		position.project(camera);
+		let x = (position.x * widthHalf) + widthHalf;
+		let y = -(position.y * heightHalf) + heightHalf;
+		
+		ctx.font = 'bold ' + String(options.getfieldvalue('colorbarfontsize', 22))+'px Arial Black, sans-serif';
+		ctx.fillStyle = options.getfieldvalue('colorbarfontcolor','black');
+		ctx.strokeStyle = 'white';
+		ctx.textAlign = 'center';
+		ctx.textBaseline = 'middle';
+		ctx.fillText(text, x, y);
+		ctx.strokeText(text, x, y);
+	}
+} //}}}
+function processColor(color) { //{{{
+	//Update the diffuse color with an RGB color name or vec4 containing r, g, b, and opacity values from 0.0 to 1.0
+	if (typeof color === 'string') {
+		color = new THREE.Color(color);
+	} else if (Array.isArray(color)) {
+		color = new THREE.Color().fromArray(color);
+	}
+	return color;
+} //}}}
Index: issm/trunk/src/m/plot/applyoptions.m
===================================================================
--- issm/trunk/src/m/plot/applyoptions.m	(revision 25994)
+++ issm/trunk/src/m/plot/applyoptions.m	(revision 26744)
@@ -52,5 +52,5 @@
 if exist(options,'axis')
 	axisopts = getfieldvalue(options,'axis');
-	if ischar(axisopts) & contains(axisopts,' ');
+	if ischar(axisopts) & any(axisopts==' ');
 		axisopts = strsplit(axisopts);
 		axis(axisopts{:});
@@ -289,4 +289,41 @@
 		shpdisp(filenamei,1,stylei,linewidthi,getfieldvalue(options,'unit',1));
 	end
+end
+if exist(options,'contours'),
+
+	hold on;
+	contours=getfieldvalue(options,'contours');
+	style=getfieldvalue(options,'contourstyle',{'-'});
+	linewidth=getfieldvalue(options,'linewidth',{1});
+	color=getfieldvalue(options,'contourcolor',{'r'});
+	contourheight=getfieldvalue(options,'contourheight',1); 
+
+	radius=md.solidearth.planetradius;
+	ratio=1+(contourheight*1000/radius);
+
+	
+	if ~isa(contours,'cell'),
+		contours={contours};
+	end
+	nc=length(contours);
+	if ~isa(style,'cell'), error('contour style should be a cell array'); end
+	if ~isa(linewidth,'cell'), error('contour line width should be a cell array'); end
+	if ~isa(color,'cell'), error('contour color should be a cell array'); end
+
+	for i=1:length(contours),
+		ci=contours{i};
+		if length(style)==1, sti=style{1}; else sti=style{i}; end
+		if length(color)==1, coli=color{1}; else coli=color{i}; end
+		if length(linewidth)==1, li=linewidth{1}; else li=linewidth{i}; end
+
+		for j=1:length(ci),
+			cijx=ci(j).x*ratio;
+			cijy=ci(j).y*ratio;
+			cijz=ci(j).z*ratio;
+
+			plot3(cijx,cijy,cijz,'LineWidth',li,'LineStyle',sti,'Color',coli);
+		end
+	end
+
 end
 
@@ -448,10 +485,26 @@
 
 %flag edges of a partition
-if exist(options,'partitionedges') & ~strcmp(getfieldvalue(options,'partitionedges','off'),'off')
-	mdp=getfieldvalue(options,'partitionedges','off');
-	if ischar(mdp)
-		mdp=md;
-	end
-	[xsegments ysegments]=flagedges(mdp.mesh.elements,mdp.mesh.x,mdp.mesh.y,mdp.qmu.partition);
+%
+% TODO:
+% - Figure out how to expand string representing an object (e.g. 
+%	'md.qmu.variables.thickness.partition') to get the actual value *without* 
+%	using `eval` and like functions (md.('token').('token') works, but how do 
+%	we access md given the string 'md').
+if exist(options,'partition')
+	partition=getfieldvalue(options,'partition','');
+	if isvector(partition) & isnumeric(partition) % partition option is vector
+		% do nothing: we already have a partition vector
+	% elseif ischar(partition) & ~isempty(partition) % partition option is string
+	% 	% expand string
+	% 	partition=eval(partition);
+	% 	class(partition);
+	% 	if ~(isvector(partition) & isnumeric(partition))
+	% 		error('String passed to ''partition'' option does not represent a partition vector');
+	% 	end
+	else
+		error('If ''partition'' option is supplied, it should be a partition vector object');
+	end
+	mdp=md;
+	[xsegments ysegments]=flagedges(mdp.mesh.elements,mdp.mesh.x,mdp.mesh.y,partition);
 	xsegments=xsegments*getfieldvalue(options,'unit',1);
 	ysegments=ysegments*getfieldvalue(options,'unit',1);
Index: issm/trunk/src/m/plot/checkplotoptions.py
===================================================================
--- issm/trunk/src/m/plot/checkplotoptions.py	(revision 25994)
+++ issm/trunk/src/m/plot/checkplotoptions.py	(revision 26744)
@@ -3,21 +3,20 @@
 
 def checkplotoptions(md, options):
-    '''
-    CHECKPLOTOPTIONS - build a structure that holds all plot options
+    """CHECKPLOTOPTIONS - build a structure that holds all plot options
 
-        Usage:
-            options = checkplotoptions(md, options)
+    Usage:
+        options = checkplotoptions(md, options)
 
-        See also: PLOTMODEL
+    See also: PLOTMODEL
 
-        NOTE: not fully implemented yet
-    '''
+    NOTE: not fully implemented yet
+    """
 
     # {{{ units
     if options.exist('unit'):
         if 'km' in options.getfieldvalue('unit', 'km'):
-            options.changefieldvalue('unit', 10**-3)
+            options.changefieldvalue('unit', pow(10, -3))
         elif '100km' in options.getfieldvalue('unit', '100km'):
-            options.changefieldvalue('unit', 10**-5)
+            options.changefieldvalue('unit', pow(10, -5))
     # }}}
     # {{{ density
@@ -62,5 +61,5 @@
         textlist.extend([text] if isinstance(text, str) else text)
         numtext = len(textlist)
-    # text position
+        # text position
         textpos = options.getfieldvalue('textposition', [0.5, 0.5])
         if not isinstance(textpos, list):
@@ -75,5 +74,5 @@
             raise Exception('textposition should contain one list of x, y vertices for every text instance')
 
-    # font size
+        # font size
         if options.exist('textfontsize'):
             textfontsize = options.getfieldvalue('textfontsize', 12)
@@ -85,5 +84,5 @@
             sizelist = np.tile(sizelist, numtext)
 
-    # font color
+        # font color
         if options.exist('textcolor'):
             textcolor = options.getfieldvalue('textcolor', 'k')
@@ -95,5 +94,5 @@
             colorlist = np.tile(colorlist, numtext)
 
-    # textweight
+        # textweight
         if options.exist('textweight'):
             textweight = options.getfieldvalue('textweight')
@@ -105,5 +104,5 @@
             weightlist = np.tile(weightlist, numtext)
 
-    # text rotation
+        # text rotation
         if options.exist('textrotation'):
             textrotation = options.getfieldvalue('textrotation', 0)
@@ -152,5 +151,5 @@
     if options.exist('northarrow'):
         if 'on' in options.getfieldvalue('northarrow', 'on'):
-            #default values
+            # default values
             Lx = max(md.mesh.x) - min(md.mesh.x)
             Ly = max(md.mesh.y) - min(md.mesh.y)
Index: issm/trunk/src/m/plot/colormaps/cmocean.m
===================================================================
--- issm/trunk/src/m/plot/colormaps/cmocean.m	(revision 26744)
+++ issm/trunk/src/m/plot/colormaps/cmocean.m	(revision 26744)
@@ -0,0 +1,6989 @@
+function cmap = cmocean(ColormapName,varargin) 
+% cmocean returns perceptually-uniform colormaps created by Kristen Thyng. 
+% 
+%% Syntax 
+% 
+%  cmocean 
+%  cmap = cmocean('ColormapName') 
+%  cmap = cmocean('-ColormapName') 
+%  cmap = cmocean(...,NLevels)
+%  cmap = cmocean(...,'pivot',PivotValue) 
+%  cmap = cmocean(...,'negative') 
+%  cmocean(...)
+% 
+%% Description 
+% 
+% cmocean without any inputs displays the options for colormaps. 
+% 
+% cmap = cmocean('ColormapName') returns a 256x3 colormap. ColormapName can be any of 
+% of the following: 
+% 
+%          SEQUENTIAL:                DIVERGING: 
+%          'thermal'                  'balance'
+%          'haline'                   'delta'
+%          'solar'                    'curl'
+%          'ice'                      'diff'
+%          'gray'                     'tarn'
+%          'oxy' 
+%          'deep'                     CONSTANT LIGHTNESS:
+%          'dense'                    'phase'
+%          'algae'                
+%          'matter'                   OTHER:
+%          'turbid'                   'topo'
+%          'speed'                    
+%          'amp'
+%          'tempo'
+%          'rain'
+%
+% cmap = cmocean('-ColormapName') a minus sign preceeding any ColormapName flips the
+% order of the colormap. 
+%
+% cmap = cmocean(...,NLevels) specifies a number of levels in the colormap.  Default
+% value is 256. 
+%
+% cmap = cmocean(...,'pivot',PivotValue) centers a diverging colormap such that white 
+% corresponds to a given value and maximum extents are set using current caxis limits. 
+% If no PivotValue is set, 0 is assumed. Early versions of this function used 'zero'
+% as the syntax for 'pivot',0 and the old syntax is still supported. 
+%
+% cmap = cmocean(...,'negative') inverts the lightness profile of the colormap. This can be 
+% useful particularly for divergent colormaps if the default white point of divergence
+% gets lost in a white background. 
+% 
+% cmocean(...) without any outputs sets the current colormap to the current axes.  
+% 
+%% Examples 
+% Using this sample plot: 
+% 
+%   imagesc(peaks(1000)+1)
+%   colorbar
+% 
+% Set the colormap to 'algae': 
+% 
+%   cmocean('algae') 
+% 
+% Same as above, but with an inverted algae colormap: 
+% 
+%   cmocean('-algae')
+% 
+% Set the colormap to a 12-level 'solar': 
+% 
+%   cmocean('solar',12)
+% 
+% Get the RGB values of a 5-level thermal colormap: 
+% 
+%   RGB = cmocean('thermal',5)
+% 
+% Some of those values are below zero and others are above. If this dataset represents
+% anomalies, perhaps a diverging colormap is more appropriate: 
+% 
+%   cmocean('balance') 
+% 
+% It's unlikely that 1.7776 is an interesting value about which the data values 
+% diverge.  If you want to center the colormap on zero using the current color 
+% axis limits, simply include the 'pivot' option:  
+% 
+%   cmocean('balance','pivot',0) 
+%
+%% Author Info 
+% This function was written by Chad A. Greene of the Institute for Geophysics at the 
+% University of Texas at Austin (UTIG), June 2016, using colormaps created by Kristen
+% Thyng of Texas A&M University, Department of Oceanography. More information on the
+% cmocean project can be found at http://matplotlib.org/cmocean/. 
+% 
+%% Citing this colormap: 
+% If you find an occasion to cite these colormaps for any reason, or if you just want
+% some nice beach reading, check out the following paper from the journal Oceanography: 
+% 
+% Thyng, K.M., C.A. Greene, R.D. Hetland, H.M. Zimmerle, and S.F. DiMarco. 2016. True 
+% colors of oceanography: Guidelines for effective and accurate colormap selection. 
+% Oceanography 29(3):9?13, http://dx.doi.org/10.5670/oceanog.2016.66.
+% 
+% See also colormap and caxis.  
+
+%% Display colormap options: 
+
+if nargin==0
+   figure('menubar','none','numbertitle','off','Name','cmocean options:')
+   
+   if license('test','image_toolbox')
+      imshow(imread('cmocean.png')); 
+   else
+      axes('pos',[0 0 1 1])
+      image(imread('cmocean.png')); 
+      axis image off
+   end
+   
+   return
+end
+%% Error checks: 
+
+assert(isnumeric(ColormapName)==0,'Input error: ColormapName must be a string.') 
+
+%% Set defaults: 
+
+NLevels = 256; 
+autopivot = false; 
+PivotValue = 0; 
+InvertedColormap = false; 
+
+%% Parse inputs: 
+
+% Does user want to flip the colormap direction? 
+dash = regexp(ColormapName,'-'); 
+if any(dash) 
+   InvertedColormap = true; 
+   ColormapName(dash) = []; 
+end
+
+% Forgive the British: 
+if strncmpi(ColormapName,'grey',4)
+   ColormapName = 'gray'; 
+end
+
+% Does the user want a "negative" version of the colormap (with an inverted lightness profile)? 
+tmp = strncmpi(varargin,'negative',3); 
+if any(tmp) 
+   negativeColormap = true; 
+   varargin = varargin(~tmp); 
+else
+   negativeColormap = false; 
+end
+
+% Does the user want to center a diverging colormap on a specific value? 
+% This parsing support original 'zero' syntax and current 'pivot' syntax. 
+ tmp = strncmpi(varargin,'pivot',3) | strncmpi(varargin,'zero',3); % Thanks to Phelype Oleinik for this suggestion. 
+ if any(tmp) 
+   autopivot = true; 
+   try
+      if isscalar(varargin{find(tmp)+1})
+         PivotValue = varargin{find(tmp)+1}; 
+         tmp(find(tmp)+1) = 1; 
+      end
+   end
+   varargin = varargin(~tmp); 
+end
+
+% Has user requested a specific number of levels? 
+tmp = isscalar(varargin); 
+if any(tmp) 
+   NLevels = varargin{tmp}; 
+end
+
+
+%% Load RGB values and interpolate to NLevels: 
+
+cmap = cmoceanRawRGB(ColormapName); % a subfunction provided below with RGB values of all maps. 
+
+if negativeColormap
+   
+   % Convert RGB to LAB colorspace: 
+   LAB = colorspace('RGB->LAB',cmap); 
+
+   % Operate on the lightness profile: 
+   L = LAB(:,1); 
+
+   % Flip the lightness profile and set the lowest point to black:
+   L = max(L) - L; 
+
+   % Stretch the lightness profile to make the lightest bits 95% white. (Going 100% white
+   % would make the ends of a divergent profile impossible to distinguish.)
+   L = L*(95/max(L)); 
+
+   % Make a new LAB matrix: 
+   LAB = [L LAB(:,2:3)]; 
+   
+   % Convert LAB back to RGB: 
+   cmap = colorspace('LAB->RGB',LAB); 
+end
+
+%% Invert the colormap if requested by user: 
+
+if InvertedColormap
+   cmap = flipud(cmap); 
+end
+
+%% Adjust values to current caxis limits? 
+
+if autopivot
+   clim = caxis; 
+   assert(PivotValue>=clim(1) & PivotValue<=clim(2),'Error: pivot value must be within the current color axis limits.') 
+   maxval = max(abs(clim-PivotValue)); 
+   cmap = interp1(linspace(-maxval,maxval,size(cmap,1))+PivotValue, cmap, linspace(clim(1),clim(2),size(cmap,1)),'linear');
+end
+
+%% Interpolate if necessary: 
+
+if NLevels~=size(cmap,1)
+   cmap = interp1(1:size(cmap,1), cmap, linspace(1,size(cmap,1),NLevels),'linear');
+end
+
+%% Clean up 
+
+if nargout==0
+   colormap(gca,cmap) 
+   clear cmap  
+end
+
+
+
+%%  S U B F U N C T I O N S 
+
+
+function RGB = cmoceanRawRGB(cmapName) 
+
+
+switch lower(cmapName(1:3))
+   case {'dee'} 
+      RGB = [9.928371765383620096e-01 9.943734553013935384e-01 8.001361955494933342e-01
+9.849374457410008388e-01 9.913545172197536504e-01 7.953271573982337861e-01
+9.770418482420034634e-01 9.883418276673759939e-01 7.905717472557142189e-01
+9.691488355955474310e-01 9.853357520972024775e-01 7.858697059005903540e-01
+9.612382061888059548e-01 9.823439661710483550e-01 7.812181455049906909e-01
+9.533233708513803029e-01 9.793607550577946297e-01 7.766197776697654209e-01
+9.454069776374501854e-01 9.763847481120443428e-01 7.720753845210462929e-01
+9.374799177499437697e-01 9.734191074102575003e-01 7.675843461643131471e-01
+9.295353395208965086e-01 9.704660061861888343e-01 7.631467470398153319e-01
+9.215850348376466439e-01 9.675205198521025229e-01 7.587646801057830181e-01
+9.136274030668488644e-01 9.645828701859077148e-01 7.544386825530340346e-01
+9.056514559384564178e-01 9.616567079910524063e-01 7.501688017241657791e-01
+8.976569922484586295e-01 9.587415918264282633e-01 7.459562027416458685e-01
+8.896512126622908578e-01 9.558344072358454513e-01 7.418023698547455691e-01
+8.816325974742758032e-01 9.529352564923027069e-01 7.377082218108865774e-01
+8.735986658557798323e-01 9.500445573198598170e-01 7.336747582572585857e-01
+8.655355018678880796e-01 9.471666805105979359e-01 7.297031220835451526e-01
+8.574559441871676402e-01 9.442965454208677167e-01 7.257948454644865821e-01
+8.493586413080321806e-01 9.414341108550433601e-01 7.219511807036801398e-01
+8.412422934868647451e-01 9.385792958890862847e-01 7.181734629573161000e-01
+8.331056602292961077e-01 9.357319779845385543e-01 7.144631077114116380e-01
+8.249438571064254822e-01 9.328932140048489252e-01 7.108218561594963347e-01
+8.167536485550084269e-01 9.300634438432798801e-01 7.072516022427790539e-01
+8.085407925860420564e-01 9.272401607530683654e-01 7.037535913222745521e-01
+8.003043988510905038e-01 9.244230580301131539e-01 7.003294929842703853e-01
+7.920436855303579771e-01 9.216117772405966191e-01 6.969810377273069069e-01
+7.837579923068553889e-01 9.188059058340631857e-01 6.937100117646464170e-01
+7.754467945117471395e-01 9.160049747102424478e-01 6.905182510191696377e-01
+7.671097184662585278e-01 9.132084557727712104e-01 6.874076341947011892e-01
+7.587465580267132026e-01 9.104157595099175992e-01 6.843800748081978469e-01
+7.503572923166539343e-01 9.076262326497597233e-01 6.814375120698907828e-01
+7.419421046029871514e-01 9.048391559449654453e-01 6.785819005039074314e-01
+7.335014022414247936e-01 9.020537421501462205e-01 6.758151982106467281e-01
+7.250358375800118882e-01 8.992691342626382145e-01 6.731393536848668813e-01
+7.165463296678448168e-01 8.964844041051395207e-01 6.705562911206142118e-01
+7.080340865696405084e-01 8.936985513356989763e-01 6.680678941563225059e-01
+6.995006280355556827e-01 8.909105029766873907e-01 6.656759880411459163e-01
+6.909478082204841831e-01 8.881191135591984809e-01 6.633823202371271766e-01
+6.823778380886152961e-01 8.853231659823359578e-01 6.611885395113676900e-01
+6.737933070789577927e-01 8.825213731875580780e-01 6.590961736178440056e-01
+6.651972035471812594e-01 8.797123807461469935e-01 6.571066057195337207e-01
+6.565929334411800822e-01 8.768947704523611941e-01 6.552210497573525139e-01
+6.479843366143701600e-01 8.740670650055498703e-01 6.534405250319036407e-01
+6.393757001353049807e-01 8.712277338509245572e-01 6.517658303256151919e-01
+6.307693113306602761e-01 8.683757593089920235e-01 6.501986071208971651e-01
+6.221681809999368706e-01 8.655099786991408140e-01 6.487403091120448329e-01
+6.135828162115329887e-01 8.626276255310663110e-01 6.473888753222819537e-01
+6.050194699551968425e-01 8.597270135144634562e-01 6.461439080647282118e-01
+5.964848373853082197e-01 8.568064537576968176e-01 6.450046593443751197e-01
+5.879840953182007279e-01 8.538646600753627691e-01 6.439710905713145195e-01
+5.795218127572832056e-01 8.509005270271372545e-01 6.430435569229606685e-01
+5.711115213696185133e-01 8.479112775740021979e-01 6.422171169895777298e-01
+5.627614837100215484e-01 8.448953489705807174e-01 6.414893854468299850e-01
+5.544783665092802849e-01 8.418515860497588488e-01 6.408587965640016870e-01
+5.462695843545278818e-01 8.387787842708503971e-01 6.403232223573597226e-01
+5.381481232862911357e-01 8.356748924828519831e-01 6.398763669277579558e-01
+5.301228248165350543e-01 8.325387580839158641e-01 6.395142187190840932e-01
+5.221997330825246530e-01 8.293697946738645133e-01 6.392346216632595057e-01
+5.143908532894702068e-01 8.261665755050031645e-01 6.390304309659169402e-01
+5.067050118087177424e-01 8.229283397233977393e-01 6.388963162980869637e-01
+4.991495064662723746e-01 8.196546689563362076e-01 6.388277739100475250e-01
+4.917330703220189059e-01 8.163450533427777378e-01 6.388184799685107107e-01
+4.844633050708381794e-01 8.129992646664957467e-01 6.388624455765857801e-01
+4.773469739538908629e-01 8.096172922533247940e-01 6.389538165444101914e-01
+4.703904182695624603e-01 8.061992786917829834e-01 6.390864379965265352e-01
+4.635986539031755060e-01 8.027456073395251579e-01 6.392548734619343254e-01
+4.569766618393767410e-01 7.992567478306369377e-01 6.394529319719780558e-01
+4.505287643111087204e-01 7.957333261733031682e-01 6.396742566585853496e-01
+4.442569334258392177e-01 7.921762343010834151e-01 6.399148201157260907e-01
+4.381634653667463852e-01 7.885863788123392837e-01 6.401694292235835526e-01
+4.322513883314121341e-01 7.849647158245569578e-01 6.404304190942151642e-01
+4.265195639210723755e-01 7.813124732411278472e-01 6.406960731925235297e-01
+4.209679602144861810e-01 7.776308288475485275e-01 6.409622276506293792e-01
+4.155968407812616339e-01 7.739210344346504344e-01 6.412227317683711902e-01
+4.104045242070183952e-01 7.701844253858858291e-01 6.414742347181462412e-01
+4.053883482522956383e-01 7.664223146281371468e-01 6.417151578859574546e-01
+4.005459328058830759e-01 7.626360316845265386e-01 6.419424749255564500e-01
+3.958750262046074608e-01 7.588270315806920907e-01 6.421508285001665817e-01
+3.913718273240804346e-01 7.549966666219802836e-01 6.423387337484185444e-01
+3.870322615152646528e-01 7.511462095764531721e-01 6.425055472082883412e-01
+3.828523536620307977e-01 7.472769743775978801e-01 6.426493131526664904e-01
+3.788278449989629926e-01 7.433902546660990929e-01 6.427683061328856029e-01
+3.749542811367644335e-01 7.394876286687900313e-01 6.428573615340694714e-01
+3.712266123106295335e-01 7.355700686179795778e-01 6.429189618774799886e-01
+3.676399929257251897e-01 7.316387718079003788e-01 6.429520487195032885e-01
+3.641894512092864744e-01 7.276949011320993366e-01 6.429557270674552960e-01
+3.608699207518579755e-01 7.237395816489646805e-01 6.429292709767442382e-01
+3.576762479926827720e-01 7.197739138067411613e-01 6.428719883285997083e-01
+3.546027248366774298e-01 7.157992458648064771e-01 6.427810759039616073e-01
+3.516446005650431528e-01 7.118162697085735902e-01 6.426589560156208414e-01
+3.487967412412643076e-01 7.078259414050183107e-01 6.425054728664090220e-01
+3.460540467004642462e-01 7.038291754672099110e-01 6.423205839967465192e-01
+3.434114694865876838e-01 6.998268449671132263e-01 6.421043512357870187e-01
+3.408640318201912600e-01 6.958197818437616977e-01 6.418569321473704958e-01
+3.384068406811324148e-01 6.918087773726725453e-01 6.415785719753461791e-01
+3.360351011011302735e-01 6.877945827659479594e-01 6.412695960850323118e-01
+3.337441277691141628e-01 6.837779098758932639e-01 6.409304028912300444e-01
+3.315291322901112725e-01 6.797595093162658308e-01 6.405610222271946874e-01
+3.293855731203558790e-01 6.757400463409192204e-01 6.401618521317685717e-01
+3.273095072934468774e-01 6.717199943156246800e-01 6.397341828681051279e-01
+3.252967835603527980e-01 6.676999151191671533e-01 6.392786349130804568e-01
+3.233433949344308722e-01 6.636803359579184214e-01 6.387958727683986648e-01
+3.214454825944703664e-01 6.596617502568347113e-01 6.382866005148117861e-01
+3.195993388733257556e-01 6.556446185422359907e-01 6.377515576836865208e-01
+3.178014094235615539e-01 6.516293693095515094e-01 6.371915154212616228e-01
+3.160482946464280851e-01 6.476163998706647718e-01 6.366072729215248582e-01
+3.143367504654775990e-01 6.436060771766987099e-01 6.359996541044424800e-01
+3.126636885203824545e-01 6.395987386132337971e-01 6.353695045172913503e-01
+3.110261758511674857e-01 6.355946927658273626e-01 6.347176884379418516e-01
+3.094214341373541788e-01 6.315942201545601264e-01 6.340450861601970578e-01
+3.078468385510386152e-01 6.275975739369872297e-01 6.333525914425652825e-01
+3.062999162775806861e-01 6.236049805794583456e-01 6.326411091031564071e-01
+3.047783447524610168e-01 6.196166404972232034e-01 6.319115527447410896e-01
+3.032799496578738041e-01 6.156327286641396501e-01 6.311648425953061414e-01
+3.018027027180503197e-01 6.116533951930802626e-01 6.304019034507418739e-01
+3.003447193279823457e-01 6.076787658883653354e-01 6.296236627075371128e-01
+2.989042560461285802e-01 6.037089427717098333e-01 6.288310484745529561e-01
+2.974797079780254205e-01 5.997440045832753697e-01 6.280249877540684533e-01
+2.960696060742640245e-01 5.957840072594756675e-01 6.272064046833601969e-01
+2.946726143633343065e-01 5.918289843891730850e-01 6.263762188290394883e-01
+2.932875271368584058e-01 5.878789476499071132e-01 6.255353435272825724e-01
+2.919132661023912667e-01 5.839338872257091584e-01 6.246846842638799080e-01
+2.905488775167375803e-01 5.799937722079637759e-01 6.238251370887518688e-01
+2.891935293105973304e-01 5.760585509806988025e-01 6.229575870601862242e-01
+2.878465082138687570e-01 5.721281515915097593e-01 6.220829067145717817e-01
+2.865071747347951447e-01 5.682024945496734203e-01 6.212019079466474247e-01
+2.851749861947763254e-01 5.642814857106783766e-01 6.203153697409601319e-01
+2.838497050469647731e-01 5.603649539888247988e-01 6.194242689076802089e-01
+2.825310677598035780e-01 5.564527485481920444e-01 6.185294158631611250e-01
+2.812189151446758406e-01 5.525446999518639490e-01 6.176316008625786225e-01
+2.799131896111074491e-01 5.486406204645675189e-01 6.167315925457064196e-01
+2.786139324558262742e-01 5.447403043452749838e-01 6.158301364812402978e-01
+2.773212811865227168e-01 5.408435281299215358e-01 6.149279537054621603e-01
+2.760354668808263079e-01 5.369500509042623992e-01 6.140257392505246159e-01
+2.747568115804877587e-01 5.330596145668072827e-01 6.131241606570347891e-01
+2.734857257205313141e-01 5.291719440816851083e-01 6.122238564648385672e-01
+2.722227055926091377e-01 5.252867477212617153e-01 6.113254346750160995e-01
+2.709683308416185876e-01 5.214037172983150281e-01 6.104294711750373192e-01
+2.697232619941725140e-01 5.175225283875982685e-01 6.095365081178055755e-01
+2.684882380171457750e-01 5.136428405367017280e-01 6.086470522439324515e-01
+2.672640739041831637e-01 5.097642974662250914e-01 6.077615731349965689e-01
+2.660516582874621339e-01 5.058865272594796902e-01 6.068805013837572648e-01
+2.648519510715739433e-01 5.020091425421505660e-01 6.060042266652778675e-01
+2.636659810857353015e-01 4.981317406526836744e-01 6.051330956906521008e-01
+2.624948437498288434e-01 4.942539038045714039e-01 6.042674100224807443e-01
+2.613396987489819967e-01 4.903751992421883643e-01 6.034074237284018372e-01
+2.602017811880152354e-01 4.864951750164123179e-01 6.025533553474511361e-01
+2.590825816132030779e-01 4.826133005480903182e-01 6.017055804809932074e-01
+2.579832374637801018e-01 4.787291639776031782e-01 6.008639770499764055e-01
+2.569051367797046126e-01 4.748422758923547815e-01 6.000285749995881712e-01
+2.558497193309375306e-01 4.709521329962904068e-01 5.991993407256713811e-01
+2.548184740794410263e-01 4.670582183399953347e-01 5.983761730113198452e-01
+2.538129365659009817e-01 4.631600015854966945e-01 5.975588985257048735e-01
+2.528346862021874641e-01 4.592569393176054171e-01 5.967472668238706923e-01
+2.518853434473967146e-01 4.553484754161292725e-01 5.959409447786497838e-01
+2.509665668417216944e-01 4.514340415062205181e-01 5.951395103673859932e-01
+2.500800498681828299e-01 4.475130575075850214e-01 5.943424457267542094e-01
+2.492275176071283571e-01 4.435849323073600692e-01 5.935491293785424283e-01
+2.484107231427581941e-01 4.396490645862106139e-01 5.927588275177814170e-01
+2.476314436738927260e-01 4.357048438328084417e-01 5.919706842419948378e-01
+2.468914762732849488e-01 4.317516515883728090e-01 5.911837105866416531e-01
+2.461926332303804310e-01 4.277888629705645096e-01 5.903967722170088139e-01
+2.455367369014649914e-01 4.238158485348740845e-01 5.896085756110598375e-01
+2.449256139784778408e-01 4.198319765418777605e-01 5.888176525512366366e-01
+2.443611399380560822e-01 4.158365980702596332e-01 5.880223891276964432e-01
+2.438461792188084676e-01 4.118287207942545325e-01 5.872218507211212080e-01
+2.433817108226277726e-01 4.078080077755985022e-01 5.864131553289283483e-01
+2.429695407602900925e-01 4.037738393736669540e-01 5.855939512690606641e-01
+2.426114394907277760e-01 3.997256137994158465e-01 5.847615988448080504e-01
+2.423091294682429564e-01 3.956627542073260506e-01 5.839131390484204598e-01
+2.420642707838099872e-01 3.915847171721096864e-01 5.830452587571144374e-01
+2.418784445905285962e-01 3.874910027793410650e-01 5.821542521747482546e-01
+2.417531339648231747e-01 3.833811665857123074e-01 5.812359783131098023e-01
+2.416897018162703636e-01 3.792548337300427064e-01 5.802858143751018494e-01
+2.416907565718227624e-01 3.751112253980636857e-01 5.792995847596160708e-01
+2.417595622535183009e-01 3.709493751547713325e-01 5.782729391945388153e-01
+2.418940089237943680e-01 3.667702659833258494e-01 5.771972660307567171e-01
+2.420946965383475313e-01 3.625739944720036134e-01 5.760653956197256953e-01
+2.423619198524908369e-01 3.583608468185064400e-01 5.748693688323588402e-01
+2.426978313653707087e-01 3.541305556383861908e-01 5.736016010478480753e-01
+2.431056167697961956e-01 3.498826161637011989e-01 5.722540340252517677e-01
+2.435790408918375727e-01 3.456199709880173332e-01 5.708127541670769967e-01
+2.441164681518231960e-01 3.413441041408621368e-01 5.692658625959313712e-01
+2.447220255685461088e-01 3.370546900675063240e-01 5.676029832475817383e-01
+2.453897790312707938e-01 3.327551263503047418e-01 5.658082210414479007e-01
+2.461121481740833894e-01 3.284495884603169102e-01 5.638648470620498676e-01
+2.468912126448456479e-01 3.241391993124722593e-01 5.617586120246663706e-01
+2.477157002362878613e-01 3.198299095156284522e-01 5.594704462476630669e-01
+2.485761162021524751e-01 3.155272777788998839e-01 5.569822129976372826e-01
+2.494682375867288693e-01 3.112353605277175528e-01 5.542766318947622839e-01
+2.503729202057394798e-01 3.069632816204772574e-01 5.513352372309007210e-01
+2.512817651002536290e-01 3.027167370222472731e-01 5.481422664464320471e-01
+2.521753740527091225e-01 2.985048904754492582e-01 5.446839245346258851e-01
+2.530378388279626023e-01 2.943355684042912035e-01 5.409499814033098541e-01
+2.538514672799476179e-01 2.902167617845944347e-01 5.369345375383627328e-01
+2.545978636988186494e-01 2.861560770732184955e-01 5.326370186681820273e-01
+2.552597334794323158e-01 2.821600341185547811e-01 5.280624026249696179e-01
+2.558254018044066047e-01 2.782328077909240194e-01 5.232189983935346955e-01
+2.562737222001675308e-01 2.743799915974786674e-01 5.181261586082565040e-01
+2.566051651711689918e-01 2.706008890121900934e-01 5.127963599343589030e-01
+2.568071232679735028e-01 2.668971447705413280e-01 5.072541841677337127e-01
+2.568729082739400482e-01 2.632680806498599591e-01 5.015251413221865073e-01
+2.568088786232387566e-01 2.597098435540172168e-01 4.956253550777797723e-01
+2.566151212870083631e-01 2.562195453869526296e-01 4.895770754997314511e-01
+2.562879598478859378e-01 2.527944349049762174e-01 4.834087259028412853e-01
+2.558322794870629413e-01 2.494300496133808887e-01 4.771399728195321877e-01
+2.552572079534596305e-01 2.461214417402471932e-01 4.707834286138410929e-01
+2.545675711557803811e-01 2.428643843006248471e-01 4.643557571030281772e-01
+2.537686502971923108e-01 2.396546885092911139e-01 4.578718126285494239e-01
+2.528659964243425984e-01 2.364882912834416206e-01 4.513446141213755536e-01
+2.518652755598765891e-01 2.333613180085921113e-01 4.447853910070804773e-01
+2.507721436866522935e-01 2.302701237479483076e-01 4.382036814126420432e-01
+2.495921493408267966e-01 2.272113165747541852e-01 4.316074651476269897e-01
+2.483306606950595463e-01 2.241817667402334346e-01 4.250033167249620547e-01
+2.469928136315570621e-01 2.211786051187170643e-01 4.183965667275956202e-01
+2.455817950644241798e-01 2.181991605590304917e-01 4.117955160707330586e-01
+2.440963016438912891e-01 2.152407079180826410e-01 4.052187485307188752e-01
+2.425474613143962510e-01 2.123011804696942062e-01 3.986531809377649171e-01
+2.409394174709658110e-01 2.093786088479052676e-01 3.921004515047561423e-01
+2.392760085101002243e-01 2.064712127546999287e-01 3.855616338648150121e-01
+2.375559510487991743e-01 2.035768990151702318e-01 3.790513023869773179e-01
+2.357791582066215419e-01 2.006936504843463420e-01 3.725810406048237766e-01
+2.339566833930070699e-01 1.978208439176197264e-01 3.661282774694271658e-01
+2.320913707908846546e-01 1.949572807641995476e-01 3.596924727656225507e-01
+2.301734316844865069e-01 1.921000566693645550e-01 3.533131710447778295e-01
+2.282155151615900546e-01 1.892493734782149939e-01 3.469585312854190362e-01
+2.262221013532286218e-01 1.864046213456004575e-01 3.406203233993785884e-01
+2.241821302892643142e-01 1.835626593748518609e-01 3.343431537784405938e-01
+2.221083620693462546e-01 1.807243380946543521e-01 3.280900612914751102e-01
+2.200027865362182422e-01 1.778889096627078448e-01 3.218593457818205161e-01
+2.178554139765243036e-01 1.750533261852178779e-01 3.156932341101472139e-01
+2.156819223383368844e-01 1.722195412332822306e-01 3.095395593647118360e-01
+2.134730781003147948e-01 1.693846918206770857e-01 3.034377234324792671e-01
+2.112350828916275125e-01 1.665490510713014960e-01 2.973690772834624574e-01
+2.089702734855372057e-01 1.637121940546225618e-01 2.913286801723345421e-01
+2.066728560428846562e-01 1.608719311731062473e-01 2.853437530392856081e-01
+2.043551063834350701e-01 1.580301135357929931e-01 2.793689192405632293e-01
+2.020028382233076125e-01 1.551826890051333785e-01 2.734655011163185101e-01
+1.996333580091984583e-01 1.523327614839000976e-01 2.675659276139747411e-01
+1.972319620276792862e-01 1.494761585027865047e-01 2.617344119314569673e-01
+1.948137533226730334e-01 1.466155558553730864e-01 2.559107021731873988e-01
+1.923665760685599468e-01 1.437473901381048913e-01 2.501489823140411461e-01
+1.899031789417767457e-01 1.408738040042367690e-01 2.443975812138057813e-01
+1.874125186315797886e-01 1.379915476831030108e-01 2.387062880680187460e-01
+1.849071752981109873e-01 1.351026683367795023e-01 2.330231779340583564e-01
+1.823751828761793481e-01 1.322038111876145949e-01 2.274020989868827392e-01
+1.798308834661569988e-01 1.292972741720705698e-01 2.217828373102059270e-01
+1.772595702951434704e-01 1.263792859047284667e-01 2.162309361702130506e-01
+1.746769766714075522e-01 1.234522307754042925e-01 2.106797904214151584e-01
+1.720703275074147443e-01 1.205129174047056828e-01 2.051860710532931176e-01
+1.694509066570421274e-01 1.175626362090423926e-01 1.997023294326863430e-01
+1.668117590877864764e-01 1.145994139402238821e-01 1.942594655847655616e-01
+1.641571774416621943e-01 1.116231764992316466e-01 1.888399155026514453e-01
+1.614878059346168959e-01 1.086331782717616379e-01 1.834416540200605461e-01
+1.587995102818766935e-01 1.056281331759973130e-01 1.780821476813713722e-01
+1.561019746507273376e-01 1.026082525875711138e-01 1.727215696232307918e-01]; 
+
+   case 'mat' 
+      RGB = [9.942936149611202312e-01 9.303277953232079733e-01 6.910969022498407721e-01
+9.938034737629607429e-01 9.248067799917484288e-01 6.856470896792071779e-01
+9.932915386396504731e-01 9.192993747690529904e-01 6.802308895677181555e-01
+9.927922245331627371e-01 9.137917294903226129e-01 6.748329403835298113e-01
+9.922937701498860674e-01 9.082882194233706796e-01 6.694590190525575579e-01
+9.917843550306121303e-01 9.027933977435592672e-01 6.641148019075449049e-01
+9.912962746539998315e-01 8.972938428980343772e-01 6.587860434151366906e-01
+9.907825925330567829e-01 8.918085346471608110e-01 6.534941055176841651e-01
+9.902949549053171596e-01 8.863158938146130650e-01 6.482161486636766057e-01
+9.897868190815676259e-01 8.808350065840212517e-01 6.429731121246738956e-01
+9.892857473867685547e-01 8.753541152485579957e-01 6.377529594546893499e-01
+9.887800796370288525e-01 8.698778821960219121e-01 6.325610007226144527e-01
+9.882646997282734658e-01 8.644083076900085372e-01 6.273995656371403884e-01
+9.877584964502673648e-01 8.589369989413550011e-01 6.222606017222616082e-01
+9.872280289134517384e-01 8.534782966339129473e-01 6.171585665698279266e-01
+9.867183884350317902e-01 8.480122040334344691e-01 6.120742768604477968e-01
+9.861766767190066618e-01 8.425618846460892764e-01 6.070302342911766402e-01
+9.856563017997251874e-01 8.371033300354000506e-01 6.020039838864913451e-01
+9.851070454224936102e-01 8.316588814371468352e-01 5.970165676525449605e-01
+9.845690242211674326e-01 8.262101763023093071e-01 5.920513492549713819e-01
+9.840096682146298734e-01 8.207718909127237339e-01 5.871217557569952117e-01
+9.834535848293927129e-01 8.153324961500217904e-01 5.822177451775890633e-01
+9.828817074848651414e-01 8.099006555998068402e-01 5.773470477348076058e-01
+9.823072425148250408e-01 8.044699893992296458e-01 5.725043678439867278e-01
+9.817205500240108185e-01 7.990448613324698801e-01 5.676935526547516320e-01
+9.811274651130897917e-01 7.936222997819741831e-01 5.629123141708799460e-01
+9.805237822250761903e-01 7.882041368744077126e-01 5.581623151179201381e-01
+9.799119019116716567e-01 7.827890166019746410e-01 5.534426550185235216e-01
+9.792891597791347769e-01 7.773780574795166043e-01 5.487543863553446810e-01
+9.786583517021393286e-01 7.719696800001862869e-01 5.440965033742034551e-01
+9.780145739702225116e-01 7.665661517278330450e-01 5.394708896034823287e-01
+9.773647283145959763e-01 7.611637891820339785e-01 5.348750765091280224e-01
+9.766980163585675667e-01 7.557679109997390565e-01 5.303130790083464552e-01
+9.760290252537030531e-01 7.503708130006796484e-01 5.257797515465254534e-01
+9.753375433133614214e-01 7.449828010040938642e-01 5.212823917018596376e-01
+9.746492807368433153e-01 7.395902023503717615e-01 5.168121142252199984e-01
+9.739312415395592337e-01 7.342102748450782812e-01 5.123804929986149892e-01
+9.732235441351503313e-01 7.288214038955377339e-01 5.079740009039053206e-01
+9.724836441494412176e-01 7.234462681298939879e-01 5.036071894033782304e-01
+9.717498445504565430e-01 7.180638747370174935e-01 4.992675340324776445e-01
+9.709912116410467364e-01 7.126909352035095679e-01 4.949654270232705655e-01
+9.702261620325377534e-01 7.073170976907954266e-01 4.906951514278061199e-01
+9.694484453171449134e-01 7.019455954348422511e-01 4.864590138179895606e-01
+9.686504017535663147e-01 6.965805969226914751e-01 4.822596297437949375e-01
+9.678531538881393059e-01 6.912098001765796251e-01 4.780909555078191597e-01
+9.670272977476158660e-01 6.858499112812684873e-01 4.739621016861336744e-01
+9.662030356838596790e-01 6.804831678592252464e-01 4.698646253054341027e-01
+9.653577621840926382e-01 6.751225363106635458e-01 4.658054627874114728e-01
+9.644956606754987449e-01 6.697653999656224544e-01 4.617837747090557943e-01
+9.636302007256901669e-01 6.644033993552483919e-01 4.577964421810854501e-01
+9.627382975013459854e-01 6.590502602174439506e-01 4.538500459526182973e-01
+9.618419029037778012e-01 6.536923650498338567e-01 4.499394348167297664e-01
+9.609293304705296412e-01 6.483365953124501369e-01 4.460681718992942080e-01
+9.599915754015638791e-01 6.429884241455728899e-01 4.422388634417756537e-01
+9.590555927894280908e-01 6.376305748866927248e-01 4.384459238793448344e-01
+9.580962561892508722e-01 6.322786777663680358e-01 4.346957499886874854e-01
+9.571138853949342495e-01 6.269324224641481536e-01 4.309887354294504314e-01
+9.561315297025726467e-01 6.215764963092997863e-01 4.273209635732272416e-01
+9.551250405128054455e-01 6.162263913356859080e-01 4.236980325915365997e-01
+9.540950546856811210e-01 6.108815734129118269e-01 4.201203681538954182e-01
+9.530626716897264705e-01 6.055275479248746207e-01 4.165851980241140895e-01
+9.520078397406573911e-01 6.001775213709300560e-01 4.130968208871531600e-01
+9.509298744158470873e-01 5.948318045431840728e-01 4.096560342134981103e-01
+9.498400194890849191e-01 5.894823244090308112e-01 4.062621760942275451e-01
+9.487347976692349638e-01 5.841311256224190895e-01 4.029168199567615405e-01
+9.476064491016543689e-01 5.787834319880815759e-01 3.996218296412110127e-01
+9.464553073333200617e-01 5.734388133376047136e-01 3.963780340202668340e-01
+9.452939757532162757e-01 5.680877777926379713e-01 3.931855149232086899e-01
+9.441119180634874875e-01 5.627376402983688131e-01 3.900463532360756713e-01
+9.429065439155045469e-01 5.573900694724827076e-01 3.869617715840133476e-01
+9.416779791961638058e-01 5.520447400757862999e-01 3.839328326459904850e-01
+9.404312902807343555e-01 5.466974929733746658e-01 3.809606687756254551e-01
+9.391670109637508812e-01 5.413475099598963336e-01 3.780467610439202097e-01
+9.378784499903906058e-01 5.359996531278976573e-01 3.751924384200013285e-01
+9.365655059652620018e-01 5.306537435419416138e-01 3.723989770682498146e-01
+9.352280123612883855e-01 5.253096443760549850e-01 3.696677100588824927e-01
+9.338657357609021492e-01 5.199672647340076725e-01 3.670000247302842578e-01
+9.324834513518638346e-01 5.146223341056469502e-01 3.643980039003675286e-01
+9.310764112648535207e-01 5.092783920261573227e-01 3.618628439391275986e-01
+9.296425700359164379e-01 5.039368520229430271e-01 3.593958605013685692e-01
+9.281814529069224440e-01 4.985978383651590851e-01 3.569985751712403399e-01
+9.266925163734759385e-01 4.932615377693159719e-01 3.546725399001493528e-01
+9.251751483021848355e-01 4.879282029910456120e-01 3.524193303048753223e-01
+9.236286685007274455e-01 4.825981562592266960e-01 3.502405381564949738e-01
+9.220523297832619036e-01 4.772717924986036864e-01 3.481377630517493160e-01
+9.204453195710341484e-01 4.719495822836188847e-01 3.461126032707011468e-01
+9.188067620643404210e-01 4.666320744633321582e-01 3.441666458384411431e-01
+9.171357210169962526e-01 4.613198983953663013e-01 3.423014558239780292e-01
+9.154312031382285664e-01 4.560137657258883093e-01 3.405185649261683878e-01
+9.136921621394280546e-01 4.507144716528461159e-01 3.388194594142976412e-01
+9.119175034344646491e-01 4.454228956112940563e-01 3.372055675093833527e-01
+9.101060894923883593e-01 4.401400013227078634e-01 3.356782463109665438e-01
+9.082567458304244834e-01 4.348668361548626016e-01 3.342387683926176800e-01
+9.063682676234201541e-01 4.296045297451883127e-01 3.328883082070119848e-01
+9.044394268935215253e-01 4.243542918485532223e-01 3.316279284576256203e-01
+9.024689802311073317e-01 4.191174093801583456e-01 3.304585666082093254e-01
+9.004556769853120368e-01 4.138952426354805536e-01 3.293810217125931472e-01
+8.983982678499889962e-01 4.086892206819806583e-01 3.283959417554291327e-01
+8.962955137593517918e-01 4.035008359311561543e-01 3.275038116986458414e-01
+8.941481104554649395e-01 3.983293983456084875e-01 3.267070561329722400e-01
+8.919536525149722728e-01 3.931778253066712803e-01 3.260048269152195366e-01
+8.897101199351982181e-01 3.880487567649602565e-01 3.253961697320843505e-01
+8.874163795567694413e-01 3.829439054205242554e-01 3.248807846244438635e-01
+8.850713585473568568e-01 3.778650063033766049e-01 3.244581619630766411e-01
+8.826755435924777959e-01 3.728118797277990004e-01 3.241299144458608672e-01
+8.802274289557096010e-01 3.677869127615048805e-01 3.238946418203613176e-01
+8.777249655021830410e-01 3.627933891756242590e-01 3.237493930733041925e-01
+8.751673985732256744e-01 3.578330531078428023e-01 3.236927558288430484e-01
+8.725555139394461923e-01 3.529055754992642124e-01 3.237261048951861064e-01
+8.698877548666956727e-01 3.480139364384642886e-01 3.238460395212981457e-01
+8.671629330678980452e-01 3.431608117920707524e-01 3.240490255671465425e-01
+8.643813155550574834e-01 3.383468700732272794e-01 3.243343280815126350e-01
+8.615430100192384977e-01 3.335730372253879472e-01 3.247007528957156497e-01
+8.586467469801843944e-01 3.288425164717434512e-01 3.251427866013465451e-01
+8.556930023091509074e-01 3.241559097884965657e-01 3.256590726700412941e-01
+8.526821206317460877e-01 3.195140519652634459e-01 3.262477399527137223e-01
+8.496135249080434271e-01 3.149194771604064691e-01 3.269031319055852869e-01
+8.464880691147448344e-01 3.103723490573296884e-01 3.276240607685041994e-01
+8.433059903582461603e-01 3.058739837233550030e-01 3.284066774658670473e-01
+8.400675201697129779e-01 3.014258630212182100e-01 3.292462412802209526e-01
+8.367737994501905918e-01 2.970277335155548926e-01 3.301419279880662416e-01
+8.334250817653976462e-01 2.926812202808505847e-01 3.310879308798391207e-01
+8.300223167271181257e-01 2.883865925403408248e-01 3.320815261966803544e-01
+8.265664528479066409e-01 2.841441353717970020e-01 3.331197789552536870e-01
+8.230582869411739999e-01 2.799545862699168719e-01 3.341980671944378423e-01
+8.194989991910379690e-01 2.758177426460852733e-01 3.353144156579274116e-01
+8.158895345625488682e-01 2.717340841090945536e-01 3.364643892127716640e-01
+8.122310472907531276e-01 2.677035350490168386e-01 3.376451421817873721e-01
+8.085246874446361254e-01 2.637260312682816465e-01 3.388536188130562565e-01
+8.047716060121338222e-01 2.598015433395364782e-01 3.400863817867416095e-01
+8.009730135703670983e-01 2.559297758719957794e-01 3.413409259751189473e-01
+7.971300939112275774e-01 2.521105612652171368e-01 3.426140174094376434e-01
+7.932440533013958017e-01 2.483435687707094552e-01 3.439030220163640239e-01
+7.893160890135294538e-01 2.446284526280468330e-01 3.452052771464595993e-01
+7.853473877765537736e-01 2.409648192333603833e-01 3.465182972816244766e-01
+7.813391260814397388e-01 2.373522835108513029e-01 3.478394483472491694e-01
+7.772924488739767490e-01 2.337903640474600642e-01 3.491667244042649942e-01
+7.732084983091196406e-01 2.302786572731657100e-01 3.504975234338518764e-01
+7.690883651827444822e-01 2.268166676306541119e-01 3.518300145036632465e-01
+7.649331213342656088e-01 2.234039396519906795e-01 3.531621316810459876e-01
+7.607438261029081383e-01 2.200400345294166726e-01 3.544916653625779235e-01
+7.565214435019435024e-01 2.167244640001846911e-01 3.558173116773682421e-01
+7.522670051172567485e-01 2.134568325306841485e-01 3.571365659018996275e-01
+7.479813874637180060e-01 2.102366867865238520e-01 3.584483801868486030e-01
+7.436655059621508634e-01 2.070636399021255625e-01 3.597509060488300325e-01
+7.393202434785964838e-01 2.039373173302497233e-01 3.610423849932817841e-01
+7.349463482724380992e-01 2.008573725915569486e-01 3.623219106278985358e-01
+7.305447136853985279e-01 1.978234802458921360e-01 3.635871804824805653e-01
+7.261159828724578214e-01 1.948353685346151387e-01 3.648375781480875379e-01
+7.216608959662019762e-01 1.918927853792166127e-01 3.660715129191122186e-01
+7.171801670483409774e-01 1.889955002148961394e-01 3.672874263418225982e-01
+7.126743300531552805e-01 1.861433788319636073e-01 3.684846837309949108e-01
+7.081441223914051175e-01 1.833362215388179839e-01 3.696612595209343710e-01
+7.035900061356136215e-01 1.805739799909275023e-01 3.708165722616917348e-01
+6.990125222046897902e-01 1.778565964180273684e-01 3.719494030784631367e-01
+6.944122804123707970e-01 1.751839824866724127e-01 3.730580800830735622e-01
+6.897896069146784992e-01 1.725562544195547443e-01 3.741422132560422997e-01
+6.851450759297335047e-01 1.699733803139570343e-01 3.752000809033200213e-01
+6.804790620490438480e-01 1.674354838987148208e-01 3.762308077572429355e-01
+6.757918752796293616e-01 1.649427652357627616e-01 3.772336599439788940e-01
+6.710841190288990843e-01 1.624951923227635209e-01 3.782065903997158807e-01
+6.663559221262009835e-01 1.600931455660249692e-01 3.791494395940231965e-01
+6.616076837858697601e-01 1.577367904785384745e-01 3.800608417430486607e-01
+6.568398281175149567e-01 1.554262673949660112e-01 3.809393122355112515e-01
+6.520524648278914759e-01 1.531620260338200923e-01 3.817844598609113071e-01
+6.472460502131879290e-01 1.509441834093387669e-01 3.825945806932325444e-01
+6.424208086222070735e-01 1.487730846896873349e-01 3.833687631504908433e-01
+6.375768667154826375e-01 1.466491860640934397e-01 3.841063458261376740e-01
+6.327147719614083510e-01 1.445724818775720732e-01 3.848052877974663111e-01
+6.278345360543612363e-01 1.425435417995506715e-01 3.854652342077181104e-01
+6.229363449371848604e-01 1.405627442689544315e-01 3.860852182514847852e-01
+6.180208267587814497e-01 1.386299275595349323e-01 3.866630046493146899e-01
+6.130878172636732293e-01 1.367458410848005068e-01 3.871986373954375282e-01
+6.081376300127646628e-01 1.349106539902725221e-01 3.876907660008953038e-01
+6.031708343692542273e-01 1.331241752511138077e-01 3.881374204452801013e-01
+5.981872594198538451e-01 1.313871076769131119e-01 3.885385758335542783e-01
+5.931872993271581906e-01 1.296994119208923768e-01 3.888927420384044042e-01
+5.881715194167826954e-01 1.280607661499650052e-01 3.891980996789912162e-01
+5.831397292746328676e-01 1.264718001616958465e-01 3.894546477166113685e-01
+5.780923809284296278e-01 1.249322477491876249e-01 3.896608882675748342e-01
+5.730301484941315859e-01 1.234414650841386962e-01 3.898149438393606059e-01
+5.679527785339369972e-01 1.220000281824430710e-01 3.899169825800337663e-01
+5.628606992123619257e-01 1.206075179177948653e-01 3.899657247446918218e-01
+5.577549128735556083e-01 1.192626131188577743e-01 3.899588733885684388e-01
+5.526350045348186191e-01 1.179659461688005728e-01 3.898969895870120772e-01
+5.475013145908723677e-01 1.167170132781017999e-01 3.897791516609607765e-01
+5.423552229242829537e-01 1.155136939391362971e-01 3.896026927627281311e-01
+5.371963110518728213e-01 1.143564329775472455e-01 3.893682721938278024e-01
+5.320248625085529648e-01 1.132445825251853777e-01 3.890752921818558807e-01
+5.268418790923193873e-01 1.121763322989662304e-01 3.887220732362928199e-01
+5.216480344214139420e-01 1.111502746625857019e-01 3.883076350820581779e-01
+5.164430850451627864e-01 1.101663332257847294e-01 3.878324664548168932e-01
+5.112275102681053118e-01 1.092232673876926685e-01 3.872959651352503863e-01
+5.060029073959358970e-01 1.083180273650512782e-01 3.866960834588916152e-01
+5.007692304925555060e-01 1.074500336043514026e-01 3.860332364294135066e-01
+4.955265944792267008e-01 1.066184092659498428e-01 3.853076049214476662e-01
+4.902755524910634155e-01 1.058215397414334347e-01 3.845188368245686661e-01
+4.850176459901380244e-01 1.050561979453382144e-01 3.836654992000479436e-01
+4.797532909040905236e-01 1.043208730187463462e-01 3.827476922012114091e-01
+4.744823785889252243e-01 1.036148463575309320e-01 3.817661365680148355e-01
+4.692055171112920475e-01 1.029362343090417242e-01 3.807207588669155873e-01
+4.639233255037821801e-01 1.022831037225876705e-01 3.796115541526619008e-01
+4.586377341242697248e-01 1.016514176559336347e-01 3.784373263419291700e-01
+4.533486056644123185e-01 1.010403969450098804e-01 3.771990792167705386e-01
+4.480561070398016432e-01 1.004487677966155457e-01 3.758974928385367953e-01
+4.427608762820601784e-01 9.987450133495995308e-02 3.745328419993724234e-01
+4.374635532679027050e-01 9.931556251859710582e-02 3.731054660236349796e-01
+4.321647778868571432e-01 9.876991822512792840e-02 3.716157670899542520e-01
+4.268658599998730319e-01 9.823449013050672418e-02 3.700637078536853086e-01
+4.215676735765455097e-01 9.770690573986753891e-02 3.684497084664269395e-01
+4.162699168504104819e-01 9.718665004270135577e-02 3.667750666255454317e-01
+4.109731987208080639e-01 9.667179308527124038e-02 3.650404160810349907e-01
+4.056781184785120398e-01 9.616044175324228727e-02 3.632464399813756240e-01
+4.003852641200214557e-01 9.565074509543119996e-02 3.613938677771775798e-01
+3.950952107257716950e-01 9.514089908082037916e-02 3.594834719896101149e-01
+3.898085189133677075e-01 9.462915077538672226e-02 3.575160648711968037e-01
+3.845257333758309581e-01 9.411380193352703039e-02 3.554924949866632988e-01
+3.792473815136121473e-01 9.359321200643175298e-02 3.534136437413167853e-01
+3.739739721678181361e-01 9.306580057655630678e-02 3.512804218838474490e-01
+3.687059944607640194e-01 9.253004923332719400e-02 3.490937660095801975e-01
+3.634439167485821742e-01 9.198450291035600856e-02 3.468546350890427399e-01
+3.581881856892511484e-01 9.142777070873894796e-02 3.445640070453340198e-01
+3.529392254280559471e-01 9.085852623447668308e-02 3.422228754021731101e-01
+3.476974369011708865e-01 9.027550748073234765e-02 3.398322460227614084e-01
+3.424631972568040195e-01 8.967751628755202264e-02 3.373931339577017074e-01
+3.372368593921474811e-01 8.906341741289613978e-02 3.349065604182628331e-01
+3.320187516032832020e-01 8.843213724940904297e-02 3.323735498892629314e-01
+3.268091773441717529e-01 8.778266222136388297e-02 3.297951273938287686e-01
+3.216084150899517491e-01 8.711403689571997622e-02 3.271723159202782338e-01
+3.164167182989683913e-01 8.642536184028648538e-02 3.245061340194448363e-01
+3.112343154672587153e-01 8.571579126067202514e-02 3.217975935788711661e-01
+3.060614102686342042e-01 8.498453044606019136e-02 3.190476977785482449e-01
+3.008981817730306263e-01 8.423083305194795090e-02 3.162574392312175187e-01
+2.957447847354051640e-01 8.345399824589613824e-02 3.134277983087430108e-01
+2.906013499472219208e-01 8.265336774002721154e-02 3.105597416546946876e-01
+2.854679846423482936e-01 8.182832273165288606e-02 3.076542208820723934e-01
+2.803477329331294232e-01 8.097431979192776241e-02 3.047120362305891783e-01
+2.752380681858879186e-01 8.009433346301736423e-02 3.017343316299965217e-01
+2.701389341759609652e-01 7.918798082745703848e-02 2.987220235093637766e-01
+2.650503484302856316e-01 7.825477700181371343e-02 2.956760032243300196e-01
+2.599723067663477494e-01 7.729426121855428877e-02 2.925971426566268407e-01
+2.549047838884308526e-01 7.630599343423161152e-02 2.894862939132400448e-01
+2.498493147092451516e-01 7.528752506190716787e-02 2.863443687052725228e-01
+2.448074110283037785e-01 7.423648337865965119e-02 2.831723508316192905e-01
+2.397761080979832760e-01 7.315619369923848092e-02 2.799709378403843485e-01
+2.347552980534894362e-01 7.204627593897616755e-02 2.767409087277542534e-01
+2.297448542911243452e-01 7.090635374932227619e-02 2.734830227534650882e-01
+2.247460435545195478e-01 6.973430487024689928e-02 2.701981884636781017e-01
+2.197617914493367186e-01 6.852599251980440176e-02 2.668875888727837431e-01
+2.147876871428340828e-01 6.728630515821912295e-02 2.635514822299450111e-01
+2.098235281541684927e-01 6.601485651366462148e-02 2.601905585020159450e-01
+2.048690954628696881e-01 6.471124480576789795e-02 2.568054914489818485e-01
+1.999302337340111424e-01 6.336777961956377436e-02 2.533980282310328569e-01
+1.950016002461211762e-01 6.199020593164828591e-02 2.499680455203335816e-01
+1.900821894571196047e-01 6.057894133574073109e-02 2.465160535124999996e-01
+1.851717128353368158e-01 5.913348735199071976e-02 2.430426744218359136e-01];
+
+   case 'alg'
+      RGB = [8.429022637670927631e-01 9.769128443086748659e-01 8.146495714674897304e-01
+8.379898654100343958e-01 9.732407342044756549e-01 8.088430556678033456e-01
+8.330792003033266058e-01 9.695822214541992556e-01 8.030532648620265501e-01
+8.281700574948731575e-01 9.659372187629376993e-01 7.972802422761141594e-01
+8.232591263824388106e-01 9.623071583180456967e-01 7.915177499867750432e-01
+8.183491723383330418e-01 9.586904682961984170e-01 7.857720506350698297e-01
+8.134400361234097598e-01 9.550870346415619716e-01 7.800433040617480440e-01
+8.085287334688994187e-01 9.514980955891142456e-01 7.743261813916382241e-01
+8.036173420648491383e-01 9.479224436104144447e-01 7.686253533397395810e-01
+7.987060409170214648e-01 9.443598003220095016e-01 7.629416545120045745e-01
+7.937925122347354590e-01 9.408110588423104215e-01 7.572712382873506565e-01
+7.888774721308737803e-01 9.372756747279427092e-01 7.516160461408240012e-01
+7.839617672758154576e-01 9.337530574201664546e-01 7.459781551153893409e-01
+7.790441380861869991e-01 9.302435915337518013e-01 7.403557861728765621e-01
+7.741231638352710220e-01 9.267477183327949009e-01 7.347469917710997001e-01
+7.692007373711554630e-01 9.232643756857683570e-01 7.291556698393132363e-01
+7.642766080322838107e-01 9.197934849334901131e-01 7.235818576277038838e-01
+7.593478268473826676e-01 9.163361556599034508e-01 7.180210830197953920e-01
+7.544162681443719043e-01 9.128913482866579665e-01 7.124771068936172069e-01
+7.494821658995169944e-01 9.094587642780913583e-01 7.069508171108205286e-01
+7.445446445348200548e-01 9.060385878865820919e-01 7.014412864903698530e-01
+7.396014349798241128e-01 9.026315871837650162e-01 6.959454639490867400e-01
+7.346547940498792117e-01 8.992365867115311717e-01 6.904675150024160990e-01
+7.297044319156630321e-01 8.958535131435325649e-01 6.850074822882207259e-01
+7.247490312042899063e-01 8.924827183233180472e-01 6.795638773235905816e-01
+7.197871536503424039e-01 8.891245874731169563e-01 6.741351421211713157e-01
+7.148205906315451275e-01 8.857781679670407859e-01 6.687245323963695309e-01
+7.098490222489788337e-01 8.824433898084057537e-01 6.633320978710508520e-01
+7.048715598638584101e-01 8.791204089748886341e-01 6.579571019276890809e-01
+6.998858807424097606e-01 8.758099421807559182e-01 6.525968888447420957e-01
+6.948941393454671767e-01 8.725109084606608167e-01 6.472550946180131159e-01
+6.898959788510803381e-01 8.692232412884600690e-01 6.419317800561787912e-01
+6.848910317118895863e-01 8.659468751996841629e-01 6.366270089015387823e-01
+6.798769490247473790e-01 8.626825033431277934e-01 6.313382981547220885e-01
+6.748542718513756977e-01 8.594296871845804597e-01 6.260670342676678546e-01
+6.698236059410382914e-01 8.561879728828601932e-01 6.208146206652157550e-01
+6.647845365512859983e-01 8.529572984927470403e-01 6.155811388293935815e-01
+6.597366350463846896e-01 8.497376032066983331e-01 6.103666749315915796e-01
+6.546778498073401176e-01 8.465294186026240952e-01 6.051694131498632778e-01
+6.496081377794251654e-01 8.433325185775547572e-01 5.999900369339508099e-01
+6.445282101635998462e-01 8.401464057748564418e-01 5.948300803069692666e-01
+6.394375788791967219e-01 8.369710226136972686e-01 5.896896565661723377e-01
+6.343357381511850468e-01 8.338063126244976697e-01 5.845688863102624921e-01
+6.292221635729954299e-01 8.306522204479636073e-01 5.794678980553558123e-01
+6.240950633957039750e-01 8.275091254279797193e-01 5.743855059995368606e-01
+6.189539477625067843e-01 8.243769361676358542e-01 5.693220109772474391e-01
+6.137994351057367570e-01 8.212551782044565929e-01 5.642788688985792556e-01
+6.086309233573077293e-01 8.181437984076060932e-01 5.592562516207922885e-01
+6.034477870757418705e-01 8.150427445292480755e-01 5.542543429870632199e-01
+5.982493762730075604e-01 8.119519651518264380e-01 5.492733398149425295e-01
+5.930350151926494506e-01 8.088714096235919415e-01 5.443134529660692555e-01
+5.878040010377325597e-01 8.058010279811619325e-01 5.393749085029397872e-01
+5.825556026472022975e-01 8.027407708577772860e-01 5.344579489389233995e-01
+5.772876663840377232e-01 7.996910315164064142e-01 5.295616097386441901e-01
+5.720007307801391327e-01 7.966513294788654109e-01 5.246873967172444031e-01
+5.666941554135628278e-01 7.936215585273497242e-01 5.198357685218710778e-01
+5.613670944828393905e-01 7.906016675911841096e-01 5.150070514423125134e-01
+5.560186672658552487e-01 7.875916053777574088e-01 5.102015958622602154e-01
+5.506479565076832783e-01 7.845913201632197520e-01 5.054197781680845880e-01
+5.452540067541281621e-01 7.816007595558720489e-01 5.006620028015225099e-01
+5.398358226320055797e-01 7.786198702294978569e-01 4.959287044657145205e-01
+5.343923670778303325e-01 7.756485976236309199e-01 4.912203504944597232e-01
+5.289225595174025241e-01 7.726868856074639025e-01 4.865374433949326005e-01
+5.234252739997397041e-01 7.697346761037856533e-01 4.818805235744546001e-01
+5.178993372898965664e-01 7.667919086690104802e-01 4.772501722621809717e-01
+5.123435269266533032e-01 7.638585200249727869e-01 4.726470146367432457e-01
+5.067565692524964582e-01 7.609344435378136984e-01 4.680717231709499715e-01
+5.011371374253174027e-01 7.580196086388175658e-01 4.635250212045694540e-01
+4.954838494233231860e-01 7.551139401816627794e-01 4.590076867559155782e-01
+4.897952660572904571e-01 7.522173577300403924e-01 4.545205565824696481e-01
+4.840681573071378696e-01 7.493302232220337977e-01 4.500635797773255287e-01
+4.783013360124501179e-01 7.464523294656015828e-01 4.456380221845723244e-01
+4.724940506024824516e-01 7.435833409938815697e-01 4.412454477696442501e-01
+4.666445818616462016e-01 7.407231498818752646e-01 4.368869875723455642e-01
+4.607511431720994755e-01 7.378716377692448036e-01 4.325638579641650772e-01
+4.548118791551377105e-01 7.350286745174200442e-01 4.282773665493129212e-01
+4.488246916697360978e-01 7.321941577075956609e-01 4.240288438198308585e-01
+4.427816707495262905e-01 7.293693063882581429e-01 4.198173776667764034e-01
+4.366861225292572590e-01 7.265526435148784712e-01 4.156470546985623349e-01
+4.305358706593315765e-01 7.237439753686812915e-01 4.115196426107185501e-01
+4.243286683688641259e-01 7.209430867475091764e-01 4.074370373866784134e-01
+4.180533691692684961e-01 7.181516616727471325e-01 4.033983548745580516e-01
+4.117152151566086937e-01 7.153676995586070175e-01 3.994086748894248862e-01
+4.053120447326638009e-01 7.125908305255362896e-01 3.954704830581987074e-01
+3.988310338161633051e-01 7.098228382481286403e-01 3.915835586978753668e-01
+3.922773504125326993e-01 7.070616628058336017e-01 3.877531715317056316e-01
+3.856453036392904488e-01 7.043074656954597668e-01 3.839816779215288745e-01
+3.789264219900637110e-01 7.015608428874934299e-01 3.802713204645660205e-01
+3.721249180146385394e-01 6.988198403254852753e-01 3.766273561291236249e-01
+3.652256292309092323e-01 6.960861432527269965e-01 3.730515342232093579e-01
+3.582353316782660446e-01 6.933572072574926137e-01 3.695499404331015203e-01
+3.511405088327756996e-01 6.906341612001636321e-01 3.661256768699447939e-01
+3.439420657842418572e-01 6.879154082481935273e-01 3.627843734908121065e-01
+3.366376245587633931e-01 6.851998988322398620e-01 3.595313212824273741e-01
+3.292131284244469436e-01 6.824884139177085363e-01 3.563714602024023459e-01
+3.216744583078648412e-01 6.797783170101999728e-01 3.533114882245381727e-01
+3.140172671350762723e-01 6.770686201449667152e-01 3.503575531959788325e-01
+3.062375560076174841e-01 6.743581777161754554e-01 3.475162179105460436e-01
+2.983302406892556213e-01 6.716458949569478198e-01 3.447945234485624288e-01
+2.903003733928296581e-01 6.689291557488895590e-01 3.421993121220623379e-01
+2.821497842888552321e-01 6.662058429849556651e-01 3.397373505300674279e-01
+2.738829008222237738e-01 6.634735172067438569e-01 3.374150438308454736e-01
+2.655071740281889081e-01 6.607294316207971141e-01 3.352380978850171278e-01
+2.570334211300853156e-01 6.579705722659228151e-01 3.332111341597794874e-01
+2.484760249031935930e-01 6.551937268253881230e-01 3.313372827145077970e-01
+2.398529309513116603e-01 6.523955825377709683e-01 3.296177905380952566e-01
+2.311841779376898609e-01 6.495729702230954583e-01 3.280520259104468539e-01
+2.224959725553208312e-01 6.467225401811796948e-01 3.266360450956267703e-01
+2.138146081063950210e-01 6.438414682793780486e-01 3.253637783252084081e-01
+2.051671661243615885e-01 6.409273967897467505e-01 3.242268145630948784e-01
+1.965805108315318850e-01 6.379785280095539024e-01 3.232146947371194456e-01
+1.880802465071397533e-01 6.349936851788878789e-01 3.223153652533572999e-01
+1.796913740541281890e-01 6.319722298814686168e-01 3.215149361924393712e-01
+1.714330705005376321e-01 6.289143429606669500e-01 3.208003886075819211e-01
+1.633223574014183166e-01 6.258206603139722102e-01 3.201583938437198018e-01
+1.553730387230779220e-01 6.226922583196569105e-01 3.195761743639152774e-01
+1.475958738836526396e-01 6.195305528827301789e-01 3.190418452926268023e-01
+1.399989467346693939e-01 6.163371978378411331e-01 3.185446364378627382e-01
+1.325881576814804952e-01 6.131139916341550311e-01 3.180750084472180883e-01
+1.253677831749437921e-01 6.098627973272553460e-01 3.176246802424351201e-01
+1.183415125249481503e-01 6.065854884488630638e-01 3.171858497741395500e-01
+1.115126074344926499e-01 6.032839586583695901e-01 3.167505890039074568e-01
+1.048819394515066727e-01 5.999599650973242992e-01 3.163157773881625778e-01
+9.845229630728663528e-02 5.966151576836506987e-01 3.158774289651596345e-01
+9.222723505152297108e-02 5.932511684885474201e-01 3.154305788787992171e-01
+8.620976681204781111e-02 5.898696713297170158e-01 3.149695047280966498e-01
+8.040588003861268152e-02 5.864717566016173222e-01 3.144963594445834287e-01
+7.481986998062370442e-02 5.830590393336594346e-01 3.140045327658092522e-01
+6.946029534260433902e-02 5.796325615836696032e-01 3.134943864901328370e-01
+6.433627993915527754e-02 5.761934589668912254e-01 3.129640951373787172e-01
+5.945721644433194647e-02 5.727428791151661924e-01 3.124113492075187293e-01
+5.483676528890226581e-02 5.692816942618841303e-01 3.118359557718813901e-01
+5.049036852106828649e-02 5.658107385911853582e-01 3.112374314935371089e-01
+4.642777154917742538e-02 5.623311839573432724e-01 3.106124662721929663e-01
+4.267873894906259319e-02 5.588431316231524670e-01 3.099653177208470112e-01
+3.923368215696795835e-02 5.553481890828847467e-01 3.092892996314257625e-01
+3.621581017331615415e-02 5.518464055245291267e-01 3.085882846661225365e-01
+3.367174260746116921e-02 5.483382191382968340e-01 3.078629031746034084e-01
+3.155357134880961562e-02 5.448249609075901390e-01 3.071084590117025281e-01
+2.984163194432063598e-02 5.413067537046710731e-01 3.063273483583937029e-01
+2.851433193286296089e-02 5.377838583018560437e-01 3.055207233916585885e-01
+2.754542481457317171e-02 5.342567759013212569e-01 3.046882377538095987e-01
+2.689570440508957244e-02 5.307265908415563782e-01 3.038266898313282116e-01
+2.655111347348209846e-02 5.271933424208224972e-01 3.029380668195990611e-01
+2.649479114279441189e-02 5.236572235511334217e-01 3.020233215230865298e-01
+2.670582470265941977e-02 5.201186270434556835e-01 3.010823500978198064e-01
+2.716440603849906016e-02 5.165779238412415708e-01 3.001150958048797168e-01
+2.785177445187870041e-02 5.130354641701924123e-01 2.991215440838268513e-01
+2.874507672231698188e-02 5.094917938725799234e-01 2.981008701035369746e-01
+2.982666070550293522e-02 5.059472607886396078e-01 2.970530677865693692e-01
+3.108771284944302979e-02 5.024018586614166226e-01 2.959794192966550552e-01
+3.251322799624088711e-02 4.988558619272636663e-01 2.948800270305382831e-01
+3.408899261646199802e-02 4.953095294092992318e-01 2.937550173740440806e-01
+3.580154506882658044e-02 4.917631050765793321e-01 2.926045381193648209e-01
+3.763813815230969417e-02 4.882168187516792712e-01 2.914287561365453416e-01
+3.958670383768114059e-02 4.846708867690439626e-01 2.902278552740369943e-01
+4.160606223970295808e-02 4.811255125865287474e-01 2.890020344652265427e-01
+4.364369199371629510e-02 4.775808873526497522e-01 2.877515060197786689e-01
+4.569661527765144643e-02 4.740371904320783147e-01 2.864764940804359616e-01
+4.775452753988133209e-02 4.704945898919368763e-01 2.851772332276043542e-01
+4.980869291606532939e-02 4.669532429514431926e-01 2.838539672156359384e-01
+5.185173623572528895e-02 4.634132963974310626e-01 2.825069478261687528e-01
+5.387745614388812082e-02 4.598748869682287022e-01 2.811364338252513306e-01
+5.588065991543698235e-02 4.563381417083428038e-01 2.797426900122344517e-01
+5.785701915204972262e-02 4.528031782963246044e-01 2.783259863495758379e-01
+5.979876706363549538e-02 4.492703547749640758e-01 2.768859613477449022e-01
+6.170040530833437870e-02 4.457399494079358759e-01 2.754224910913550817e-01
+6.356556527046725025e-02 4.422117069661303246e-01 2.739367706711952621e-01
+6.539233256679152784e-02 4.386857116546215574e-01 2.724290903132413622e-01
+6.717918154984042767e-02 4.351620395957427334e-01 2.708997417620619963e-01
+6.892491848697404611e-02 4.316407590421982854e-01 2.693490177429860299e-01
+7.062863315353248850e-02 4.281219305768591554e-01 2.677772114552923188e-01
+7.228965757688332605e-02 4.246056073010452958e-01 2.661846160919238424e-01
+7.389641781918890318e-02 4.210926586635973523e-01 2.645697649893180015e-01
+7.545434928417493747e-02 4.175827498520321979e-01 2.629338431200398118e-01
+7.696833442757364252e-02 4.140755522595082616e-01 2.612779353323396725e-01
+7.843838726966873010e-02 4.105710916270851607e-01 2.596023362544704338e-01
+7.986463095393955824e-02 4.070693869948522892e-01 2.579073383225120586e-01
+8.124183059024486786e-02 4.035709045576263421e-01 2.561923603053372633e-01
+8.256190184629638718e-02 4.000763929725326684e-01 2.544563479235497083e-01
+8.383876927413885793e-02 3.965847495529768452e-01 2.527017537470714892e-01
+8.507286345646175585e-02 3.930959685837552287e-01 2.509288633450958983e-01
+8.626466273198904466e-02 3.896100382985579480e-01 2.491379583258400143e-01
+8.739775523971837767e-02 3.861285039195596069e-01 2.473266151547285352e-01
+8.848513420336723279e-02 3.826502629618194207e-01 2.454971009362341139e-01
+8.953167205157094855e-02 3.791748988832845391e-01 2.436503732426347768e-01
+9.053797836732038751e-02 3.757023773832682267e-01 2.417867000353674523e-01
+9.148554097617969671e-02 3.722345634210443843e-01 2.399033173203807268e-01
+9.239032630846283345e-02 3.687699624551818989e-01 2.380029261610703828e-01
+9.325665476520708652e-02 3.653081665793141419e-01 2.360863630636709232e-01
+9.407947178296760526e-02 3.618497205076261491e-01 2.341529827160940824e-01
+9.484677589858042657e-02 3.583959460277540421e-01 2.322010660237076030e-01
+9.557752330564703303e-02 3.549448939617083076e-01 2.302337247418529409e-01
+9.627239441888107985e-02 3.514964944168565975e-01 2.282511932335974936e-01
+9.690948221035081134e-02 3.480532009152630946e-01 2.262502344543431132e-01
+9.750943240499498899e-02 3.446127832007709890e-01 2.242341737774653510e-01
+9.807545896746669434e-02 3.411748780303069384e-01 2.222036193428468254e-01
+9.858840445742730885e-02 3.377417205454144589e-01 2.201557955312036796e-01
+9.906254148928930747e-02 3.343117038364873950e-01 2.180929998845686502e-01
+9.950470237088998582e-02 3.308840188006390015e-01 2.160163648855405460e-01
+9.989442828501457483e-02 3.274611474658599142e-01 2.139229716850828411e-01
+1.002478051840671458e-01 3.240411780581063939e-01 2.118153315535568071e-01
+1.005711171338506127e-01 3.206233202298787721e-01 2.096944585359068469e-01
+1.008389569492894877e-01 3.172107795653626439e-01 2.075567848977897256e-01
+1.010766013830992904e-01 3.138003866895044958e-01 2.054060788674454963e-01
+1.012797610659880443e-01 3.103926683916618523e-01 2.032418103374508123e-01
+1.014336128495174072e-01 3.069895754355959072e-01 2.010620024754192769e-01
+1.015604574719611575e-01 3.035881742672912331e-01 1.988698806638831140e-01
+1.016439043068387282e-01 3.001906378105418383e-01 1.966632618336682237e-01
+1.016900146818882356e-01 2.967961587009928515e-01 1.944430867217927517e-01
+1.017093270307037889e-01 2.934032641989809398e-01 1.922108533595217328e-01
+1.016765444870794677e-01 2.900154576395235773e-01 1.899632762562097343e-01
+1.016196069311545991e-01 2.866288210415605109e-01 1.877041478451552947e-01
+1.015219485974463154e-01 2.832456655164396486e-01 1.854313688320031739e-01
+1.013890307775781596e-01 2.798651977505757227e-01 1.831457349733398854e-01
+1.012281681325793714e-01 2.764863132581988348e-01 1.808482324484150805e-01
+1.010210261960676481e-01 2.731116796865848406e-01 1.785366459436490416e-01
+1.007923256501605802e-01 2.697375956289435606e-01 1.762140933897481665e-01
+1.005175174628768486e-01 2.663676978648497062e-01 1.738776494133498218e-01
+1.002173006867299876e-01 2.629988175863644528e-01 1.715298624270491512e-01
+9.988042668340707531e-02 2.596326158562400344e-01 1.691694475105532114e-01
+9.951032875855422843e-02 2.562685171837931764e-01 1.667968626726523129e-01
+9.911165965335702599e-02 2.529057275734052368e-01 1.644126697900448464e-01
+9.867326641808749077e-02 2.495459516150641543e-01 1.620156747879235859e-01
+9.821309319240137392e-02 2.461862546952748865e-01 1.596078670948603284e-01
+9.770793688346479655e-02 2.428303047023268602e-01 1.571867977376794623e-01
+9.718522833757223256e-02 2.394735637952865592e-01 1.547553696066038820e-01
+9.661611889067361902e-02 2.361206836681891130e-01 1.523106424045232721e-01
+9.602890382911671852e-02 2.327668939738092857e-01 1.498554790261657776e-01
+9.539953637497836092e-02 2.294161153913850115e-01 1.473875249443533098e-01
+9.474917991081285851e-02 2.260646807246796119e-01 1.449088125658586357e-01
+9.405984876891312907e-02 2.227155420665202223e-01 1.424176598027472040e-01
+9.334764966575742617e-02 2.193658224428529091e-01 1.399155213806154985e-01
+9.259864172169812724e-02 2.160178161752643877e-01 1.374011522998845325e-01
+9.182582886012352619e-02 2.126691252719348779e-01 1.348756437215534176e-01
+9.101741805439966804e-02 2.093216946605545581e-01 1.323379906767623293e-01
+9.018514688041953664e-02 2.059732968223858540e-01 1.297890966546490499e-01
+8.931758876675888192e-02 2.026258321763433345e-01 1.272280374767779110e-01
+8.842693764273418244e-02 1.992769388914110706e-01 1.246556670387520271e-01
+8.750046390510707317e-02 1.959287732623697376e-01 1.220710201130164874e-01
+8.655243027600306727e-02 1.925785390204607095e-01 1.194750015988692016e-01
+8.556724308545121671e-02 1.892289432653286863e-01 1.168665204409958802e-01
+8.456273936118519075e-02 1.858764606951441301e-01 1.142465958957942507e-01
+8.351900544036733320e-02 1.825246377933723574e-01 1.116139631166048474e-01
+8.245885447713624528e-02 1.791689319540810954e-01 1.089697819472404405e-01
+8.135669872091313981e-02 1.758140104483569555e-01 1.063126024658284652e-01
+8.023864908973366017e-02 1.724546122292074379e-01 1.036435837789304870e-01
+7.908112723260085630e-02 1.690950585274078044e-01 1.009615075211427460e-01
+7.790439520871850210e-02 1.657311325223233545e-01 9.826708487284271931e-02
+7.669293821383046939e-02 1.623656063191788734e-01 9.555954478117026363e-02
+7.545752224924831553e-02 1.589960594221086487e-01 9.283909520333205601e-02
+7.419260617097681032e-02 1.556232855365611012e-01 9.010535811327979872e-02
+7.289843379575938753e-02 1.522469176001574609e-01 8.735814807810177163e-02
+7.158041455970551303e-02 1.488655123209624287e-01 8.459734502497687214e-02
+7.022733114464504989e-02 1.454810031009998728e-01 8.182251708486179553e-02
+6.885643403782271132e-02 1.420894601159049808e-01 7.903362825094448207e-02]; 
+
+   case 'den' 
+      RGB = [9.022021640633741679e-01 9.441797977915000750e-01 9.438027309131502562e-01
+8.954445384876381642e-01 9.409578903665054561e-01 9.410648759794842944e-01
+8.886855788874895579e-01 9.377403820634679921e-01 9.384098650760986926e-01
+8.819275100483495722e-01 9.345262546442011375e-01 9.358372814047579702e-01
+8.751724774625697645e-01 9.313145521613219735e-01 9.333465385891809296e-01
+8.684225465562396273e-01 9.281043788756372370e-01 9.309368983040341439e-01
+8.616797015669134252e-01 9.248948973050555855e-01 9.286074874996731454e-01
+8.549458444869071361e-01 9.216853262599870034e-01 9.263573151615366319e-01
+8.482227943572994144e-01 9.184749387758168737e-01 9.241852885114790750e-01
+8.415122870990738857e-01 9.152630598938195083e-01 9.220902285443438595e-01
+8.348159759916423672e-01 9.120490642716416740e-01 9.200708847923535494e-01
+8.281354328507813944e-01 9.088323736256948004e-01 9.181259492188009741e-01
+8.214721499137223049e-01 9.056124540224106401e-01 9.162540691578000551e-01
+8.148275424063925465e-01 9.023888130447765832e-01 9.144538592359539031e-01
+8.082029517444304645e-01 8.991609968660188024e-01 9.127239122325879750e-01
+8.015996493038702875e-01 8.959285872646755022e-01 9.110628088561002480e-01
+7.950188742001107478e-01 8.926911903474541443e-01 9.094690972400388818e-01
+7.884617893745216044e-01 8.894484461080551796e-01 9.079413399350437786e-01
+7.819294709222469608e-01 8.862000288332800846e-01 9.064781367807944745e-01
+7.754229463217646723e-01 8.829456358148736195e-01 9.050781031537078469e-01
+7.689431984424601740e-01 8.796849849240929720e-01 9.037398757679527828e-01
+7.624911712284807574e-01 8.764178119047121296e-01 9.024621162700895427e-01
+7.560677754202349554e-01 8.731438677954835859e-01 9.012435140344750018e-01
+7.496738942657009686e-01 8.698629164913183054e-01 9.000827882281617898e-01
+7.433103891809360597e-01 8.665747324492172332e-01 8.989786892140232410e-01
+7.369781053261772463e-01 8.632790985421132657e-01 8.979299993594229701e-01
+7.306778770702586634e-01 8.599758040613866283e-01 8.969355333152028154e-01
+7.244105333220340892e-01 8.566646428667109570e-01 8.959941378263615031e-01
+7.181769027125698424e-01 8.533454116802825506e-01 8.951046911317568355e-01
+7.119778186163850942e-01 8.500179085211370111e-01 8.942661020057923738e-01
+7.058142285268640403e-01 8.466819129479339345e-01 8.934771781429077242e-01
+6.996868754737947116e-01 8.433372425635760061e-01 8.927370216147950677e-01
+6.935966262281186845e-01 8.399836925869731408e-01 8.920446369253884900e-01
+6.875443783072674453e-01 8.366210531289836050e-01 8.913990435590287698e-01
+6.815310569542375463e-01 8.332491095447560614e-01 8.907992825434407624e-01
+6.755576190661271019e-01 8.298676415986731003e-01 8.902444142113377090e-01
+6.696250569512002260e-01 8.264764227239829175e-01 8.897335158509319664e-01
+6.637344019158556430e-01 8.230752193711802223e-01 8.892656792634947571e-01
+6.578867276821276366e-01 8.196637904396377738e-01 8.888400082431817673e-01
+6.520831536351689994e-01 8.162418867874922102e-01 8.884556159917510465e-01
+6.463248478988037338e-01 8.128092508153051954e-01 8.881116224784991742e-01
+6.406130302355731443e-01 8.093656161195516008e-01 8.878071517537653445e-01
+6.349489747657169891e-01 8.059107072125802906e-01 8.875413292226665973e-01
+6.293340124974293737e-01 8.024442393062223289e-01 8.873132788842952312e-01
+6.237695336583948258e-01 7.989659181568090629e-01 8.871221205404720145e-01
+6.182569898160699129e-01 7.954754399699002221e-01 8.869669669772310971e-01
+6.127978529026838483e-01 7.919724939438572697e-01 8.868470036964815062e-01
+6.073937143892588209e-01 7.884567552174953642e-01 8.867613059311603152e-01
+6.020462362204239692e-01 7.849278896215748924e-01 8.867089225926839680e-01
+5.967571335484213035e-01 7.813855546115021644e-01 8.866889106706612456e-01
+5.915281898823177009e-01 7.778293984625483937e-01 8.867003055015370006e-01
+5.863612575196054388e-01 7.742590605302298590e-01 8.867421178165009188e-01
+5.812582575983973321e-01 7.706741715732086107e-01 8.868133307743576443e-01
+5.762211797340099917e-01 7.670743541409147381e-01 8.869128969829140896e-01
+5.712520812007981785e-01 7.634592230284988901e-01 8.870397355132993988e-01
+5.663530856178774497e-01 7.598283858019500014e-01 8.871927289126763094e-01
+5.615263810949739920e-01 7.561814433965411419e-01 8.873707202219829338e-01
+5.567742177930775638e-01 7.525179907919229416e-01 8.875725100066919060e-01
+5.520989048532665144e-01 7.488376177673574663e-01 8.877968534100384446e-01
+5.475028066465008614e-01 7.451399097406838923e-01 8.880424572398104566e-01
+5.429883038774732107e-01 7.414244411965056347e-01 8.883081102246548344e-01
+5.385578037806126872e-01 7.376907727350942023e-01 8.885926739767254778e-01
+5.342139074650678054e-01 7.339384990781333551e-01 8.888943435724941944e-01
+5.299591516928192636e-01 7.301671976158840005e-01 8.892116013883853975e-01
+5.257960979209626018e-01 7.263764470411206986e-01 8.895428673545512366e-01
+5.217273234975481344e-01 7.225658287807643632e-01 8.898864965652431014e-01
+5.177554119038457747e-01 7.187349285333118898e-01 8.902407770595432979e-01
+5.138829420298184347e-01 7.148833379130644650e-01 8.906039278005388748e-01
+5.101124764807559719e-01 7.110106562012711295e-01 8.909740968830553998e-01
+5.064465489258500597e-01 7.071164922032951994e-01 8.913493600019622987e-01
+5.028876505140544850e-01 7.032004662097455228e-01 8.917277192147863296e-01
+4.994382152582386714e-01 6.992621674331673809e-01 8.921074350832908229e-01
+4.961006347215984325e-01 6.953012224940204877e-01 8.924864661543192579e-01
+4.928771955532800786e-01 6.913173542206699773e-01 8.928621485317782547e-01
+4.897700668589555772e-01 6.873102514205022828e-01 8.932321753875414050e-01
+4.867812943786045676e-01 6.832796259123631311e-01 8.935941653626673364e-01
+4.839127827295982009e-01 6.792252150037093594e-01 8.939456639464463672e-01
+4.811662774244846452e-01 6.751467840099739659e-01 8.942841454160184167e-01
+4.785433468471342322e-01 6.710441287994942661e-01 8.946070153685665716e-01
+4.760453643890875663e-01 6.669170783452496032e-01 8.949116138746746607e-01
+4.736736428294658352e-01 6.627653768113491717e-01 8.951957859716279664e-01
+4.714290262412598742e-01 6.585890168305761350e-01 8.954562723025643045e-01
+4.693121574935592011e-01 6.543879757664989860e-01 8.956900818434682110e-01
+4.673234528945732769e-01 6.501622438680934035e-01 8.958943277799077398e-01
+4.654630534005658737e-01 6.459118568983728270e-01 8.960660842179661856e-01
+4.637308126788352580e-01 6.416368981971656282e-01 8.962023935259622043e-01
+4.621262870085202645e-01 6.373375005637914592e-01 8.963002743257548754e-01
+4.606487857322991153e-01 6.330138155630400387e-01 8.963568414436460241e-01
+4.592973162762510886e-01 6.286660463835676005e-01 8.963691878774373567e-01
+4.580703339287382492e-01 6.242945769689846047e-01 8.963339924500021150e-01
+4.569661322748618804e-01 6.198997574323485971e-01 8.962482674873512023e-01
+4.559826907629682125e-01 6.154819930493959923e-01 8.961090514006179175e-01
+4.551176793504218554e-01 6.110417444047528956e-01 8.959134196000665407e-01
+4.543684658154031886e-01 6.065795271800727972e-01 8.956584955889488331e-01
+4.537321103072295414e-01 6.020959187639063348e-01 8.953414439077735931e-01
+4.532053056792195167e-01 5.975915899334859338e-01 8.949594061016020730e-01
+4.527845804849874312e-01 5.930672153918072897e-01 8.945097368602321630e-01
+4.524662055084718859e-01 5.885235252040261766e-01 8.939898705469653262e-01
+4.522462243009037208e-01 5.839612972830612314e-01 8.933973456284665104e-01
+4.521204742039108271e-01 5.793813548677185787e-01 8.927298144348156939e-01
+4.520846088132207119e-01 5.747845636677534342e-01 8.919850523005500298e-01
+4.521340640278729839e-01 5.701718535137081378e-01 8.911609204213972735e-01
+4.522636556547669495e-01 5.655443967339887079e-01 8.902550664458118712e-01
+4.524690821672368579e-01 5.609029696513448959e-01 8.892660746141660688e-01
+4.527455061379137002e-01 5.562485728577384325e-01 8.881923021329055645e-01
+4.530880320659124716e-01 5.515822303923638703e-01 8.870322627966300555e-01
+4.534917310405354729e-01 5.469049855617650335e-01 8.857846304506885593e-01
+4.539516647179116515e-01 5.422178966900855768e-01 8.844482413776627583e-01
+4.544629083695410077e-01 5.375220328430567740e-01 8.830220956021650469e-01
+4.550204443687518308e-01 5.328185230036192044e-01 8.815052933071011454e-01
+4.556185611092698484e-01 5.281088097066267695e-01 8.798967638851667994e-01
+4.562534204266542326e-01 5.233935859930700651e-01 8.781964868264527935e-01
+4.569203709084596610e-01 5.186739169401044514e-01 8.764041195297782583e-01
+4.576148706477833339e-01 5.139508576774439730e-01 8.745194730542404926e-01
+4.583325010790182952e-01 5.092254498718804534e-01 8.725425074817807491e-01
+4.590689790493137079e-01 5.044987184411230396e-01 8.704733265502938577e-01
+4.598201671313326133e-01 4.997716685175846441e-01 8.683121716406742019e-01
+4.605820822069772169e-01 4.950452826784434435e-01 8.660594152048119998e-01
+4.613509023726869995e-01 4.903205184540396222e-01 8.637155537234258995e-01
+4.621229722350553293e-01 4.855983061224402042e-01 8.612812002829223212e-01
+4.628948066804312034e-01 4.808795467939734336e-01 8.587570768592888149e-01
+4.636621617804746465e-01 4.761655004408036906e-01 8.561438461496413410e-01
+4.644228483348319947e-01 4.714566096078480206e-01 8.534426324219575033e-01
+4.651739386269664878e-01 4.667536635703780079e-01 8.506544391441875907e-01
+4.659126485884828583e-01 4.620574294334566789e-01 8.477803402103136765e-01
+4.666363628095652749e-01 4.573686402108441684e-01 8.448214774526084936e-01
+4.673426313321316639e-01 4.526879945693308982e-01 8.417790529251527598e-01
+4.680291657078233247e-01 4.480161567955825430e-01 8.386543213914651185e-01
+4.686938344285310198e-01 4.433537569692765912e-01 8.354485830591045215e-01
+4.693346578320167217e-01 4.387013913255956021e-01 8.321631765974399908e-01
+4.699498025791529199e-01 4.340596227897761117e-01 8.287994724682681280e-01
+4.705375757926853475e-01 4.294289816663295900e-01 8.253588665927664714e-01
+4.710964189403291091e-01 4.248099664657251084e-01 8.218427743723751844e-01
+4.716249015377835252e-01 4.202030448517347638e-01 8.182526250758133113e-01
+4.721217147398471536e-01 4.156086546932221681e-01 8.145898565994108553e-01
+4.725856648806062155e-01 4.110272052049120939e-01 8.108559106034937125e-01
+4.730156670165072685e-01 4.064590781625461724e-01 8.070522280235292722e-01
+4.734107385193607187e-01 4.019046291787961578e-01 8.031802449512829289e-01
+4.737699927598160721e-01 3.973641890273297284e-01 7.992413888782301523e-01
+4.740926329157582608e-01 3.928380650035104282e-01 7.952370752909331264e-01
+4.743779459344564242e-01 3.883265423112774450e-01 7.911687046060347228e-01
+4.746252966720311828e-01 3.838298854668622528e-01 7.870376594308572393e-01
+4.748341222291213026e-01 3.793483397110574140e-01 7.828453021343189100e-01
+4.750039264972926722e-01 3.748821324227855634e-01 7.785929727119723642e-01
+4.751342749269319987e-01 3.704314745277388354e-01 7.742819869283568135e-01
+4.752247895239137265e-01 3.659965618967846446e-01 7.699136347195338903e-01
+4.752751440794077964e-01 3.615775767297375043e-01 7.654891788385849161e-01
+4.752846577346016566e-01 3.571748688576533159e-01 7.610100397104845316e-01
+4.752531583445195884e-01 3.527885695695618384e-01 7.564774234071200976e-01
+4.751807975405666906e-01 3.484186721552497978e-01 7.518923528283415481e-01
+4.750674206653115461e-01 3.440653140404167365e-01 7.472559685686853692e-01
+4.749129042193905303e-01 3.397286256677667371e-01 7.425693796885003417e-01
+4.747171524182526858e-01 3.354087317676910929e-01 7.378336635067138660e-01
+4.744800939620510971e-01 3.311057526021228270e-01 7.330498655303070432e-01
+4.742016790105380575e-01 3.268198051821941674e-01 7.282189995072744226e-01
+4.738818763543148349e-01 3.225510044607445836e-01 7.233420475907058611e-01
+4.735206707734627707e-01 3.182994645010271961e-01 7.184199606025195584e-01
+4.731180605743212086e-01 3.140652996233325722e-01 7.134536583862346459e-01
+4.726740552951489982e-01 3.098486255314443216e-01 7.084440302390293542e-01
+4.721886735713431427e-01 3.056495604211318384e-01 7.033919354141809910e-01
+4.716613727297020442e-01 3.014684828248803128e-01 6.982986813805610593e-01
+4.710926963645384880e-01 2.973052870266812420e-01 6.931646771793222861e-01
+4.704828136289659901e-01 2.931600441838846383e-01 6.879905802658634606e-01
+4.698317639381846544e-01 2.890328918495519428e-01 6.827771264871377310e-01
+4.691395866583317198e-01 2.849239757466777712e-01 6.775250248474340431e-01
+4.684063197381936328e-01 2.808334508365700755e-01 6.722349583426855402e-01
+4.676319984415455155e-01 2.767614823885942155e-01 6.669075848245407112e-01
+4.668166541724163010e-01 2.727082470546194348e-01 6.615435378909206854e-01
+4.659603133859185342e-01 2.686739339515746283e-01 6.561434278004181220e-01
+4.650628643816827057e-01 2.646588038897796924e-01 6.507079958832593380e-01
+4.641242580497152992e-01 2.606631006122758221e-01 6.452378997676680994e-01
+4.631447877428095938e-01 2.566869305701654502e-01 6.397333527350717031e-01
+4.621244494694312643e-01 2.527305449360881529e-01 6.341948722101476976e-01
+4.610632293393826520e-01 2.487942133948352064e-01 6.286229575018943416e-01
+4.599611028558598380e-01 2.448782253548376642e-01 6.230180909006084455e-01
+4.588180342503813125e-01 2.409828911918876493e-01 6.173807387973655469e-01
+4.576339758554896497e-01 2.371085435285009702e-01 6.117113528277585699e-01
+4.564088675103588622e-01 2.332555385522245284e-01 6.060103710422047874e-01
+4.551426114844220883e-01 2.294242672454404608e-01 6.002782575500510420e-01
+4.538352109035017068e-01 2.256151009415963693e-01 5.945152849064858636e-01
+4.524865766439374881e-01 2.218284716492017750e-01 5.887218272221994564e-01
+4.510965881023942248e-01 2.180648477346619485e-01 5.828982757017970862e-01
+4.496651090864017264e-01 2.143247287775243981e-01 5.770450152504881247e-01
+4.481919873439485502e-01 2.106086471651167358e-01 5.711624259770210488e-01
+4.466770541000937844e-01 2.069171697362102713e-01 5.652508847626541710e-01
+4.451201235978615167e-01 2.032508994724643858e-01 5.593107669047254760e-01
+4.435210649059648236e-01 1.996104535682982628e-01 5.533422989220041499e-01
+4.418797550887742509e-01 1.959964848006353622e-01 5.473456323671032075e-01
+4.401958303868417355e-01 1.924097603751145913e-01 5.413213827196030614e-01
+4.384690252866834115e-01 1.888510510844303159e-01 5.352699392743940354e-01
+4.366990547337928352e-01 1.853211730457038908e-01 5.291917009058230148e-01
+4.348856137062026561e-01 1.818209895007495414e-01 5.230870785018020275e-01
+4.330283767917184612e-01 1.783514125901697334e-01 5.169564975681201213e-01
+4.311269977716754020e-01 1.749134050778043403e-01 5.108004010215621005e-01
+4.291811092153304252e-01 1.715079819968361174e-01 5.046192521919092844e-01
+4.271904344659923636e-01 1.681361967924985268e-01 4.984132106571174670e-01
+4.251546522673581574e-01 1.647991755952243342e-01 4.921824740309181379e-01
+4.230731286286127379e-01 1.614981359784699588e-01 4.859281380753826540e-01
+4.209454004136206628e-01 1.582343200442791198e-01 4.796507952549767251e-01
+4.187709818950797191e-01 1.550090272321758555e-01 4.733510791258234707e-01
+4.165493646911141434e-01 1.518236143519533232e-01 4.670296690947607909e-01
+4.142800178080069395e-01 1.486794951032471834e-01 4.606872955350938548e-01
+4.119623878145514673e-01 1.455781389789607694e-01 4.543247452773370720e-01
+4.095958991778662628e-01 1.425210694369028197e-01 4.479428674896456797e-01
+4.071799547953330878e-01 1.395098612110991787e-01 4.415425799574690391e-01
+4.047139367624922324e-01 1.365461366216895456e-01 4.351248757648299992e-01
+4.021972936019284628e-01 1.336316105494000928e-01 4.286903779176353124e-01
+3.996293630849273582e-01 1.307680150350410408e-01 4.222401836338272596e-01
+3.970093606178293211e-01 1.279570274853844003e-01 4.157761120045768699e-01
+3.943365976380542870e-01 1.252003942696350014e-01 4.092995513119635498e-01
+3.916103749033576498e-01 1.224998688123591362e-01 4.028120041341317625e-01
+3.888299858840064682e-01 1.198571984110099742e-01 3.963150954999720699e-01
+3.859947208059889556e-01 1.172741089547249538e-01 3.898105809973525515e-01
+3.831038714159066827e-01 1.147522874417901684e-01 3.833003546699703667e-01
+3.801567365353383798e-01 1.122933622374599760e-01 3.767864564999491295e-01
+3.771526284658990869e-01 1.098988810729940035e-01 3.702710792321893263e-01
+3.740908802950018708e-01 1.075702868621947472e-01 3.637565742534386581e-01
+3.709708541354928557e-01 1.053088915040240603e-01 3.572454561957943420e-01
+3.677919503089708275e-01 1.031158479486348478e-01 3.507404058933542013e-01
+3.645536174519507511e-01 1.009921209275927434e-01 3.442442712851704334e-01
+3.612553634855836804e-01 9.893845688361260771e-02 3.377600658314386384e-01
+3.578967673433453012e-01 9.695535377529579391e-02 3.312909639976103771e-01
+3.544774912975176551e-01 9.504303157033086591e-02 3.248402933678479765e-01
+3.509972936657820841e-01 9.320140436662560646e-02 3.184115229802063629e-01
+3.474560416161082133e-01 9.143005518316707492e-02 3.120082475359999274e-01
+3.438537237247893397e-01 8.972821452832538403e-02 3.056341672288407363e-01
+3.401904735486728781e-01 8.809468358171337887e-02 2.992931815755145442e-01
+3.364665724714709372e-01 8.652789261304066892e-02 2.929892038941975252e-01
+3.326824502647063309e-01 8.502592614588003195e-02 2.867260839053818455e-01
+3.288387024976534012e-01 8.358647051086640078e-02 2.805076847277695462e-01
+3.249360934730275985e-01 8.220683878873383255e-02 2.743378151941179288e-01
+3.209755584101655623e-01 8.088399100741089365e-02 2.682201871550352612e-01
+3.169582022236226426e-01 7.961456284429593855e-02 2.621583713198606391e-01
+3.128852946012805614e-01 7.839490235071094881e-02 2.561557528820557206e-01
+3.087582612248004899e-01 7.722111381434071387e-02 2.502154883125917717e-01
+3.045786711401687885e-01 7.608910749927882966e-02 2.443404647714875755e-01
+3.003482204670568367e-01 7.499465368295166190e-02 2.385332635717280492e-01
+2.960687128198414286e-01 7.393343917254721620e-02 2.327961290245241788e-01
+2.917420369856660312e-01 7.290112435224016529e-02 2.271309438018545013e-01
+2.873701425511966390e-01 7.189339879884681928e-02 2.215392116816457535e-01
+2.829550142767416343e-01 7.090603360902006380e-02 2.160220482113159313e-01
+2.784999277173711985e-01 6.993210653137302280e-02 2.105832735994622174e-01
+2.740068130913843047e-01 6.896804327168698512e-02 2.052225548327365479e-01
+2.694770905593398824e-01 6.801140076763184661e-02 1.999383122503714527e-01
+2.649127155611373241e-01 6.705861363954487842e-02 1.947301490341072916e-01
+2.603155555465970217e-01 6.610638194498252851e-02 1.895973275559961757e-01
+2.556873713350471533e-01 6.515168315524647036e-02 1.845388003264406274e-01
+2.510311382384792789e-01 6.418928564209233634e-02 1.795555007506528800e-01
+2.463515264850693609e-01 6.321115386076697762e-02 1.746505568409140452e-01
+2.416465428487372114e-01 6.222162722501616700e-02 1.698160042316500806e-01
+2.369174512696113344e-01 6.121879219616855466e-02 1.650498029374760922e-01
+2.321653556071113234e-01 6.020099184329732317e-02 1.603497740495725687e-01
+2.273975644358762205e-01 5.915624173942467950e-02 1.557218456563352615e-01
+2.226121431237116921e-01 5.808842465569693386e-02 1.511590815358170026e-01
+2.178074381899826051e-01 5.700049790743180050e-02 1.466558187034970040e-01
+2.129839422000848193e-01 5.589168645699472276e-02 1.422095068240733784e-01]; 
+
+   case 'bal' 
+      RGB = [9.317630180115785143e-02 1.111733294776027225e-01 2.615123885530547532e-01
+9.697151501690241815e-02 1.168702109792841837e-01 2.730963071061036085e-01
+1.009688451686782534e-01 1.223931506799195018e-01 2.849103610759459171e-01
+1.049927013864766501e-01 1.278243708004132007e-01 2.968738052891420898e-01
+1.089874020283561201e-01 1.331935038256579495e-01 3.089538370897204067e-01
+1.129223008178065757e-01 1.385131449459734432e-01 3.211528356563003173e-01
+1.167787372671460905e-01 1.437907235567953967e-01 3.334763137669404798e-01
+1.205463368759411846e-01 1.490330498991488395e-01 3.459192712822865556e-01
+1.242159653236002137e-01 1.542448960991174289e-01 3.584824902114073786e-01
+1.277778433781233958e-01 1.594292997650425259e-01 3.711737182907450250e-01
+1.312243830518974863e-01 1.645899274655008293e-01 3.839938980982077199e-01
+1.345490385720651272e-01 1.697307784244891371e-01 3.969402498465131601e-01
+1.377440294143187915e-01 1.748552489081271477e-01 4.100132193954066917e-01
+1.407996250839473606e-01 1.799660943911219058e-01 4.232173781877683894e-01
+1.437072840727513789e-01 1.850671827584920992e-01 4.365502201613832844e-01
+1.464560785040432134e-01 1.901619264187031366e-01 4.500130967746718835e-01
+1.490348239402249919e-01 1.952544786288682443e-01 4.636036238706138235e-01
+1.514309258266629821e-01 2.003493745808981319e-01 4.773185296806868871e-01
+1.536266468153191511e-01 2.054503782969492598e-01 4.911623505831314018e-01
+1.556073044691906326e-01 2.105638989188344801e-01 5.051241984185815825e-01
+1.573534941852142433e-01 2.156962129560367203e-01 5.191977165014443063e-01
+1.588411077773489166e-01 2.208540630983729658e-01 5.333780986311171812e-01
+1.600396310676128475e-01 2.260448054488821412e-01 5.476626851250718797e-01
+1.609205321230856855e-01 2.312792188936386995e-01 5.620307968352061812e-01
+1.614455266589641669e-01 2.365687572657042548e-01 5.764661948566720540e-01
+1.615687582201552897e-01 2.419271731798259828e-01 5.909472809712390529e-01
+1.612352769386722617e-01 2.473711867632350236e-01 6.054446786315181850e-01
+1.603793369556453796e-01 2.529213001868846900e-01 6.199179403497330210e-01
+1.589165703217830516e-01 2.586022090180682964e-01 6.343183928801525706e-01
+1.567387388150081051e-01 2.644444177118183137e-01 6.485832602021305293e-01
+1.537422741701028883e-01 2.704875236386605764e-01 6.625942914402649375e-01
+1.497539850217274870e-01 2.767772906869140348e-01 6.762428866538948702e-01
+1.446190280141932405e-01 2.833703371099008383e-01 6.893303155405390292e-01
+1.381506719438430897e-01 2.903290266080994497e-01 7.016166706228140759e-01
+1.301937481102784511e-01 2.977137475582261605e-01 7.127928058673724809e-01
+1.207056294812082625e-01 3.055623316038361126e-01 7.225101391519437311e-01
+1.098226938414934850e-01 3.138651882979107688e-01 7.304694442052537262e-01
+9.795843445627248902e-02 3.225431024585883599e-01 7.365271649499161022e-01
+8.570023827886968926e-02 3.314661612751826358e-01 7.407718073497575606e-01
+7.367688675533522191e-02 3.404967458048910878e-01 7.434693436710165804e-01
+6.252232597310111717e-02 3.495197377754474255e-01 7.449562973790243570e-01
+5.283258403911513662e-02 3.584600781237165523e-01 7.455451847703780111e-01
+4.520938539971628561e-02 3.672749347230809258e-01 7.454889092261348660e-01
+4.023631323597558207e-02 3.759418522020857023e-01 7.449841371058433248e-01
+3.831576485736640919e-02 3.844536826035842014e-01 7.441746283479093726e-01
+3.948349528027724625e-02 3.928137536670130436e-01 7.431581338661337188e-01
+4.345843888396401511e-02 4.010237097170425424e-01 7.420243047032398787e-01
+4.962431895510652918e-02 4.090953160508887798e-01 7.408166831290733390e-01
+5.739800117053886486e-02 4.170346954168047682e-01 7.395877539875740370e-01
+6.626017539288729663e-02 4.248521500099918247e-01 7.383650122111450331e-01
+7.582789138192139178e-02 4.325572249230948407e-01 7.371697936237424642e-01
+8.583710398799437868e-02 4.401583433039914506e-01 7.360206802189788178e-01
+9.611023898027164225e-02 4.476635745571445613e-01 7.349312516211791158e-01
+1.065303883460570755e-01 4.550804241299538089e-01 7.339117735870001047e-01
+1.170216465020320479e-01 4.624159111924117660e-01 7.329693696980987827e-01
+1.275357983203295742e-01 4.696767197731893662e-01 7.321074968220891988e-01
+1.380432121650685962e-01 4.768686794858796318e-01 7.313295149248254523e-01
+1.485266661140711986e-01 4.839970747487774561e-01 7.306374469250058734e-01
+1.589774367328510296e-01 4.910666599003393196e-01 7.300322634722052895e-01
+1.693927097070233589e-01 4.980816767007848478e-01 7.295140990156090410e-01
+1.797738575018875684e-01 5.050458714090990675e-01 7.290824177866462863e-01
+1.901252883653588299e-01 5.119625097219066001e-01 7.287361439246872186e-01
+2.004536741991692628e-01 5.188343886055641896e-01 7.284737667569484154e-01
+2.107674308545827713e-01 5.256638445778923918e-01 7.282934299212738827e-01
+2.210763664417479957e-01 5.324527583974503209e-01 7.281930113726282627e-01
+2.313914398990180310e-01 5.392025564688637251e-01 7.281702001646749300e-01
+2.417245888287989919e-01 5.459142096302009861e-01 7.282225751002735503e-01
+2.520885959217774586e-01 5.525882304010224511e-01 7.283476897674903139e-01
+2.624969693582706598e-01 5.592246702775622857e-01 7.285431679898072277e-01
+2.729638158446638374e-01 5.658231192947545951e-01 7.288068131774058100e-01
+2.835036864649327915e-01 5.723827108458280355e-01 7.291367343046032401e-01
+2.941313761905648416e-01 5.789021356407471064e-01 7.295314900628433463e-01
+3.048616586033888742e-01 5.853796696249742304e-01 7.299902509334000866e-01
+3.157089391891977348e-01 5.918132215225327952e-01 7.305129762764809298e-01
+3.266868146870496870e-01 5.982004061606387424e-01 7.311005998876300982e-01
+3.378075337747806772e-01 6.045386495071959354e-01 7.317552128195412564e-01
+3.490818000871770965e-01 6.108253115449155946e-01 7.324796800093837934e-01
+3.605169723334935572e-01 6.170578982409773428e-01 7.332792190500567742e-01
+3.721163789840524760e-01 6.232343167456089184e-01 7.341612307067191256e-01
+3.838798790902256397e-01 6.293530561660979350e-01 7.351337469132933622e-01
+3.958028137607393915e-01 6.354134382185918639e-01 7.362060213183361235e-01
+4.078755353103907799e-01 6.414158575290970221e-01 7.373884640869047269e-01
+4.200825599604326444e-01 6.473620651543986471e-01 7.386930839012650907e-01
+4.324066537782813580e-01 6.532548504780409937e-01 7.401294470548486215e-01
+4.448270147115060968e-01 6.590982595876608841e-01 7.417069328868316491e-01
+4.573210929073768805e-01 6.648973878622411737e-01 7.434335263117878290e-01
+4.698658823662555939e-01 6.706581495075844002e-01 7.453153847182404368e-01
+4.824391638200489774e-01 6.763869948243975694e-01 7.473565606883062484e-01
+4.950205546820442004e-01 6.820906132919950515e-01 7.495589040396917202e-01
+5.075922656244505893e-01 6.877756591216436233e-01 7.519221394187723950e-01
+5.201395209800695474e-01 6.934485275105084501e-01 7.544440922042097153e-01
+5.326506556783058288e-01 6.991151975856019218e-01 7.571210204550441469e-01
+5.451151059190834092e-01 7.047815278674717243e-01 7.599492971931861574e-01
+5.575181558550945660e-01 7.104543187762520917e-01 7.629291415211207905e-01
+5.698635397781144363e-01 7.161365136199150383e-01 7.660488334775965580e-01
+5.821485860154738123e-01 7.218322109491160932e-01 7.693023567855580280e-01
+5.943602368020499682e-01 7.275477994362923306e-01 7.726916325476315128e-01
+6.065080899095934841e-01 7.332844479726540188e-01 7.762041114816310428e-01
+6.185864665812587093e-01 7.390466790641196937e-01 7.798383670352863062e-01
+6.305963554035781682e-01 7.448373397672364282e-01 7.835892177406345027e-01
+6.425403291413834816e-01 7.506587685331359561e-01 7.874510644025978223e-01
+6.544185977825304201e-01 7.565137308188258913e-01 7.914204294842384080e-01
+6.662315287143806275e-01 7.624048800378464552e-01 7.954941819359623301e-01
+6.779850393157120791e-01 7.683332855369554570e-01 7.996659972294575258e-01
+6.896755013217630292e-01 7.743024253591546113e-01 8.039360994237751967e-01
+7.013107513266423343e-01 7.803126348729136907e-01 8.082975524678305268e-01
+7.128885314512861671e-01 7.863668558670167119e-01 8.127502175082055302e-01
+7.244112448085553435e-01 7.924667152464015540e-01 8.172911293271547528e-01
+7.358836989688380958e-01 7.986130654557248576e-01 8.219158971644889844e-01
+7.473044386446877629e-01 8.048084510111997991e-01 8.266243361574353576e-01
+7.586759860087319840e-01 8.110542493572184819e-01 8.314137476978961105e-01
+7.700007022560961811e-01 8.173518180665149124e-01 8.362815657919246970e-01
+7.812789490175476859e-01 8.237030526155880716e-01 8.412265533654796901e-01
+7.925116214732782494e-01 8.301096652946458043e-01 8.462470956714009951e-01
+8.036997510351909790e-01 8.365733017623517842e-01 8.513414099007207136e-01
+8.148431081888104499e-01 8.430959697406819053e-01 8.565084542610862384e-01
+8.259421593641688153e-01 8.496794646156250463e-01 8.617465433522450979e-01
+8.369967539127278755e-01 8.563257710703112702e-01 8.670541605111352634e-01
+8.480038340013845710e-01 8.630377874332209043e-01 8.724315628924932398e-01
+8.589628398368314155e-01 8.698176873531217046e-01 8.778768407867350021e-01
+8.698718779534676537e-01 8.766681056859056964e-01 8.833884311630415542e-01
+8.807225950585577667e-01 8.835937613774932364e-01 8.889689808541467730e-01
+8.915125639987498962e-01 8.905976582376062822e-01 8.946157932523199907e-01
+9.022321856472953483e-01 8.976851819173250480e-01 9.003303399902121695e-01
+9.128629530771473766e-01 9.048646775143293075e-01 9.061201920398328502e-01
+9.233906674988954233e-01 9.121434538185491103e-01 9.119872701021832784e-01
+9.337690699519377580e-01 9.195389121458987791e-01 9.179604265763980919e-01
+9.438768578707728008e-01 9.270905817099515112e-01 9.241478407896098757e-01
+9.450241336950316873e-01 9.267273985243987822e-01 9.232017297254778709e-01
+9.401771503305338396e-01 9.175010969420787088e-01 9.127353023021862466e-01
+9.357788176131993652e-01 9.081849602977229985e-01 9.019958970504049489e-01
+9.316195516453253944e-01 8.988455936080792519e-01 8.911247259869568005e-01
+9.276366903952597553e-01 8.895015346080178409e-01 8.801625091446737548e-01
+9.237963723082156520e-01 8.801619939913720714e-01 8.691306632065185500e-01
+9.200767818087643990e-01 8.708323115565800299e-01 8.580426479951916985e-01
+9.164622665155582881e-01 8.615158650696722598e-01 8.469079246742292622e-01
+9.129409700010679973e-01 8.522148302070590153e-01 8.357335125969563849e-01
+9.095033897880691054e-01 8.429306461313940124e-01 8.245249535921664874e-01
+9.061413505699446036e-01 8.336643536120030840e-01 8.132870275157044748e-01
+9.028482401464246188e-01 8.244164969479621519e-01 8.020234992942889551e-01
+8.996183458250350817e-01 8.151873435674267254e-01 7.907375926293952473e-01
+8.964464017336835067e-01 8.059770371403549571e-01 7.794323253122593664e-01
+8.933280984986637918e-01 7.967854062668440207e-01 7.681100636805964221e-01
+8.902585423162623357e-01 7.876125240246927284e-01 7.567737971546929510e-01
+8.872341531517662361e-01 7.784580066111700392e-01 7.454255275413548265e-01
+8.842515223931736168e-01 7.693214239645329577e-01 7.340672060990318659e-01
+8.813075692568397290e-01 7.602022354826803996e-01 7.227005864751234743e-01
+8.783989821496545058e-01 7.511000050313838550e-01 7.113277185683902770e-01
+8.755220238171187441e-01 7.420144833045193566e-01 6.999511354610528091e-01
+8.726749843514796101e-01 7.329446408023255755e-01 6.885716411869530207e-01
+8.698547215416584377e-01 7.238900130170270453e-01 6.771913952144653637e-01
+8.670596624933959440e-01 7.148495108503407636e-01 6.658111988100340328e-01
+8.642855405275950975e-01 7.058231520382152180e-01 6.544344321908397433e-01
+8.615312235931757989e-01 6.968096810882964398e-01 6.430616521710770250e-01
+8.587945613193220806e-01 6.878082471826545419e-01 6.316944172411573799e-01
+8.560737697641845889e-01 6.788178389092562881e-01 6.203340096274330140e-01
+8.533647514077651319e-01 6.698384520573987810e-01 6.089840337795546787e-01
+8.506671813652186831e-01 6.608684511065675560e-01 5.976445430267850467e-01
+8.479803760976425409e-01 6.519062997089123401e-01 5.863159553827915760e-01
+8.452992890124730874e-01 6.429524288345007665e-01 5.750030931030669645e-01
+8.426233261680482478e-01 6.340052727647743636e-01 5.637064935396088883e-01
+8.399526706457652869e-01 6.250628349958033958e-01 5.524259435430849408e-01
+8.372823606159069953e-01 6.161255232979981900e-01 5.411665126797099434e-01
+8.346115013722664733e-01 6.071918418882036317e-01 5.299292934604437066e-01
+8.319416971332159738e-01 5.982589838531851001e-01 5.187128588454869016e-01
+8.292658393187906096e-01 5.893284247613858051e-01 5.075248627530006829e-01
+8.265865191963318592e-01 5.803968068112989043e-01 4.963630791145096643e-01
+8.239007716165898110e-01 5.714634777707676694e-01 4.852311209906218226e-01
+8.212047236427109098e-01 5.625283035002011101e-01 4.741337367172645534e-01
+8.185028441784485409e-01 5.535866371885466153e-01 4.630669974760600605e-01
+8.157857974447502158e-01 5.446412013022012832e-01 4.520417208585162938e-01
+8.130598755024439628e-01 5.356861530869529986e-01 4.410523109242584505e-01
+8.103157295614864530e-01 5.267242547499885186e-01 4.301100025814295069e-01
+8.075600763067809496e-01 5.177491168092126506e-01 4.192090517728162546e-01
+8.047829983640772955e-01 5.087638530967844019e-01 4.083617627821872209e-01
+8.019913643823087801e-01 4.997616265469864705e-01 3.975626288212918968e-01
+7.991776069093209367e-01 4.907441098507538402e-01 3.868219510427612362e-01
+7.963412506983238437e-01 4.817086347924898759e-01 3.761426799347312722e-01
+7.934853391750592566e-01 4.726500967551418020e-01 3.655242898980974875e-01
+7.906020861628313412e-01 4.635701843716890092e-01 3.549783159786080722e-01
+7.876922078438237662e-01 4.544650164439674178e-01 3.445075235304189132e-01
+7.847584433242353885e-01 4.453290095612297272e-01 3.341130019968927001e-01
+7.817943763481589592e-01 4.361626378195018194e-01 3.238062118505327658e-01
+7.787986023472407426e-01 4.269628178617235204e-01 3.135938243777520174e-01
+7.757700306772615795e-01 4.177259860608659170e-01 3.034828822113839197e-01
+7.727073763310282617e-01 4.084484227667745659e-01 2.934814547614346680e-01
+7.696090956246998127e-01 3.991262801626034307e-01 2.835988305456279002e-01
+7.664733140591651894e-01 3.897556205902359405e-01 2.738457322824414675e-01
+7.632977462662783319e-01 3.803324674237734127e-01 2.642345539395078435e-01
+7.600796083228246180e-01 3.708528707479538111e-01 2.547796171102231777e-01
+7.568155232311498670e-01 3.613129902046505748e-01 2.454974414736316723e-01
+7.535014210471865370e-01 3.517091973617619272e-01 2.364070204678299647e-01
+7.501324359996863755e-01 3.420381997805444496e-01 2.275300884680255264e-01
+7.467083678923864820e-01 3.322917332197801166e-01 2.188868097223075626e-01
+7.432206214135255173e-01 3.224689513722865386e-01 2.105072965395320406e-01
+7.396626352495903056e-01 3.125667176366879740e-01 2.024226257801388651e-01
+7.360276592028781595e-01 3.025817058357924139e-01 1.946669682951213953e-01
+7.323075054306246168e-01 2.925115926125090304e-01 1.872788656593587786e-01
+7.284886793139783157e-01 2.823599622393618280e-01 1.803025816545419935e-01
+7.245597795551689257e-01 2.721283507524605572e-01 1.737830391183990686e-01
+7.205052554891407945e-01 2.618237699935750395e-01 1.677681078164939554e-01
+7.163077524522897255e-01 2.514568470079543427e-01 1.623050371038979034e-01
+7.119477511381474555e-01 2.410431671523047270e-01 1.574376915741905747e-01
+7.074046106878864038e-01 2.306029576903746436e-01 1.532027782639572566e-01
+7.026577763956233236e-01 2.201603247696940491e-01 1.496264194674281345e-01
+6.976856380676357272e-01 2.097462458983016809e-01 1.467193374830310926e-01
+6.924700993857928477e-01 1.993923480969033712e-01 1.444757571309586708e-01
+6.869956304794752056e-01 1.891326217641629281e-01 1.428720296451389260e-01
+6.812509389222788370e-01 1.790005719286615893e-01 1.418684919672574540e-01
+6.752290404511711586e-01 1.690283951735306323e-01 1.414126182563193168e-01
+6.689272347019628029e-01 1.592460113853382819e-01 1.414436246187784352e-01
+6.623462930327670417e-01 1.496814992323431404e-01 1.418966965532167945e-01
+6.554894621920681619e-01 1.403622590219790744e-01 1.427060758527507467e-01
+6.483618361407726960e-01 1.313154491044398742e-01 1.438093776439538507e-01
+6.409690900196458596e-01 1.225708994915949840e-01 1.451466621124405387e-01
+6.333171868548845840e-01 1.141616381299322275e-01 1.466635532234118466e-01
+6.254117682555888624e-01 1.061263207405454406e-01 1.483083323541042609e-01
+6.172580943089347461e-01 9.850955940169045522e-02 1.500342818055006577e-01
+6.088612137441752337e-01 9.136271116346880716e-02 1.517946748017894032e-01
+6.002260075568476294e-01 8.474268845605749390e-02 1.535471889644061949e-01
+5.913580665313180607e-01 7.870937974751122945e-02 1.552475962263118736e-01
+5.822640724597829553e-01 7.332110668924821106e-02 1.568528524628541587e-01
+5.729523242155735163e-01 6.862870182587510470e-02 1.583209522546889236e-01
+5.634337248699358147e-01 6.466696013382158825e-02 1.596097119552595534e-01
+5.537224099506778963e-01 6.144626935987178989e-02 1.606779590153868675e-01
+5.438351395676241928e-01 5.894914800814857886e-02 1.614895452047331870e-01
+5.337912133736735232e-01 5.712858102881844535e-02 1.620138116792186611e-01
+5.236119994512118403e-01 5.591095129374230172e-02 1.622265257547594042e-01
+5.133214710039554207e-01 5.519900277454217047e-02 1.621082697921440163e-01
+5.029415119053961547e-01 5.489268743951671026e-02 1.616521201270082198e-01
+4.924920560465744224e-01 5.489497800522934179e-02 1.608594568967110505e-01
+4.819970419875420631e-01 5.509874164212420766e-02 1.597294678457327477e-01
+4.714685312956432006e-01 5.543752958786138385e-02 1.582803570073196830e-01
+4.609298385556733768e-01 5.581817450175154821e-02 1.565161535498545142e-01
+4.503882306974699712e-01 5.620093240974462917e-02 1.544603609580012249e-01
+4.398550445667638309e-01 5.653967482715421822e-02 1.521296397207116124e-01
+4.293395854267749168e-01 5.679892905513854451e-02 1.495413040881575784e-01
+4.188488052114383020e-01 5.695351275720081374e-02 1.467131019928892832e-01
+4.083874753510262079e-01 5.698679735961746651e-02 1.436626150429021476e-01
+3.979584206972520133e-01 5.688899115379054960e-02 1.404067946849407167e-01
+3.875661805934746962e-01 5.664744510513378128e-02 1.369596232193354413e-01
+3.772162562473511671e-01 5.624858727791105101e-02 1.333332882463785507e-01
+3.669009710312429173e-01 5.571027577451325569e-02 1.295456315830630090e-01
+3.566289201162299305e-01 5.501236188184371184e-02 1.256041268313332904e-01
+3.463946141954395985e-01 5.416713051157899528e-02 1.215221064681567403e-01
+3.362018241761821069e-01 5.316577293008726418e-02 1.173074037138401304e-01
+3.260424402261492549e-01 5.202497987647033972e-02 1.129713889339670624e-01
+3.159278573165507087e-01 5.071934147936141973e-02 1.085175153831856448e-01
+3.058440467352613878e-01 4.927677960771512794e-02 1.039569210271578392e-01
+2.957906289005873823e-01 4.769542811326495796e-02 9.929501197500162357e-02
+2.857761694878986902e-01 4.595516903310007534e-02 9.453469664208309642e-02
+2.757883929056377248e-01 4.407729543414404955e-02 8.968329380554104779e-02
+2.658251433737037206e-01 4.206161274965801444e-02 8.474472186508703875e-02
+2.558840557281191197e-01 3.990046570244704105e-02 7.972236454569985031e-02
+2.459622220783502511e-01 3.762595141506584057e-02 7.461913567560218841e-02
+2.360563646646140490e-01 3.529747994604028744e-02 6.943744239412558139e-02]; 
+
+   case 'gra'
+      RGB = [5.119113838889112324e-07 2.052270195661655352e-06 5.982577941045682640e-06
+2.598440803609315740e-04 2.625944024536107477e-04 2.770622839605119624e-04
+8.656156394278343835e-04 8.570638031131799393e-04 8.794207369001087564e-04
+1.769403238430108027e-03 1.740368058158140796e-03 1.768607096399604827e-03
+2.949472160671299040e-03 2.891903379202926793e-03 2.924180394823831797e-03
+4.392323531342203803e-03 4.298904740810657703e-03 4.333431047933433700e-03
+6.088553115957890012e-03 5.952519318106651129e-03 5.987527380406317858e-03
+8.031191715623246449e-03 7.846222922619310730e-03 7.879950296964649201e-03
+1.021487523527209347e-02 9.975026089550139557e-03 1.000570608701620810e-02
+1.263537226121889262e-02 1.233502163300135256e-02 1.236087717148891089e-02
+1.528929074309834900e-02 1.492310361152201538e-02 1.494234288239030227e-02
+1.817388406754013447e-02 1.773678153559082871e-02 1.774759483393608533e-02
+2.128691657088564032e-02 2.077405157770592994e-02 2.077460893832101113e-02
+2.462656669738432988e-02 2.403330390048570228e-02 2.402175331762853791e-02
+2.819135511163322477e-02 2.751325392935317568e-02 2.748772001065160481e-02
+3.198008997843642537e-02 3.121289009539909495e-02 3.117147304311678954e-02
+3.599182442355883943e-02 3.513143325966101155e-02 3.507220810044759524e-02
+4.022582286584987926e-02 3.926830463975648777e-02 3.918932064337803806e-02
+4.449007920559793633e-02 4.350122490641009781e-02 4.340640025397465157e-02
+4.870367428407672977e-02 4.767846692745423415e-02 4.756790269604229543e-02
+5.287362099388332598e-02 5.181334368492381687e-02 5.168705396373681621e-02
+5.700314746954803641e-02 5.590901252301124641e-02 5.576700147480036923e-02
+6.109513723484618491e-02 5.996829329212761267e-02 5.981055680351737153e-02
+6.515218007540821143e-02 6.399371820125457355e-02 6.382024521975740439e-02
+6.917661353844734018e-02 6.798757248509634810e-02 6.779834611081525519e-02
+7.317055710313111194e-02 7.195192788781537563e-02 7.174692627103734788e-02
+7.713594055593872567e-02 7.588867046670466632e-02 7.566786755046528423e-02
+8.107452773767656606e-02 7.979952385914274027e-02 7.956288999694530184e-02
+8.498793655960165672e-02 8.368606889245686076e-02 8.343357136470588853e-02
+8.887765598636060416e-02 8.754976022063193364e-02 8.728136366834671200e-02
+9.274506053351619372e-02 9.139194052486757092e-02 9.110760731542752455e-02
+9.659142271361736976e-02 9.521385270343013518e-02 9.491354324016601507e-02
+1.004179237775132127e-01 9.901665039071003149e-02 9.870032337586748250e-02
+1.042256630300536779e-01 1.028014070791676282e-01 1.024690197379714285e-01
+1.080156659465895397e-01 1.065691240661386929e-01 1.062206323382679229e-01
+1.117888912751462127e-01 1.103207374067532442e-01 1.099560961104033285e-01
+1.155462372762081913e-01 1.140571240219185878e-01 1.136762869947187948e-01
+1.192885472257254331e-01 1.177791070845015386e-01 1.173820273048238605e-01
+1.230166142857740674e-01 1.214874607860790545e-01 1.210740904776794746e-01
+1.267311858301593541e-01 1.251829145698133972e-01 1.247532052922631640e-01
+1.304329672982797728e-01 1.288661569013136721e-01 1.284200596282795426e-01
+1.341226256391360172e-01 1.325378386381312334e-01 1.320753038252369949e-01
+1.378007923979476801e-01 1.361985760492960551e-01 1.357195536930293212e-01
+1.414680664900422602e-01 1.398489535286627783e-01 1.393533932175645418e-01
+1.451250167001958413e-01 1.434895260394738747e-01 1.429773769986621423e-01
+1.487721839401931478e-01 1.471208213222370831e-01 1.465920324521616802e-01
+1.524100832928171334e-01 1.507433418935591463e-01 1.501978618037517477e-01
+1.560392058666605075e-01 1.543575668598215767e-01 1.537953438982961329e-01
+1.596600204829017322e-01 1.579639535664100758e-01 1.573849358452757696e-01
+1.632729752124383871e-01 1.615629391005102000e-01 1.609670745182808227e-01
+1.668784987794287578e-01 1.651549416631863942e-01 1.645421779242018656e-01
+1.704770018452845537e-01 1.687403618244931736e-01 1.681106464558155544e-01
+1.740688781854339839e-01 1.723195836736857167e-01 1.716728640397789662e-01
+1.776545057697057339e-01 1.758929758751424655e-01 1.752291991906090307e-01
+1.812342477558830656e-01 1.794608926393625181e-01 1.787800059799695696e-01
+1.848084534049017069e-01 1.830236746173136975e-01 1.823256249295160947e-01
+1.883774589251684672e-01 1.865816497254700890e-01 1.858663838346062414e-01
+1.919415882526751271e-01 1.901351339080520064e-01 1.894025985253704192e-01
+1.955011537728245652e-01 1.936844318422726863e-01 1.929345735709248333e-01
+1.990564569892651070e-01 1.972298375917654889e-01 1.964626029318853884e-01
+2.026077891444517665e-01 2.007716352128197101e-01 1.999869705657932872e-01
+2.061554317961845073e-01 2.043100993175656077e-01 2.035079509895849070e-01
+2.096996573539102737e-01 2.078454955978322194e-01 2.070258098028130989e-01
+2.132407295782156598e-01 2.113780813130166081e-01 2.105408041749530779e-01
+2.167789040465809003e-01 2.149081057449790388e-01 2.140531832997963901e-01
+2.203144285881817321e-01 2.184358106226793050e-01 2.175631888196422614e-01
+2.238475436902406246e-01 2.219614305190086845e-01 2.210710552217338698e-01
+2.273784828782031697e-01 2.254851932220399702e-01 2.245770102091559361e-01
+2.309074730717983193e-01 2.290073200827110744e-01 2.280812750482046902e-01
+2.344347349188553031e-01 2.325280263407684678e-01 2.315840648940526436e-01
+2.379604831085705419e-01 2.360475214306362868e-01 2.350855890963675088e-01
+2.414849266657837501e-01 2.395660092687221798e-01 2.385860514863973880e-01
+2.450082692276646656e-01 2.430836885235431177e-01 2.420856506468980207e-01
+2.485307093041047577e-01 2.466007528699289408e-01 2.455845801661603045e-01
+2.520524405229936926e-01 2.501173912284589962e-01 2.490830288772885037e-01
+2.555736518614571962e-01 2.536337879911821358e-01 2.525811810837814142e-01
+2.590945278640408023e-01 2.571501232345917431e-01 2.560792167723802693e-01
+2.626152488487566439e-01 2.606665729207388593e-01 2.595773118140702884e-01
+2.661359911018202906e-01 2.641833090872994227e-01 2.630756381540483857e-01
+2.696569270618426883e-01 2.677005000273448010e-01 2.665743639914045504e-01
+2.731782254941877985e-01 2.712183104595063399e-01 2.700736539492059607e-01
+2.767000516561451962e-01 2.747369016891675342e-01 2.735736692356186550e-01
+2.802225674535130939e-01 2.782564317612734595e-01 2.770745677966527931e-01
+2.837459315891543987e-01 2.817770556052956454e-01 2.805765044610715742e-01
+2.872702997040328943e-01 2.852989251728569320e-01 2.840796310779650780e-01
+2.907958245112020612e-01 2.888221895684777163e-01 2.875840966474506044e-01
+2.943226559231933992e-01 2.923469951738719153e-01 2.910900474449292785e-01
+2.978509411732042089e-01 2.958734857661936557e-01 2.945976271392962698e-01
+3.013808249304671394e-01 2.994018026306028979e-01 2.981069769054734420e-01
+3.049124494101519978e-01 3.029320846674894985e-01 3.016182355316066044e-01
+3.084459544781194551e-01 3.064644684946828401e-01 3.051315395212462755e-01
+3.119814777508492787e-01 3.099990885449340761e-01 3.086470231908091666e-01
+3.155191546907993305e-01 3.135360771589531526e-01 3.121648187625948867e-01
+3.190591186974824911e-01 3.170755646742604017e-01 3.156850564536164416e-01
+3.226015011944919908e-01 3.206176795100827426e-01 3.192078645604823350e-01
+3.261464317127154011e-01 3.241625482485306353e-01 3.227333695405575908e-01
+3.296940379699381807e-01 3.277102957122579041e-01 3.262616960896098095e-01
+3.332444459470546017e-01 3.312610450388014383e-01 3.297929672161359349e-01
+3.367977799610606948e-01 3.348149177517827924e-01 3.333273043125560831e-01
+3.403541627350049614e-01 3.383720338291492657e-01 3.368648272234392449e-01
+3.439137154650676598e-01 3.419325117686051185e-01 3.404056543109294508e-01
+3.474765578849234871e-01 3.454964686503906313e-01 3.439499025175156155e-01
+3.510428083275172195e-01 3.490640201975497847e-01 3.474976874262884485e-01
+3.546125837844137374e-01 3.526352808338130695e-01 3.510491233188203775e-01
+3.581859999628214664e-01 3.562103637392293742e-01 3.546043232307861115e-01
+3.617631713404313443e-01 3.597893809036549762e-01 3.581633990054478578e-01
+3.653442112181757850e-01 3.633724431782132114e-01 3.617264613451083854e-01
+3.689292317710045621e-01 3.669596603248330147e-01 3.652936198606414053e-01
+3.725183440967992365e-01 3.705511410639528158e-01 3.688649831191926354e-01
+3.761116582634963512e-01 3.741469931204933763e-01 3.724406586901452543e-01
+3.797092833545231416e-01 3.777473232681791138e-01 3.760207531894346200e-01
+3.833113275126273645e-01 3.813522373722905701e-01 3.796053723222968523e-01
+3.869178979821737419e-01 3.849618404309278485e-01 3.831946209245254420e-01
+3.905291011499888443e-01 3.885762366148534097e-01 3.867886030023093280e-01
+3.941450425848224692e-01 3.921955293059884440e-01 3.903874217707223315e-01
+3.977658270754869663e-01 3.958198211346236617e-01 3.939911796909281172e-01
+4.013915586677523906e-01 3.994492140154045079e-01 3.975999785061617997e-01
+4.050223407000290154e-01 4.030838091821594138e-01 4.012139192765472040e-01
+4.086582758379366798e-01 4.067237072216087768e-01 4.048331024128048461e-01
+4.122994661077632461e-01 4.103690081060247796e-01 4.084576277089013163e-01
+4.159460129289094255e-01 4.140198112248798523e-01 4.120875943736929670e-01
+4.195980171453375096e-01 4.176762154155350126e-01 4.157231010616072031e-01
+4.232555790560795228e-01 4.213383189930122175e-01 4.193642459024058966e-01
+4.269187984448540862e-01 4.250062197788932461e-01 4.230111265300784962e-01
+4.305877746088247471e-01 4.286800151293829186e-01 4.266638401108986955e-01
+4.342626063865396291e-01 4.323598019625811695e-01 4.303224833706847940e-01
+4.379433921850948153e-01 4.360456767849914539e-01 4.339871526213026076e-01
+4.416302300065532149e-01 4.397377357173059553e-01 4.376579437864426825e-01
+4.453232174736505011e-01 4.434360745195019549e-01 4.413349524267043966e-01
+4.490224518548273092e-01 4.471407886152713451e-01 4.450182737640205333e-01
+4.527280300886077913e-01 4.508519731158264210e-01 4.487080027054508036e-01
+4.564400488073677153e-01 4.545697228430990999e-01 4.524042338663719076e-01
+4.601586043605019882e-01 4.582941323523668786e-01 4.561070615930931660e-01
+4.638837928370361241e-01 4.620252959543280080e-01 4.598165799849223689e-01
+4.676157100876950357e-01 4.657633077366521435e-01 4.635328829157047692e-01
+4.713544517464566819e-01 4.695082615850322827e-01 4.672560640548638067e-01
+4.751001132516106673e-01 4.732602512037566433e-01 4.709862168879611066e-01
+4.788527898663595406e-01 4.770193701358209082e-01 4.747234347367983998e-01
+4.826125766989533550e-01 4.807857117826079274e-01 4.784678107790839019e-01
+4.863795687224105602e-01 4.845593694231487558e-01 4.822194380676812497e-01
+4.901538607938191183e-01 4.883404362329857862e-01 4.859784095494587564e-01
+4.939355476732588124e-01 4.921290053026548539e-01 4.897448180837610798e-01
+4.977247240423329777e-01 4.959251696558080735e-01 4.935187564605149624e-01
+5.015214845223622264e-01 4.997290222669866222e-01 4.973003174179899122e-01
+5.053259236922266195e-01 5.035406560790653963e-01 5.010895936602286493e-01
+5.091381361058908706e-01 5.073601640203813101e-01 5.048866778741611938e-01
+5.129582163096103598e-01 5.111876390215642774e-01 5.086916627464180829e-01
+5.167862588588553185e-01 5.150231740320770912e-01 5.125046409798591496e-01
+5.206223583349409711e-01 5.188668620364874640e-01 5.163257053098251337e-01
+5.244666093614033242e-01 5.227187960704765546e-01 5.201549485201331091e-01
+5.283191066201067265e-01 5.265790692366016934e-01 5.239924634588227770e-01
+5.321799448671195032e-01 5.304477747198240722e-01 5.278383430536651710e-01
+5.360492189483508918e-01 5.343250058028127247e-01 5.316926803274503177e-01
+5.399270238149752599e-01 5.382108558810341226e-01 5.355555684130592908e-01
+5.438134545386418273e-01 5.421054184776434859e-01 5.394271005683370923e-01
+5.477086063264958726e-01 5.460087872581790291e-01 5.433073701907695785e-01
+5.516125745359978794e-01 5.499210560450835672e-01 5.471964708319829729e-01
+5.555254546895829204e-01 5.538423188320419355e-01 5.510944962120672974e-01
+5.594473424891353019e-01 5.577726697981703063e-01 5.550015402337400428e-01
+5.633783338303157695e-01 5.617122033220391941e-01 5.589176969963529640e-01
+5.673185248167353922e-01 5.656610139955613459e-01 5.628430608097579890e-01
+5.712680117739895591e-01 5.696191966377359694e-01 5.667777262080311296e-01
+5.752268912635538634e-01 5.735868463082712809e-01 5.707217879630733792e-01
+5.791952600965620812e-01 5.775640583210815970e-01 5.746753410980864896e-01
+5.831732153474624702e-01 5.815509282576770689e-01 5.786384809009386121e-01
+5.871608543675723713e-01 5.855475519804423934e-01 5.826113029374229146e-01
+5.911582747985197894e-01 5.895540256458231543e-01 5.865939030644199415e-01
+5.951655745855983781e-01 5.935704457174205695e-01 5.905863774429681579e-01
+5.991828519910353812e-01 5.975969089789966437e-01 5.945888225512460101e-01
+6.032102056071760865e-01 6.016335125474120415e-01 5.986013351974859287e-01
+6.072477343695864560e-01 6.056803538854835800e-01 6.026240125328050645e-01
+6.112955375701087934e-01 6.097375308147855444e-01 6.066569520639827351e-01
+6.153537148698353665e-01 6.138051415283823919e-01 6.107002516661682590e-01
+6.194223663120388412e-01 6.178832846035217097e-01 6.147540095955469353e-01
+6.235015923350435418e-01 6.219720590142719940e-01 6.188183245019491796e-01
+6.275914937850678443e-01 6.260715641441202406e-01 6.228932954414247991e-01
+6.316921719290113924e-01 6.301818997985384474e-01 6.269790218887789646e-01
+6.358037284672281020e-01 6.343031662175184771e-01 6.310756037500810933e-01
+6.399262655462556459e-01 6.384354640880801623e-01 6.351831413751425348e-01
+6.440598857715362779e-01 6.425788945567643129e-01 6.393017355699824877e-01
+6.482046922201168959e-01 6.467335592421092905e-01 6.434314876092731561e-01
+6.523607884533356716e-01 6.508995602471195907e-01 6.475724992487805753e-01
+6.565282785295067924e-01 6.550770001717296509e-01 6.517248727377952244e-01
+6.607072670166060924e-01 6.592659821252698782e-01 6.558887108315696324e-01
+6.648978590049534620e-01 6.634666097389374517e-01 6.600641168037573170e-01
+6.691001601199109139e-01 6.676789871782776720e-01 6.642511944588598283e-01
+6.733142765345891956e-01 6.719032191556818523e-01 6.684500481446935538e-01
+6.775403149825812710e-01 6.761394109429005317e-01 6.726607827648712901e-01
+6.817783827707052380e-01 6.803876683835863304e-01 6.768835037913099040e-01
+6.860285877917917663e-01 6.846480979058627847e-01 6.811183172767648619e-01
+6.902910385374814162e-01 6.889208065349254895e-01 6.853653298673966221e-01
+6.945658441110833525e-01 6.932059019056816540e-01 6.896246488153768839e-01
+6.988531142404552643e-01 6.975034922754330680e-01 6.938963819915323628e-01
+7.031529592909376847e-01 7.018136865365992572e-01 6.981806378980350836e-01
+7.074654902783347188e-01 7.061365942294985931e-01 7.024775256811436330e-01
+7.117908188819498383e-01 7.104723255551799177e-01 7.067871551439977029e-01
+7.161290574576848478e-01 7.148209913883080135e-01 7.111096367594695877e-01
+7.204803190511824829e-01 7.191827032901243477e-01 7.154450816830777438e-01
+7.248447174110647095e-01 7.235575735214593296e-01 7.197936017659686270e-01
+7.292223670022126569e-01 7.279457150558282796e-01 7.241553095679664764e-01
+7.336133830191388094e-01 7.323472415925961210e-01 7.285303183706990371e-01
+7.380178813994349163e-01 7.367622675702208968e-01 7.329187421908015532e-01
+7.424359788373007252e-01 7.411909081795812204e-01 7.373206957932009198e-01
+7.468677927971572039e-01 7.456332793773956524e-01 7.417362947044913168e-01
+7.513134415273599043e-01 7.500894978997243445e-01 7.461656552263956632e-01
+7.557730440739957034e-01 7.545596812755732685e-01 7.506088944493225501e-01
+7.602467202947890135e-01 7.590439478405959228e-01 7.550661302660249818e-01
+7.647345908731115749e-01 7.635424167508956250e-01 7.595374813853584817e-01
+7.692367773320856195e-01 7.680552079969388268e-01 7.640230673461460009e-01
+7.737534020488213704e-01 7.725824424175786742e-01 7.685230085311559600e-01
+7.782845882687531303e-01 7.771242417141914771e-01 7.730374261811926440e-01
+7.828304601200990476e-01 7.816807284649387455e-01 7.775664424093062799e-01
+7.873911426284513349e-01 7.862520261391466869e-01 7.821101802151280147e-01
+7.919667617314893882e-01 7.908382591118159333e-01 7.866687634993275724e-01
+7.965574442938269106e-01 7.954395526782646053e-01 7.912423170782062476e-01
+8.011633181219949273e-01 8.000560330689072686e-01 7.958309666984236808e-01
+8.057845119795647992e-01 8.046878274641713347e-01 8.004348390518634115e-01
+8.104211556024298879e-01 8.093350640095594573e-01 8.050540617906442042e-01
+8.150733797142104553e-01 8.139978718308641392e-01 8.096887635422753693e-01
+8.197413160418366429e-01 8.186763810495288896e-01 8.143390739249705135e-01
+8.244250973312831077e-01 8.233707227981730270e-01 8.190051235631107263e-01
+8.291248573634558694e-01 8.280810292362735803e-01 8.236870441028736334e-01
+8.338407309702662307e-01 8.328074335660153871e-01 8.283849682280266524e-01
+8.385728540508587958e-01 8.375500700483110572e-01 8.330990296758882252e-01
+8.433213635880250081e-01 8.423090740189962400e-01 8.378293632534637991e-01
+8.480863976647909919e-01 8.470845819052075232e-01 8.425761048537626641e-01
+8.528680954812019044e-01 8.518767312419356363e-01 8.473393914722943121e-01
+8.576665973712844782e-01 8.566856606887783832e-01 8.521193612237554227e-01
+8.624820448202135115e-01 8.615115100468785370e-01 8.569161533589082502e-01
+8.673145804816755344e-01 8.663544202760624646e-01 8.617299082816555211e-01
+8.721643481954295396e-01 8.712145335121869172e-01 8.665607675663183906e-01
+8.770314930050886471e-01 8.760919930846851056e-01 8.714088739751210122e-01
+8.819161611761232589e-01 8.809869435343266053e-01 8.762743714758871594e-01
+8.868185002140476225e-01 8.858995306312075213e-01 8.811574052599523421e-01
+8.917386588828791760e-01 8.908299013929442678e-01 8.860581217602967463e-01
+8.966767872237935144e-01 8.957782041031091547e-01 8.909766686699112093e-01
+9.016330365740294894e-01 9.007445883298949019e-01 8.959131949603859058e-01
+9.066075595860336733e-01 9.057292049450164084e-01 9.008678509007446156e-01
+9.116005102468445198e-01 9.107322061428585469e-01 9.058407880765154685e-01
+9.166120438977335416e-01 9.157537454598729809e-01 9.108321594090563744e-01
+9.216423172541110542e-01 9.207939777942257820e-01 9.158421191751267010e-01
+9.266914884256760576e-01 9.258530594257129431e-01 9.208708230267246275e-01
+9.317597169368545540e-01 9.309311480359353519e-01 9.259184280111854015e-01
+9.368471637474911073e-01 9.360284027287524289e-01 9.309850925915528208e-01
+9.419539912738585929e-01 9.411449840510025533e-01 9.360709766672253851e-01
+9.470803634098973189e-01 9.462810540135232484e-01 9.411762415948876637e-01
+9.522264455488126389e-01 9.514367761124457035e-01 9.463010502097274346e-01
+9.573924046049070435e-01 9.566123153508007126e-01 9.514455668469502525e-01
+9.625784090357906164e-01 9.618078382604079435e-01 9.566099573635956643e-01
+9.677846288648154216e-01 9.670235129241012695e-01 9.617943891606574036e-01
+9.730112357039150117e-01 9.722595089982409844e-01 9.669990312055217752e-01
+9.782584027767170509e-01 9.775159977355695196e-01 9.722240540547290033e-01
+9.835263049420009951e-01 9.827931520083860173e-01 9.774696298770532144e-01
+9.888151187175039381e-01 9.880911463320615207e-01 9.827359324769276983e-01
+9.941250223040635214e-01 9.934101568888956679e-01 9.880231373182063459e-01
+9.994561956101176703e-01 9.987503615523224410e-01 9.933314215482736964e-01]; 
+
+   case 'oxy' 
+      RGB = [2.503217690585841648e-01 2.046237300762866404e-02 1.966891524096342492e-02
+2.555648459031592545e-01 2.111591456205731687e-02 2.090007960568026485e-02
+2.608015512876060149e-01 2.176436656689777205e-02 2.215967228611414111e-02
+2.660446264484087608e-01 2.238303577293145399e-02 2.344016212259009482e-02
+2.712886712210940687e-01 2.298148595687718801e-02 2.474301784763054818e-02
+2.765326364024714989e-01 2.356133594445880552e-02 2.606762144216200061e-02
+2.817861616671273883e-01 2.410204070052599998e-02 2.740685289115278589e-02
+2.870367982396965223e-01 2.462864448899236905e-02 2.876669328790133415e-02
+2.922964729271802509e-01 2.511521382538545177e-02 3.013810573921637051e-02
+2.975597737008193189e-01 2.557236440082744783e-02 3.152275139605174165e-02
+3.028221259572578816e-01 2.600980779972315513e-02 3.292220687889551439e-02
+3.080989498969098905e-01 2.639179365308667174e-02 3.432344572619091400e-02
+3.133766829953620880e-01 2.674829090811269017e-02 3.573422597599480721e-02
+3.186553157006936643e-01 2.707912721943054463e-02 3.715280555634475207e-02
+3.239494929539773471e-01 2.734824710730623595e-02 3.856493364156053649e-02
+3.292456607259481305e-01 2.758740066123798601e-02 3.997915613902540410e-02
+3.345444278514146941e-01 2.779482795061332528e-02 4.137064065412290187e-02
+3.398547648028715784e-01 2.794706430858015858e-02 4.271748371599067701e-02
+3.451724938219263294e-01 2.805368502448264342e-02 4.402857557145471029e-02
+3.504942702458693216e-01 2.812284384388611183e-02 4.530588662285887219e-02
+3.558206849295221796e-01 2.815263330374409914e-02 4.654771396733792949e-02
+3.611591248942810362e-01 2.812226066677377817e-02 4.774545304821291997e-02
+3.665053860525750440e-01 2.804229091411641200e-02 4.890135088859193929e-02
+3.718571787846235432e-01 2.791864422174392124e-02 5.001583572284549334e-02
+3.772149143594046850e-01 2.774987601297047857e-02 5.108646119902058441e-02
+3.825789453973626464e-01 2.753471831366087474e-02 5.211053476335369278e-02
+3.879495474114582620e-01 2.727215754453635524e-02 5.308509691226611510e-02
+3.933299882018631566e-01 2.695211659028963827e-02 5.400332569218738860e-02
+3.987172740322774689e-01 2.658339014111724477e-02 5.486495007360833037e-02
+4.041100983203390062e-01 2.617015416328878283e-02 5.566751194225177252e-02
+4.095080947848049324e-01 2.571397721177636972e-02 5.640694245975855919e-02
+4.149106638808665037e-01 2.521741655377478589e-02 5.707880838445476140e-02
+4.203169224276966931e-01 2.468426285194311523e-02 5.767829102284769555e-02
+4.257256449760880579e-01 2.411983059354547848e-02 5.820016787208186909e-02
+4.311355423694091527e-01 2.353014014799948567e-02 5.863827924234723404e-02
+4.365491859863961932e-01 2.290868330200904537e-02 5.897909145270988779e-02
+4.419598927187284310e-01 2.228071155950197418e-02 5.922145534252384186e-02
+4.473641324377782280e-01 2.166211126655111924e-02 5.935827807305734533e-02
+4.527575481284770720e-01 2.107281505394200879e-02 5.938213194820316648e-02
+4.581418547792654450e-01 2.051270615727579169e-02 5.927134198778213209e-02
+4.635070947573724509e-01 2.002404746597910568e-02 5.902266227273281901e-02
+4.688449749746688711e-01 1.964556257714445905e-02 5.862776439317262528e-02
+4.741516624279997205e-01 1.940234058919213661e-02 5.806380572763907705e-02
+4.794118268811014549e-01 1.936335100061424216e-02 5.733101890860898414e-02
+4.846131761746131361e-01 1.958983233892800865e-02 5.642063175373675937e-02
+4.897434510076072445e-01 2.014613479230887780e-02 5.532001973850570603e-02
+4.947824246224634126e-01 2.112807697320261829e-02 5.404462487713374702e-02
+4.997137287427875774e-01 2.261949505617124809e-02 5.260678769207213085e-02
+5.045221796142561610e-01 2.470021881498402766e-02 5.103037173727244941e-02
+5.091962933960687554e-01 2.743497840685808764e-02 4.934858848197953146e-02
+5.137301598248652512e-01 3.086487576009750225e-02 4.759930860912273826e-02
+5.181239197849397682e-01 3.500462903556054994e-02 4.582042542223261489e-02
+5.223830134996687580e-01 3.984501254619848137e-02 4.404711326285257883e-02
+5.265167824786487483e-01 4.511655072324017440e-02 4.230178743284147141e-02
+5.305361428192386652e-01 5.056764255442364880e-02 4.059909753035081253e-02
+5.344521625028915146e-01 5.613230116634507910e-02 3.893707769140806324e-02
+5.382767330694612218e-01 6.174820344635036790e-02 3.738224682749225619e-02
+5.420185347623404093e-01 6.738177887118912412e-02 3.591446197845812871e-02
+5.456872157339706098e-01 7.300021292187203192e-02 3.454024418762975668e-02
+5.492896320812740152e-01 7.858770433534650879e-02 3.324672306620826689e-02
+5.528333528391162766e-01 8.412806121949528704e-02 3.203530971705802199e-02
+5.563218795889670609e-01 8.962115486157959388e-02 3.088637914922974861e-02
+5.597632862141976862e-01 9.505189218342754987e-02 2.981373160271517594e-02
+5.631590542003003241e-01 1.004271762153811642e-01 2.879663766133408118e-02
+3.124295956605860902e-01 3.104471192643529220e-01 3.090926227255514358e-01
+3.153354478588585863e-01 3.133524060708574033e-01 3.119821443435121244e-01
+3.182430598922476594e-01 3.162596157133579222e-01 3.148735451052371292e-01
+3.211522197125276645e-01 3.191685075353222212e-01 3.177665914743306730e-01
+3.240629875467020971e-01 3.220791403920337248e-01 3.206613422482794129e-01
+3.269754230998080380e-01 3.249915726322321063e-01 3.235578557174154657e-01
+3.298895855632509311e-01 3.279058621062435619e-01 3.264561896730452384e-01
+3.328058950511413872e-01 3.308224519789740858e-01 3.293567801282767382e-01
+3.357242465615515870e-01 3.337412216005199994e-01 3.322595102624680830e-01
+3.386445426634580036e-01 3.366620612448586458e-01 3.351642734426954484e-01
+3.415668398051758814e-01 3.395850261019035532e-01 3.380711247962143173e-01
+3.444911940093728364e-01 3.425101709489803414e-01 3.409801190370675417e-01
+3.474177171638533901e-01 3.454376095238633759e-01 3.438913688818530656e-01
+3.503469833885533569e-01 3.483679413950338533e-01 3.468054653691610145e-01
+3.532785135690075240e-01 3.513006555881026949e-01 3.497219068304560641e-01
+3.562123614381408343e-01 3.542358046622061107e-01 3.526407457578920046e-01
+3.591485803768168505e-01 3.571734408356729285e-01 3.555620343021813068e-01
+3.620872234195166572e-01 3.601136159915630519e-01 3.584858242781328586e-01
+3.650286939883333193e-01 3.630567477596149395e-01 3.614125280750120628e-01
+3.679730835603966521e-01 3.660029262684281748e-01 3.643422355711175009e-01
+3.709200935456273829e-01 3.689518358458999114e-01 3.672746363207957110e-01
+3.738697751287151094e-01 3.719035265860498596e-01 3.702097803460631664e-01
+3.768221792091647204e-01 3.748580483073254976e-01 3.731477173927215119e-01
+3.797773564061294738e-01 3.778154505573166899e-01 3.760884969350717366e-01
+3.827360799167192629e-01 3.807765314450937688e-01 3.790329075084533650e-01
+3.856977984917309143e-01 3.837407150183698712e-01 3.819803814059496427e-01
+3.886624779865983093e-01 3.867079629882915204e-01 3.849308813833784426e-01
+3.916301675373726754e-01 3.896783234711069799e-01 3.878844554799001365e-01
+3.946009160512599645e-01 3.926518443624523180e-01 3.908411515134125325e-01
+3.975750328941100031e-01 3.956288421370338648e-01 3.938012827103044011e-01
+4.005529526089701697e-01 3.986097611264988183e-01 3.967652888788774646e-01
+4.035341133137877456e-01 4.015940188237794861e-01 3.997325949836182390e-01
+4.065185627017746106e-01 4.045816619557017213e-01 4.027032476697736119e-01
+4.095063482817839495e-01 4.075727370718815190e-01 4.056772934047228052e-01
+4.124975173818349883e-01 4.105672905481647095e-01 4.086547784814160145e-01
+4.154927954346919750e-01 4.135660647292051517e-01 4.116364375734101744e-01
+4.184918779167747238e-01 4.165687434984514104e-01 4.146219586956935155e-01
+4.214945204326190908e-01 4.195750736283389015e-01 4.176110918403175276e-01
+4.245007693662425363e-01 4.225851005893354051e-01 4.206038823909587498e-01
+4.275106709591262044e-01 4.255988697155072553e-01 4.236003755942250870e-01
+4.305243725018209622e-01 4.286165297439478161e-01 4.266007190310782127e-01
+4.335427826643468152e-01 4.316390076472571558e-01 4.296058306451354114e-01
+4.365650183856102373e-01 4.346653972573469860e-01 4.326148141166248351e-01
+4.395911251655309493e-01 4.376957432004656146e-01 4.356277139803868548e-01
+4.426211483952462444e-01 4.407300899994052723e-01 4.386445746671270296e-01
+4.456551333598003373e-01 4.437684820761266802e-01 4.416654405060406741e-01
+4.486936890393982691e-01 4.468115388000440946e-01 4.446909251918003680e-01
+4.517368917688296959e-01 4.498593352768152642e-01 4.477211036271617761e-01
+4.547842258698517881e-01 4.529113434703738172e-01 4.507554532964671012e-01
+4.578357360933586473e-01 4.559676072973268823e-01 4.537940180195341733e-01
+4.608914671138729657e-01 4.590281706024677000e-01 4.568368415436758201e-01
+4.639514635319542113e-01 4.620930771611265198e-01 4.598839675460500431e-01
+4.670168649608225642e-01 4.651634846458155281e-01 4.629365433533288998e-01
+4.700867768827386439e-01 4.682384803878612001e-01 4.659936652121621781e-01
+4.731611215843889440e-01 4.713179837040911146e-01 4.690552534918061012e-01
+4.762399433154002049e-01 4.744020380433919271e-01 4.721213515388643089e-01
+4.793232862779120418e-01 4.774906868110462277e-01 4.751920026556298859e-01
+4.824115798157278534e-01 4.805843644813184157e-01 4.782676377512943278e-01
+4.855054065192261903e-01 4.836836604074202794e-01 4.813488413805353527e-01
+4.886039206405141666e-01 4.867877139846760737e-01 4.844347609063475724e-01
+4.917071661727567822e-01 4.898965684306006430e-01 4.875254394390606261e-01
+4.948151870857158130e-01 4.930102669426385531e-01 4.906209200682110083e-01
+4.979280273277140179e-01 4.961288527000837223e-01 4.937212458644600344e-01
+5.010466910650995809e-01 4.992533419227356273e-01 4.968274246952877893e-01
+5.041707018503041038e-01 5.023832495766817896e-01 4.999389760567756191e-01
+5.072996974715958673e-01 5.055182071194114224e-01 5.030555348110034020e-01
+5.104337218186610903e-01 5.086582576893806662e-01 5.061771439834861219e-01
+5.135728187816994694e-01 5.118034444283539042e-01 5.093038466023047661e-01
+5.167171776492902602e-01 5.149539576128636664e-01 5.124358316223290855e-01
+5.198680090904711504e-01 5.181110205469275920e-01 5.155743126495593298e-01
+5.230240786607408543e-01 5.212733823701987124e-01 5.187180494068470704e-01
+5.261854303107180719e-01 5.244410863000215084e-01 5.218670849934367029e-01
+5.293521080119285571e-01 5.276141755769954145e-01 5.250214625310645200e-01
+5.325241557584816654e-01 5.307926934666159502e-01 5.281812251655980672e-01
+5.357023822572596350e-01 5.339774558564434059e-01 5.313471825523317094e-01
+5.388868512651764364e-01 5.371685253040656693e-01 5.345193971027960567e-01
+5.420768564731617278e-01 5.403651867966881017e-01 5.376971597230371103e-01
+5.452724420645790326e-01 5.435674838014370458e-01 5.408805137559964393e-01
+5.484736522643940404e-01 5.467754598289500390e-01 5.440695025873386603e-01
+5.516805313407564526e-01 5.499891584349245743e-01 5.472641696469991990e-01
+5.548945759211054707e-01 5.532100885206570062e-01 5.504660124980879088e-01
+5.581145670784500856e-01 5.564370183489838473e-01 5.536738091851505228e-01
+5.613403945534086725e-01 5.596698355312789142e-01 5.568874483927889196e-01
+5.645721029241054234e-01 5.629085839430609806e-01 5.601069738660463537e-01
+5.678097368298002934e-01 5.661533075224889355e-01 5.633324294117918463e-01
+5.710538502837967378e-01 5.694045636227955676e-01 5.665643684189753948e-01
+5.743051694640114446e-01 5.726630826009092567e-01 5.698035160864106663e-01
+5.775625831679842559e-01 5.759277431077964859e-01 5.730487596836393305e-01
+5.808261364437535823e-01 5.791985894982362160e-01 5.763001434292895908e-01
+5.840958744176996120e-01 5.824756662065079249e-01 5.795577116206488411e-01
+5.873718422959868235e-01 5.857590177478061433e-01 5.828215086350755358e-01
+5.906553283643478647e-01 5.890499401540877367e-01 5.860928212875072818e-01
+5.939456863496749284e-01 5.923477811162676243e-01 5.893710023062436187e-01
+5.972424456095442036e-01 5.956520656886060694e-01 5.926555803959596691e-01
+6.005456518693509382e-01 5.989628389111977258e-01 5.959466004538667150e-01
+6.038553509508688411e-01 6.022801459213279474e-01 5.992441074734932149e-01
+6.071717820521228548e-01 6.056042263837068118e-01 6.025483395942317077e-01
+6.104964593110322468e-01 6.089366020846007643e-01 6.058608080471198365e-01
+6.138278031916972743e-01 6.122756828005896379e-01 6.091799341380006449e-01
+6.171658601273857236e-01 6.156215142843693977e-01 6.125057634705911580e-01
+6.205106766639508775e-01 6.189741424017308757e-01 6.158383417607966592e-01
+6.238622994612079697e-01 6.223336131329110232e-01 6.191777148380593898e-01
+6.272217495526114517e-01 6.257009516987572795e-01 6.225249009896979269e-01
+6.305890773753839440e-01 6.290762073460191006e-01 6.258799493857725160e-01
+6.339633886626701020e-01 6.324584802535679895e-01 6.292419666367617959e-01
+6.373447307909330117e-01 6.358478171202772700e-01 6.326109992853028441e-01
+6.407331512665517259e-01 6.392442647751326312e-01 6.359870940032011921e-01
+6.441286977271819536e-01 6.426478701785689474e-01 6.393702975927646470e-01
+6.475332468520634821e-01 6.460605168712778568e-01 6.427624810073024886e-01
+6.509452405110124351e-01 6.494806387834576311e-01 6.461620890521664329e-01
+6.543645413031805580e-01 6.529080970404893547e-01 6.495689839578402403e-01
+6.577911976868459076e-01 6.563429394235856806e-01 6.529832133417282636e-01
+6.612252582674151835e-01 6.597852138609858752e-01 6.564048249672772561e-01
+6.646674156910871156e-01 6.632356145596635111e-01 6.598345085785605191e-01
+6.681185471134806209e-01 6.666950204492557708e-01 6.632731374913205524e-01
+6.715772676011302345e-01 6.701620407069336371e-01 6.667193303275074090e-01
+6.750436266693425891e-01 6.736367241694728447e-01 6.701731357532019207e-01
+6.785176739964410286e-01 6.771191198362991326e-01 6.736346025961090778e-01
+6.819994594251277409e-01 6.806092768708275065e-01 6.771037798468937385e-01
+6.854905830673579947e-01 6.841087989309356798e-01 6.805822608627878356e-01
+6.889902152593658791e-01 6.876168527353629933e-01 6.840692180364433828e-01
+6.924977753545575876e-01 6.911328551431065170e-01 6.875640721906080000e-01
+6.960133142099522718e-01 6.946568563288202380e-01 6.910668733210059145e-01
+6.995368828630013081e-01 6.981889066469423311e-01 6.945776716020720665e-01
+7.030687808865530020e-01 7.017293055249038680e-01 6.980967646835468665e-01
+7.066108508007371558e-01 7.052798983395075494e-01 7.016259863087929149e-01
+7.101611448678148975e-01 7.088387320594561336e-01 7.051633961675597417e-01
+7.137197152305658765e-01 7.124058581399919099e-01 7.087090455286524371e-01
+7.172866142285043711e-01 7.159813282321918493e-01 7.122629858555886706e-01
+7.208618943992978201e-01 7.195651941843620447e-01 7.158252688079900228e-01
+7.244468165907456125e-01 7.231587179839266133e-01 7.193971485631489582e-01
+7.280414152493157598e-01 7.267619329076518975e-01 7.229786584068481625e-01
+7.316445953770737143e-01 7.303737413779746168e-01 7.265687078387530473e-01
+7.352564107249326408e-01 7.339941964502680882e-01 7.301673497187975981e-01
+7.388769152586618372e-01 7.376233513935839259e-01 7.337746371194190376e-01
+7.425061631603386836e-01 7.412612596920828967e-01 7.373906233269835742e-01
+7.461464606086873896e-01 7.449102288687008411e-01 7.410176017144567417e-01
+7.497958701755464972e-01 7.485683184324932737e-01 7.446536440345916663e-01
+7.534542299137884092e-01 7.522353655092588465e-01 7.482985885600491605e-01
+7.571215953297079082e-01 7.559114248995535412e-01 7.519524898864893281e-01
+7.607980221631284179e-01 7.595965516360115855e-01 7.556154028404162837e-01
+7.644843645869688897e-01 7.632915995427993483e-01 7.592881761602847668e-01
+7.681816678947460675e-01 7.669976132758333787e-01 7.629718483168250742e-01
+7.718882453269261257e-01 7.707129043795911683e-01 7.666647413348012252e-01
+7.756041540460802963e-01 7.744375293002100369e-01 7.703669114468018053e-01
+7.793294514661021077e-01 7.781715447334471847e-01 7.740784151337410934e-01
+7.830641952537596984e-01 7.819150076262105786e-01 7.777993091263859515e-01
+7.868103454866590685e-01 7.856698771694257122e-01 7.815315409597441976e-01
+7.905668625004234062e-01 7.894351125938581237e-01 7.852740763344663311e-01
+7.943330461869060333e-01 7.932100130488932699e-01 7.890262187563090723e-01
+7.981089557544192026e-01 7.969946370120729595e-01 7.927880264788568221e-01
+8.018946506826831744e-01 8.007890432303661488e-01 7.965595580237599949e-01
+8.056905050124041345e-01 8.045936048548131270e-01 8.003411844486416626e-01
+8.094987355104209525e-01 8.084105365473570615e-01 8.041351074326460457e-01
+8.133169785258600459e-01 8.122374748676888245e-01 8.079389777476483347e-01
+8.171452951864401903e-01 8.160744801984102237e-01 8.117528555427496739e-01
+8.209837469106039398e-01 8.199216132106035282e-01 8.155768012541027012e-01
+8.248323954092128263e-01 8.237789348655052413e-01 8.194108756065791033e-01
+8.286927840915763177e-01 8.276479863786950775e-01 8.232566109078919281e-01
+8.325649270796637857e-01 8.315287807573953360e-01 8.271140202815062681e-01
+8.364475027756378411e-01 8.354199968604651971e-01 8.309817904707684777e-01
+8.403405746677916621e-01 8.393216974124767527e-01 8.348599839552471868e-01
+8.442442065571257315e-01 8.432339454481773133e-01 8.387486635231791166e-01
+8.481584625591254145e-01 8.471568043142441162e-01 8.426478922732166810e-01
+8.520861550384412064e-01 8.510930816852287917e-01 8.465604617719046932e-01
+8.560249024716682920e-01 8.550403982451367790e-01 8.504840066608007065e-01
+8.599745194151316996e-01 8.589985681043337262e-01 8.544183422480284840e-01
+8.639350718981159138e-01 8.629676565074151373e-01 8.583635335210283435e-01
+8.679066262857828562e-01 8.669477290320206642e-01 8.623196457986929131e-01
+8.718902314626645333e-01 8.709398320337272681e-01 8.662877195686166099e-01
+8.758871280259100667e-01 8.749452028944590953e-01 8.702689853121506891e-01
+8.798952803818768098e-01 8.789618087644507360e-01 8.742614219551688715e-01
+8.839147569330807475e-01 8.829897172412359829e-01 8.782650968268708169e-01
+8.879456264404302912e-01 8.870289962776199966e-01 8.822800776100528930e-01
+8.919879580252079165e-01 8.910797141836338531e-01 8.863064323430556168e-01
+8.960441427301344408e-01 8.951442561280015253e-01 8.903465328361804820e-01
+9.001128904953542564e-01 8.992213337528862649e-01 8.943990982004267343e-01
+9.041933650584489390e-01 9.033101118731188262e-01 8.984632980967039995e-01
+9.082856377297909845e-01 9.074106609684426950e-01 9.025392027229122149e-01
+9.123897802040108473e-01 9.115230518994157372e-01 9.066268826559935601e-01
+9.165062601210144377e-01 9.156477504829055869e-01 9.107268012198581619e-01
+9.206377372962850636e-01 9.197874089604549663e-01 9.148415959800745290e-01
+9.247813586963474775e-01 9.239391805138976732e-01 9.189684361991556916e-01
+9.289371983431667923e-01 9.281031383100254439e-01 9.231073947496013510e-01
+9.331053306682361992e-01 9.322793559214043180e-01 9.272585449078167841e-01
+9.372858305148153990e-01 9.364679073285836486e-01 9.314219603563131944e-01
+9.414805849385761150e-01 9.406706735323028257e-01 9.355995118038626934e-01
+9.456895815303881792e-01 9.448876411191396985e-01 9.397911860891489111e-01
+9.499112324285693409e-01 9.491172259914930631e-01 9.439954080097928690e-01
+9.541456149743491322e-01 9.533595046046891008e-01 9.482122537117517735e-01
+9.583928069476742584e-01 9.576145538486544595e-01 9.524417997736036590e-01
+9.626528865695892501e-01 9.618824510502640424e-01 9.566841232088870717e-01
+9.717386353800526733e-01 9.973777600608618732e-01 4.115658643585359822e-01
+9.662006602777347686e-01 9.937266459819259490e-01 4.023251811958163393e-01
+9.607627521945550919e-01 9.900572267174857499e-01 3.929085929665734889e-01
+9.554415272451376451e-01 9.863634202187735456e-01 3.833020851902597670e-01
+9.502559385734440367e-01 9.826387048868144847e-01 3.734797610708937010e-01
+9.452247574758879667e-01 9.788787426033022099e-01 3.633572044040755400e-01
+9.403922547690045652e-01 9.750651532690909340e-01 3.529658674736868007e-01
+9.358012781940933111e-01 9.711846436929117976e-01 3.422125309180296115e-01
+9.315219006576069827e-01 9.672115998149192206e-01 3.310553617148976335e-01
+9.276515136764329483e-01 9.631091768055900504e-01 3.194750358456411865e-01
+9.243262891934023173e-01 9.588257749438183764e-01 3.074483567011621621e-01
+9.217020058646493430e-01 9.542951650631289473e-01 2.951579532336194300e-01
+9.198887370469149838e-01 9.494613758630886524e-01 2.829933059330041467e-01
+9.188014423728452229e-01 9.443342663663614189e-01 2.716012421636955776e-01
+9.181820869339853974e-01 9.389970698605141219e-01 2.614202290916152749e-01
+9.177841550998647735e-01 9.335426933786861170e-01 2.524800001657211412e-01
+9.174401026070885257e-01 9.280407871647589069e-01 2.446155106635521936e-01
+9.170895513231805962e-01 9.225221346800714928e-01 2.375965624445583457e-01
+9.167020828694254497e-01 9.170043397013648567e-01 2.312467382449614473e-01
+9.162674970718558409e-01 9.114958340077099486e-01 2.254318760810480882e-01
+9.157691900066246005e-01 9.060063912564605415e-01 2.200571360818813216e-01
+9.152197058922081352e-01 9.005338027659569589e-01 2.150417998700874245e-01
+9.146241645334555193e-01 8.950779708690549397e-01 2.103289435929298068e-01
+9.139711070576973517e-01 8.896449914470077047e-01 2.058761237663177535e-01
+9.132755157040669536e-01 8.842301350859270714e-01 2.016464740967732761e-01
+9.125407126803214419e-01 8.788330083046588248e-01 1.976125145460150279e-01
+9.117530169460994482e-01 8.734600806229881886e-01 1.937497985711440218e-01
+9.109311963239964394e-01 8.681043338417845368e-01 1.900403276536027364e-01
+9.100752049629435847e-01 8.627663273889324413e-01 1.864683841517677521e-01
+9.091854095601151764e-01 8.574463833033296734e-01 1.830203816986048226e-01
+9.082549005100644113e-01 8.521478984780772592e-01 1.796821188488442467e-01
+9.072929210165844305e-01 8.468673217860986924e-01 1.764454502969030336e-01
+9.063013792870692198e-01 8.416041433916346959e-01 1.733019473598792493e-01
+9.052811273728736952e-01 8.363582655293054779e-01 1.702439219249277103e-01
+9.042330703505969680e-01 8.311295331123278451e-01 1.672645945644082588e-01
+9.031581378443196417e-01 8.259177493137719317e-01 1.643579680291452627e-01
+9.020572628789119696e-01 8.207226877358885231e-01 1.615187200622499042e-01
+9.009313663687085194e-01 8.155441018959304067e-01 1.587421124067343314e-01
+8.997813459322432372e-01 8.103817325993176723e-01 1.560239134014781981e-01
+8.986080680213675009e-01 8.052353136482993667e-01 1.533603319950107013e-01
+8.974123625824063089e-01 8.001045762385368132e-01 1.507479613684808151e-01
+8.961950196441476058e-01 7.949892523212133133e-01 1.481837306596257842e-01
+8.949567873642767513e-01 7.898890771497076857e-01 1.456648635287154658e-01
+8.936983711718720080e-01 7.848037911839249592e-01 1.431888425141153720e-01
+8.924204337256359532e-01 7.797331414892141321e-01 1.407533782964209279e-01
+8.911216151255343387e-01 7.746778361440714855e-01 1.383548030403051743e-01
+8.898020181760183389e-01 7.696378889985142635e-01 1.359906608477614021e-01
+8.884645911096110682e-01 7.646119206511362565e-01 1.336610605915157513e-01
+8.871098774237282658e-01 7.595996914637694886e-01 1.313644302926826601e-01
+8.857383791003278217e-01 7.546009727066200767e-01 1.290993233143932217e-01
+8.843505587935225343e-01 7.496155463925207041e-01 1.268644048815629477e-01
+8.829468419986222782e-01 7.446432050409976799e-01 1.246584402943621550e-01
+8.815249085514379468e-01 7.396851204434677918e-01 1.224776444651401730e-01
+8.800852120157934833e-01 7.347410842227017902e-01 1.203208501022957344e-01
+8.786308879175975806e-01 7.298095076593623665e-01 1.181897480034229675e-01
+8.771622516330287445e-01 7.248902111580254326e-01 1.160834456649006141e-01
+8.756795889485279316e-01 7.199830249122411985e-01 1.140011085329386831e-01
+8.741818688473920185e-01 7.150884618420272343e-01 1.119405415999485953e-01
+8.726664701310860028e-01 7.102078845126149620e-01 1.098977185964423176e-01
+8.711380365425036576e-01 7.053388457490094021e-01 1.078767213026572136e-01
+8.695967618761146767e-01 7.004812035381728919e-01 1.058769266693721234e-01
+8.680428176626151515e-01 6.956348241211850469e-01 1.038977462027144416e-01
+8.664728647912948167e-01 6.908014665312249836e-01 1.019343675562955354e-01
+8.648889520799001307e-01 6.859800077414488495e-01 9.998838514326469085e-02];
+
+   case 'sol' 
+      RGB = [2.014250997833959556e-01 7.730778455372402935e-02 9.342024025258441333e-02
+2.062319592710875060e-01 7.906207768979725548e-02 9.541606071998920413e-02
+2.110428892884436691e-01 8.079536357043612393e-02 9.737846202556904585e-02
+2.158580822956807643e-01 8.250806203226229707e-02 9.930725029816905858e-02
+2.206777103783343352e-01 8.420058748958639261e-02 1.012022063667477878e-01
+2.255019582885565144e-01 8.587332122435217818e-02 1.030630633154644982e-01
+2.303310909623697555e-01 8.752655129320324745e-02 1.048894558390352783e-01
+2.351651244914957362e-01 8.916077192669072393e-02 1.066811567589351084e-01
+2.400041538413338893e-01 9.077639059472936145e-02 1.084378476867565166e-01
+2.448482542469172518e-01 9.237381813988079782e-02 1.101591880324293282e-01
+2.496974811012195872e-01 9.395347052392380438e-02 1.118448155598189275e-01
+2.545518697677066067e-01 9.551577058896976169e-02 1.134943469265998206e-01
+2.594114353201673606e-01 9.706114983944272301e-02 1.151073782157037984e-01
+2.642761722125430146e-01 9.859005025060077476e-02 1.166834854654446307e-01
+2.691460538812255332e-01 1.001029261086328892e-01 1.182222252052740896e-01
+2.740210322821139965e-01 1.016002458867145131e-01 1.197231350040377507e-01
+2.789010373645949281e-01 1.030824941607314804e-01 1.211857340375411263e-01
+2.837859764845531707e-01 1.045501735676682975e-01 1.226095236822268009e-01
+2.886757337585150185e-01 1.060038068088898222e-01 1.239939881417738143e-01
+2.935705596266552364e-01 1.074435592047325860e-01 1.253382180210721730e-01
+2.984708123016127645e-01 1.088694832683588798e-01 1.266411225341654012e-01
+3.033754705455499190e-01 1.102829776040219478e-01 1.279029157767591629e-01
+3.082843160981594277e-01 1.116846670615513903e-01 1.291230138435368602e-01
+3.131971029671865581e-01 1.130752078289798124e-01 1.303008196341493008e-01
+3.181135564546491157e-01 1.144552897453308959e-01 1.314357238709698839e-01
+3.230337594016901570e-01 1.158252511924781902e-01 1.325266762725714476e-01
+3.279584359813157990e-01 1.171847867104950369e-01 1.335718110238658662e-01
+3.328858414856893377e-01 1.185360731157172887e-01 1.345719725768937669e-01
+3.378155708245871303e-01 1.198799635036237599e-01 1.355265097514237183e-01
+3.427471842250678358e-01 1.212173573516503733e-01 1.364347662233350855e-01
+3.476817676568914606e-01 1.225476080130979417e-01 1.372941239039429107e-01
+3.526179187878998866e-01 1.238726093833323050e-01 1.381049156392651633e-01
+3.575544570498519481e-01 1.251940557912539775e-01 1.388672386602565201e-01
+3.624908511464776661e-01 1.265129959708437557e-01 1.395803418854749678e-01
+3.674287950126607916e-01 1.278281902872998865e-01 1.402403192837867185e-01
+3.723652245912653647e-01 1.291433283978542790e-01 1.408496559025098349e-01
+3.772994043575393919e-01 1.304597230378949646e-01 1.414077190879147183e-01
+3.822328244976108125e-01 1.317763828069311027e-01 1.419104659088263887e-01
+3.871627501840784191e-01 1.330967329073056149e-01 1.423599677282273157e-01
+3.920880611619059208e-01 1.344225444091708133e-01 1.427559829693639537e-01
+3.970102845366911826e-01 1.357528321160993978e-01 1.430939047058796265e-01
+4.019257908029647552e-01 1.370920335458912787e-01 1.433773252895977068e-01
+4.068349561616130816e-01 1.384404082220755672e-01 1.436033049025308150e-01
+4.117365731263126216e-01 1.397998954736640875e-01 1.437714012378476514e-01
+4.166285955020519460e-01 1.411733354490503911e-01 1.438826947863026673e-01
+4.215115464927484679e-01 1.425608842716513391e-01 1.439334793454142836e-01
+4.263818625509953053e-01 1.439670074541691269e-01 1.439276912848104217e-01
+4.312408181144407604e-01 1.453911021832318962e-01 1.438598606513883382e-01
+4.360843175580979003e-01 1.468382080621888075e-01 1.437352070106750757e-01
+4.409133399041038626e-01 1.483080544589621963e-01 1.435484892033262738e-01
+4.457240620502335715e-01 1.498053889889406909e-01 1.433047202671754727e-01
+4.505169861034231116e-01 1.513304477119505886e-01 1.429993558897900696e-01
+4.552886678338638471e-01 1.528875528172430887e-01 1.426369447211624508e-01
+4.600387072749128614e-01 1.544778583065680166e-01 1.422148901612839134e-01
+4.647645669051368444e-01 1.561046932382532393e-01 1.417359354431781127e-01
+4.694647696847664142e-01 1.577702615986552870e-01 1.412003046328143552e-01
+4.741377460736882488e-01 1.594768244179092798e-01 1.406085235372486197e-01
+4.787811635810699795e-01 1.612273475797827982e-01 1.399635953741071304e-01
+4.833940392196432456e-01 1.630233960258756498e-01 1.392646788568434324e-01
+4.879740080405346458e-01 1.648678210719416448e-01 1.385155272254653958e-01
+4.925195693223419213e-01 1.667625387560449646e-01 1.377175480485133274e-01
+4.970292850743541213e-01 1.687093212494573113e-01 1.368722045288005285e-01
+5.015013418271374590e-01 1.707101850535491239e-01 1.359828524777431658e-01
+5.059344608615837791e-01 1.727665378729273671e-01 1.350513348829507354e-01
+5.103272555076001638e-01 1.748797680652766917e-01 1.340804814887887886e-01
+5.146784999821305551e-01 1.770509926066398676e-01 1.330731030668735604e-01
+5.189871207659747521e-01 1.792810660321904059e-01 1.320320170625302603e-01
+5.232521628013230286e-01 1.815706081303557207e-01 1.309602397868673829e-01
+5.274729145399480457e-01 1.839199144444812750e-01 1.298602350351042156e-01
+5.316485781433754054e-01 1.863291944433481395e-01 1.287360215107217765e-01
+5.357788119794710813e-01 1.887982003317690283e-01 1.275896151617726404e-01
+5.398632980453529351e-01 1.913265486380361924e-01 1.264236887032485768e-01
+5.439016755531911329e-01 1.939137144580994065e-01 1.252427388260835273e-01
+5.478941342086204314e-01 1.965587857098634594e-01 1.240472431523338970e-01
+5.518406011876045847e-01 1.992608233247842864e-01 1.228416287224595171e-01
+5.557413604777560190e-01 2.020186434106095441e-01 1.216276788300265921e-01
+5.595967825163993270e-01 2.048309740311727856e-01 1.204067641590413351e-01
+5.634071785471536087e-01 2.076963248023981912e-01 1.191839172318373274e-01
+5.671732069794859221e-01 2.106133447776186718e-01 1.179569341314256059e-01
+5.708953502475510033e-01 2.135801749668952421e-01 1.167331750031382620e-01
+5.745743340603017835e-01 2.165955297740416174e-01 1.155086834950974917e-01
+5.782108774062354462e-01 2.196573476346848075e-01 1.142903383669127693e-01
+5.818056681759461446e-01 2.227643917275112795e-01 1.130745297734544186e-01
+5.853596324247829497e-01 2.259144368785390156e-01 1.118679346243981187e-01
+5.888733531729506421e-01 2.291064977832514282e-01 1.106657061174652901e-01
+5.923480147332496060e-01 2.323380142637169188e-01 1.094762267036840098e-01
+5.957840241257977842e-01 2.356083643285451501e-01 1.082930207415330470e-01
+5.991826510896112179e-01 2.389150535758420846e-01 1.071233989765111305e-01
+6.025444033584952397e-01 2.422572079085022478e-01 1.059638000704014038e-01
+6.058701491001592387e-01 2.456332409492081315e-01 1.048158025498839019e-01
+6.091610396494541169e-01 2.490411636600449730e-01 1.036832083023569995e-01
+6.124172967183565408e-01 2.524805655496659695e-01 1.025613962727195683e-01
+6.156402174450263942e-01 2.559493015306805175e-01 1.014554136320146294e-01
+6.188304674185852727e-01 2.594462946423264360e-01 1.003647858381197522e-01
+6.219883549579363624e-01 2.629709881912258296e-01 9.928701461787994842e-02
+6.251150949354874475e-01 2.665215196417168309e-01 9.822607331815666476e-02
+6.282114705640686747e-01 2.700967151118268128e-01 9.718275325572381385e-02
+6.312775931157122988e-01 2.736963322450938207e-01 9.615407260814298751e-02
+6.343140968307461325e-01 2.773194022482146082e-01 9.514062524056160486e-02
+6.373225940474543938e-01 2.809637253536654833e-01 9.414820920814792604e-02
+6.403029049301643960e-01 2.846294803262617856e-01 9.317287627515624671e-02
+6.432554503146770131e-01 2.883160464262430889e-01 9.221435672465166933e-02
+6.461807870545831500e-01 2.920226445998113096e-01 9.127322088316058846e-02
+6.490798649799141007e-01 2.957480457349839220e-01 9.035190862912848009e-02
+6.519534890851086395e-01 2.994912417888541123e-01 8.945207804511770555e-02
+6.548014840508611378e-01 3.032523985397311828e-01 8.857115779395227650e-02
+6.576243271404891289e-01 3.070309030666096284e-01 8.770973119670061324e-02
+6.604224780876138956e-01 3.108261780844247535e-01 8.686839073952234980e-02
+6.631963792788750922e-01 3.146376804982159436e-01 8.604773901491818977e-02
+6.659464950830153995e-01 3.184648571182398524e-01 8.524854019761693436e-02
+6.686740068110078594e-01 3.223063950997894223e-01 8.447431908919650345e-02
+6.713784685540787889e-01 3.261627733896342862e-01 8.372242463404078183e-02
+6.740602498156743616e-01 3.300335755312562847e-01 8.299350184989945367e-02
+6.767197045307955516e-01 3.339184117562906673e-01 8.228820834254704786e-02
+6.793571714405546302e-01 3.378169176731946055e-01 8.160721412236313088e-02
+6.819729744807380145e-01 3.417287529939577184e-01 8.095120122856311329e-02
+6.845674231809769639e-01 3.456536003014257785e-01 8.032086315939043764e-02
+6.871408130714994345e-01 3.495911638591582271e-01 7.971690410726239850e-02
+6.896934260947393813e-01 3.535411684651399988e-01 7.914003799874758105e-02
+6.922255310194272981e-01 3.575033583501715517e-01 7.859098734029026923e-02
+6.947373838550107150e-01 3.614774961213378379e-01 7.807048187183049381e-02
+6.972292282645524697e-01 3.654633617505798626e-01 7.757925703187978916e-02
+6.997012959744630667e-01 3.694607516080961052e-01 7.711805223920600860e-02
+7.021538071796381564e-01 3.734694775400307920e-01 7.668760899803153674e-02
+7.045869709427744487e-01 3.774893659897066711e-01 7.628866883556534306e-02
+7.070009855867870341e-01 3.815202571614760840e-01 7.592197108269088668e-02
+7.093960390794303850e-01 3.855620042261392877e-01 7.558825051079040569e-02
+7.117723094093527658e-01 3.896144725667428643e-01 7.528823483980665032e-02
+7.141299649529336824e-01 3.936775390635336991e-01 7.502264213486334321e-02
+7.164691648313716854e-01 3.977510914167320943e-01 7.479217811087204848e-02
+7.187900592575979797e-01 4.018350275057843701e-01 7.459753336661339995e-02
+7.210927898726463559e-01 4.059292547837213827e-01 7.443938057163165811e-02
+7.233774900712311995e-01 4.100336897052239138e-01 7.431837163097509968e-02
+7.256442853163093121e-01 4.141482571870220286e-01 7.423513485418420377e-02
+7.278932934424962031e-01 4.182728900992377374e-01 7.419027215599127700e-02
+7.301246249482277184e-01 4.224075287863344741e-01 7.418435631686179366e-02
+7.323383832766364732e-01 4.265521206163164214e-01 7.421792833176479864e-02
+7.345353882716817440e-01 4.307060349567022883e-01 7.429319537753659164e-02
+7.367156646423576039e-01 4.348693003618859243e-01 7.441039153688730479e-02
+7.388787494489402752e-01 4.390423308641819844e-01 7.456862859096566321e-02
+7.410247212778052761e-01 4.432250991934941209e-01 7.476828631581519669e-02
+7.431536528151155840e-01 4.474175832571065103e-01 7.500970147240951236e-02
+7.452656110665121236e-01 4.516197658271001170e-01 7.529316628527241151e-02
+7.473606575657232298e-01 4.558316342481479322e-01 7.561892717684162712e-02
+7.494388485722311977e-01 4.600531801646510766e-01 7.598718377039928584e-02
+7.515014494005359813e-01 4.642834853101814319e-01 7.640057068894035019e-02
+7.535482386381918696e-01 4.685227724793568638e-01 7.685851802683341116e-02
+7.555784292647326206e-01 4.727716755322179387e-01 7.735934440269953694e-02
+7.575920584303713623e-01 4.770302023787819645e-01 7.790304647924226056e-02
+7.595891587998102601e-01 4.812983641144596425e-01 7.848957351759905388e-02
+7.615697586917992146e-01 4.855761748409669898e-01 7.911882810663906085e-02
+7.635351559772435293e-01 4.898627402128037933e-01 7.979298836587264687e-02
+7.654855818523200739e-01 4.941579525945941076e-01 8.051210547168902165e-02
+7.674196884953543574e-01 4.984628195279873775e-01 8.127340285315723389e-02
+7.693374880099380642e-01 5.027773670563000508e-01 8.207659805554132215e-02
+7.712389886872909051e-01 5.071016234993879213e-01 8.292136945254757752e-02
+7.731249880551478437e-01 5.114350748098054344e-01 8.380866202872513937e-02
+7.749971634096607387e-01 5.157766247025432627e-01 8.474069791771285387e-02
+7.768531656759695148e-01 5.201279334240793695e-01 8.571310136491594456e-02
+7.786929885023088360e-01 5.244890387928055064e-01 8.672540635712724932e-02
+7.805166220614638828e-01 5.288599804136482341e-01 8.777711918476124864e-02
+7.823261306937436821e-01 5.332394286426104246e-01 8.887078595429290240e-02
+7.841211261331867410e-01 5.376277019226174403e-01 9.000512625428583324e-02
+7.859000063657322066e-01 5.420258982280999893e-01 9.117718483670700369e-02
+7.876627478111991598e-01 5.464340650106903619e-01 9.238637445837943885e-02
+7.894103755328435446e-01 5.508515783238705499e-01 9.363351104642655964e-02
+7.911449489936349666e-01 5.552771776345648558e-01 9.492063714767667859e-02
+7.928634178435132185e-01 5.597128604871853819e-01 9.624295938665472505e-02
+7.945657449982463927e-01 5.641586812836011378e-01 9.759983714409603550e-02
+7.962529317489702718e-01 5.686140495102688375e-01 9.899190462101559174e-02
+7.979274645055595139e-01 5.730774789890704657e-01 1.004214627980108965e-01
+7.995858497679293464e-01 5.775511834408552092e-01 1.018835148330231588e-01
+8.012280368308171141e-01 5.820352236202099849e-01 1.033774013447087969e-01
+8.028560740659145267e-01 5.865283957952628358e-01 1.049048199319871921e-01
+8.044707409966546097e-01 5.910302911313597418e-01 1.064658666440542745e-01
+8.060691629501393063e-01 5.955426815778210869e-01 1.080566579062864629e-01
+8.076512751425731773e-01 6.000656338781130694e-01 1.096765425113208070e-01
+8.092212933019986565e-01 6.045967120149606799e-01 1.113292481825315650e-01
+8.107760556043207556e-01 6.091378327200270837e-01 1.130107512069984665e-01
+8.123144185459451050e-01 6.136896959567099685e-01 1.147193037693588491e-01
+8.138381395305365196e-01 6.182513237945769236e-01 1.164560306092000397e-01
+8.153492559398581863e-01 6.228216087115111543e-01 1.182221687055251269e-01
+8.168438497700267753e-01 6.274028329685673588e-01 1.200133807424188237e-01
+8.183218295752512361e-01 6.319950736315883555e-01 1.218290715633482957e-01
+8.197890431479778472e-01 6.365951069307501653e-01 1.236738150663118929e-01
+8.212397496268510899e-01 6.412061948148843893e-01 1.255419007966243339e-01
+8.226736710596913582e-01 6.458285162251576894e-01 1.274326125224898576e-01
+8.240954168836683857e-01 6.504595882304867738e-01 1.293492244766023536e-01
+8.255020135816337756e-01 6.551010940717902908e-01 1.312886736975442947e-01
+8.268916161790003105e-01 6.597540661653059635e-01 1.332490015865780419e-01
+8.282680782241739204e-01 6.644164751020815718e-01 1.352327076170389830e-01
+8.296302321797530688e-01 6.690890043064162684e-01 1.372383190289331867e-01
+8.309751426979781197e-01 6.737732479628292248e-01 1.392631732853782667e-01
+8.323064093623322446e-01 6.784673500649637257e-01 1.413094448639914957e-01
+8.336236702662669362e-01 6.831715585604193341e-01 1.433763438952303237e-01
+8.349233956754664732e-01 6.878877450853391196e-01 1.454609632889922177e-01
+8.362094522088989734e-01 6.926139541357441143e-01 1.475655370255327115e-01
+8.374812451634525701e-01 6.973505478666088830e-01 1.496891818583828970e-01
+8.387351652304512184e-01 7.020993985062000675e-01 1.518291366884736149e-01
+8.399758860500933233e-01 7.068581852631129481e-01 1.539880238042938276e-01
+8.412015039419409312e-01 7.116279196951651453e-01 1.561642027825314583e-01
+8.424088634362330019e-01 7.164102051502189150e-01 1.583553901645263495e-01
+8.436040043728154636e-01 7.212020966440341185e-01 1.605648786739153067e-01
+8.447825998855326146e-01 7.260057762544317450e-01 1.627897017014220959e-01
+8.459425004297633777e-01 7.308223161702667170e-01 1.650283355910636407e-01
+8.470916909310660659e-01 7.356478948636396842e-01 1.672849872513207936e-01
+8.482222682093125687e-01 7.404863725972353761e-01 1.695548732398838021e-01
+8.493354922705429466e-01 7.453371669715372905e-01 1.718384513727829743e-01
+8.504363950839656239e-01 7.501979378252857655e-01 1.741381147288197651e-01
+8.515178010463546610e-01 7.550721145067320617e-01 1.764497766633903175e-01
+8.525841071331127230e-01 7.599576641399760080e-01 1.787754909642916834e-01
+8.536351063891680635e-01 7.648547324583224727e-01 1.811148665949305070e-01
+8.546660216706046809e-01 7.697655561558608417e-01 1.834652953721074564e-01
+8.556846647048813592e-01 7.746865865799383855e-01 1.858303883039418847e-01
+8.566843283862169978e-01 7.796209322090990046e-01 1.882066457578640828e-01
+8.576654697805085048e-01 7.845684046728831351e-01 1.905941213680029112e-01
+8.586333372669123776e-01 7.895266856020336510e-01 1.929950487363375766e-01
+8.595800514528921799e-01 7.944993343355386539e-01 1.954056082908571246e-01
+8.605118919067250571e-01 7.994835879345245644e-01 1.978284835821235155e-01
+8.614257659190140970e-01 8.044808542070145396e-01 2.002621028413892890e-01
+8.623187318174559968e-01 8.094924397675259398e-01 2.027050514589471275e-01
+8.631990866135879070e-01 8.145147714844941378e-01 2.051607456378260474e-01
+8.640570316077024193e-01 8.195521241156307202e-01 2.076248627732380503e-01
+8.648985892446832136e-01 8.246019286985761809e-01 2.100998205615737802e-01
+8.657217542057287218e-01 8.296650789343075205e-01 2.125846498551076103e-01
+8.665227359996962031e-01 8.347431960854363453e-01 2.150777232526754901e-01
+8.673102956545263309e-01 8.398326248425269647e-01 2.175824369796515168e-01
+8.680739840584389411e-01 8.449377672354075886e-01 2.200945521598048904e-01
+8.688209397597312922e-01 8.500556721057834775e-01 2.226167862486261861e-01
+8.695475257414353454e-01 8.551878730451877297e-01 2.251476450914057237e-01
+8.702518466222823879e-01 8.603351573784762119e-01 2.276863618988967386e-01
+8.709403456886846140e-01 8.654949292658645765e-01 2.302352780671254040e-01
+8.716032871795772463e-01 8.706711460791707324e-01 2.327907403748207260e-01
+8.722504095804027857e-01 8.758599106230183784e-01 2.353562666294088945e-01
+8.728735089177709350e-01 8.810645242778994968e-01 2.379288443348342996e-01
+8.734755480931443161e-01 8.862838169179700909e-01 2.405095194908647427e-01
+8.740576468844427627e-01 8.915173698391286594e-01 2.430986533749082690e-01
+8.746134519571161503e-01 8.967676725126847437e-01 2.456940353088591378e-01
+8.751533192048812637e-01 9.020307187484648548e-01 2.482992135687792645e-01
+8.756648875509137619e-01 9.073112946820588443e-01 2.509099777331614822e-01
+8.761579961220332669e-01 9.126056308170312770e-01 2.535296558873600947e-01
+8.766251762717257590e-01 9.179165870428791507e-01 2.561557673694155324e-01
+8.770689942806796369e-01 9.232431892037369359e-01 2.587891932203917889e-01
+8.774903570045399226e-01 9.285851079338152125e-01 2.614302497362179234e-01
+8.778834706355089779e-01 9.339444999568264905e-01 2.640771174844134261e-01
+8.782575035190057777e-01 9.393179743031147000e-01 2.667327577149610218e-01
+8.785999460636340075e-01 9.447101339348284998e-01 2.693932729818908633e-01
+8.789235199162210854e-01 9.501163253664915986e-01 2.720626987422674059e-01
+8.792160143882136181e-01 9.555409855460589297e-01 2.747373107314689533e-01
+8.794851333774609259e-01 9.609813222108515296e-01 2.774195521504189688e-01
+8.797259382267708094e-01 9.664391027363387066e-01 2.801079938733134767e-01
+8.799388863582034981e-01 9.719141474258771174e-01 2.828028665891310078e-01
+8.801261631980005218e-01 9.774056784469543624e-01 2.855049064351531940e-01
+8.802811281654138176e-01 9.829160047653974219e-01 2.882122575277183407e-01
+8.804129372223431504e-01 9.884419266545670935e-01 2.909276978215925569e-01
+8.805080058500511786e-01 9.939881188401472611e-01 2.936474048368232226e-01]; 
+
+   case 'pha' 
+      RGB = [6.583083928922510708e-01 4.699391690315133929e-01 4.941288203988051381e-02
+6.643374189373471017e-01 4.662019008569991407e-01 5.766473450402211792e-02
+6.702086925052345157e-01 4.624801381219734719e-01 6.534560309537773559e-02
+6.760429905334627287e-01 4.586983759956768103e-01 7.273174322210870790e-02
+6.817522846284524984e-01 4.549140651836585669e-01 7.979261956680192003e-02
+6.874028047282801923e-01 4.510841669914616436e-01 8.667102950867147659e-02
+6.929504980948593129e-01 4.472389296506211198e-01 9.335868960148416273e-02
+6.984261912087648128e-01 4.433576785927097474e-01 9.992839268327721736e-02
+7.038122981036579739e-01 4.394532762349419586e-01 1.063871045640915336e-01
+7.091206923190102041e-01 4.355176525107516405e-01 1.127717449252612913e-01
+7.143452449012380745e-01 4.315557562030358230e-01 1.190934789448820086e-01
+7.194928861674689813e-01 4.275627171694253437e-01 1.253760590955056708e-01
+7.245561927479047259e-01 4.235446971269447580e-01 1.316232516304018385e-01
+7.295489482895208821e-01 4.194909849233816046e-01 1.378630483492892522e-01
+7.344517242247444733e-01 4.154177405103107734e-01 1.440803933719045082e-01
+7.392949550641365608e-01 4.112997327023164562e-01 1.503221736968965161e-01
+7.440383351241327547e-01 4.071715772870146410e-01 1.565433461845777419e-01
+7.487369523694534790e-01 4.029851907815384382e-01 1.628228161295872112e-01
+7.533231937521204236e-01 3.988010690198531272e-01 1.690756638056752914e-01
+7.578808294584169492e-01 3.945424511336589335e-01 1.754217924072464518e-01
+7.623326022156785564e-01 3.902809567197497165e-01 1.817591538530497208e-01
+7.667320478995347521e-01 3.859654943537603744e-01 1.881681875043557384e-01
+7.710524721820763983e-01 3.816214148216601210e-01 1.946153193576832252e-01
+7.752952778457107286e-01 3.772473246523442292e-01 2.011065208945331251e-01
+7.794866593781552000e-01 3.728150850100374614e-01 2.076872953652798559e-01
+7.835853362619955575e-01 3.683677247727679127e-01 2.142973641992331202e-01
+7.876376313731141554e-01 3.638539950288945946e-01 2.210164757476915653e-01
+7.916113385801130109e-01 3.593080404226161040e-01 2.277974012097270795e-01
+7.955060552511121763e-01 3.547298979176854994e-01 2.346435260251332755e-01
+7.993539838133075781e-01 3.500795929482780067e-01 2.416183193481767355e-01
+8.031167084780931331e-01 3.454015163918872089e-01 2.486589162182153978e-01
+8.068103261859892461e-01 3.406745225101673324e-01 2.558007514596662979e-01
+8.104452043001210138e-01 3.358824841311982556e-01 2.630722168071251699e-01
+8.139968010634672790e-01 3.310553831960054150e-01 2.704318260711638389e-01
+8.174768947816700715e-01 3.261752637674419919e-01 2.779109619017897659e-01
+8.208941481936247175e-01 3.212262889577221503e-01 2.855384604486080891e-01
+8.242271261613036692e-01 3.162361985850312696e-01 2.932761677775464482e-01
+8.274766137520660481e-01 3.112015433453460544e-01 3.011338788484150264e-01
+8.306639856730879679e-01 3.060845940504859919e-01 3.091757851828964565e-01
+8.337630658888238733e-01 3.009224359536462057e-01 3.173492086215453090e-01
+8.367728587568070697e-01 2.957134612590129330e-01 3.256619937531243236e-01
+8.396969301670653696e-01 2.904472328682123905e-01 3.341366497709652439e-01
+8.425387334318170662e-01 2.851115076990556330e-01 3.427996193346179443e-01
+8.452829693062083871e-01 2.797291658336165110e-01 3.516207809735176215e-01
+8.479270414576970394e-01 2.743004518168249417e-01 3.606068061808916925e-01
+8.504679257105771661e-01 2.688262350691851821e-01 3.697639476988339724e-01
+8.529105574510703613e-01 2.632885874038991547e-01 3.791311611530527870e-01
+8.552420044048544279e-01 2.577088839643039142e-01 3.886821696092926381e-01
+8.574567263211506640e-01 2.520936658861107627e-01 3.984160108673813205e-01
+8.595502320723124035e-01 2.464473708549377862e-01 4.083362533435646036e-01
+8.615176695665305306e-01 2.407756349505418836e-01 4.184455712413106543e-01
+8.633539245616504987e-01 2.350852138633325872e-01 4.287460573240959860e-01
+8.650568452189218993e-01 2.293728768111193417e-01 4.392600781097817930e-01
+8.666160631462880293e-01 2.236630759123471868e-01 4.499612660389528673e-01
+8.680257787196800079e-01 2.179678524813165597e-01 4.608475800597766070e-01
+8.692800281403405549e-01 2.123013227323138907e-01 4.719155444862356830e-01
+8.703727414475561641e-01 2.066798807505955682e-01 4.831601540690036445e-01
+8.712978068076887572e-01 2.011223984119477337e-01 4.945747939602412324e-01
+8.720491402648608004e-01 1.956504128743852822e-01 5.061511790861612514e-01
+8.726207597696474805e-01 1.902882889012951495e-01 5.178793172539123413e-01
+8.730068619526127893e-01 1.850633392111822872e-01 5.297474998646168887e-01
+8.732018998073337590e-01 1.800058813906028066e-01 5.417423233741458510e-01
+8.732006592202997686e-01 1.751492049740893675e-01 5.538487436526324803e-01
+8.729983321570818910e-01 1.705294177324829519e-01 5.660501641838993070e-01
+8.725905843033689990e-01 1.661851370964102237e-01 5.783285576821829421e-01
+8.719736126526835829e-01 1.621569796196943858e-01 5.906646606873059424e-01
+8.711441430703839028e-01 1.584866680756561452e-01 6.030388085538075371e-01
+8.700996606911847175e-01 1.552168662477456385e-01 6.154284378630663355e-01
+8.688382315166471859e-01 1.523889228568965915e-01 6.278117548576560569e-01
+8.673585803491290491e-01 1.500419870434277214e-01 6.401665059420836856e-01
+8.656600953609360216e-01 1.482114935188816873e-01 6.524702171100530412e-01
+8.637428203708292784e-01 1.469276207331668138e-01 6.647004334019646077e-01
+8.616074355850228406e-01 1.462138565700954185e-01 6.768349518289993316e-01
+8.592552279602999610e-01 1.460858181738819150e-01 6.888520417478360969e-01
+8.566880526588371847e-01 1.465504601378146143e-01 7.007306474947510022e-01
+8.539082940810565070e-01 1.476057634824317899e-01 7.124505416663439172e-01
+8.509188132430276497e-01 1.492409439214724132e-01 7.239924974090546916e-01
+8.477228732160004832e-01 1.514371672020923265e-01 7.353384896921373315e-01
+8.443240935674275471e-01 1.541686506679828816e-01 7.464717393223647690e-01
+8.407263939629991967e-01 1.574040314553000475e-01 7.573767829039294019e-01
+8.369339386719339968e-01 1.611078555520196187e-01 7.680395184197363889e-01
+8.329510832270686782e-01 1.652420527841307607e-01 7.784472273410004695e-01
+8.287823240288615390e-01 1.697672910052525075e-01 7.885885755886976600e-01
+8.244322514509230260e-01 1.746441391323516057e-01 7.984535959358352031e-01
+8.199055067926670493e-01 1.798340046929527702e-01 8.080336545530442116e-01
+8.152067432395495583e-01 1.852998414406232253e-01 8.173214043862717659e-01
+8.103405908369269994e-01 1.910066437572490727e-01 8.263107279415592421e-01
+8.053117579051806141e-01 1.969216010609510237e-01 8.349964504885767358e-01
+8.001246695316600599e-01 2.030146524204510805e-01 8.433748621071933682e-01
+7.947836730093801316e-01 2.092582614636481764e-01 8.514431956464665330e-01
+7.892930180385833161e-01 2.156273737159832282e-01 8.591995655348122485e-01
+7.836568069717744223e-01 2.220993550443281506e-01 8.666429444356050782e-01
+7.778789796122015376e-01 2.286538551089048465e-01 8.737730828797295457e-01
+7.719633002465959848e-01 2.352726496465096795e-01 8.805904299224873721e-01
+7.659133466040326521e-01 2.419394735315277267e-01 8.870960555269299386e-01
+7.597325004651533931e-01 2.486398530394249295e-01 8.932915751926430170e-01
+7.534239396834068181e-01 2.553609429642716422e-01 8.991790771963389384e-01
+7.469906314200031039e-01 2.620913721366889826e-01 9.047610526867282399e-01
+7.404353264352245834e-01 2.688210993418901351e-01 9.100403287788533246e-01
+7.337605543192734503e-01 2.755412805372748908e-01 9.150200047193097763e-01
+7.269686195850667554e-01 2.822441475132592692e-01 9.197033911407090923e-01
+7.200615985827201193e-01 2.889228976436723495e-01 9.240939523881464002e-01
+7.130413372306516617e-01 2.955715940634778272e-01 9.281952518796100504e-01
+7.059094495911268918e-01 3.021850754377659598e-01 9.320109004535763741e-01
+6.986673173487639721e-01 3.087588744057577217e-01 9.355445076582962205e-01
+6.913160902792203633e-01 3.152891437666022756e-01 9.387996359465969887e-01
+6.838566878221142842e-01 3.217725894980000279e-01 9.417797577558794098e-01
+6.762898018976056802e-01 3.282064097483991527e-01 9.444882154741288671e-01
+6.686159011300095711e-01 3.345882390078672719e-01 9.469281843183131597e-01
+6.608352366648267973e-01 3.409160967342457216e-01 9.491026381806494383e-01
+6.529478497874137144e-01 3.471883397852293385e-01 9.510143185305323099e-01
+6.449535815726188392e-01 3.534036180803885596e-01 9.526657064947888776e-01
+6.368520848146350666e-01 3.595608329884161236e-01 9.540589982761437104e-01
+6.286428385050449874e-01 3.656590980031973470e-01 9.551960841088614762e-01
+6.203251651440072623e-01 3.716977013375789007e-01 9.560785309910512231e-01
+6.118982511841425387e-01 3.776760701263490727e-01 9.567075694743777392e-01
+6.033611709179768079e-01 3.835937359904362243e-01 9.570840848332117234e-01
+5.947129141266446206e-01 3.894503017735960748e-01 9.572086129751365968e-01
+5.859524178083830304e-01 3.952454093215529429e-01 9.570813414919564499e-01
+5.770786022984990549e-01 4.009787082326203289e-01 9.567021162826109260e-01
+5.680904120756430364e-01 4.066498255689147689e-01 9.560704542043091392e-01
+5.589868615201727398e-01 4.122583365789312393e-01 9.551855622225308151e-01
+5.497670858464057675e-01 4.178037365457583641e-01 9.540463635305430623e-01
+5.404303973688802110e-01 4.232854139404694238e-01 9.526515310905910860e-01
+5.309763471805271084e-01 4.287026251268353794e-01 9.509995290068892215e-01
+5.214047922154096959e-01 4.340544709302417981e-01 9.490886620701871612e-01
+5.117159675380545947e-01 4.393398754490472347e-01 9.469171337096092822e-01
+5.019105635439048418e-01 4.445575675481795996e-01 9.444831124449268867e-01
+4.919898075708288299e-01 4.497060655293146358e-01 9.417848067474301477e-01
+4.819555492105473404e-01 4.547836655159373520e-01 9.388205479873396042e-01
+4.718103483745911819e-01 4.597884341201938230e-01 9.355888808698555881e-01
+4.615575649166388517e-01 4.647182059669867082e-01 9.320886604427106592e-01
+4.511980082251949020e-01 4.695721776839077433e-01 9.283178636903177683e-01
+4.407385246316099514e-01 4.743468819302843476e-01 9.242766906682317041e-01
+4.301872191964954406e-01 4.790386406828319177e-01 9.199661970019400448e-01
+4.195516590423077341e-01 4.836443962749994996e-01 9.153875906397229700e-01
+4.088406331006777528e-01 4.881609386110861704e-01 9.105429315654867128e-01
+3.980642083018061106e-01 4.925849423947825101e-01 9.054352272162426996e-01
+3.872337717548847147e-01 4.969130108713233906e-01 9.000685170373873278e-01
+3.763620564988861550e-01 5.011417254753421924e-01 8.944479427537497251e-01
+3.654612663762428770e-01 5.052684034325813922e-01 8.885787674719856089e-01
+3.545465439790672080e-01 5.092897968880314430e-01 8.824681923036010733e-01
+3.436377931849474154e-01 5.132015795889635079e-01 8.761266360928694485e-01
+3.327530939137686161e-01 5.170008198204416594e-01 8.695640864822369309e-01
+3.219116583925260011e-01 5.206848733578030020e-01 8.627916585616799416e-01
+3.111337198622898259e-01 5.242514414427805747e-01 8.558215206665023000e-01
+3.004403986093719392e-01 5.276986238157412856e-01 8.486667948769511804e-01
+2.898532566310526581e-01 5.310250549915590534e-01 8.413412305522999235e-01
+2.793961594244663282e-01 5.342293148180886631e-01 8.338605094653681604e-01
+2.690918119759744820e-01 5.373109871573702456e-01 8.262398418700288572e-01
+2.589630009926549015e-01 5.402702010433201307e-01 8.184947475296583397e-01
+2.490323931623479869e-01 5.431076290262466522e-01 8.106408952154365855e-01
+2.393222899575573326e-01 5.458244839403564308e-01 8.026939223701164972e-01
+2.298566351816503373e-01 5.484218890000336355e-01 7.946712158983202379e-01
+2.206551002944838191e-01 5.509024141956824216e-01 7.865870626923798792e-01
+2.117364094415158937e-01 5.532690129113547739e-01 7.784553296976853831e-01
+2.031184306485467883e-01 5.555248911915373622e-01 7.702897347110843063e-01
+1.948172015035146420e-01 5.576736467032974431e-01 7.621031776295352778e-01
+1.868465966290397962e-01 5.597192229650957973e-01 7.539076339343501187e-01
+1.792179884783634825e-01 5.616658613090964591e-01 7.457140662049784874e-01
+1.719421959020442647e-01 5.635174702399022850e-01 7.375349843171632447e-01
+1.650229512673002386e-01 5.652791533635259658e-01 7.293775439873284583e-01
+1.584611602813638387e-01 5.669560017699032395e-01 7.212481886261494779e-01
+1.522549918213680353e-01 5.685529672520610589e-01 7.131532051881548373e-01
+1.463987618681510117e-01 5.700750569206646245e-01 7.050976866560473288e-01
+1.408828405908224835e-01 5.715272914520931336e-01 6.970855353349069139e-01
+1.356936625367466953e-01 5.729146658465781305e-01 6.891194758268863740e-01
+1.308138525417579801e-01 5.742421127377883572e-01 6.812010763134157543e-01
+1.262224734293325157e-01 5.755144682058210837e-01 6.733307769330967307e-01
+1.218953938035638729e-01 5.767364399826563348e-01 6.655079242329828837e-01
+1.178065439715534068e-01 5.779123523036159282e-01 6.577323260140637284e-01
+1.139261298009009160e-01 5.790467957802227783e-01 6.499998366451625875e-01
+1.102234782385779766e-01 5.801439808367224726e-01 6.423063681141680803e-01
+1.066673235183970281e-01 5.812078215483343913e-01 6.346473314887408623e-01
+1.032263067644274834e-01 5.822419757773840132e-01 6.270172879951815270e-01
+9.986970116659238395e-02 5.832498248631478033e-01 6.194100074982554771e-01
+9.656813269866712512e-02 5.842344549012296051e-01 6.118185305845139643e-01
+9.329429206118067253e-02 5.851986396650793454e-01 6.042352341768219004e-01
+9.002364276931534848e-02 5.861448252640329981e-01 5.966519005456781821e-01
+8.673514013646366205e-02 5.870751166646858143e-01 5.890597894857422245e-01
+8.341198598223345528e-02 5.879912662222103181e-01 5.814497133016774955e-01
+8.004245400348602990e-02 5.888946643728962815e-01 5.738121141059205899e-01
+7.662083060590932360e-02 5.897863326271246542e-01 5.661371427838456372e-01
+7.314852485397654869e-02 5.906669189727291602e-01 5.584147388414824054e-01
+6.963540714651897390e-02 5.915366957529474279e-01 5.506347102299997687e-01
+6.610143501147561218e-02 5.923955600227664986e-01 5.427868121514007882e-01
+6.257860760091599195e-02 5.932430363153763375e-01 5.348608238014407323e-01
+5.911303759975024968e-02 5.940783314685343930e-01 5.268461376019544229e-01
+5.576765010285392871e-02 5.949002975004614724e-01 5.187321979872163702e-01
+5.262510565424809855e-02 5.957073200832398996e-01 5.105097808257538228e-01
+4.978880680939656161e-02 5.964975038111670624e-01 5.021693595319391967e-01
+4.738319269394732774e-02 5.972686215557058143e-01 4.937017361708459506e-01
+4.555066847662456869e-02 5.980181252952141424e-01 4.850980867717663014e-01
+4.444396189302631667e-02 5.987431566697054564e-01 4.763500004038906943e-01
+4.421322948900235222e-02 5.994405566877633040e-01 4.674495124401222834e-01
+4.498917867710291313e-02 6.001068740129568146e-01 4.583891327826852824e-01
+4.686604485069371245e-02 6.007383712762072170e-01 4.491618701849053319e-01
+4.988979024235475762e-02 6.013310288983726437e-01 4.397612541729841729e-01
+5.405573006313083712e-02 6.018805543938667846e-01 4.301812015738862294e-01
+5.932208540209162745e-02 6.023828876312081748e-01 4.204054325617814780e-01
+6.560773880422715587e-02 6.028325831369402144e-01 4.104377156032376628e-01
+7.281962363892094392e-02 6.032244155970721833e-01 4.002736262351211383e-01
+8.086176781346332554e-02 6.035528335053932381e-01 3.899094149354802585e-01
+8.964365767756551917e-02 6.038119404209635332e-01 3.793420777858104165e-01
+9.908952486975769469e-02 6.039955435016706176e-01 3.685641184021282157e-01
+1.091461686387718844e-01 6.040969460876761676e-01 3.575579876882719055e-01
+1.197411868235576382e-01 6.041085844094219448e-01 3.463409605502589250e-01
+1.308274635712054768e-01 6.040228036354146068e-01 3.349141605174003056e-01
+1.423800347596975990e-01 6.038311914501962585e-01 3.232669997463486489e-01
+1.543847008629261053e-01 6.035242532835117801e-01 3.113882295486853913e-01
+1.667909278439370091e-01 6.030930063069259717e-01 2.993102878563658198e-01
+1.795975741928860503e-01 6.025266800569213377e-01 2.870237044475537069e-01
+1.927996570161342460e-01 6.018136381688595771e-01 2.745296424849442141e-01
+2.063446461864067438e-01 6.009446614046377588e-01 2.618794002040416569e-01
+2.202728729725795254e-01 5.999042993738278318e-01 2.490425136645111337e-01
+2.344983329249494819e-01 5.986859114745567423e-01 2.361102156981361166e-01
+2.490441577314199684e-01 5.972745984023483112e-01 2.230778046167814499e-01
+2.638200588853058526e-01 5.956665601719514092e-01 2.100467332369221340e-01
+2.788103972435367339e-01 5.938520960352462463e-01 1.970548426870546432e-01
+2.939149436021079032e-01 5.918334783865150106e-01 1.842162055743405413e-01
+3.090633958032663053e-01 5.896130197890373514e-01 1.716194213262129398e-01
+3.241557701146778325e-01 5.872013194176191053e-01 1.593775348465770181e-01
+3.391058987925449908e-01 5.846116417760637285e-01 1.475901239657965436e-01
+3.537962403050050608e-01 5.818679304916246631e-01 1.363773405186440579e-01
+3.681790539934771678e-01 5.789861015095073560e-01 1.258005415905540103e-01
+3.821596573789931561e-01 5.759951191731197406e-01 1.159503977992311363e-01
+3.957282445230750900e-01 5.729092809436007183e-01 1.068503820674790161e-01
+4.088192648913888116e-01 5.697572697905517458e-01 9.855521202608327758e-02
+4.214810649035653500e-01 5.665415862717396722e-01 9.104002246571415990e-02
+4.336495334558000403e-01 5.632929561600926727e-01 8.434116239111955071e-02
+4.453890783516751273e-01 5.600085906382493706e-01 7.841305443909030171e-02
+4.567242130853677584e-01 5.566942951475172263e-01 7.322913012508130981e-02
+4.676501707681009479e-01 5.533637269053324204e-01 6.876762134759795142e-02
+4.781913781821610088e-01 5.500213008191600084e-01 6.498435721988443659e-02
+4.883968612384750885e-01 5.466619506976900800e-01 6.182162837413415074e-02
+4.982892398787829857e-01 5.432873953595327432e-01 5.922725775013665955e-02
+5.078911374422868663e-01 5.398982668933685058e-01 5.714465998451528223e-02
+5.172247456455653092e-01 5.364942872197172585e-01 5.551476288204022086e-02
+5.263115025893324583e-01 5.330744300746458331e-01 5.427792556635833293e-02
+5.351718645250624906e-01 5.296370658817842747e-01 5.337566853443905662e-02
+5.438251536372012973e-01 5.261800887043684982e-01 5.275207547378853862e-02
+5.522894663786476199e-01 5.227010255649303661e-01 5.235479075452074277e-02
+5.605816294780567866e-01 5.191971290183284848e-01 5.213559944466891055e-02
+5.687171933168381210e-01 5.156654540879882509e-01 5.205062439450063722e-02
+5.767104547724090091e-01 5.121029206313181259e-01 5.206020204364426168e-02
+5.845745037500035268e-01 5.085063619725217476e-01 5.212850674796504907e-02
+5.923212894447653643e-01 5.048725602928031408e-01 5.222298774900729218e-02
+5.999617038945115333e-01 5.011982688438658684e-01 5.231366903560310394e-02
+6.075056816322426112e-01 4.974802205790658793e-01 5.237234455720112675e-02
+6.149623152735116394e-01 4.937151222923196747e-01 5.237168182411356537e-02
+6.223399877334323538e-01 4.898996328220020513e-01 5.228422613133864444e-02
+6.296465225194588511e-01 4.860303233135512824e-01 5.208127381405584094e-02
+6.368893542334475022e-01 4.821036169426133333e-01 5.173155232549151578e-02
+6.440757220432393737e-01 4.781157049081125598e-01 5.119960076823739520e-02
+6.512128893528150719e-01 4.740624350126631525e-01 5.044367478760234530e-02
+6.583083928921535932e-01 4.699391690315524728e-01 4.941288204103298082e-02];
+
+   case 'hal' 
+      RGB = [1.629529545569048110e-01 9.521591660747855124e-02 4.225729247643043585e-01
+1.648101130638113809e-01 9.635115909727909322e-02 4.318459659833655540e-01
+1.666161667445505146e-01 9.744967053737302320e-02 4.412064832719169161e-01
+1.683662394047173716e-01 9.851521320092249123e-02 4.506510991070378780e-01
+1.700547063176806595e-01 9.955275459284393391e-02 4.601751103492678907e-01
+1.716750780810941956e-01 1.005687314559364776e-01 4.697722208210775574e-01
+1.732198670017069397e-01 1.015713570251385311e-01 4.794342308257477092e-01
+1.746804342417165035e-01 1.025709733421875103e-01 4.891506793097686878e-01
+1.760433654254164593e-01 1.035658402770499587e-01 4.989416012077843576e-01
+1.772982333235153807e-01 1.045802467658180357e-01 5.087715885336102639e-01
+1.784322966250933284e-01 1.056380265564063059e-01 5.186108302832771466e-01
+1.794226692010022772e-01 1.067416562108134404e-01 5.284836071020164727e-01
+1.802542327126359922e-01 1.079356346679062328e-01 5.383245681077661882e-01
+1.808975365813079994e-01 1.092386640641496154e-01 5.481352134375515606e-01
+1.813298273265454008e-01 1.107042924622455293e-01 5.578435355461390799e-01
+1.815069308605478937e-01 1.123613365530294061e-01 5.674471854200233700e-01
+1.813959559086370799e-01 1.142804413027345978e-01 5.768505865319291104e-01
+1.809499433760710929e-01 1.165251530113385336e-01 5.859821014031293407e-01
+1.801166524094891808e-01 1.191682999758127970e-01 5.947494236872948870e-01
+1.788419557731087683e-01 1.222886104999623413e-01 6.030366129604394221e-01
+1.770751344832933727e-01 1.259620672997293078e-01 6.107077426144936760e-01
+1.747764954226868062e-01 1.302486445940692350e-01 6.176174300439590814e-01
+1.719255883800615836e-01 1.351768519397535118e-01 6.236290832033221099e-01
+1.685302279919113078e-01 1.407308818346016399e-01 6.286357211183263294e-01
+1.646373543798159977e-01 1.468433194330099889e-01 6.325796572366660930e-01
+1.603141656593721487e-01 1.534074847391770635e-01 6.354701889106297852e-01
+1.556539455727427579e-01 1.602911795924207572e-01 6.373742153046678682e-01
+1.507373567977903506e-01 1.673688895313445446e-01 6.383989700654711941e-01
+1.456427577979826360e-01 1.745293312408868480e-01 6.386687569056349600e-01
+1.404368075255880977e-01 1.816841459042554952e-01 6.383089542091028301e-01
+1.351726504089350855e-01 1.887688275072176014e-01 6.374350053971095109e-01
+1.298906561807787186e-01 1.957398580438490798e-01 6.361469852044080442e-01
+1.246205125693149729e-01 2.025703385486158914e-01 6.345282558695404251e-01
+1.193859004780570554e-01 2.092446623034395214e-01 6.326478270215730726e-01
+1.142294912197052703e-01 2.157456284251405010e-01 6.305768690676523125e-01
+1.091404911375367659e-01 2.220831206181900774e-01 6.283455167242665285e-01
+1.041438584244326337e-01 2.282546518282705383e-01 6.259979600528258192e-01
+9.926304855671816418e-02 2.342609767388125763e-01 6.235717761795677161e-01
+9.449512580805050077e-02 2.401139958170242505e-01 6.210816676451920149e-01
+8.986951574154733446e-02 2.458147193889331228e-01 6.185591936304666305e-01
+8.539285840535987271e-02 2.513729453557033144e-01 6.160166295227810229e-01
+8.106756674391193962e-02 2.567997050291829786e-01 6.134596708213713168e-01
+7.694418932732069449e-02 2.620915612909199277e-01 6.109238301118911085e-01
+7.300703739422578775e-02 2.672655035330154250e-01 6.083965011432549419e-01
+6.927650669442811382e-02 2.723273008096985248e-01 6.058873223830183452e-01
+6.578801445169751849e-02 2.772789491245566951e-01 6.034141752438300088e-01
+6.255595479554787453e-02 2.821282390686886132e-01 6.009787922718963227e-01
+5.959205181913470456e-02 2.868831717247524726e-01 5.985797542127682114e-01
+5.691772151374491912e-02 2.915488716281217640e-01 5.962214962176209943e-01
+5.455347307306369214e-02 2.961302536799313989e-01 5.939076044300871660e-01
+5.251889627870443694e-02 3.006318409387543356e-01 5.916414807294642086e-01
+5.083877347247430650e-02 3.050562292020492783e-01 5.894315315373579445e-01
+4.951454037014189208e-02 3.094102218220906031e-01 5.872714908845412252e-01
+4.855490408104565919e-02 3.136977658751046727e-01 5.851627302038014955e-01
+4.796369156225028380e-02 3.179225992994973993e-01 5.831062484926557987e-01
+4.773946305380068894e-02 3.220882581897950847e-01 5.811027291021745311e-01
+4.787545181415154422e-02 3.261980852298422273e-01 5.791525884087008746e-01
+4.835984720504159923e-02 3.302552388254387794e-01 5.772560174768572860e-01
+4.917638757411300215e-02 3.342627026038174076e-01 5.754130176762238813e-01
+5.030518671680884318e-02 3.382232950310170572e-01 5.736234310853615126e-01
+5.172369283691292258e-02 3.421396789632700219e-01 5.718869664041401624e-01
+5.340767549062541003e-02 3.460143709989857430e-01 5.702032209969470911e-01
+5.533215100674954839e-02 3.498497505368459159e-01 5.685716996038682192e-01
+5.747218306369886870e-02 3.536480684754851334e-01 5.669918301827847618e-01
+5.980352430527090951e-02 3.574114555130643578e-01 5.654629772812437283e-01
+6.230309069250609261e-02 3.611419300223894235e-01 5.639844532816007394e-01
+6.494927925026378057e-02 3.648414054902228698e-01 5.625555278152573058e-01
+6.772215122553368327e-02 3.685116975190721456e-01 5.611754356007422340e-01
+7.060350747784929770e-02 3.721545303967777607e-01 5.598433829250933913e-01
+7.357840396611611822e-02 3.757710087912914942e-01 5.585612898846836760e-01
+7.663101364217325684e-02 3.793629991309988569e-01 5.573268773673928367e-01
+7.974739830752586300e-02 3.829322364932883360e-01 5.561380319387883020e-01
+8.291580548873803136e-02 3.864801413799028307e-01 5.549938581786431069e-01
+8.612580955679122185e-02 3.900080689665953448e-01 5.538934528024703763e-01
+8.936817980172057085e-02 3.935173134989205512e-01 5.528359060062189023e-01
+9.263475301781654014e-02 3.970091123550867351e-01 5.518203023495191761e-01
+9.591831391237073956e-02 4.004846497947374129e-01 5.508457212473490960e-01
+9.921323508992196949e-02 4.039446967979293257e-01 5.499133654313189679e-01
+1.025139614653171327e-01 4.073902646845309894e-01 5.490228475752887416e-01
+1.058144853522852702e-01 4.108228877965505177e-01 5.481703859285301794e-01
+1.091104131658914012e-01 4.142435690118807523e-01 5.473550236322454188e-01
+1.123978495089298091e-01 4.176532725696484594e-01 5.465757987301745890e-01
+1.156733362160069500e-01 4.210529263321469151e-01 5.458317432175192607e-01
+1.189341701380315364e-01 4.244432161011251203e-01 5.451231873866256850e-01
+1.221781892974011241e-01 4.278246691926565481e-01 5.444513010684173260e-01
+1.254018943745988379e-01 4.311987106338182607e-01 5.438113725374379426e-01
+1.286031296249826039e-01 4.345661396549306832e-01 5.432023919026625070e-01
+1.317799711665625373e-01 4.379277275711909168e-01 5.426233385794481112e-01
+1.349307019221451520e-01 4.412842189714309415e-01 5.420731800699918335e-01
+1.380549051543558114e-01 4.446356900078314855e-01 5.415550926551251365e-01
+1.411501069188544899e-01 4.479834819017672332e-01 5.410638066180113448e-01
+1.442150210041465985e-01 4.513283116704150388e-01 5.405979268760919831e-01
+1.472485820103837661e-01 4.546708245755168298e-01 5.401563599016087069e-01
+1.502499341655997578e-01 4.580115969309521140e-01 5.397383042732707414e-01
+1.532192022679761678e-01 4.613507130792227628e-01 5.393460827274304537e-01
+1.561545863558880531e-01 4.646893652629560667e-01 5.389744586257710912e-01
+1.590554825896313418e-01 4.680281092699005163e-01 5.386222668134232894e-01
+1.619213854747377779e-01 4.713674796485894380e-01 5.382883230992108192e-01
+1.647524478987731911e-01 4.747077026242289555e-01 5.379733478625169374e-01
+1.675482630437002962e-01 4.780493319379570116e-01 5.376757027790604049e-01
+1.703080688452488778e-01 4.813931150452205876e-01 5.373922894579649112e-01
+1.730317245949949956e-01 4.847395013664480001e-01 5.371218460871988176e-01
+1.757193664968157432e-01 4.880888303994977417e-01 5.368636833242294015e-01
+1.783716503259393793e-01 4.914412289641479359e-01 5.366183612997760255e-01
+1.809878167761821144e-01 4.947975030047193079e-01 5.363817525707026412e-01
+1.835680719416625251e-01 4.981580161432020426e-01 5.361525222751042374e-01
+1.861127112291278973e-01 5.015231101060642072e-01 5.359293193132266264e-01
+1.886230405888700001e-01 5.048927132825591357e-01 5.357133548543864254e-01
+1.910985251486422565e-01 5.082675669534003626e-01 5.355003101591436776e-01
+1.935397227717326196e-01 5.116479477164066481e-01 5.352887824024628038e-01
+1.959472883340568350e-01 5.150341080561433582e-01 5.350773667248226451e-01
+1.983227076664061950e-01 5.184259856373716335e-01 5.348665525352744865e-01
+2.006660342507454731e-01 5.218241099237964642e-01 5.346528031121534630e-01
+2.029781360478647434e-01 5.252286912572143862e-01 5.344345169358406533e-01
+2.052600444742044838e-01 5.286398903414566419e-01 5.342102605335536936e-01
+2.075134652380221101e-01 5.320576287402744020e-01 5.339799959048032729e-01
+2.097389494614402272e-01 5.354822793223580346e-01 5.337406085215398166e-01
+2.119377691272176234e-01 5.389139515314046447e-01 5.334905459074957834e-01
+2.141113437844118228e-01 5.423527133674995726e-01 5.332283775266504211e-01
+2.162615771757636085e-01 5.457984712571943842e-01 5.329535750363618707e-01
+2.183895286205785324e-01 5.492514494924778390e-01 5.326634150194080597e-01
+2.204969036245257863e-01 5.527116487772890663e-01 5.323564832742772035e-01
+2.225855272635121618e-01 5.561790393438251767e-01 5.320314302436226495e-01
+2.246573660062902156e-01 5.596535532346759156e-01 5.316870266023980829e-01
+2.267141352300188206e-01 5.631352211554988552e-01 5.313212748929951879e-01
+2.287579175696445311e-01 5.666239548700177098e-01 5.309328290550865415e-01
+2.307908679682200148e-01 5.701196510565367248e-01 5.305203252817071169e-01
+2.328150701112509102e-01 5.736222405040750649e-01 5.300820599240353426e-01
+2.348328561421904603e-01 5.771315766359990107e-01 5.296167282704775658e-01
+2.368466495707550745e-01 5.806474896434283828e-01 5.291230766564496424e-01
+2.388588283644081933e-01 5.841698333340915594e-01 5.285995915811123602e-01
+2.408716822240541400e-01 5.876984999166237067e-01 5.280443921862176815e-01
+2.428880608722543410e-01 5.912331932277818947e-01 5.274567814051942527e-01
+2.449106759672304290e-01 5.947736703172152861e-01 5.268356212312692577e-01
+2.469420290965465559e-01 5.983197676291379663e-01 5.261791312000029253e-01
+2.489846702882144713e-01 6.018713111492172141e-01 5.254854952988164962e-01
+2.510418446331669773e-01 6.054278820406324702e-01 5.247545535679302153e-01
+2.531164830585315162e-01 6.089891735215487989e-01 5.239852980594518206e-01
+2.552111567013787274e-01 6.125550130731924892e-01 5.231756545447472373e-01
+2.573286340449815746e-01 6.161251617120727664e-01 5.223239185167128928e-01
+2.594724447386158594e-01 6.196990932330638246e-01 5.214304767886038805e-01
+2.616456589963800927e-01 6.232764459181282524e-01 5.204944566826074093e-01
+2.638509342960791981e-01 6.268570181766053295e-01 5.195136536074571598e-01
+2.660910828965943331e-01 6.304405546707460006e-01 5.184861377534477622e-01
+2.683698467163787016e-01 6.340264147511259774e-01 5.174130230514244477e-01
+2.706903509949471487e-01 6.376141889650659422e-01 5.162935692788781505e-01
+2.730554221838172868e-01 6.412035896296301996e-01 5.151259285643695618e-01
+2.754676310512871873e-01 6.447944545228798674e-01 5.139069764892589820e-01
+2.779309010023177096e-01 6.483859905965968506e-01 5.126390269795514376e-01
+2.804483318408275694e-01 6.519777450281342146e-01 5.113214639163841113e-01
+2.830229969716622218e-01 6.555692556652558123e-01 5.099537040511894492e-01
+2.856569925022096612e-01 6.591606030439277619e-01 5.085297306531970651e-01
+2.883543502639873135e-01 6.627507929293073863e-01 5.070537569679475220e-01
+2.911180907975667309e-01 6.663393219020087299e-01 5.055253556302098383e-01
+2.939511790083492726e-01 6.699256847308838747e-01 5.039440536705714901e-01
+2.968562131418951422e-01 6.735096490751359966e-01 5.023062065413991251e-01
+2.998362114418811064e-01 6.770906951012128916e-01 5.006109626120457401e-01
+3.028943961763405635e-01 6.806680059292820051e-01 4.988609220555944579e-01
+3.060335830069556007e-01 6.842410278074210206e-01 4.970557164988521071e-01
+3.092565373453909361e-01 6.878091952372648032e-01 4.951950035800954386e-01
+3.125659486948474952e-01 6.913723055472413836e-01 4.932732004330610542e-01
+3.159647522698377231e-01 6.949295261702347348e-01 4.912927476409480465e-01
+3.194556489243873809e-01 6.984800979280558764e-01 4.892553378582480961e-01
+3.230412442793148542e-01 7.020233920397538352e-01 4.871607422199746851e-01
+3.267240985578743762e-01 7.055587631720373620e-01 4.850087606010107799e-01
+3.305070751488592418e-01 7.090857414439620809e-01 4.827955626459811689e-01
+3.343929739199408280e-01 7.126036449951604901e-01 4.805201317683439055e-01
+3.383839618515475101e-01 7.161115318028217214e-01 4.781864627637871235e-01
+3.424824761777380822e-01 7.196086676710338192e-01 4.757945201032026117e-01
+3.466909265050957534e-01 7.230942938245445983e-01 4.733443136156250675e-01
+3.510117003671430203e-01 7.265676248366644829e-01 4.708359034900377327e-01
+3.554477481971078934e-01 7.300279237012574640e-01 4.682667163182038794e-01
+3.600022066505755847e-01 7.334743741555846963e-01 4.656343331651458528e-01
+3.646764457841936702e-01 7.369059239634064840e-01 4.629441295765394648e-01
+3.694728210602395979e-01 7.403216514270205550e-01 4.601965063235068931e-01
+3.743936915522128039e-01 7.437205957454258165e-01 4.573919681273960758e-01
+3.794414259131371203e-01 7.471017539541063845e-01 4.545311394783269621e-01
+3.846184079557829483e-01 7.504640777072076885e-01 4.516147832933739559e-01
+3.899270416022538321e-01 7.538064699246833644e-01 4.486438228496626990e-01
+3.953697549145612777e-01 7.571277813375660859e-01 4.456193674826627871e-01
+4.009508646485598904e-01 7.604267477869489644e-01 4.425380639654961090e-01
+4.066714019599443342e-01 7.637021069222051928e-01 4.394056497009877216e-01
+4.125334807152798988e-01 7.669525443587899005e-01 4.362249727525224774e-01
+4.185395667527040398e-01 7.701766751192415938e-01 4.329983295596441795e-01
+4.246921350385852723e-01 7.733730477083216037e-01 4.297284080553480656e-01
+4.309936593663836191e-01 7.765401418648604226e-01 4.264183470604332449e-01
+4.374465975304094312e-01 7.796763669997491819e-01 4.230718037095967943e-01
+4.440533711015541840e-01 7.827800615723168320e-01 4.196930295353452078e-01
+4.508163388346139722e-01 7.858494937119429036e-01 4.162869557148224930e-01
+4.577377626480225170e-01 7.888828634531382944e-01 4.128592877810690620e-01
+4.648197650471433406e-01 7.918783070193569085e-01 4.094166097874233912e-01
+4.720642768256655963e-01 7.948339036614172626e-01 4.059664974607166132e-01
+4.794729738954752185e-01 7.977476856267914362e-01 4.025176392507668344e-01
+4.870472021865835388e-01 8.006176519006481529e-01 3.990799633442549399e-01
+4.947878897554374711e-01 8.034417864099652196e-01 3.956647676266520364e-01
+5.026954455748450235e-01 8.062180814071850943e-01 3.922848482216537147e-01
+5.107722312752203120e-01 8.089441566688712060e-01 3.889513459863399025e-01
+5.190175807229889804e-01 8.116180108735555621e-01 3.856804341377490508e-01
+5.274270476594079549e-01 8.142382455983395717e-01 3.824934902796895964e-01
+5.359974387485314518e-01 8.168032862890818313e-01 3.794106529717772847e-01
+5.447242959015131669e-01 8.193118012377970105e-01 3.764539238160731771e-01
+5.536017493685388979e-01 8.217627673204914718e-01 3.736470734604069865e-01
+5.626223858732353200e-01 8.241555398979113489e-01 3.710154595070918049e-01
+5.717801732913297963e-01 8.264893011624766528e-01 3.685830453573430421e-01
+5.810619798273547465e-01 8.287648131945639651e-01 3.663798607459672341e-01
+5.904522695833789303e-01 8.309836316507100973e-01 3.644363382969363352e-01
+5.999363056699199559e-01 8.331474672067843423e-01 3.627802030453921023e-01
+6.094978370184862548e-01 8.352587020450518152e-01 3.614380620192426119e-01
+6.191178753985615568e-01 8.373207419267220120e-01 3.604354982890065617e-01
+6.287753075069072439e-01 8.393379672623436649e-01 3.597956834322972863e-01
+6.384515865712356852e-01 8.413146218129586851e-01 3.595361765343614291e-01
+6.481275660781142811e-01 8.432555569199260415e-01 3.596707668706327632e-01
+6.577845458065525452e-01 8.451659780810962808e-01 3.602086612732601778e-01
+6.674047070379289792e-01 8.470513147981415525e-01 3.611542742755425861e-01
+6.769617561788032756e-01 8.489198363378159806e-01 3.625096347273936148e-01
+6.864487597795673191e-01 8.507748949282539774e-01 3.642665641101618390e-01
+6.958544314564799604e-01 8.526212799355240568e-01 3.664154684319869681e-01
+7.051685608468114541e-01 8.544637256207057163e-01 3.689436786046771388e-01
+7.143830272263600456e-01 8.563065614925247093e-01 3.718358172740615641e-01
+7.234917624309317175e-01 8.581536540348341235e-01 3.750744951817871486e-01
+7.324906484647774052e-01 8.600083717860309562e-01 3.786409937540124448e-01
+7.413773645706981386e-01 8.618735721244006331e-01 3.825158976261986421e-01
+7.501511992657796668e-01 8.637516069265696039e-01 3.866796514151401021e-01
+7.588128421172509741e-01 8.656443435632366068e-01 3.911130257986148440e-01
+7.673641682613402404e-01 8.675531974405399360e-01 3.957974875667232828e-01
+7.758080262912036007e-01 8.694791724028596569e-01 4.007154759905482422e-01
+7.841480375461038488e-01 8.714229056785223193e-01 4.058505933213660266e-01
+7.923777293356836227e-01 8.733886508286130557e-01 4.111824877427081026e-01
+8.004976303968860396e-01 8.753781889640523950e-01 4.166935560611597644e-01
+8.085242857272323391e-01 8.773871783186646400e-01 4.223760515178233144e-01
+8.164630734789560806e-01 8.794151844938148388e-01 4.282186311869483064e-01
+8.243194501554683695e-01 8.814616081475756815e-01 4.342112747863317024e-01
+8.320860387263339097e-01 8.835308362945183402e-01 4.403358497380424619e-01
+8.397544323444476877e-01 8.856278479633188372e-01 4.465723185371322512e-01
+8.473543986252204396e-01 8.877421380157632935e-01 4.529306634208433713e-01
+8.548913210362114601e-01 8.898726582646793171e-01 4.594053245849991085e-01
+8.623409541601502193e-01 8.920307544658760968e-01 4.659650403812060637e-01
+8.697191661117472661e-01 8.942111604773197442e-01 4.726125804953009157e-01
+8.770479480763140323e-01 8.964055876253053112e-01 4.793596015320920611e-01
+8.843061388708378656e-01 8.986242192828276520e-01 4.861771826919926709e-01
+8.914967901846199139e-01 9.008669432468144889e-01 4.930589607663434237e-01
+8.986506618699680038e-01 9.031210853874221955e-01 5.000298200873778409e-01
+9.057328617844134788e-01 9.054032588350297006e-01 5.070444917818385244e-01
+9.127681739145864226e-01 9.077032841253237505e-01 5.141229319104883011e-01
+9.197719823668246697e-01 9.100148294768658497e-01 5.212774789419143406e-01
+9.266999503758117651e-01 9.123594905222979223e-01 5.284479861571415027e-01
+9.336093927737403320e-01 9.147111822755604749e-01 5.356989519972219504e-01
+9.404610328906413130e-01 9.170893351552455997e-01 5.429753047678268496e-01
+9.472803518326599059e-01 9.194825361628593541e-01 5.503044468166357062e-01
+9.540659681238262690e-01 9.218921210725944393e-01 5.576799909240343078e-01
+9.608049809199471492e-01 9.243252266483533708e-01 5.650790057480892248e-01
+9.675287370768704820e-01 9.267668902399696096e-01 5.725413863443260531e-01
+9.741967269037244970e-01 9.292382142036349491e-01 5.800041593344547053e-01
+9.808627042040826138e-01 9.317124815536732552e-01 5.875425838151492330e-01
+9.874684104099172854e-01 9.342202886448683907e-01 5.950648878797101249e-01
+9.940805805099582892e-01 9.367275819156850591e-01 6.026699962989522374e-01]; 
+
+   case 'spe' 
+      RGB = [9.996253193176977137e-01 9.913711226010460953e-01 8.041012438578545307e-01
+9.969312990878144154e-01 9.865865913107011442e-01 7.958196545688069889e-01
+9.942533588637104680e-01 9.818135789307643746e-01 7.875317815897165952e-01
+9.915896776086415842e-01 9.770525904709529419e-01 7.792374356109948996e-01
+9.889384786221749879e-01 9.723041153469224041e-01 7.709364896057565586e-01
+9.862980251266783016e-01 9.675686302753326862e-01 7.626288656679628408e-01
+9.836666169060123144e-01 9.628466015967408476e-01 7.543145233681930462e-01
+9.810425876106124710e-01 9.581384871880828102e-01 7.459934495167190871e-01
+9.784237290846492519e-01 9.534448589527805273e-01 7.376670490866494845e-01
+9.758091741853186507e-01 9.487660072025493330e-01 7.293335612360094533e-01
+9.731976797213667263e-01 9.441023023821585314e-01 7.209921595340745837e-01
+9.705876565172376624e-01 9.394541905537218129e-01 7.126429103405369503e-01
+9.679775344953384097e-01 9.348221172710475813e-01 7.042858810456844587e-01
+9.653657609756586266e-01 9.302065285603877687e-01 6.959211353452218196e-01
+9.627508763245108403e-01 9.256078555762781157e-01 6.875485248304887831e-01
+9.601317913231469658e-01 9.210264571207541495e-01 6.791669211618720503e-01
+9.575068348330096901e-01 9.164628209777989643e-01 6.707767168399573210e-01
+9.548744491996995487e-01 9.119174176425877132e-01 6.623780173986024700e-01
+9.522330808045905703e-01 9.073907239128325974e-01 6.539709177027834830e-01
+9.495811770290348841e-01 9.028832240271246201e-01 6.455555018977681137e-01
+9.469171829214290126e-01 8.983954108674836458e-01 6.371318441574638225e-01
+9.442402190659517913e-01 8.939276490907958062e-01 6.286979645113369708e-01
+9.415486437855169477e-01 8.894804711503382366e-01 6.202539985663386712e-01
+9.388403761261178149e-01 8.850545069722992597e-01 6.118014161078325630e-01
+9.361137658947894513e-01 8.806503085987659185e-01 6.033403762527677072e-01
+9.333671427931780062e-01 8.762684428171652051e-01 5.948710444843188228e-01
+9.305988122871574619e-01 8.719094924143574454e-01 5.863935979844183688e-01
+9.278070514355759579e-01 8.675740573997056115e-01 5.779082318269497254e-01
+9.249901047433721768e-01 8.632627561697012730e-01 5.694151660419812799e-01
+9.221469800733509414e-01 8.589760860685742294e-01 5.609116482547054083e-01
+9.192753048560652340e-01 8.547148108589553983e-01 5.523997440377725887e-01
+9.163728560349155838e-01 8.504796735679325259e-01 5.438810466983201586e-01
+9.134376867190158178e-01 8.462713800742609482e-01 5.353560484875481418e-01
+9.104678046010745707e-01 8.420906570028113824e-01 5.268253096213930675e-01
+9.074611700430375016e-01 8.379382516634488187e-01 5.182894693241438810e-01
+9.044156948810763152e-01 8.338149316350844664e-01 5.097492574011085464e-01
+9.013292420875533839e-01 8.297214839374013051e-01 5.012055062134753713e-01
+8.981996264328737656e-01 8.256587137313211588e-01 4.926591628979440363e-01
+8.950246162923013449e-01 8.216274424893472705e-01 4.841113016411668357e-01
+8.918019367410795484e-01 8.176285055788921063e-01 4.755631357855747976e-01
+8.885292740744069606e-01 8.136627492060259925e-01 4.670160295098501613e-01
+8.852042818763621312e-01 8.097310266740884721e-01 4.584715087957387802e-01
+8.818245887426444662e-01 8.058341939216442373e-01 4.499312713647861117e-01
+8.783878077356160885e-01 8.019731043176190344e-01 4.413971952459587733e-01
+8.748915476159051519e-01 7.981486027081815537e-01 4.328713456201330745e-01
+8.713334258529761289e-01 7.943615187300834268e-01 4.243559795823733105e-01
+8.677110833677242896e-01 7.906126594284177411e-01 4.158535484698712703e-01
+8.640222009043423412e-01 7.869028012426558805e-01 4.073666974243692063e-01
+8.602645168678531018e-01 7.832326814525909509e-01 3.988982618942717440e-01
+8.564358463998196225e-01 7.796029892044549214e-01 3.904512608343593816e-01
+8.525341014005127782e-01 7.760143562656642846e-01 3.820288864300384613e-01
+8.485573111443696082e-01 7.724673476829161389e-01 3.736344902575098326e-01
+8.445036430802366212e-01 7.689624525410815314e-01 3.652715658890242079e-01
+8.403714233625397823e-01 7.655000750378188057e-01 3.569437280604416673e-01
+8.361591566273345322e-01 7.620805260995172636e-01 3.486546886323707573e-01
+8.318655445115968883e-01 7.587040157667198637e-01 3.404082296912668837e-01
+8.274895024172935765e-01 7.553706465705579687e-01 3.322081742472747790e-01
+8.230301740454328829e-01 7.520804081054507373e-01 3.240583550855133943e-01
+8.184868212302832680e-01 7.488332616294635091e-01 3.159617825674137515e-01
+8.138590110822148116e-01 7.456289896604103573e-01 3.079221377655331771e-01
+8.091468181242912339e-01 7.424670871619818424e-01 2.999443469091602199e-01
+8.043504122379883103e-01 7.393470563716729727e-01 2.920319686576324791e-01
+7.994702184716161453e-01 7.362682828578653860e-01 2.841884012704181672e-01
+7.945069109411802000e-01 7.332300399833050486e-01 2.764168555307422448e-01
+7.894614033518293494e-01 7.302314948629916591e-01 2.687203309843908539e-01
+7.843348364120679150e-01 7.272717156577747089e-01 2.611015959667907227e-01
+7.791285260147496894e-01 7.243496994364320152e-01 2.535630684860531447e-01
+7.738440801480908071e-01 7.214643092911102729e-01 2.461071963221510561e-01
+7.684833208817296590e-01 7.186143199358207001e-01 2.387362039122769009e-01
+7.630481315977482026e-01 7.157984953860191402e-01 2.314517734491695622e-01
+7.575405230514773436e-01 7.130155515836559266e-01 2.242553190375982108e-01
+7.519626112766101267e-01 7.102641669372077304e-01 2.171479941172158035e-01
+7.463165956980535309e-01 7.075429925763011552e-01 2.101307026608347228e-01
+7.406047378440419049e-01 7.048506621488696000e-01 2.032041138079452858e-01
+7.348297350913484127e-01 7.021856197788983733e-01 1.963692968886621149e-01
+7.289936844492124202e-01 6.995466025992004289e-01 1.896260481458106884e-01
+7.230988483362374986e-01 6.969322773880018973e-01 1.829743149302962002e-01
+7.171475322086006132e-01 6.943412998823550453e-01 1.764139943240976283e-01
+7.111420143928013360e-01 6.917723467781027313e-01 1.699448658068684892e-01
+7.050845338608371371e-01 6.892241206236302542e-01 1.635666199792324693e-01
+6.989772797030316953e-01 6.866953538838792559e-01 1.572788888364401172e-01
+6.928223822517928232e-01 6.841848122132092591e-01 1.510812776309110872e-01
+6.866220524799201419e-01 6.816912363109779438e-01 1.449735254345622115e-01
+6.803786701652846380e-01 6.792133090629258740e-01 1.389555620195359609e-01
+6.740936196655853418e-01 6.767501306945983286e-01 1.330266252977832520e-01
+6.677687244983904202e-01 6.743006234739316040e-01 1.271865644636745452e-01
+6.614057275351008514e-01 6.718637487365417549e-01 1.214353970802317662e-01
+6.550062900453353931e-01 6.694385066322930955e-01 1.157733573283348805e-01
+6.485719915801509972e-01 6.670239355272904458e-01 1.102009495253571669e-01
+6.421043305819508218e-01 6.646191111168818777e-01 1.047190080781650323e-01
+6.356047256163376291e-01 6.622231453008022850e-01 9.932876523540395963e-02
+6.290745171295046845e-01 6.598351848668921882e-01 9.403192821288078318e-02
+6.225149696438274649e-01 6.574544100249212208e-01 8.883076747185855715e-02
+6.159272743135092432e-01 6.550800328272597950e-01 8.372821811088401733e-02
+6.093126663293514378e-01 6.527112545185101977e-01 7.872799706657532259e-02
+6.026723170612737768e-01 6.503473055396404856e-01 7.383469856963406630e-02
+5.960069280976730832e-01 6.479875866853281874e-01 6.905400752442764079e-02
+5.893174254692321590e-01 6.456314203776034599e-01 6.439287527349069062e-02
+5.826046784844106652e-01 6.432781520370909334e-01 5.985968924725062340e-02
+5.758695032242261425e-01 6.409271483905801814e-01 5.546448455059219823e-02
+5.691126660872921628e-01 6.385777958070207871e-01 5.121916775709036557e-02
+5.623348873683923221e-01 6.362294986703330713e-01 4.713774156788400754e-02
+5.555368448583254404e-01 6.338816777957024806e-01 4.323651096469569716e-02
+5.487191774565705060e-01 6.315337688945173999e-01 3.952487864258176498e-02
+5.418824887917018662e-01 6.291852210919098853e-01 3.612051121019213551e-02
+5.350273508472259687e-01 6.268354954999130202e-01 3.311399967360150604e-02
+5.281543075929241438e-01 6.244840638484698836e-01 3.049096132752013993e-02
+5.212638786236020172e-01 6.221304071760309640e-01 2.823775650583685778e-02
+5.143565628087404251e-01 6.197740145810481938e-01 2.634144880489198981e-02
+5.074328419576341620e-01 6.174143820354919265e-01 2.478976657062584646e-02
+5.004931845054064743e-01 6.150510112614009373e-01 2.357106560875196072e-02
+4.935380492257968599e-01 6.126834086714986194e-01 2.267429306479169446e-02
+4.865677337149327264e-01 6.103111278318402722e-01 2.208918519158591109e-02
+4.795827833081557912e-01 6.079336535225863258e-01 2.180564619063158835e-02
+4.725836555273193462e-01 6.055504983495709759e-01 2.181419194008693205e-02
+4.655708088649732068e-01 6.031611773523495312e-01 2.210580170001537684e-02
+4.585447116306416437e-01 6.007652058968021569e-01 2.267187969798983502e-02
+4.515058459835388782e-01 5.983620990282547680e-01 2.350422445657735990e-02
+4.444547120266517104e-01 5.959513709030562767e-01 2.459499875403014374e-02
+4.373918319618326778e-01 5.935325343022211930e-01 2.593670014651517156e-02
+4.303177543037495223e-01 5.911051002310937497e-01 2.752213198538535840e-02
+4.232330581488202292e-01 5.886685776092354105e-01 2.934437486930205341e-02
+4.161383574931313278e-01 5.862224730549979723e-01 3.139675847884770832e-02
+4.090343055913983616e-01 5.837662907693373926e-01 3.367283375013734037e-02
+4.019215993467592507e-01 5.812995325235387201e-01 3.616634535426579283e-02
+3.948009837190709082e-01 5.788216977554323517e-01 3.887120446073646235e-02
+3.876732561372571162e-01 5.763322837785355146e-01 4.174672181203834681e-02
+3.805386564470196742e-01 5.738309171411589693e-01 4.468566878513501733e-02
+3.733986391498164137e-01 5.713169711328536238e-01 4.768049787246867594e-02
+3.662542351622480874e-01 5.687899279044026368e-01 5.071835758395210753e-02
+3.591065040473656045e-01 5.662492786415918022e-01 5.378828392041421630e-02
+3.519565800474088735e-01 5.636945152858550134e-01 5.688085721725138350e-02
+3.448056760545124555e-01 5.611251315161035480e-01 5.998797256299469999e-02
+3.376550874229136134e-01 5.585406238589376571e-01 6.310263770132876204e-02
+3.305061956006355439e-01 5.559404929241524851e-01 6.621879773242350664e-02
+3.233604715607960034e-01 5.533242447607230607e-01 6.933118466356372189e-02
+3.162194790161148017e-01 5.506913923265978061e-01 7.243518928216058361e-02
+3.090846039651472532e-01 5.480415027343880086e-01 7.552721746757809496e-02
+3.019574288899705139e-01 5.453741321890830385e-01 7.860394456462099777e-02
+2.948403194287022577e-01 5.426887379559618418e-01 8.166128713902018332e-02
+2.877352499045566225e-01 5.399848761881764769e-01 8.469633286585029341e-02
+2.806442994214729536e-01 5.372621189537871711e-01 8.770643445761908130e-02
+2.735696535538801322e-01 5.345200561570193631e-01 9.068916512095565041e-02
+2.665136059049172390e-01 5.317582974656462902e-01 9.364228167891575083e-02
+2.594785595977833204e-01 5.289764742223507232e-01 9.656369418956520234e-02
+2.524670287821700332e-01 5.261742413169625543e-01 9.945144107016240520e-02
+2.454813557062531792e-01 5.233513142453691813e-01 1.023041162767710510e-01
+2.385245828710040317e-01 5.205073603004944927e-01 1.051194831525161522e-01
+2.315996737216303170e-01 5.176421037021866622e-01 1.078956959800008442e-01
+2.247096070811669399e-01 5.147553123030387257e-01 1.106311405318080310e-01
+2.178574824667257048e-01 5.118467857547527311e-01 1.133242655958566492e-01
+2.110465244393363582e-01 5.089163566221597268e-01 1.159735773093806543e-01
+2.042800881777394606e-01 5.059638913007615812e-01 1.185776351459725819e-01
+1.975616665475327660e-01 5.029892907239723598e-01 1.211350492651094846e-01
+1.908950317685597087e-01 4.999924798399172921e-01 1.236442618572499708e-01
+1.842839642352289697e-01 4.969734333710090213e-01 1.261039978961912833e-01
+1.777324020667393756e-01 4.939321620495928378e-01 1.285130506256617899e-01
+1.712444848635372441e-01 4.908687102327232155e-01 1.308702368677320538e-01
+1.648245567449286297e-01 4.877831568788963401e-01 1.331744245804179216e-01
+1.584771896665797541e-01 4.846756148389082530e-01 1.354245338303780855e-01
+1.522072108246106115e-01 4.815462299379932865e-01 1.376195378692431359e-01
+1.460197345452351747e-01 4.783951798632230523e-01 1.397584642177332193e-01
+1.399204939260773328e-01 4.752226638142488802e-01 1.418397751955981501e-01
+1.339151022806790436e-01 4.720289313790105301e-01 1.438629155677119409e-01
+1.280096392738992173e-01 4.688142535267130762e-01 1.458273227721058329e-01
+1.222107627052576584e-01 4.655789223639808516e-01 1.477322650340249788e-01
+1.165256528622910237e-01 4.623232537320298152e-01 1.495770677617926092e-01
+1.109620746853187123e-01 4.590475853271560047e-01 1.513611132825743999e-01
+1.055284430115649430e-01 4.557522747771929894e-01 1.530838402977779955e-01
+1.002338888313226428e-01 4.524376976954341267e-01 1.547447430577089666e-01
+9.508832342249537439e-02 4.491042457325262194e-01 1.563433702619193288e-01
+9.010250937510871916e-02 4.457523324675090604e-01 1.578790892676192326e-01
+8.528801833375249108e-02 4.423823989146767888e-01 1.593510674113139958e-01
+8.065727940861416867e-02 4.389948528858526600e-01 1.607597457256386420e-01
+7.622371216564308161e-02 4.355901307746828932e-01 1.621048834368656322e-01
+7.200158271604989446e-02 4.321686757028083692e-01 1.633862841279137557e-01
+6.800589086138220107e-02 4.287309359317861834e-01 1.646037933778843332e-01
+6.425218103335716968e-02 4.252773633715483670e-01 1.657572962977645059e-01
+6.075626148835750612e-02 4.218084121914437157e-01 1.668467149892300661e-01
+5.753381975108700502e-02 4.183245375382101949e-01 1.678720059529140995e-01
+5.459992971435845971e-02 4.148261943636451510e-01 1.688331574715942474e-01
+5.196845773512390881e-02 4.113138363632788397e-01 1.697301869925023354e-01
+4.965139124510086627e-02 4.077879150260529384e-01 1.705631385315065085e-01
+4.765813208284918473e-02 4.042488787938245398e-01 1.713320801202671551e-01
+4.599481449154869256e-02 4.006971723285012166e-01 1.720371013157572515e-01
+4.466371969486728627e-02 3.971332358837184051e-01 1.726783107897287561e-01
+4.366274483561478209e-02 3.935575133766276990e-01 1.732557671739120286e-01
+4.298497468310508857e-02 3.899704687794856572e-01 1.737693705957654433e-01
+4.262017645185838671e-02 3.863724827023667929e-01 1.742196255705478480e-01
+4.255352467768171859e-02 3.827639728113220174e-01 1.746066936456434071e-01
+4.276673184831410873e-02 3.791453506945430818e-01 1.749307448926006592e-01
+4.323878239983177524e-02 3.755170217599948512e-01 1.751919563188165385e-01
+4.394675081101364483e-02 3.718793851987791665e-01 1.753905104335057585e-01
+4.486662442701292580e-02 3.682328340080037177e-01 1.755265939730583369e-01
+4.597406436707644067e-02 3.645777550668193867e-01 1.756003967899375517e-01
+4.724505801823831314e-02 3.609145292591857124e-01 1.756121109084000098e-01
+4.865643856140024898e-02 3.572435316368365310e-01 1.755619297495205344e-01
+5.018626632042253594e-02 3.535651316158259783e-01 1.754500475272437465e-01
+5.181408104443557122e-02 3.498796931999255677e-01 1.752766588164567374e-01
+5.352104295989750654e-02 3.461875752240315962e-01 1.750419582933170903e-01
+5.528998425553303259e-02 3.424891316106106198e-01 1.747461406473147794e-01
+5.710539287663336100e-02 3.387847116320403806e-01 1.743894006636908245e-01
+5.895334846203271334e-02 3.350746601715560713e-01 1.739719334739151524e-01
+6.082142709649813322e-02 3.313593179753057116e-01 1.734939349708606859e-01
+6.269858808390260663e-02 3.276390218878380001e-01 1.729556023841174184e-01
+6.457505267241087088e-02 3.239141050631572094e-01 1.723571350094970367e-01
+6.644218183629055363e-02 3.201848971432968427e-01 1.716987350852014205e-01
+6.829235792686130790e-02 3.164517243962254311e-01 1.709806088053268391e-01
+7.011887323479765177e-02 3.127149098048046527e-01 1.702029674593475428e-01
+7.191582719453681882e-02 3.089747730984767071e-01 1.693660286839586415e-01
+7.367740139700959534e-02 3.052317018390342529e-01 1.684698187582648887e-01
+7.539908659075802988e-02 3.014860094828903936e-01 1.675145933863426417e-01
+7.707730571895973770e-02 2.977379606831319081e-01 1.665007348086736949e-01
+7.870852955781817983e-02 2.939878648964006636e-01 1.654284970811750188e-01
+8.028965953863020921e-02 2.902360278178472974e-01 1.642981478645798299e-01
+8.181797774419891089e-02 2.864827509313960796e-01 1.631099700093367744e-01
+8.329110360766753263e-02 2.827283309501391617e-01 1.618642630930951787e-01
+8.470695659424687385e-02 2.789730591425138573e-01 1.605613448745624727e-01
+8.606372418387428502e-02 2.752172205414125661e-01 1.592015526248838075e-01
+8.735983452008261319e-02 2.714610930351273321e-01 1.577852442954886525e-01
+8.859393314120664331e-02 2.677049463410028363e-01 1.563127994796906506e-01
+8.976486326081492551e-02 2.639490408648579312e-01 1.547846201243904263e-01
+9.087164911293293956e-02 2.601936264515474218e-01 1.532011309481255412e-01
+9.191348192284298779e-02 2.564389410344570241e-01 1.515627795225681362e-01
+9.288704312629730842e-02 2.526856315239155992e-01 1.498693699931691048e-01
+9.379283018859288501e-02 2.489337717503207204e-01 1.481216905842226428e-01
+9.463163644057562274e-02 2.451833792964967507e-01 1.463205652098015508e-01
+9.540318566942779244e-02 2.414346401225993533e-01 1.444665315338557743e-01
+9.610732643393554708e-02 2.376877206774311024e-01 1.425601463139360425e-01
+9.674402718144511915e-02 2.339427661170380146e-01 1.406019829499289553e-01
+9.731337192794831115e-02 2.301998985206034631e-01 1.385926284969124511e-01
+9.781527030012060475e-02 2.264592671684997338e-01 1.365326231802845014e-01
+9.824358966693200190e-02 2.227221381992704474e-01 1.344213498047777955e-01
+9.860476008591259611e-02 2.189874851640599696e-01 1.322606854144605382e-01
+9.889926458171927059e-02 2.152553323101172311e-01 1.300512525669721697e-01
+9.912768720083675600e-02 2.115256719866073221e-01 1.277936680974917916e-01
+9.929070945217863264e-02 2.077984630697710111e-01 1.254885372707029156e-01
+9.938536693535210409e-02 2.040743841747782450e-01 1.231359093599569132e-01
+9.940987528000957973e-02 2.003539028956775048e-01 1.207361104943659447e-01
+9.937074432198822471e-02 1.966357733029605592e-01 1.182905659078862248e-01
+9.926899950314096999e-02 1.929198155529378012e-01 1.157998086675786908e-01
+9.910574746809375224e-02 1.892058087816931022e-01 1.132643300609986470e-01
+9.887273365069987330e-02 1.854955476839638961e-01 1.106837415179452166e-01
+9.857702759168757156e-02 1.817875303344013982e-01 1.080592207487474365e-01
+9.822269753736714848e-02 1.780808239249605796e-01 1.053914161709541830e-01
+9.781113633355650872e-02 1.743750377566490040e-01 1.026806351620476176e-01
+9.733238005935909709e-02 1.706723687329834982e-01 9.992670564763897478e-02
+9.679537330416121410e-02 1.669706979907544520e-01 9.713043093317094701e-02
+9.620476860769888727e-02 1.632687911401897729e-01 9.429209466525781402e-02
+9.555840111219859878e-02 1.595669718044100127e-01 9.141177435708905397e-02
+9.484851695793727888e-02 1.558669291806107915e-01 8.848983773912671991e-02
+9.408911153954402362e-02 1.521650578561620781e-01 8.552628708305054506e-02
+9.328192094338655371e-02 1.484606091474970080e-01 8.252094903627574252e-02
+9.241015243151923242e-02 1.447574737795673805e-01 7.947496936453349314e-02
+9.149313879389489590e-02 1.410504572025015335e-01 7.638732537156053826e-02
+9.053276383981978537e-02 1.373386075843833487e-01 7.325761429945673586e-02]; 
+
+   case 'the' 
+      RGB = [1.555601333154079877e-02 1.382442454646408414e-01 2.018108864558305071e-01
+1.620183633850513089e-02 1.410507428866217272e-01 2.089765125440807836e-01
+1.685648942708358952e-02 1.438270143621834252e-01 2.162386804476043589e-01
+1.752640064782528401e-02 1.465717250667996630e-01 2.235996996833259920e-01
+1.821871873545745021e-02 1.492834638238061673e-01 2.310618693528040390e-01
+1.894137836902154426e-02 1.519607349643580241e-01 2.386274839825403005e-01
+1.969967580211434005e-02 1.546014513385217670e-01 2.463049741539924953e-01
+2.050331512714091350e-02 1.572037794856419868e-01 2.540971092002056730e-01
+2.136720981691051999e-02 1.597664500864496573e-01 2.619991459036808412e-01
+2.230340677460975612e-02 1.622875536944013708e-01 2.700132114112391291e-01
+2.332520459934065912e-02 1.647650548255009395e-01 2.781413941166567261e-01
+2.444727823684482437e-02 1.671967824349823439e-01 2.863857270216258466e-01
+2.568581629165060318e-02 1.695804203313354408e-01 2.947481661145329168e-01
+2.705867185137392564e-02 1.719134976584987262e-01 3.032305630924797546e-01
+2.858552764394725262e-02 1.741933796245943022e-01 3.118346316168387755e-01
+3.028807626872338093e-02 1.764172587161002559e-01 3.205619061457981589e-01
+3.219021609777513587e-02 1.785821467123839268e-01 3.294136922283489310e-01
+3.431826321592867240e-02 1.806848679100377109e-01 3.383910069732901649e-01
+3.670117943457189280e-02 1.827220540829147533e-01 3.474945082255425644e-01
+3.937081594703384368e-02 1.846901418460877020e-01 3.567244107935257369e-01
+4.230474116360182640e-02 1.865853732643254770e-01 3.660803878810173217e-01
+4.544128431656369732e-02 1.884038007524381497e-01 3.755614556934170345e-01
+4.879889459256544354e-02 1.901412975600472455e-01 3.851658390246698871e-01
+5.238564999909287728e-02 1.917935754201579024e-01 3.948908155057742619e-01
+5.620896927989652708e-02 1.933562112707872260e-01 4.047325361348014794e-01
+6.027560971317643540e-02 1.948246853300575621e-01 4.146858197468099028e-01
+6.459519137924149557e-02 1.961877478810097886e-01 4.247714594384868758e-01
+6.917293885235362150e-02 1.974458334676339466e-01 4.349572770994127868e-01
+7.401397924875777190e-02 1.985943734629224688e-01 4.452322549865626589e-01
+7.912632580773251711e-02 1.996251445642635014e-01 4.555965555444902448e-01
+8.452074659970570947e-02 2.005284212595413451e-01 4.660508732253974551e-01
+9.019392390291772199e-02 2.013079448693051998e-01 4.765478779135125520e-01
+9.616430834359415702e-02 2.019472529514862447e-01 4.871044455010897223e-01
+1.024253987466881288e-01 2.024520213616345932e-01 4.976646226688278829e-01
+1.089944270249512126e-01 2.028088855832538839e-01 5.082270885561682716e-01
+1.158597351626668159e-01 2.030273547727350913e-01 5.187245256305992314e-01
+1.230424263443430921e-01 2.030937970306834206e-01 5.291483757425788914e-01
+1.305276694613609623e-01 2.030217816424806365e-01 5.394201195013325068e-01
+1.383099125215292158e-01 2.028195613734770086e-01 5.494767764101642360e-01
+1.463797060150685281e-01 2.025001769277504637e-01 5.592461312000727158e-01
+1.547186326280874380e-01 2.020850680852618320e-01 5.686422620965899677e-01
+1.632970499077517346e-01 2.016054641193363861e-01 5.775676861911989146e-01
+1.720728231749732162e-01 2.011027291278179585e-01 5.859183845130113699e-01
+1.809917622181062835e-01 2.006270524284321510e-01 5.935918186078640302e-01
+1.899902199574210471e-01 2.002341583564870575e-01 6.004970669758479263e-01
+1.989997441940680178e-01 1.999802927301375655e-01 6.065651516258429021e-01
+2.079529779081165097e-01 1.999164256738651391e-01 6.117570630961892686e-01
+2.167895160216459782e-01 2.000830340237900185e-01 6.160673924886361785e-01
+2.254604257150365498e-01 2.005067081654643424e-01 6.195227918364496489e-01
+2.339306302023402284e-01 2.011991984057693306e-01 6.221760825969698816e-01
+2.421790683949211487e-01 2.021587162723321729e-01 6.240979346009031259e-01
+2.501971277034634733e-01 2.033727314506766359e-01 6.253682433520739714e-01
+2.579861074778473928e-01 2.048213417591974728e-01 6.260687943604991146e-01
+2.655544225081862275e-01 2.064804694302365684e-01 6.262779744769025880e-01
+2.729150389729214088e-01 2.083244557603688429e-01 6.260675767301320249e-01
+2.800833915559314269e-01 2.103279194298604549e-01 6.255013265069014894e-01
+2.870675074033041674e-01 2.124691386407265292e-01 6.246420009551492125e-01
+2.938851360627945386e-01 2.147254304183257023e-01 6.235380183242871244e-01
+3.005577213461362307e-01 2.170756514619715527e-01 6.222251903623999825e-01
+3.070843773107185259e-01 2.195059802015210115e-01 6.207554984633752992e-01
+3.134916285549604886e-01 2.219983100391352271e-01 6.191452159520036691e-01
+3.197798380866583856e-01 2.245420356602937373e-01 6.174343435010863912e-01
+3.259695527216341926e-01 2.271241237863139140e-01 6.156329324235468858e-01
+3.320579089479565038e-01 2.297373625924510887e-01 6.137771467682858750e-01
+3.380660052498126178e-01 2.323715331127139128e-01 6.118660583919267593e-01
+3.439917420525137604e-01 2.350215076527270575e-01 6.099280657295180763e-01
+3.498460685618723365e-01 2.376808945869600675e-01 6.079694872801727490e-01
+3.556384580181179977e-01 2.403444043084654869e-01 6.059953497614897211e-01
+3.613686295558476425e-01 2.430089153836439420e-01 6.040241385974032262e-01
+3.670434468015162932e-01 2.456707832167414618e-01 6.020607616318822686e-01
+3.726708785615932551e-01 2.483266964722255499e-01 6.001059364008434205e-01
+3.782547954216434749e-01 2.509743622345630976e-01 5.981656274234778969e-01
+3.837960822688916696e-01 2.536122834643630419e-01 5.962498766549472196e-01
+3.892988345534371120e-01 2.562387736058999166e-01 5.943618049976240325e-01
+3.947690991030736729e-01 2.588520700720948198e-01 5.924996351953921714e-01
+4.002098946086877773e-01 2.614510659770345469e-01 5.906660913059953444e-01
+4.056240909379103532e-01 2.640348396856425084e-01 5.888633104220148962e-01
+4.110144223076953041e-01 2.666026246434279878e-01 5.870929096766683841e-01
+4.163832172801885667e-01 2.691538344975527575e-01 5.853565951388559618e-01
+4.217313231007376317e-01 2.716882525666767800e-01 5.836583632684495537e-01
+4.270634345309600177e-01 2.742050306264073312e-01 5.819941042354170868e-01
+4.323818104897113601e-01 2.767038027770706843e-01 5.803639256565888971e-01
+4.376886243188534142e-01 2.791842625143060586e-01 5.787676418773346487e-01
+4.429859696643737577e-01 2.816461519867726748e-01 5.772048027503156042e-01
+4.482758654902720408e-01 2.840892531259122666e-01 5.756747186760452495e-01
+4.535602602863915700e-01 2.865133804028727749e-01 5.741764823913096949e-01
+4.588410355259065487e-01 2.889183750000149931e-01 5.727089879419176022e-01
+4.641200084236148382e-01 2.913041002126984247e-01 5.712709472315609105e-01
+4.693989340425177015e-01 2.936704379215548943e-01 5.698609044983501404e-01
+4.746795067933508583e-01 2.960172859965477521e-01 5.684772490345112450e-01
+4.799633613697112389e-01 2.983445565121622955e-01 5.671182264323321176e-01
+4.852520731601697723e-01 3.006521746683436525e-01 5.657819486102849682e-01
+4.905471581781303825e-01 3.029400783247205298e-01 5.644664028469250638e-01
+4.958500725502145712e-01 3.052082180664184574e-01 5.631694600262432404e-01
+5.011622116043696895e-01 3.074565577287760587e-01 5.618888822762294621e-01
+5.064849085998188727e-01 3.096850753156841218e-01 5.606223301621769961e-01
+5.118194331420761189e-01 3.118937642524056697e-01 5.593673695773668797e-01
+5.171669893275794294e-01 3.140826349187781363e-01 5.581214784559522801e-01
+5.225287136638799845e-01 3.162517164128481606e-01 5.568820534159194535e-01
+5.279056728126164666e-01 3.184010584984696690e-01 5.556464164236831760e-01
+5.332988612036093645e-01 3.205307336933521101e-01 5.544118215561065766e-01
+5.387091985692399332e-01 3.226408394566178117e-01 5.531754619204082291e-01
+5.441375274486375258e-01 3.247315004373090841e-01 5.519344767774559957e-01
+5.495846107110635703e-01 3.268028707475315597e-01 5.506859588994191812e-01
+5.550511291471261766e-01 3.288551362262008837e-01 5.494269621786239677e-01
+5.605376791749926424e-01 3.308885166617086537e-01 5.481545094908906179e-01
+5.660447559653561944e-01 3.329032737201366166e-01 5.468656290966650291e-01
+5.715723572408055730e-01 3.348998704862335973e-01 5.455581199822507887e-01
+5.771213104289429907e-01 3.368784486432290226e-01 5.442280104688511644e-01
+5.826918609018115758e-01 3.388393806259411556e-01 5.428722728323092106e-01
+5.882841610050709713e-01 3.407830824811499126e-01 5.414878910241607279e-01
+5.938982692324897839e-01 3.427100153754324974e-01 5.400718694374621043e-01
+5.995341497366565298e-01 3.446206869260000083e-01 5.386212416598933350e-01
+6.051916721861749782e-01 3.465156523493675422e-01 5.371330791454219655e-01
+6.108706119725975103e-01 3.483955154267821541e-01 5.356044997333838653e-01
+6.165706507631435462e-01 3.502609292895154658e-01 5.340326759432469927e-01
+6.222913773881607602e-01 3.521125970311436149e-01 5.324148429745680922e-01
+6.280322890453092777e-01 3.539512721578863541e-01 5.307483063447554494e-01
+6.337927927958686425e-01 3.557777588917046541e-01 5.290304491020394462e-01
+6.395721854014132512e-01 3.575929224264804973e-01 5.272587829694529438e-01
+6.453697498455218673e-01 3.593976455700171879e-01 5.254307632896803026e-01
+6.511846984697030605e-01 3.611928549527803622e-01 5.235439096149940852e-01
+6.570160963803246545e-01 3.629795579684892415e-01 5.215959730192853971e-01
+6.628629283562820218e-01 3.647588132682739737e-01 5.195848109675399451e-01
+6.687241012633005077e-01 3.665317306708469891e-01 5.175083912494201632e-01
+6.745984464659754432e-01 3.682994710922303794e-01 5.153647953022981731e-01
+6.804847221871188623e-01 3.700632465224873990e-01 5.131522209386339961e-01
+6.863816157645579175e-01 3.718243200760849021e-01 5.108689845040222943e-01
+6.922877457570544291e-01 3.735840061411623281e-01 5.085135225034096429e-01
+6.982016638532075881e-01 3.753436706510840937e-01 5.060843927435032530e-01
+7.041218565401857754e-01 3.771047314992945210e-01 5.035802750493091340e-01
+7.100468845018954589e-01 3.788685911907690995e-01 5.009996451582281463e-01
+7.159752518731292703e-01 3.806367017978663503e-01 4.983410633235164089e-01
+7.219050254760910335e-01 3.824107548202065887e-01 4.956041045679995816e-01
+7.278344332015346252e-01 3.841923879692217270e-01 4.927879483140180095e-01
+7.337616407032357957e-01 3.859832960516177969e-01 4.898918977085310877e-01
+7.396847510296571393e-01 3.877852324461281697e-01 4.869153794944616753e-01
+7.456018038508585022e-01 3.896000107579556393e-01 4.838579440403712462e-01
+7.515107742785041012e-01 3.914295066368485010e-01 4.807192656291401911e-01
+7.574095712835625660e-01 3.932756597383701980e-01 4.774991431076147097e-01
+7.632960357235062387e-01 3.951404758009958162e-01 4.741975009994948143e-01
+7.691679379984673881e-01 3.970260288041012053e-01 4.708143911830061090e-01
+7.750229753641669772e-01 3.989344631636088656e-01 4.673499952331199858e-01
+7.808587689384376418e-01 4.008679959130103665e-01 4.638046275250513051e-01
+7.866728604480874854e-01 4.028289188075652172e-01 4.601787391913814695e-01
+7.924627087737056153e-01 4.048196002786729752e-01 4.564729230191116316e-01
+7.982256863620216247e-01 4.068424871537119070e-01 4.526879193650572009e-01
+8.039590755885861473e-01 4.089001060440320967e-01 4.488246231577860956e-01
+8.096600651680347926e-01 4.109950642903736351e-01 4.448840920414381395e-01
+8.153258420561760866e-01 4.131300072582320126e-01 4.408672005707100494e-01
+8.209533846301936277e-01 4.153077124896901728e-01 4.367753702901882029e-01
+8.265394587133882975e-01 4.175310847974926798e-01 4.326106584748535266e-01
+8.320808476618816174e-01 4.198030498289601065e-01 4.283748912056176694e-01
+8.375742298072511582e-01 4.221266063894242304e-01 4.240701127101388912e-01
+8.430161781421201539e-01 4.245048216497959159e-01 4.196985997897492715e-01
+8.484031611801808870e-01 4.269408247931844591e-01 4.152628771038663902e-01
+8.537315452228415591e-01 4.294377989032187592e-01 4.107657331305429871e-01
+8.589975982777037222e-01 4.319989708985695898e-01 4.062102365684474026e-01
+8.641974958823694930e-01 4.346275993272235572e-01 4.015997528869852951e-01
+8.693273290890853877e-01 4.373269598520185819e-01 3.969379606684441675e-01
+8.743831148591909574e-01 4.401003282876529976e-01 3.922288673203608855e-01
+8.793608090992056647e-01 4.429509610905758565e-01 3.874768236699652202e-01
+8.842563225402819693e-01 4.458820732584555802e-01 3.826865368883226592e-01
+8.890655396175203284e-01 4.488968136663485375e-01 3.778630811333164030e-01
+8.937843693689974112e-01 4.519982404973394430e-01 3.730116014425700621e-01
+8.984086715918495614e-01 4.551892900487020666e-01 3.681382748140558103e-01
+9.029343899688814234e-01 4.584727367754222738e-01 3.632494215164466245e-01
+9.073575586033109097e-01 4.618511663085561048e-01 3.583516614288673741e-01
+9.116743277656134126e-01 4.653269421603676848e-01 3.534519722899168159e-01
+9.158809992051784032e-01 4.689021723136149178e-01 3.485576699619067353e-01
+9.199740625655835613e-01 4.725786767270368505e-01 3.436763818638891022e-01
+9.239502320744639174e-01 4.763579567194722864e-01 3.388160133952918263e-01
+9.278064825504417357e-01 4.802411672570275347e-01 3.339847073943023048e-01
+9.315400836682339314e-01 4.842290931875970483e-01 3.291907969273191181e-01
+9.351486313601243827e-01 4.883221304365225612e-01 3.244427519772630775e-01
+9.386300752174523421e-01 4.925202730905588466e-01 3.197491208755643965e-01
+9.419827407976890665e-01 4.968231071526066356e-01 3.151184675888816233e-01
+9.452053458453827384e-01 5.012298115494860928e-01 3.105593062092800172e-01
+9.482970095990234105e-01 5.057391667267315816e-01 3.060800341879720277e-01
+9.512572545755481057e-01 5.103495708806106146e-01 3.016888659817511531e-01
+9.540860004899643920e-01 5.150590635745326828e-01 2.973937688352701891e-01
+9.567835502644689294e-01 5.198653561843505910e-01 2.932024023936338208e-01
+9.593505683914355098e-01 5.247658683349885056e-01 2.891220637265379811e-01
+9.617880522174245828e-01 5.297577692490467172e-01 2.851596391521897811e-01
+9.640972969908582213e-01 5.348380227429672118e-01 2.813215639873033469e-01
+9.662798557460373639e-01 5.400034344900018768e-01 2.776137910349112392e-01
+9.683374952663609259e-01 5.452507001277228094e-01 2.740417682745930894e-01
+9.702721494708056449e-01 5.505764528210163045e-01 2.706104258619907443e-01
+9.720889605050128113e-01 5.559744240639272750e-01 2.673323057285149629e-01
+9.737882391976736551e-01 5.614431075234689317e-01 2.642051375197135843e-01
+9.753722517954447335e-01 5.669791681305653697e-01 2.612321043607351290e-01
+9.768433321430202154e-01 5.725792962307277856e-01 2.584161030939570725e-01
+9.782037550763590383e-01 5.782403184217296266e-01 2.557595328984585970e-01
+9.794556966363962003e-01 5.839592236834146854e-01 2.532643241222839459e-01
+9.806011989875685897e-01 5.897331838357899869e-01 2.509319710696591987e-01
+9.816445119805891073e-01 5.955576445021050214e-01 2.487674614053176358e-01
+9.825957966513861885e-01 6.014235301335163486e-01 2.467838886220111161e-01
+9.834484089207010671e-01 6.073354334336248384e-01 2.449669167474177733e-01
+9.842037798764916579e-01 6.132913094304376367e-01 2.433164315861336413e-01
+9.848630901763529844e-01 6.192893396808167861e-01 2.418320393357376030e-01
+9.854335855591603854e-01 6.253232095344845032e-01 2.405207443125048083e-01
+9.859266054527725531e-01 6.313839151833324781e-01 2.393924955683320310e-01
+9.863290788081210403e-01 6.374805817839866995e-01 2.384285005271009616e-01
+9.866412575432023102e-01 6.436122274808632193e-01 2.376272705850792089e-01
+9.868743031654042541e-01 6.497702193582076680e-01 2.369977788720153966e-01
+9.870387195949218428e-01 6.559468364085242476e-01 2.365460008515470891e-01
+9.871160198111447182e-01 6.621544902577213287e-01 2.362516434857291903e-01
+9.871054832314208882e-01 6.683929123881801049e-01 2.361125093170109435e-01
+9.870452158568817635e-01 6.746361467497961062e-01 2.361551640855951706e-01
+9.869008071972434903e-01 6.809069196703931848e-01 2.363489608363473771e-01
+9.866692878063002548e-01 6.872064512263130753e-01 2.366900769944741967e-01
+9.863929517876753872e-01 6.935072010148546351e-01 2.372025181179537867e-01
+9.860358081545986808e-01 6.998320059248218650e-01 2.378591308273384497e-01
+9.855936903889445100e-01 7.061828277187244263e-01 2.386553467137359497e-01
+9.851166760681809853e-01 7.125285611733751523e-01 2.396137846497558566e-01
+9.845515404596055786e-01 7.189016348706930293e-01 2.407027465239837682e-01
+9.839219208542443473e-01 7.252873073536283410e-01 2.419304971970357987e-01
+9.832411577231264799e-01 7.316776102841332508e-01 2.432981102176038357e-01
+9.824686360853925882e-01 7.380960010628512258e-01 2.447853973017022899e-01
+9.816675490572134288e-01 7.445058075421049359e-01 2.464118597749720974e-01
+9.807811261674898029e-01 7.509394073137781733e-01 2.481527624504580309e-01
+9.798377198237012697e-01 7.573804700508821597e-01 2.500137146942527089e-01
+9.788392654586509645e-01 7.638279008720277874e-01 2.519905378906656113e-01
+9.777574675384567149e-01 7.702969047505190403e-01 2.540716600569991046e-01
+9.766479350869351483e-01 7.767573771217611833e-01 2.562664070834250185e-01
+9.754356977304895482e-01 7.832491288133777152e-01 2.585534361426328198e-01
+9.742107025732685832e-01 7.897246981741067318e-01 2.609472103669700505e-01
+9.728835679779427315e-01 7.962305102434532600e-01 2.634261983272434549e-01
+9.715297353896644728e-01 8.027276438790406088e-01 2.659994820979044161e-01
+9.700861348373609472e-01 8.092479763321948072e-01 2.686528986078252079e-01
+9.686057099481873989e-01 8.157648637457888263e-01 2.713899293880046582e-01
+9.670430691608270513e-01 8.223006128282058791e-01 2.742007328066633498e-01
+9.654377156641301694e-01 8.288358297838601674e-01 2.770858440538391254e-01
+9.637524161478506768e-01 8.353882936883590959e-01 2.800376262549509332e-01
+9.620231537308009395e-01 8.419407901977008502e-01 2.830554448577937698e-01
+9.602104885023859948e-01 8.485116373841136150e-01 2.861325388392048086e-01
+9.583576301078738924e-01 8.550807238511934916e-01 2.892681513706822360e-01
+9.564117528707279936e-01 8.616719638797333269e-01 2.924557053792812833e-01
+9.544348419615947821e-01 8.682572954460299197e-01 2.956947937778980906e-01
+9.523487086523741985e-01 8.748712522095133393e-01 2.989788164145827376e-01
+9.502464564071694264e-01 8.814728114137494464e-01 3.023077648025994102e-01
+9.480141307284709606e-01 8.881110895508603775e-01 3.056751963404329420e-01
+9.457819798963852387e-01 8.947301765899248194e-01 3.090811208408512645e-01
+9.434198646152930356e-01 9.013849121338212145e-01 3.125200216900483885e-01
+9.410286159691669816e-01 9.080328518084608280e-01 3.159906396320988908e-01
+9.385331275251967975e-01 9.147047487143539213e-01 3.194893313796646206e-01
+9.359711083432949996e-01 9.213848126149789541e-01 3.230138415459749002e-01
+9.333375985220991877e-01 9.280748341844049509e-01 3.265615469169362850e-01
+9.305915654403119630e-01 9.347905093445134650e-01 3.301299810381577715e-01
+9.278142496620381818e-01 9.414998557883345054e-01 3.337168327083647745e-01
+9.248899165263079203e-01 9.482470197415310276e-01 3.373199677733378365e-01
+9.219411401959984875e-01 9.549849147932994997e-01 3.409370492608514991e-01
+9.188613878011584468e-01 9.617532494963948464e-01 3.445662997232426528e-01
+9.156931782520092433e-01 9.685354904254356301e-01 3.482056900726151483e-01
+9.124490701578419349e-01 9.753266872784461805e-01 3.518533597970244786e-01
+9.090418416674036495e-01 9.821574063216705897e-01 3.555078064299531104e-01]; 
+
+   case 'tur' 
+      RGB = [9.128247827303703765e-01 9.639053479101408195e-01 6.723488894068933019e-01
+9.105541439463002984e-01 9.592872094872512134e-01 6.663907644186453094e-01
+9.082861583229014935e-01 9.546805250318116665e-01 6.604691147501789983e-01
+9.060452334346256187e-01 9.500783067250512248e-01 6.545538618591559832e-01
+9.038150489008132116e-01 9.454849862587190179e-01 6.486649327173524826e-01
+9.016037749037892901e-01 9.408980925645457072e-01 6.427923205892623892e-01
+8.994100526612220925e-01 9.363178430715828338e-01 6.369376634451241470e-01
+8.972283335855062436e-01 9.317456838096750404e-01 6.311075587918794083e-01
+8.950696728809198754e-01 9.271782394664687121e-01 6.252888115672152747e-01
+8.929173737868275618e-01 9.226202315494650419e-01 6.195011901939884158e-01
+8.907923116926522722e-01 9.180653547565199579e-01 6.137200788543796248e-01
+8.886692522817520867e-01 9.135209242332905655e-01 6.079750370293484085e-01
+8.865762636352767512e-01 9.089784066893161762e-01 6.022333770048255985e-01
+8.844822115233714754e-01 9.044469910654970857e-01 5.965311430834745465e-01
+8.824197090505849772e-01 8.999166548769963470e-01 5.908308404756164034e-01
+8.803543805345617201e-01 8.953977033216384829e-01 5.851717778972109762e-01
+8.783207074075700671e-01 8.908794045328807254e-01 5.795148392301145979e-01
+8.762837291194094380e-01 8.863723903264537629e-01 5.738994936029852001e-01
+8.742771906432560414e-01 8.818660105043367725e-01 5.682879912596860983e-01
+8.722681388310039585e-01 8.773704198332279436e-01 5.627170493987142530e-01
+8.702869566172963811e-01 8.728758815872331711e-01 5.571531747195710427e-01
+8.683053185700908561e-01 8.683912265313378231e-01 5.516275115467151879e-01
+8.663476627856837586e-01 8.639084851022803546e-01 5.461135394992869818e-01
+8.643928371591906856e-01 8.594343049131268897e-01 5.406342206369587622e-01
+8.624568202066339451e-01 8.549633517080399425e-01 5.351725180271732496e-01
+8.605281096749168857e-01 8.504992167172934492e-01 5.297408107341389227e-01
+8.586117879987910095e-01 8.460400804193519697e-01 5.243338350869022335e-01
+8.567083921128474389e-01 8.415855961633933457e-01 5.189512185545770429e-01
+8.548097683783190126e-01 8.371383437933764826e-01 5.136015164012288636e-01
+8.529307767408889074e-01 8.326931553267608033e-01 5.082696912104300857e-01
+8.510506087990278301e-01 8.282569318779919865e-01 5.029770800265680464e-01
+8.491921882796159560e-01 8.238216896030918779e-01 4.977007922336022516e-01
+8.473354714528938958e-01 8.193941476796476886e-01 4.924611248003303854e-01
+8.454893810507302376e-01 8.149710832043290942e-01 4.872494055687389136e-01
+8.436548921629284381e-01 8.105519834307682858e-01 4.820650051378080891e-01
+8.418197380538857688e-01 8.061410299518165790e-01 4.769199747107543685e-01
+8.400053197367541857e-01 8.017304745289870471e-01 4.717941759727964368e-01
+8.381909179373602248e-01 7.973275360052080041e-01 4.667076177307682427e-01
+8.363830265089613469e-01 7.929297607375542789e-01 4.616544156277210820e-01
+8.345877920103869085e-01 7.885347495856604993e-01 4.566293264683093933e-01
+8.327919089080556558e-01 7.841472126590459668e-01 4.516448413369297810e-01
+8.310063135234079246e-01 7.797629900031863848e-01 4.466914503101058753e-01
+8.292275089883606176e-01 7.753832051359705879e-01 4.417727747802380756e-01
+8.274479714210091208e-01 7.710105395274703399e-01 4.368957512003675547e-01
+8.256785592470122781e-01 7.666407630966191045e-01 4.320514550589309999e-01
+8.239135967944541949e-01 7.622758578672201857e-01 4.272453035219374029e-01
+8.221475640634913207e-01 7.579178098056661428e-01 4.224823211006376589e-01
+8.203879070453153899e-01 7.535636173491093714e-01 4.177568735562176006e-01
+8.186335117171099629e-01 7.492135470811618347e-01 4.130705335781763021e-01
+8.168774297351566460e-01 7.448701849739395309e-01 4.084293549358841147e-01
+8.151208269598283485e-01 7.405329639445877854e-01 4.038328842986566580e-01
+8.133730042127403914e-01 7.361980289394938204e-01 3.992747817294182155e-01
+8.116225817355652294e-01 7.318697849631130570e-01 3.947642928691043052e-01
+8.098694933912269356e-01 7.275481580762414024e-01 3.903019868836329342e-01
+8.081161421647475862e-01 7.232320558774254504e-01 3.858867812020280175e-01
+8.063663538470418057e-01 7.189197605534187741e-01 3.815168716651668457e-01
+8.046125622407066524e-01 7.146142683294098852e-01 3.771981838442269308e-01
+8.028545343811845925e-01 7.103155798131343124e-01 3.729315169481128289e-01
+8.010919901003339394e-01 7.060237163039633224e-01 3.687177325408004802e-01
+7.993300055097595225e-01 7.017364019961147559e-01 3.645545873969476269e-01
+7.975634994838864955e-01 6.974556802865253813e-01 3.604460667960328046e-01
+7.957906047709230046e-01 6.931822615073386373e-01 3.563940392198953200e-01
+7.940108757837693876e-01 6.889162546167795220e-01 3.523995277667577586e-01
+7.922238209776574225e-01 6.846577925964051348e-01 3.484635956840971271e-01
+7.904293753935112132e-01 6.804068218754933950e-01 3.445871200261476641e-01
+7.886299371669703850e-01 6.761621751401072355e-01 3.407699499113064912e-01
+7.868208547545553211e-01 6.719258532155115704e-01 3.370151794848580962e-01
+7.850015016585555339e-01 6.676980777850795024e-01 3.333239143922641090e-01
+7.831712152651345571e-01 6.634790940463787257e-01 3.296972647086952590e-01
+7.813292995863233559e-01 6.592691702526117803e-01 3.261363364073748827e-01
+7.794750283869652518e-01 6.550685970372218669e-01 3.226422224503434077e-01
+7.776076486673221266e-01 6.508776865233487641e-01 3.192159935965748763e-01
+7.757263844650232887e-01 6.466967712234903409e-01 3.158586890319579621e-01
+7.738304409335882150e-01 6.425262027384857078e-01 3.125713069333992955e-01
+7.719190086491207747e-01 6.383663502685200664e-01 3.093547950848793415e-01
+7.699919228068800026e-01 6.342172763144198200e-01 3.062099646060428282e-01
+7.680475840592058123e-01 6.300797563557358760e-01 3.031377731717001534e-01
+7.660850744742599971e-01 6.259542495514858196e-01 3.001389551573931946e-01
+7.641036016288820232e-01 6.218411653176698639e-01 2.972141439455896483e-01
+7.621023798026289597e-01 6.177409214840726692e-01 2.943638837738908332e-01
+7.600806343242360041e-01 6.136539422033919777e-01 2.915886230831420400e-01
+7.580376057793873912e-01 6.095806558220696614e-01 2.888887086342720734e-01
+7.559725540291885038e-01 6.055214927394206859e-01 2.862643804685457427e-01
+7.538847619930633126e-01 6.014768832813116584e-01 2.837157677714013393e-01
+7.517735391550399715e-01 5.974472556137478962e-01 2.812428856843471325e-01
+7.496385821697367779e-01 5.934328401156596655e-01 2.788457594157026098e-01
+7.474790247249349928e-01 5.894341791373612915e-01 2.765241346674250367e-01
+7.452941571551999766e-01 5.854517449359323278e-01 2.742776443121395791e-01
+7.430834135426160891e-01 5.814859431780246002e-01 2.721058338160937673e-01
+7.408462686359136296e-01 5.775371675495697410e-01 2.700081319859798934e-01
+7.385822390693008721e-01 5.736057983656746018e-01 2.679838537450121017e-01
+7.362908841899132861e-01 5.696922013455091305e-01 2.660322037116858995e-01
+7.339718065076965559e-01 5.657967265562297010e-01 2.641522805055408485e-01
+7.316246517864810617e-01 5.619197075270785380e-01 2.623430816971141777e-01
+7.292491087989990683e-01 5.580614605321673194e-01 2.606035093141773062e-01
+7.268449087719649482e-01 5.542222840379915638e-01 2.589323758133949549e-01
+7.244119971505563749e-01 5.504023530996886571e-01 2.573286095051418587e-01
+7.219503397818252122e-01 5.466018316756788842e-01 2.557911025974954899e-01
+7.194594088198653647e-01 5.428211930643935812e-01 2.543180251101427314e-01
+7.169390970998404944e-01 5.390606612983260826e-01 2.529078914226555730e-01
+7.143893337983732161e-01 5.353204418367376594e-01 2.515591605975798783e-01
+7.118100825627617922e-01 5.316007218689121627e-01 2.502702433238302993e-01
+7.092013395547599464e-01 5.279016707079033921e-01 2.490395087311264022e-01
+7.065632761648270588e-01 5.242233436125348645e-01 2.478655721838471937e-01
+7.038960056028840118e-01 5.205658319141027723e-01 2.467469222620103930e-01
+7.011993601253575514e-01 5.169294192806536126e-01 2.456813814978507926e-01
+6.984734491802424561e-01 5.133142072042380377e-01 2.446672141412145063e-01
+6.957184043559518916e-01 5.097202822466132544e-01 2.437026738057547215e-01
+6.929343773945654261e-01 5.061477167394171639e-01 2.427860085204449625e-01
+6.901216982990902027e-01 5.025964514073363310e-01 2.419159412674971588e-01
+6.872804633072713276e-01 4.990665929836670123e-01 2.410905423858894503e-01
+6.844107686966893755e-01 4.955582518851005536e-01 2.403077709414531138e-01
+6.815128311469199618e-01 4.920714492259936068e-01 2.395658950635757289e-01
+6.785868785067301623e-01 4.886061954699182919e-01 2.388631970725307307e-01
+6.756332326667190413e-01 4.851624213327032087e-01 2.381983436213906957e-01
+6.726521288960277678e-01 4.817401209176369048e-01 2.375696985886235346e-01
+6.696437188359446457e-01 4.783393588339723279e-01 2.369751854422654791e-01
+6.666082635296274317e-01 4.749601080715157297e-01 2.364131671114735878e-01
+6.635460289039749604e-01 4.716023339061982678e-01 2.358820311548202042e-01
+6.604573673748913576e-01 4.682659130292578520e-01 2.353807610155446706e-01
+6.573424797961275878e-01 4.649508592384817285e-01 2.349074379402631418e-01
+6.542016086091390070e-01 4.616571492422122946e-01 2.344603126221481149e-01
+6.510350327978842166e-01 4.583847209004847101e-01 2.340378795902509079e-01
+6.478430515953373936e-01 4.551334824230311438e-01 2.336388774485689268e-01
+6.446259633611755024e-01 4.519033296020167900e-01 2.332622032236857934e-01
+6.413839940492124247e-01 4.486942500114745047e-01 2.329058642884746511e-01
+6.381174276440877424e-01 4.455061586981217681e-01 2.325684660088059297e-01
+6.348265500932614991e-01 4.423389620941622913e-01 2.322486831842977550e-01
+6.315116605695774155e-01 4.391925158791953887e-01 2.319458531661305334e-01
+6.281730104223729461e-01 4.360667833034455043e-01 2.316579279478628295e-01
+6.248108867019236401e-01 4.329616581049553492e-01 2.313836187886625928e-01
+6.214255770673621226e-01 4.298770280576157399e-01 2.311216752923600515e-01
+6.180173538237878628e-01 4.268127440894281532e-01 2.308715541128374960e-01
+6.145865084649400067e-01 4.237687269357882092e-01 2.306313089541623396e-01
+6.111333338376842006e-01 4.207448478787260138e-01 2.303997483300764260e-01
+6.076581198732585731e-01 4.177409699743503957e-01 2.301757903742778777e-01
+6.041611292458852756e-01 4.147569442408376994e-01 2.299587629276800271e-01
+6.006426901866908086e-01 4.117926430199113641e-01 2.297469460659757323e-01
+5.971031071270087587e-01 4.088479120598013661e-01 2.295392371763493311e-01
+5.935426680352169360e-01 4.059225898260850895e-01 2.293347588094398759e-01
+5.899616653081597439e-01 4.030165124281641087e-01 2.291325734316880802e-01
+5.863604503326285133e-01 4.001295067793814719e-01 2.289312648345211421e-01
+5.827393462725786177e-01 3.972613890222796984e-01 2.287298138873416486e-01
+5.790986411902667719e-01 3.944119738157387811e-01 2.285275119372468522e-01
+5.754386920094946012e-01 3.915810608797961612e-01 2.283231701874827158e-01
+5.717598595710956522e-01 3.887684389212705538e-01 2.281156877135243621e-01
+5.680624888217489232e-01 3.859738913687448258e-01 2.279041499218198430e-01
+5.643468987836690598e-01 3.831972016166527162e-01 2.276878398717704366e-01
+5.606135014398240246e-01 3.804381236067138072e-01 2.274655664744977823e-01
+5.568626686009898741e-01 3.776964124183660454e-01 2.272364567122592827e-01
+5.530947703612836275e-01 3.749718169415875435e-01 2.269997025952595338e-01
+5.493102061694418170e-01 3.722640707136085636e-01 2.267544107214977123e-01
+5.455093844474366849e-01 3.695728971647626593e-01 2.264997151134776621e-01
+5.416927086216569709e-01 3.668980144097471752e-01 2.262348350480499204e-01
+5.378606217947595747e-01 3.642391205981750923e-01 2.259588836659274236e-01
+5.340135354481294616e-01 3.615959178208362768e-01 2.256711679956127647e-01
+5.301518754638107067e-01 3.589680973433583278e-01 2.253709864348782954e-01
+5.262761094769513592e-01 3.563553292394111560e-01 2.250575362145477709e-01
+5.223867172868102982e-01 3.537572724565644089e-01 2.247300369556790578e-01
+5.184841017313481792e-01 3.511736091955309780e-01 2.243880288453043437e-01
+5.145687147834636654e-01 3.486039985632924942e-01 2.240309158662728284e-01
+5.106411440519553757e-01 3.460480410893026493e-01 2.236577184811773256e-01
+5.067017881423235837e-01 3.435054056903972253e-01 2.232681227570667559e-01
+5.027510796252681047e-01 3.409757445575836710e-01 2.228617265136721426e-01
+4.987895070653633467e-01 3.384586834157125024e-01 2.224379910665530979e-01
+4.948177548651969127e-01 3.359537625951555251e-01 2.219958720410014630e-01
+4.908360971463728295e-01 3.334606870942352086e-01 2.215355358785864315e-01
+4.868450056329213793e-01 3.309790783774143597e-01 2.210565950309411609e-01
+4.828450375686827445e-01 3.285085184570587513e-01 2.205584694191147777e-01
+4.788368359138705510e-01 3.260485487451708631e-01 2.200404115431305319e-01
+4.748206472212548879e-01 3.235988770790072522e-01 2.195027100981302715e-01
+4.707969362808618885e-01 3.211591169778729160e-01 2.189450971836008897e-01
+4.667662693795122109e-01 3.187288356425135860e-01 2.183670869460304087e-01
+4.627293116701075015e-01 3.163075541790801304e-01 2.177680072916463594e-01
+4.586862340695841422e-01 3.138950081558932736e-01 2.171483462825098965e-01
+4.546374811311343911e-01 3.114908131915107847e-01 2.165079490118044792e-01
+4.505834924512453488e-01 3.090945859801553230e-01 2.158466824363790559e-01
+4.465251651502277208e-01 3.067057384379430762e-01 2.151634647284257906e-01
+4.424624800332205288e-01 3.043240886593481798e-01 2.144591818414338102e-01
+4.383958498551490668e-01 3.019492632236420726e-01 2.137337799541155214e-01
+4.343256784780819557e-01 2.995808923379119637e-01 2.129872269867968959e-01
+4.302525491830334059e-01 2.972185251864662980e-01 2.122191462426318287e-01
+4.261769801706936645e-01 2.948617395754311588e-01 2.114293130588631442e-01
+4.220990387565126678e-01 2.925103169029278360e-01 2.106183606559913768e-01
+4.180190866768337399e-01 2.901639064725308748e-01 2.097863381928281035e-01
+4.139374748855114139e-01 2.878221627482029921e-01 2.089333114395358071e-01
+4.098546564000305481e-01 2.854846942476605975e-01 2.080591616116443943e-01
+4.057712419033978057e-01 2.831510381788182595e-01 2.071635039021454405e-01
+4.016871580256169971e-01 2.808210427866469350e-01 2.062471500335373853e-01
+3.976027082875563945e-01 2.784943860456884357e-01 2.053102247884384113e-01
+3.935181846712299536e-01 2.761707517515646915e-01 2.043528642900468983e-01
+3.894338675796663596e-01 2.738498295626687340e-01 2.033752150347126197e-01
+3.853501485284500094e-01 2.715312592611229259e-01 2.023772355615125473e-01
+3.812675049241057712e-01 2.692146423201499661e-01 2.013587500039031863e-01
+3.771858334106182320e-01 2.668998447434733912e-01 2.003204988638387918e-01
+3.731053664536302938e-01 2.645865804728991244e-01 1.992626621753412208e-01
+3.690263252725575205e-01 2.622745690957888343e-01 1.981854256387428070e-01
+3.649489199677356521e-01 2.599635357439662453e-01 1.970889798104242807e-01
+3.608733496668369289e-01 2.576532109746325627e-01 1.959735193223784977e-01
+3.567998026886545215e-01 2.553433306346174492e-01 1.948392421320772061e-01
+3.527288062385475209e-01 2.530334781151396539e-01 1.936858449182176090e-01
+3.486601920186409020e-01 2.507235512004114542e-01 1.925140265725779620e-01
+3.445940882588859333e-01 2.484133136793199026e-01 1.913240314183973223e-01
+3.405306410460574029e-01 2.461025213487854080e-01 1.901160637330516767e-01
+3.364699867832531277e-01 2.437909343510991644e-01 1.888903276956251931e-01
+3.324122524192171801e-01 2.414783169649092898e-01 1.876470268273142949e-01
+3.283575556825768516e-01 2.391644373879673879e-01 1.863863634598928731e-01
+3.243060053196711312e-01 2.368490675124892975e-01 1.851085382313104599e-01
+3.202577013347079893e-01 2.345319826939236685e-01 1.838137496073975197e-01
+3.162127352310978301e-01 2.322129615138344705e-01 1.825021934285724068e-01
+3.121713481873937823e-01 2.298917159046080516e-01 1.811738589048320913e-01
+3.081335147958294551e-01 2.275680750195018809e-01 1.798290697596431065e-01
+3.040992288572926250e-01 2.252418581754896398e-01 1.784681064582642751e-01
+3.000685503066236048e-01 2.229128543385760497e-01 1.770911493801810288e-01
+2.960415318405872354e-01 2.205808544095470558e-01 1.756983743063298686e-01
+2.920182191423447704e-01 2.182456509647304199e-01 1.742899520962044868e-01
+2.879986511013646333e-01 2.159070379936562922e-01 1.728660483803914072e-01
+2.839828600283449411e-01 2.135648106336759944e-01 1.714268232671206371e-01
+2.799708718647850314e-01 2.112187649015158653e-01 1.699724310614039724e-01
+2.759627063869375951e-01 2.088686974216710790e-01 1.685030199953476415e-01
+2.719583774039363577e-01 2.065144051514603007e-01 1.670187319682087390e-01
+2.679578929499804030e-01 2.041556851024882158e-01 1.655197022947889340e-01
+2.639612554705231817e-01 2.017923340581795344e-01 1.640060594607524180e-01
+2.599684620025124460e-01 1.994241482869618665e-01 1.624779248834790635e-01
+2.559795043487851918e-01 1.970509232505948671e-01 1.609354126770728421e-01
+2.519943692468365470e-01 1.946724533070429697e-01 1.593786294201690046e-01
+2.480130385322499298e-01 1.922885314071993146e-01 1.578076739252100846e-01
+2.440354892972040890e-01 1.898989487846577950e-01 1.562226370078938775e-01
+2.400616940445691738e-01 1.875034946376172018e-01 1.546236012555405048e-01
+2.360916208382524140e-01 1.851019558018774935e-01 1.530106407931814128e-01
+2.321252334505864434e-01 1.826941164137449169e-01 1.513838210462468969e-01
+2.281624915077672400e-01 1.802797575614995262e-01 1.497431984988283338e-01
+2.242033506345226801e-01 1.778586569239049842e-01 1.480888204466117852e-01
+2.202477625994911925e-01 1.754305883940150690e-01 1.464207247437575854e-01
+2.162956754630863121e-01 1.729953216862958332e-01 1.447389395432186476e-01
+2.123470337300349953e-01 1.705526219247719688e-01 1.430434830302904636e-01
+2.084017785092666109e-01 1.681022492095620435e-01 1.413343631495822261e-01
+2.044598476844710633e-01 1.656439581587243193e-01 1.396115773261282222e-01
+2.005211760994463077e-01 1.631774974218037078e-01 1.378751121820577796e-01
+1.965856988864305155e-01 1.607026079587815515e-01 1.361249399201315824e-01
+1.926533421135208923e-01 1.582190261881047944e-01 1.343610282823611279e-01
+1.887240316449029232e-01 1.557264800392861304e-01 1.325833310557416600e-01
+1.847976928565723820e-01 1.532246885529702785e-01 1.307917884786300444e-01
+1.808742494403644818e-01 1.507133617751950094e-01 1.289863286797117148e-01
+1.769536238533599426e-01 1.481921999716426241e-01 1.271668674796427312e-01
+1.730357378708484994e-01 1.456608927537091369e-01 1.253333082519507424e-01
+1.691205132766324948e-01 1.431191180966186194e-01 1.234855418704042807e-01
+1.652078727370975830e-01 1.405665412234658185e-01 1.216234467798024410e-01
+1.612977409237918991e-01 1.380028133201234297e-01 1.197468892401933882e-01
+1.573900459762036241e-01 1.354275700331004917e-01 1.178557238119506412e-01
+1.534847214366352741e-01 1.328404296837557008e-01 1.159497941721605863e-01
+1.495817088501062986e-01 1.302409911046356894e-01 1.140289343827514401e-01
+1.456809613162400874e-01 1.276288309622561901e-01 1.120929707687035870e-01
+1.417824484273444985e-01 1.250035003675231404e-01 1.101417246101454861e-01
+1.378861632611661503e-01 1.223645204774909678e-01 1.081750159008208478e-01
+1.339921324751868759e-01 1.197113766395997425e-01 1.061926684632616136e-01]; 
+
+   case 'del'
+      RGB = [6.597738601379860013e-02 1.238600499381984077e-01 2.494811599712867811e-01
+6.865757658541371544e-02 1.266324956800233548e-01 2.555762447808356264e-01
+7.132312021900141796e-02 1.293951489111998809e-01 2.616639066260320057e-01
+7.396584278365506138e-02 1.321405798946303223e-01 2.677947952348482819e-01
+7.658629323761953489e-02 1.348691618055914976e-01 2.739690401973952083e-01
+7.919241629978698849e-02 1.375884267331394517e-01 2.801420635219376565e-01
+8.176925318412744947e-02 1.402841919021537431e-01 2.864049855987979565e-01
+8.433406612792618273e-02 1.429731754896261531e-01 2.926562894753481636e-01
+8.687299291862357609e-02 1.456421509856402619e-01 2.989801852647154812e-01
+8.939564312621503528e-02 1.483008215820366127e-01 3.053194113218902772e-01
+9.189721302857964402e-02 1.509448355999061520e-01 3.117030007960572280e-01
+9.437767086491094526e-02 1.535746031892240571e-01 3.181307112978130625e-01
+9.684032408298676176e-02 1.561940161218882128e-01 3.245815662969073756e-01
+9.927796547462605647e-02 1.587964393005784070e-01 3.310975577575396844e-01
+1.016993930631445442e-01 1.613915446377360008e-01 3.376235806086802516e-01
+1.040929763606517067e-01 1.639684016677392386e-01 3.442267209045115073e-01
+1.064700341792961802e-01 1.665394889067980111e-01 3.508360219569039429e-01
+1.088176547667218386e-01 1.690928617928972866e-01 3.575240510639015601e-01
+1.111462403295262191e-01 1.716403013777595965e-01 3.642247640300367850e-01
+1.134452622240499642e-01 1.741726760902385374e-01 3.709940519253031033e-01
+1.157201477866866002e-01 1.766970342921256598e-01 3.777940670973845005e-01
+1.179671104159276951e-01 1.792114205608784372e-01 3.846393215051533421e-01
+1.201817230210445731e-01 1.817136143480379551e-01 3.915459113873127617e-01
+1.223722204783651013e-01 1.842136886386882277e-01 3.984598273467554463e-01
+1.245183567208241193e-01 1.866951930885134003e-01 4.054791326498645709e-01
+1.266365389448252943e-01 1.891762365105242871e-01 4.125046892271796994e-01
+1.287143460345438750e-01 1.916485918438771141e-01 4.195883119105888182e-01
+1.307469548160320461e-01 1.941117894471887095e-01 4.267380618771365319e-01
+1.327408430973604225e-01 1.965752427165133320e-01 4.339060811804626439e-01
+1.346828243039070450e-01 1.990323873082787132e-01 4.411366760117488295e-01
+1.365667394636138066e-01 2.014836986376687955e-01 4.484350095699139449e-01
+1.383960163689361422e-01 2.039374403932631141e-01 4.557622019510663702e-01
+1.401636755967774206e-01 2.063944663974329741e-01 4.631231418544201062e-01
+1.418540865672596740e-01 2.088512567417482035e-01 4.705504424282677678e-01
+1.434598643146114128e-01 2.113116730887077965e-01 4.780359058662089766e-01
+1.449764155851626657e-01 2.137823044275377615e-01 4.855569960092488979e-01
+1.463910004146321830e-01 2.162663403203769485e-01 4.931143386027379560e-01
+1.476886377469379952e-01 2.187680022007208458e-01 5.007063827574367298e-01
+1.488517278855215897e-01 2.212928540992544768e-01 5.083284550145572567e-01
+1.498596541692162332e-01 2.238481772327865493e-01 5.159715446979967757e-01
+1.506883975687731414e-01 2.264434023743985280e-01 5.236207927150543506e-01
+1.513102256748371788e-01 2.290905757285599531e-01 5.312536911875026524e-01
+1.516842522456439690e-01 2.318030303219635324e-01 5.388545690381982833e-01
+1.517570170754133085e-01 2.345981922008114062e-01 5.464014367414956608e-01
+1.515076197810979464e-01 2.375036749636269540e-01 5.537960248334482527e-01
+1.508527167578624095e-01 2.405440732043884755e-01 5.610095372512794443e-01
+1.497779955302820376e-01 2.437529689807156341e-01 5.679039092169722025e-01
+1.482412957217069116e-01 2.471597695361844038e-01 5.743778793359424206e-01
+1.462677401356168583e-01 2.507850610764148502e-01 5.802953371129300209e-01
+1.439355627545357286e-01 2.546290083660951442e-01 5.855507465326762473e-01
+1.413540769625598603e-01 2.586695514989866829e-01 5.901033497204623002e-01
+1.386407864858154870e-01 2.628687111034194723e-01 5.939785160116007878e-01
+1.358917366388572578e-01 2.671843825843605580e-01 5.972486725556511722e-01
+1.331956301615234428e-01 2.715742302472205494e-01 6.000063534918327335e-01
+1.305811350178066321e-01 2.760102973743540078e-01 6.023428893290788677e-01
+1.280671927186234904e-01 2.804711462805791200e-01 6.043358297286517411e-01
+1.256919911974779258e-01 2.849349146429925872e-01 6.060559435528747319e-01
+1.234353694092780451e-01 2.893960415099317007e-01 6.075503879105464966e-01
+1.213123684738988406e-01 2.938438245262708359e-01 6.088643085732736715e-01
+1.193314037280503725e-01 2.982710543730990871e-01 6.100344852684282948e-01
+1.174733533629070403e-01 3.026784028742006138e-01 6.110815570440700784e-01
+1.157410513288365805e-01 3.070626658343806881e-01 6.120282423760157187e-01
+1.141526088065836497e-01 3.114180400183615416e-01 6.129002396427197796e-01
+1.126916634208409429e-01 3.157472412451859389e-01 6.137061650582799066e-01
+1.113553786510952659e-01 3.200503527841166984e-01 6.144572065766925606e-01
+1.101437722183151724e-01 3.243271585465217766e-01 6.151637952792941011e-01
+1.090564770800171446e-01 3.285777842283311712e-01 6.158346267162948529e-01
+1.080928143315710299e-01 3.328026048887181565e-01 6.164769721944358682e-01
+1.072518450875257212e-01 3.370021743369620570e-01 6.170969325182951160e-01
+1.065324069530126649e-01 3.411771714425693713e-01 6.176996445247795453e-01
+1.059331395146229648e-01 3.453283595087877078e-01 6.182894491232916456e-01
+1.054525023039967757e-01 3.494565556897754055e-01 6.188700280655170527e-01
+1.050887878891080540e-01 3.535626081054415448e-01 6.194445153697799578e-01
+1.048401320993113395e-01 3.576473788404232468e-01 6.200155882238653771e-01
+1.047045228648097182e-01 3.617117314301156461e-01 6.205855412748909616e-01
+1.046798087267215294e-01 3.657565217601439489e-01 6.211563474636030424e-01
+1.047637077327939481e-01 3.697825915556448573e-01 6.217297079493111500e-01
+1.049538171612311999e-01 3.737907638293131996e-01 6.223070931774267178e-01
+1.052476243004594747e-01 3.777818398051627224e-01 6.228897767433481114e-01
+1.056425183464732021e-01 3.817565969485811617e-01 6.234788633863599383e-01
+1.061358033549051061e-01 3.857157878203879009e-01 6.240753121902191669e-01
+1.067247120960378159e-01 3.896601395393941014e-01 6.246799558608577829e-01
+1.074064206019045564e-01 3.935903536891926513e-01 6.252935167860671495e-01
+1.081780631610760601e-01 3.975071065441324047e-01 6.259166204489629015e-01
+1.090367475038964695e-01 4.014110495195324368e-01 6.265498066600397875e-01
+1.099820192670150909e-01 4.053023125398828030e-01 6.271951607472914247e-01
+1.110081883132479630e-01 4.091820642340333603e-01 6.278512759575444191e-01
+1.121122195896028517e-01 4.130509161123952500e-01 6.285183732165030568e-01
+1.132912658654391114e-01 4.169094262530252948e-01 6.291967191746730137e-01
+1.145425291517750410e-01 4.207581307564207673e-01 6.298865324820219769e-01
+1.158632717089364272e-01 4.245975446528400532e-01 6.305879875238334931e-01
+1.172508261265178542e-01 4.284281627655473490e-01 6.313012175820684746e-01
+1.187026044305651562e-01 4.322504605241775932e-01 6.320263175158151725e-01
+1.202170218035645832e-01 4.360647043028175740e-01 6.327640308933485391e-01
+1.217903323311140817e-01 4.398716102802121553e-01 6.335133964865322653e-01
+1.234201965028123016e-01 4.436716084893622125e-01 6.342743647718233069e-01
+1.251044458168622253e-01 4.474650989352985664e-01 6.350469034989063566e-01
+1.268410231661077081e-01 4.512524653607909442e-01 6.358309517935993860e-01
+1.286279862353579828e-01 4.550340757553759663e-01 6.366264210299322768e-01
+1.304635102569667859e-01 4.588102828035847680e-01 6.374331955697576380e-01
+1.323456332495375476e-01 4.625814799269595823e-01 6.382509181299536039e-01
+1.342726301857550264e-01 4.663480223415985004e-01 6.390792893119938700e-01
+1.362431133778941039e-01 4.701102048314840798e-01 6.399181612927934415e-01
+1.382557801777440920e-01 4.738683163523436659e-01 6.407673303740510917e-01
+1.403094518927116008e-01 4.776226319622609018e-01 6.416265687705522414e-01
+1.424030742552521711e-01 4.813734129303259279e-01 6.424956248215036858e-01
+1.445357177858233311e-01 4.851209067888150872e-01 6.433742231671184530e-01
+1.467060787915918652e-01 4.888654617396300250e-01 6.442615910488664888e-01
+1.489131851676200047e-01 4.926073688646966375e-01 6.451570946472290347e-01
+1.511571091366653297e-01 4.963466938037996434e-01 6.460609578935421204e-01
+1.534374568113274773e-01 5.000836224936368035e-01 6.469728308538383876e-01
+1.557539606313337044e-01 5.038183265492227614e-01 6.478923408808500151e-01
+1.581064802328551455e-01 5.075509629447428894e-01 6.488190927082100323e-01
+1.604950035510952222e-01 5.112816736254882644e-01 6.497526685562985405e-01
+1.629196481906860228e-01 5.150105850470044766e-01 6.506926282565553832e-01
+1.653806563676609720e-01 5.187378093247897448e-01 6.516385018000171447e-01
+1.678770878978581016e-01 5.224637768298545648e-01 6.525882706071722827e-01
+1.704107945748090658e-01 5.261882349061756114e-01 6.535428899563763272e-01
+1.729824594318147002e-01 5.299112360468477556e-01 6.545018545237717422e-01
+1.755929057918094727e-01 5.336328137580849118e-01 6.554646382342502742e-01
+1.782431006664247641e-01 5.373529815601206794e-01 6.564306947203235598e-01
+1.809341585475496006e-01 5.410717318764055594e-01 6.573994578824640111e-01
+1.836673455941881250e-01 5.447890348032889962e-01 6.583703425703313350e-01
+1.864440842101210971e-01 5.485048367520860557e-01 6.593427454071065785e-01
+1.892659579998643982e-01 5.522190589552509188e-01 6.603160457822994100e-01
+1.921347170798090864e-01 5.559315958284012371e-01 6.612896070418273764e-01
+1.950522837092731887e-01 5.596423131801995243e-01 6.622627779079297561e-01
+1.980207581910957138e-01 5.633510462626485360e-01 6.632348941655241692e-01
+2.010424249735310309e-01 5.670575976553166031e-01 6.642052806559789468e-01
+2.041197588637720939e-01 5.707617349784390726e-01 6.651732536238323945e-01
+2.072554312381834074e-01 5.744631884318825987e-01 6.661381234667468343e-01
+2.104523161046616408e-01 5.781616481597345869e-01 6.670991979438091191e-01
+2.137134958380619842e-01 5.818567614439515978e-01 6.680557859020190836e-01
+2.170422663699277943e-01 5.855481297352551628e-01 6.690072015853253395e-01
+2.204421415686979580e-01 5.892353055354571101e-01 6.699527695945174388e-01
+2.239168564955728025e-01 5.929177891529354705e-01 6.708918305694538953e-01
+2.274703691651913662e-01 5.965950253621812305e-01 6.718237476670261277e-01
+2.311068603787596043e-01 6.002664000095238039e-01 6.727479139084245885e-01
+2.348307311320150803e-01 6.039312366204897531e-01 6.736637604671461554e-01
+2.386465970323070063e-01 6.075887930799791503e-01 6.745707659639463838e-01
+2.425592790908820962e-01 6.112382584746600678e-01 6.754684668258670310e-01
+2.465737901908315322e-01 6.148787502077949219e-01 6.763564687525340791e-01
+2.506953164731830497e-01 6.185093115199363778e-01 6.772344593131256474e-01
+2.549296306833234715e-01 6.221293277287609502e-01 6.780979140255732895e-01
+2.592822774336291380e-01 6.257372346725570411e-01 6.789506539234843041e-01
+2.637588638514070660e-01 6.293318265564150638e-01 6.797927409484227912e-01
+2.683650223312705752e-01 6.329118213522958447e-01 6.806243803889014954e-01
+2.731063499524681304e-01 6.364758627686015746e-01 6.814459485792905280e-01
+2.779906740187598757e-01 6.400228375684388071e-01 6.822520389699539001e-01
+2.830218658907085461e-01 6.435508363165360901e-01 6.830490580497422526e-01
+2.882048880496008714e-01 6.470582889109053326e-01 6.838383084593062655e-01
+2.935458083139746988e-01 6.505436502020417455e-01 6.846186591669699562e-01
+2.990503892938236596e-01 6.540052313531840023e-01 6.853899295935115266e-01
+3.047196724248331101e-01 6.574412743642752410e-01 6.861585944188198782e-01
+3.105583191416750322e-01 6.608501423712110912e-01 6.869242652383956704e-01
+3.165691502323280671e-01 6.642301693361829518e-01 6.876887756715628353e-01
+3.227495057337754214e-01 6.675799504508616034e-01 6.884592417367911832e-01
+3.291028263869451576e-01 6.708979305506697077e-01 6.892345854413708395e-01
+3.356230778965553774e-01 6.741831128414313978e-01 6.900227469259155866e-01
+3.423073210907732200e-01 6.774345078849072221e-01 6.908268664523685709e-01
+3.491497562850178760e-01 6.806514618485436374e-01 6.916515776970183493e-01
+3.561412724149042863e-01 6.838337923407922236e-01 6.925029303903535993e-01
+3.632736859780383298e-01 6.869814453814443445e-01 6.933849146347551562e-01
+3.705348353526126681e-01 6.900949744532235419e-01 6.943034006383217438e-01
+3.779122643387600178e-01 6.931752240960002975e-01 6.952632699407041983e-01
+3.853938489959773395e-01 6.962232375904670034e-01 6.962682692318554745e-01
+3.929633165309669440e-01 6.992408157519413026e-01 6.973239952904880523e-01
+4.006094014150666793e-01 7.022293785228771457e-01 6.984322280579721154e-01
+4.083159356621580693e-01 7.051912169731731073e-01 6.995972410351208870e-01
+4.160701459275524816e-01 7.081283984755933902e-01 7.008208963157127602e-01
+4.238620058191452378e-01 7.110427636723841704e-01 7.021034222566255867e-01
+4.316725578542053299e-01 7.139377080072604187e-01 7.034496090272048807e-01
+4.394994714751406240e-01 7.168142170649683953e-01 7.048555730206492731e-01
+4.473284906527433269e-01 7.196752689920701274e-01 7.063236640655090604e-01
+4.551495147015194864e-01 7.225233370762427221e-01 7.078541344797719681e-01
+4.629611457318438261e-01 7.253594732048370686e-01 7.094433480260243785e-01
+4.707534852399093972e-01 7.281862590349524877e-01 7.110918876863899785e-01
+4.785169352473264692e-01 7.310063519486531547e-01 7.128002486509635860e-01
+4.862541175206331334e-01 7.338201861642941193e-01 7.145637643240034809e-01
+4.939610178122765816e-01 7.366294113512334985e-01 7.163810048013540266e-01
+5.016310591672418218e-01 7.394362226143922356e-01 7.182517850494093414e-01
+5.092596479997313352e-01 7.422424836790947333e-01 7.201752147893440981e-01
+5.168502920324100636e-01 7.450484101459822206e-01 7.221473089909000720e-01
+5.244013381888714687e-01 7.478552285559243451e-01 7.241664310755349110e-01
+5.319115488689606375e-01 7.506640750099188297e-01 7.262309445597783242e-01
+5.393800515498496928e-01 7.534759997433319034e-01 7.283392250016084146e-01
+5.468044438041703703e-01 7.562923850920999502e-01 7.304903735115424457e-01
+5.541839357415714318e-01 7.591142604468823496e-01 7.326829886087474764e-01
+5.615214997302344635e-01 7.619417788590748808e-01 7.349143832677361710e-01
+5.688172658612942190e-01 7.647756983657992835e-01 7.371830791535139982e-01
+5.760715228891868378e-01 7.676167208435804579e-01 7.394876421854478243e-01
+5.832846906737159109e-01 7.704654971547720832e-01 7.418266842236616032e-01
+5.904572957555410673e-01 7.733226320830066669e-01 7.441988638633715292e-01
+5.975899498408560051e-01 7.761886890212207346e-01 7.466028864742004778e-01
+6.046833309596043593e-01 7.790641943891402077e-01 7.490375036038013912e-01
+6.117381670592270115e-01 7.819496417678519773e-01 7.515015118481881418e-01
+6.187552218007135174e-01 7.848454957475322624e-01 7.539937512752844517e-01
+6.257352823331345792e-01 7.877521954909707524e-01 7.565131034734732252e-01
+6.326791488358145532e-01 7.906701580203755464e-01 7.590584892833606157e-01
+6.395876256322543529e-01 7.935997812385013894e-01 7.616288662585695146e-01
+6.464615136961924247e-01 7.965414466975205832e-01 7.642232258900538699e-01
+6.533016043869401823e-01 7.994955221304983484e-01 7.668405906180205678e-01
+6.601086742679306285e-01 8.024623637610888149e-01 7.694800106460160105e-01
+6.668834808789664281e-01 8.054423184071207720e-01 7.721405605628438584e-01
+6.736267593487160754e-01 8.084357253933542875e-01 7.748213357696444037e-01
+6.803392197495884419e-01 8.114429182878516444e-01 7.775214487015286169e-01
+6.870215451120499361e-01 8.144642264752101068e-01 7.802400248254467430e-01
+6.936743900300211818e-01 8.174999765783720340e-01 7.829761983884004906e-01
+7.002974950415432609e-01 8.205507454139520096e-01 7.857294359175189813e-01
+7.068916498938800919e-01 8.236168074562510988e-01 7.884988108515800231e-01
+7.134582338528936418e-01 8.266982574818713125e-01 7.912831565844938853e-01
+7.199978016303433259e-01 8.297954164160811219e-01 7.940815874530331442e-01
+7.265108777000938156e-01 8.329086081072485381e-01 7.968932005645313899e-01
+7.329979578454549616e-01 8.360381599792610086e-01 7.997170690214260302e-01
+7.394595112267420278e-01 8.391844035374615984e-01 8.025522344938926800e-01
+7.458959830242087863e-01 8.423476747120355324e-01 8.053976990501692246e-01
+7.523077977331221744e-01 8.455283140156318877e-01 8.082524161470656665e-01
+7.586951667693938584e-01 8.487267253083131680e-01 8.111153620935316333e-01
+7.650577483984875027e-01 8.519434804026106978e-01 8.139856782226038145e-01
+7.713970926011407547e-01 8.551785852225586293e-01 8.168616329686009259e-01
+7.777135915287802792e-01 8.584323939893921951e-01 8.197418712821458175e-01
+7.840076454752769042e-01 8.617052627327101977e-01 8.226249282969148036e-01
+7.902796732960170045e-01 8.649975472537146937e-01 8.255092131742095551e-01
+7.965301248451132077e-01 8.683096003971411125e-01 8.283929915814087774e-01
+8.027594957590121760e-01 8.716417684881572203e-01 8.312743668855639978e-01
+8.089680559912207913e-01 8.749944751017242339e-01 8.341514052269850543e-01
+8.151567019468018982e-01 8.783679611555336164e-01 8.370217075803022544e-01
+8.213264334358614249e-01 8.817624446744987132e-01 8.398826380716230000e-01
+8.274781243204414327e-01 8.851781910186152791e-01 8.427314427493727278e-01
+8.336128134834004388e-01 8.886154231077250110e-01 8.455651044543932571e-01
+8.397317396975054749e-01 8.920743090766621863e-01 8.483803273271105505e-01
+8.458363795503203164e-01 8.955549480225133419e-01 8.511735264537213519e-01
+8.519285410708211659e-01 8.990573377468378258e-01 8.539407899678711500e-01
+8.580104271310651232e-01 9.025813506938162867e-01 8.566778627755414766e-01
+8.640844411003687497e-01 9.061267859275130565e-01 8.593803204948170515e-01
+8.701533853242351402e-01 9.096933004913555498e-01 8.620435066748899366e-01
+8.762204735799774546e-01 9.132803958502141439e-01 8.646625969293003644e-01
+8.822893382459134903e-01 9.168874047650978909e-01 8.672326784644417419e-01
+8.883640160698558219e-01 9.205134840158590848e-01 8.697488518860556628e-01
+8.944490897569347121e-01 9.241575627749747390e-01 8.722061884634622064e-01
+9.005494862654843669e-01 9.278183935417740891e-01 8.745999527261957285e-01
+9.066697518672085510e-01 9.314947526919318266e-01 8.769263428234910229e-01
+9.128147816848455331e-01 9.351852279261616552e-01 8.791818556054207257e-01
+9.189893388971293042e-01 9.388883614412766310e-01 8.813636793355511534e-01
+9.251978653035416444e-01 9.426027146413026303e-01 8.834697874077058755e-01
+9.314442876100802460e-01 9.463269403919151168e-01 8.854989876415102490e-01
+9.377318363007438595e-01 9.500598571817585603e-01 8.874509187201842231e-01
+9.440634086681402026e-01 9.538003778631106711e-01 8.893253867710815275e-01
+9.504401533195278029e-01 9.575479274112385086e-01 8.911237616446540111e-01
+9.568622268534309194e-01 9.613022612892393459e-01 8.928479377657454474e-01
+9.633289971376283178e-01 9.650634347497447640e-01 8.944999044139121391e-01
+9.698388693863758681e-01 9.688318688917866295e-01 8.960818313086871267e-01
+9.763893802744164629e-01 9.726083363283349881e-01 8.975959074248138769e-01
+9.829773205072419584e-01 9.763939321161484441e-01 8.990442065973827113e-01
+9.895988716426143972e-01 9.801900344288262401e-01 9.004285886132605832e-01
+9.962497442478134291e-01 9.839982596313375796e-01 9.017506391251587372e-01
+9.996253193176977137e-01 9.913711226010460953e-01 8.041012438578545307e-01
+9.969312990878144154e-01 9.865865913107011442e-01 7.958196545688069889e-01
+9.942533588637104680e-01 9.818135789307643746e-01 7.875317815897165952e-01
+9.915896776086415842e-01 9.770525904709529419e-01 7.792374356109948996e-01
+9.889384786221749879e-01 9.723041153469224041e-01 7.709364896057565586e-01
+9.862980251266783016e-01 9.675686302753326862e-01 7.626288656679628408e-01
+9.836666169060123144e-01 9.628466015967408476e-01 7.543145233681930462e-01
+9.810425876106124710e-01 9.581384871880828102e-01 7.459934495167190871e-01
+9.784237290846492519e-01 9.534448589527805273e-01 7.376670490866494845e-01
+9.758091741853186507e-01 9.487660072025493330e-01 7.293335612360094533e-01
+9.731976797213667263e-01 9.441023023821585314e-01 7.209921595340745837e-01
+9.705876565172376624e-01 9.394541905537218129e-01 7.126429103405369503e-01
+9.679775344953384097e-01 9.348221172710475813e-01 7.042858810456844587e-01
+9.653657609756586266e-01 9.302065285603877687e-01 6.959211353452218196e-01
+9.627508763245108403e-01 9.256078555762781157e-01 6.875485248304887831e-01
+9.601317913231469658e-01 9.210264571207541495e-01 6.791669211618720503e-01
+9.575068348330096901e-01 9.164628209777989643e-01 6.707767168399573210e-01
+9.548744491996995487e-01 9.119174176425877132e-01 6.623780173986024700e-01
+9.522330808045905703e-01 9.073907239128325974e-01 6.539709177027834830e-01
+9.495811770290348841e-01 9.028832240271246201e-01 6.455555018977681137e-01
+9.469171829214290126e-01 8.983954108674836458e-01 6.371318441574638225e-01
+9.442402190659517913e-01 8.939276490907958062e-01 6.286979645113369708e-01
+9.415486437855169477e-01 8.894804711503382366e-01 6.202539985663386712e-01
+9.388403761261178149e-01 8.850545069722992597e-01 6.118014161078325630e-01
+9.361137658947894513e-01 8.806503085987659185e-01 6.033403762527677072e-01
+9.333671427931780062e-01 8.762684428171652051e-01 5.948710444843188228e-01
+9.305988122871574619e-01 8.719094924143574454e-01 5.863935979844183688e-01
+9.278070514355759579e-01 8.675740573997056115e-01 5.779082318269497254e-01
+9.249901047433721768e-01 8.632627561697012730e-01 5.694151660419812799e-01
+9.221469800733509414e-01 8.589760860685742294e-01 5.609116482547054083e-01
+9.192753048560652340e-01 8.547148108589553983e-01 5.523997440377725887e-01
+9.163728560349155838e-01 8.504796735679325259e-01 5.438810466983201586e-01
+9.134376867190158178e-01 8.462713800742609482e-01 5.353560484875481418e-01
+9.104678046010745707e-01 8.420906570028113824e-01 5.268253096213930675e-01
+9.074611700430375016e-01 8.379382516634488187e-01 5.182894693241438810e-01
+9.044156948810763152e-01 8.338149316350844664e-01 5.097492574011085464e-01
+9.013292420875533839e-01 8.297214839374013051e-01 5.012055062134753713e-01
+8.981996264328737656e-01 8.256587137313211588e-01 4.926591628979440363e-01
+8.950246162923013449e-01 8.216274424893472705e-01 4.841113016411668357e-01
+8.918019367410795484e-01 8.176285055788921063e-01 4.755631357855747976e-01
+8.885292740744069606e-01 8.136627492060259925e-01 4.670160295098501613e-01
+8.852042818763621312e-01 8.097310266740884721e-01 4.584715087957387802e-01
+8.818245887426444662e-01 8.058341939216442373e-01 4.499312713647861117e-01
+8.783878077356160885e-01 8.019731043176190344e-01 4.413971952459587733e-01
+8.748915476159051519e-01 7.981486027081815537e-01 4.328713456201330745e-01
+8.713334258529761289e-01 7.943615187300834268e-01 4.243559795823733105e-01
+8.677110833677242896e-01 7.906126594284177411e-01 4.158535484698712703e-01
+8.640222009043423412e-01 7.869028012426558805e-01 4.073666974243692063e-01
+8.602645168678531018e-01 7.832326814525909509e-01 3.988982618942717440e-01
+8.564358463998196225e-01 7.796029892044549214e-01 3.904512608343593816e-01
+8.525341014005127782e-01 7.760143562656642846e-01 3.820288864300384613e-01
+8.485573111443696082e-01 7.724673476829161389e-01 3.736344902575098326e-01
+8.445036430802366212e-01 7.689624525410815314e-01 3.652715658890242079e-01
+8.403714233625397823e-01 7.655000750378188057e-01 3.569437280604416673e-01
+8.361591566273345322e-01 7.620805260995172636e-01 3.486546886323707573e-01
+8.318655445115968883e-01 7.587040157667198637e-01 3.404082296912668837e-01
+8.274895024172935765e-01 7.553706465705579687e-01 3.322081742472747790e-01
+8.230301740454328829e-01 7.520804081054507373e-01 3.240583550855133943e-01
+8.184868212302832680e-01 7.488332616294635091e-01 3.159617825674137515e-01
+8.138590110822148116e-01 7.456289896604103573e-01 3.079221377655331771e-01
+8.091468181242912339e-01 7.424670871619818424e-01 2.999443469091602199e-01
+8.043504122379883103e-01 7.393470563716729727e-01 2.920319686576324791e-01
+7.994702184716161453e-01 7.362682828578653860e-01 2.841884012704181672e-01
+7.945069109411802000e-01 7.332300399833050486e-01 2.764168555307422448e-01
+7.894614033518293494e-01 7.302314948629916591e-01 2.687203309843908539e-01
+7.843348364120679150e-01 7.272717156577747089e-01 2.611015959667907227e-01
+7.791285260147496894e-01 7.243496994364320152e-01 2.535630684860531447e-01
+7.738440801480908071e-01 7.214643092911102729e-01 2.461071963221510561e-01
+7.684833208817296590e-01 7.186143199358207001e-01 2.387362039122769009e-01
+7.630481315977482026e-01 7.157984953860191402e-01 2.314517734491695622e-01
+7.575405230514773436e-01 7.130155515836559266e-01 2.242553190375982108e-01
+7.519626112766101267e-01 7.102641669372077304e-01 2.171479941172158035e-01
+7.463165956980535309e-01 7.075429925763011552e-01 2.101307026608347228e-01
+7.406047378440419049e-01 7.048506621488696000e-01 2.032041138079452858e-01
+7.348297350913484127e-01 7.021856197788983733e-01 1.963692968886621149e-01
+7.289936844492124202e-01 6.995466025992004289e-01 1.896260481458106884e-01
+7.230988483362374986e-01 6.969322773880018973e-01 1.829743149302962002e-01
+7.171475322086006132e-01 6.943412998823550453e-01 1.764139943240976283e-01
+7.111420143928013360e-01 6.917723467781027313e-01 1.699448658068684892e-01
+7.050845338608371371e-01 6.892241206236302542e-01 1.635666199792324693e-01
+6.989772797030316953e-01 6.866953538838792559e-01 1.572788888364401172e-01
+6.928223822517928232e-01 6.841848122132092591e-01 1.510812776309110872e-01
+6.866220524799201419e-01 6.816912363109779438e-01 1.449735254345622115e-01
+6.803786701652846380e-01 6.792133090629258740e-01 1.389555620195359609e-01
+6.740936196655853418e-01 6.767501306945983286e-01 1.330266252977832520e-01
+6.677687244983904202e-01 6.743006234739316040e-01 1.271865644636745452e-01
+6.614057275351008514e-01 6.718637487365417549e-01 1.214353970802317662e-01
+6.550062900453353931e-01 6.694385066322930955e-01 1.157733573283348805e-01
+6.485719915801509972e-01 6.670239355272904458e-01 1.102009495253571669e-01
+6.421043305819508218e-01 6.646191111168818777e-01 1.047190080781650323e-01
+6.356047256163376291e-01 6.622231453008022850e-01 9.932876523540395963e-02
+6.290745171295046845e-01 6.598351848668921882e-01 9.403192821288078318e-02
+6.225149696438274649e-01 6.574544100249212208e-01 8.883076747185855715e-02
+6.159272743135092432e-01 6.550800328272597950e-01 8.372821811088401733e-02
+6.093126663293514378e-01 6.527112545185101977e-01 7.872799706657532259e-02
+6.026723170612737768e-01 6.503473055396404856e-01 7.383469856963406630e-02
+5.960069280976730832e-01 6.479875866853281874e-01 6.905400752442764079e-02
+5.893174254692321590e-01 6.456314203776034599e-01 6.439287527349069062e-02
+5.826046784844106652e-01 6.432781520370909334e-01 5.985968924725062340e-02
+5.758695032242261425e-01 6.409271483905801814e-01 5.546448455059219823e-02
+5.691126660872921628e-01 6.385777958070207871e-01 5.121916775709036557e-02
+5.623348873683923221e-01 6.362294986703330713e-01 4.713774156788400754e-02
+5.555368448583254404e-01 6.338816777957024806e-01 4.323651096469569716e-02
+5.487191774565705060e-01 6.315337688945173999e-01 3.952487864258176498e-02
+5.418824887917018662e-01 6.291852210919098853e-01 3.612051121019213551e-02
+5.350273508472259687e-01 6.268354954999130202e-01 3.311399967360150604e-02
+5.281543075929241438e-01 6.244840638484698836e-01 3.049096132752013993e-02
+5.212638786236020172e-01 6.221304071760309640e-01 2.823775650583685778e-02
+5.143565628087404251e-01 6.197740145810481938e-01 2.634144880489198981e-02
+5.074328419576341620e-01 6.174143820354919265e-01 2.478976657062584646e-02
+5.004931845054064743e-01 6.150510112614009373e-01 2.357106560875196072e-02
+4.935380492257968599e-01 6.126834086714986194e-01 2.267429306479169446e-02
+4.865677337149327264e-01 6.103111278318402722e-01 2.208918519158591109e-02
+4.795827833081557912e-01 6.079336535225863258e-01 2.180564619063158835e-02
+4.725836555273193462e-01 6.055504983495709759e-01 2.181419194008693205e-02
+4.655708088649732068e-01 6.031611773523495312e-01 2.210580170001537684e-02
+4.585447116306416437e-01 6.007652058968021569e-01 2.267187969798983502e-02
+4.515058459835388782e-01 5.983620990282547680e-01 2.350422445657735990e-02
+4.444547120266517104e-01 5.959513709030562767e-01 2.459499875403014374e-02
+4.373918319618326778e-01 5.935325343022211930e-01 2.593670014651517156e-02
+4.303177543037495223e-01 5.911051002310937497e-01 2.752213198538535840e-02
+4.232330581488202292e-01 5.886685776092354105e-01 2.934437486930205341e-02
+4.161383574931313278e-01 5.862224730549979723e-01 3.139675847884770832e-02
+4.090343055913983616e-01 5.837662907693373926e-01 3.367283375013734037e-02
+4.019215993467592507e-01 5.812995325235387201e-01 3.616634535426579283e-02
+3.948009837190709082e-01 5.788216977554323517e-01 3.887120446073646235e-02
+3.876732561372571162e-01 5.763322837785355146e-01 4.174672181203834681e-02
+3.805386564470196742e-01 5.738309171411589693e-01 4.468566878513501733e-02
+3.733986391498164137e-01 5.713169711328536238e-01 4.768049787246867594e-02
+3.662542351622480874e-01 5.687899279044026368e-01 5.071835758395210753e-02
+3.591065040473656045e-01 5.662492786415918022e-01 5.378828392041421630e-02
+3.519565800474088735e-01 5.636945152858550134e-01 5.688085721725138350e-02
+3.448056760545124555e-01 5.611251315161035480e-01 5.998797256299469999e-02
+3.376550874229136134e-01 5.585406238589376571e-01 6.310263770132876204e-02
+3.305061956006355439e-01 5.559404929241524851e-01 6.621879773242350664e-02
+3.233604715607960034e-01 5.533242447607230607e-01 6.933118466356372189e-02
+3.162194790161148017e-01 5.506913923265978061e-01 7.243518928216058361e-02
+3.090846039651472532e-01 5.480415027343880086e-01 7.552721746757809496e-02
+3.019574288899705139e-01 5.453741321890830385e-01 7.860394456462099777e-02
+2.948403194287022577e-01 5.426887379559618418e-01 8.166128713902018332e-02
+2.877352499045566225e-01 5.399848761881764769e-01 8.469633286585029341e-02
+2.806442994214729536e-01 5.372621189537871711e-01 8.770643445761908130e-02
+2.735696535538801322e-01 5.345200561570193631e-01 9.068916512095565041e-02
+2.665136059049172390e-01 5.317582974656462902e-01 9.364228167891575083e-02
+2.594785595977833204e-01 5.289764742223507232e-01 9.656369418956520234e-02
+2.524670287821700332e-01 5.261742413169625543e-01 9.945144107016240520e-02
+2.454813557062531792e-01 5.233513142453691813e-01 1.023041162767710510e-01
+2.385245828710040317e-01 5.205073603004944927e-01 1.051194831525161522e-01
+2.315996737216303170e-01 5.176421037021866622e-01 1.078956959800008442e-01
+2.247096070811669399e-01 5.147553123030387257e-01 1.106311405318080310e-01
+2.178574824667257048e-01 5.118467857547527311e-01 1.133242655958566492e-01
+2.110465244393363582e-01 5.089163566221597268e-01 1.159735773093806543e-01
+2.042800881777394606e-01 5.059638913007615812e-01 1.185776351459725819e-01
+1.975616665475327660e-01 5.029892907239723598e-01 1.211350492651094846e-01
+1.908950317685597087e-01 4.999924798399172921e-01 1.236442618572499708e-01
+1.842839642352289697e-01 4.969734333710090213e-01 1.261039978961912833e-01
+1.777324020667393756e-01 4.939321620495928378e-01 1.285130506256617899e-01
+1.712444848635372441e-01 4.908687102327232155e-01 1.308702368677320538e-01
+1.648245567449286297e-01 4.877831568788963401e-01 1.331744245804179216e-01
+1.584771896665797541e-01 4.846756148389082530e-01 1.354245338303780855e-01
+1.522072108246106115e-01 4.815462299379932865e-01 1.376195378692431359e-01
+1.460197345452351747e-01 4.783951798632230523e-01 1.397584642177332193e-01
+1.399204939260773328e-01 4.752226638142488802e-01 1.418397751955981501e-01
+1.339151022806790436e-01 4.720289313790105301e-01 1.438629155677119409e-01
+1.280096392738992173e-01 4.688142535267130762e-01 1.458273227721058329e-01
+1.222107627052576584e-01 4.655789223639808516e-01 1.477322650340249788e-01
+1.165256528622910237e-01 4.623232537320298152e-01 1.495770677617926092e-01
+1.109620746853187123e-01 4.590475853271560047e-01 1.513611132825743999e-01
+1.055284430115649430e-01 4.557522747771929894e-01 1.530838402977779955e-01
+1.002338888313226428e-01 4.524376976954341267e-01 1.547447430577089666e-01
+9.508832342249537439e-02 4.491042457325262194e-01 1.563433702619193288e-01
+9.010250937510871916e-02 4.457523324675090604e-01 1.578790892676192326e-01
+8.528801833375249108e-02 4.423823989146767888e-01 1.593510674113139958e-01
+8.065727940861416867e-02 4.389948528858526600e-01 1.607597457256386420e-01
+7.622371216564308161e-02 4.355901307746828932e-01 1.621048834368656322e-01
+7.200158271604989446e-02 4.321686757028083692e-01 1.633862841279137557e-01
+6.800589086138220107e-02 4.287309359317861834e-01 1.646037933778843332e-01
+6.425218103335716968e-02 4.252773633715483670e-01 1.657572962977645059e-01
+6.075626148835750612e-02 4.218084121914437157e-01 1.668467149892300661e-01
+5.753381975108700502e-02 4.183245375382101949e-01 1.678720059529140995e-01
+5.459992971435845971e-02 4.148261943636451510e-01 1.688331574715942474e-01
+5.196845773512390881e-02 4.113138363632788397e-01 1.697301869925023354e-01
+4.965139124510086627e-02 4.077879150260529384e-01 1.705631385315065085e-01
+4.765813208284918473e-02 4.042488787938245398e-01 1.713320801202671551e-01
+4.599481449154869256e-02 4.006971723285012166e-01 1.720371013157572515e-01
+4.466371969486728627e-02 3.971332358837184051e-01 1.726783107897287561e-01
+4.366274483561478209e-02 3.935575133766276990e-01 1.732557671739120286e-01
+4.298497468310508857e-02 3.899704687794856572e-01 1.737693705957654433e-01
+4.262017645185838671e-02 3.863724827023667929e-01 1.742196255705478480e-01
+4.255352467768171859e-02 3.827639728113220174e-01 1.746066936456434071e-01
+4.276673184831410873e-02 3.791453506945430818e-01 1.749307448926006592e-01
+4.323878239983177524e-02 3.755170217599948512e-01 1.751919563188165385e-01
+4.394675081101364483e-02 3.718793851987791665e-01 1.753905104335057585e-01
+4.486662442701292580e-02 3.682328340080037177e-01 1.755265939730583369e-01
+4.597406436707644067e-02 3.645777550668193867e-01 1.756003967899375517e-01
+4.724505801823831314e-02 3.609145292591857124e-01 1.756121109084000098e-01
+4.865643856140024898e-02 3.572435316368365310e-01 1.755619297495205344e-01
+5.018626632042253594e-02 3.535651316158259783e-01 1.754500475272437465e-01
+5.181408104443557122e-02 3.498796931999255677e-01 1.752766588164567374e-01
+5.352104295989750654e-02 3.461875752240315962e-01 1.750419582933170903e-01
+5.528998425553303259e-02 3.424891316106106198e-01 1.747461406473147794e-01
+5.710539287663336100e-02 3.387847116320403806e-01 1.743894006636908245e-01
+5.895334846203271334e-02 3.350746601715560713e-01 1.739719334739151524e-01
+6.082142709649813322e-02 3.313593179753057116e-01 1.734939349708606859e-01
+6.269858808390260663e-02 3.276390218878380001e-01 1.729556023841174184e-01
+6.457505267241087088e-02 3.239141050631572094e-01 1.723571350094970367e-01
+6.644218183629055363e-02 3.201848971432968427e-01 1.716987350852014205e-01
+6.829235792686130790e-02 3.164517243962254311e-01 1.709806088053268391e-01
+7.011887323479765177e-02 3.127149098048046527e-01 1.702029674593475428e-01
+7.191582719453681882e-02 3.089747730984767071e-01 1.693660286839586415e-01
+7.367740139700959534e-02 3.052317018390342529e-01 1.684698187582648887e-01
+7.539908659075802988e-02 3.014860094828903936e-01 1.675145933863426417e-01
+7.707730571895973770e-02 2.977379606831319081e-01 1.665007348086736949e-01
+7.870852955781817983e-02 2.939878648964006636e-01 1.654284970811750188e-01
+8.028965953863020921e-02 2.902360278178472974e-01 1.642981478645798299e-01
+8.181797774419891089e-02 2.864827509313960796e-01 1.631099700093367744e-01
+8.329110360766753263e-02 2.827283309501391617e-01 1.618642630930951787e-01
+8.470695659424687385e-02 2.789730591425138573e-01 1.605613448745624727e-01
+8.606372418387428502e-02 2.752172205414125661e-01 1.592015526248838075e-01
+8.735983452008261319e-02 2.714610930351273321e-01 1.577852442954886525e-01
+8.859393314120664331e-02 2.677049463410028363e-01 1.563127994796906506e-01
+8.976486326081492551e-02 2.639490408648579312e-01 1.547846201243904263e-01
+9.087164911293293956e-02 2.601936264515474218e-01 1.532011309481255412e-01
+9.191348192284298779e-02 2.564389410344570241e-01 1.515627795225681362e-01
+9.288704312629730842e-02 2.526856315239155992e-01 1.498693699931691048e-01
+9.379283018859288501e-02 2.489337717503207204e-01 1.481216905842226428e-01
+9.463163644057562274e-02 2.451833792964967507e-01 1.463205652098015508e-01
+9.540318566942779244e-02 2.414346401225993533e-01 1.444665315338557743e-01
+9.610732643393554708e-02 2.376877206774311024e-01 1.425601463139360425e-01
+9.674402718144511915e-02 2.339427661170380146e-01 1.406019829499289553e-01
+9.731337192794831115e-02 2.301998985206034631e-01 1.385926284969124511e-01
+9.781527030012060475e-02 2.264592671684997338e-01 1.365326231802845014e-01
+9.824358966693200190e-02 2.227221381992704474e-01 1.344213498047777955e-01
+9.860476008591259611e-02 2.189874851640599696e-01 1.322606854144605382e-01
+9.889926458171927059e-02 2.152553323101172311e-01 1.300512525669721697e-01
+9.912768720083675600e-02 2.115256719866073221e-01 1.277936680974917916e-01
+9.929070945217863264e-02 2.077984630697710111e-01 1.254885372707029156e-01
+9.938536693535210409e-02 2.040743841747782450e-01 1.231359093599569132e-01
+9.940987528000957973e-02 2.003539028956775048e-01 1.207361104943659447e-01
+9.937074432198822471e-02 1.966357733029605592e-01 1.182905659078862248e-01
+9.926899950314096999e-02 1.929198155529378012e-01 1.157998086675786908e-01
+9.910574746809375224e-02 1.892058087816931022e-01 1.132643300609986470e-01
+9.887273365069987330e-02 1.854955476839638961e-01 1.106837415179452166e-01
+9.857702759168757156e-02 1.817875303344013982e-01 1.080592207487474365e-01
+9.822269753736714848e-02 1.780808239249605796e-01 1.053914161709541830e-01
+9.781113633355650872e-02 1.743750377566490040e-01 1.026806351620476176e-01
+9.733238005935909709e-02 1.706723687329834982e-01 9.992670564763897478e-02
+9.679537330416121410e-02 1.669706979907544520e-01 9.713043093317094701e-02
+9.620476860769888727e-02 1.632687911401897729e-01 9.429209466525781402e-02
+9.555840111219859878e-02 1.595669718044100127e-01 9.141177435708905397e-02
+9.484851695793727888e-02 1.558669291806107915e-01 8.848983773912671991e-02
+9.408911153954402362e-02 1.521650578561620781e-01 8.552628708305054506e-02
+9.328192094338655371e-02 1.484606091474970080e-01 8.252094903627574252e-02
+9.241015243151923242e-02 1.447574737795673805e-01 7.947496936453349314e-02
+9.149313879389489590e-02 1.410504572025015335e-01 7.638732537156053826e-02
+9.053276383981978537e-02 1.373386075843833487e-01 7.325761429945673586e-02];
+
+   case 'cur'
+      RGB = [8.225559928700268419e-02 1.149244079727295142e-01 2.647901677800857390e-01
+8.312616532498406929e-02 1.190383729463048712e-01 2.668628892216621806e-01
+8.400180885962132971e-02 1.231074880892656653e-01 2.689526699064171411e-01
+8.487294239495335457e-02 1.271387529060027943e-01 2.710541708402016137e-01
+8.574385298640457842e-02 1.311333174761502018e-01 2.731691209373900975e-01
+8.661249189260347703e-02 1.350944971238551839e-01 2.752961432065319514e-01
+8.747533041314431435e-02 1.390258052165279645e-01 2.774332852121961235e-01
+8.833858505105957049e-02 1.429270910011002649e-01 2.795831537842536352e-01
+8.919012906146844832e-02 1.468043594975814992e-01 2.817400195447572475e-01
+9.004099984169053328e-02 1.506555099870153513e-01 2.839086654207542693e-01
+9.088231952195491292e-02 1.544850037627045203e-01 2.860850125083750362e-01
+9.171714479257989105e-02 1.582931942356169963e-01 2.882702798507874586e-01
+9.254607948203208423e-02 1.620811665705463311e-01 2.904645825457518593e-01
+9.336173420340779239e-02 1.658523274558137695e-01 2.926648040593683997e-01
+9.417284157369981701e-02 1.696050767223750977e-01 2.948744162588470830e-01
+9.496899572502048859e-02 1.733434725855039771e-01 2.970892156823352059e-01
+9.575619444438937533e-02 1.770666290075273708e-01 2.993115284087380368e-01
+9.653316478613682694e-02 1.807757562460599599e-01 3.015407883893915231e-01
+9.729328810023782359e-02 1.844734436312414905e-01 3.037745103921251633e-01
+9.804493118338306057e-02 1.881580898967480098e-01 3.060157402408537064e-01
+9.877832247043097369e-02 1.918329889556127654e-01 3.082609202522414993e-01
+9.949803783218733044e-02 1.954975058870322413e-01 3.105116763778897337e-01
+1.002054858430543316e-01 1.991518634625495388e-01 3.127684262427183892e-01
+1.008900241588315538e-01 2.027992883367119026e-01 3.150275553737127421e-01
+1.015620277820400430e-01 2.064376400065636719e-01 3.172925125709148420e-01
+1.022150454689789434e-01 2.100689913462399083e-01 3.195611195376787395e-01
+1.028468845169810686e-01 2.136942776676366007e-01 3.218326666201724029e-01
+1.034637486817424901e-01 2.173124203806320875e-01 3.241090419310820314e-01
+1.040556247342821483e-01 2.209261472703716311e-01 3.263871052200472134e-01
+1.046272664909374817e-01 2.245346804307608024e-01 3.286682704446855507e-01
+1.051814556007013568e-01 2.281377376539149293e-01 3.309532535866355762e-01
+1.057055066316897329e-01 2.317384538919968207e-01 3.332383062494437276e-01
+1.062093640276061124e-01 2.353348932541681759e-01 3.355262248019345583e-01
+1.066927192498384747e-01 2.389274243968986799e-01 3.378167764830257158e-01
+1.071428862568302165e-01 2.425189920877232619e-01 3.401063918909076889e-01
+1.075713140889580088e-01 2.461073946949010050e-01 3.423980926413837667e-01
+1.079763885418836000e-01 2.496932209057829977e-01 3.446912766824791197e-01
+1.083460004297124302e-01 2.532791299120676354e-01 3.469826761312421182e-01
+1.086913329090623825e-01 2.568630402753477870e-01 3.492750549670107785e-01
+1.090116287119651528e-01 2.604453159192556266e-01 3.515680214913912693e-01
+1.092932808921200649e-01 2.640287615628073015e-01 3.538580573547516761e-01
+1.095478763802813504e-01 2.676112773022403801e-01 3.561478615212890775e-01
+1.097748910210358808e-01 2.711931376089152246e-01 3.584370856671010852e-01
+1.099635342633853707e-01 2.747764822051754763e-01 3.607229892872333421e-01
+1.101198294511886444e-01 2.783603021914852760e-01 3.630068099573608986e-01
+1.102460152182262176e-01 2.819443225282238785e-01 3.652888319764409086e-01
+1.103361572207214036e-01 2.855297163446686715e-01 3.675674754730824945e-01
+1.103867349279119559e-01 2.891171759115234718e-01 3.698417464033080804e-01
+1.104047114339987423e-01 2.927055780381122019e-01 3.721129484539063559e-01
+1.103893448894039397e-01 2.962951553198432397e-01 3.743806401368951486e-01
+1.103290785873510815e-01 2.998879083652261635e-01 3.766420819050353419e-01
+1.102317288825286901e-01 3.034825829921489193e-01 3.788986922133656954e-01
+1.100986315611906241e-01 3.070790351009552999e-01 3.811504545068737926e-01
+1.099286556573810802e-01 3.106775192369479188e-01 3.833968205472055302e-01
+1.097092559883022234e-01 3.142800415550652815e-01 3.856349205402823110e-01
+1.094518269158459012e-01 3.178848431435130073e-01 3.878667847148202785e-01
+1.091556968975302966e-01 3.214920812428978536e-01 3.900919340676701208e-01
+1.088202096165073185e-01 3.251019032868823211e-01 3.923098843692563453e-01
+1.084337294201929702e-01 3.287160421828903556e-01 3.945179917556369542e-01
+1.080052802278752000e-01 3.323331728550899533e-01 3.967176863054378000e-01
+1.075355258379605550e-01 3.359532282299735328e-01 3.989087127976621017e-01
+1.070239159802940931e-01 3.395763147211236510e-01 4.010905648833596460e-01
+1.064666158592602885e-01 3.432029795356145718e-01 4.032620996037361571e-01
+1.058582376509708545e-01 3.468339423292918222e-01 4.054218838433404359e-01
+1.052065591856250482e-01 3.504681464569319171e-01 4.075709632165070984e-01
+1.045112201334900126e-01 3.541056562885774861e-01 4.097088092956981398e-01
+1.037719209811681642e-01 3.577465259466254266e-01 4.118348877541359032e-01
+1.029884320307208612e-01 3.613907991323849767e-01 4.139486582680417803e-01
+1.021513134274243950e-01 3.650396452261166491e-01 4.160478671051655586e-01
+1.012689167529539358e-01 3.686920150348446112e-01 4.181335233490640069e-01
+1.003423119365809690e-01 3.723477936835040136e-01 4.202052548968338574e-01
+9.937169919107982641e-02 3.760069784468507703e-01 4.222625006231348066e-01
+9.835741884413440328e-02 3.796695548525758634e-01 4.243046936775203282e-01
+9.729997123759509536e-02 3.833354963232004087e-01 4.263312615677605777e-01
+9.620003933222870396e-02 3.870047637840662302e-01 4.283416262899890081e-01
+9.505172587236093706e-02 3.906780327832828914e-01 4.303339883746660766e-01
+9.386233813144639893e-02 3.943545459798681874e-01 4.323088724355508838e-01
+9.263427266200571775e-02 3.980341179549674036e-01 4.342658626828024837e-01
+9.136927887187012987e-02 4.017166535612498035e-01 4.362043674792987491e-01
+9.006945702453716951e-02 4.054020428715323643e-01 4.381237915805220595e-01
+8.873730500447504776e-02 4.090901606132017476e-01 4.400235366709063789e-01
+8.737577058920215078e-02 4.127808655736769361e-01 4.419030019956885491e-01
+8.598830961259482097e-02 4.164739999785817548e-01 4.437615850971945997e-01
+8.457895032121595658e-02 4.201693888446985103e-01 4.455986826648858368e-01
+8.315236408743081897e-02 4.238668393102046350e-01 4.474136915088433031e-01
+8.171394242970148047e-02 4.275661399451892164e-01 4.492060096666721791e-01
+8.026987997778653461e-02 4.312670600459782566e-01 4.509750376540915817e-01
+7.882726258105521300e-02 4.349693489173894201e-01 4.527201798696426915e-01
+7.739415915996109008e-02 4.386727351476746306e-01 4.544408461640829233e-01
+7.597971511267428979e-02 4.423769258816079852e-01 4.561364535850265800e-01
+7.459424408415230023e-02 4.460816060979165276e-01 4.578064283072901808e-01
+7.324931366840245484e-02 4.497864378980456768e-01 4.594502077591564038e-01
+7.195781915786156335e-02 4.534910598140922677e-01 4.610672429543411499e-01
+7.073403782879061907e-02 4.571950861446216208e-01 4.626570010388615928e-01
+6.959365457471067273e-02 4.608981063279830592e-01 4.642189680611767399e-01
+6.855374817251533304e-02 4.645996843636931994e-01 4.657526519729214276e-01
+6.763272639280798471e-02 4.682993582933911436e-01 4.672575858662252890e-01
+6.685019795786503738e-02 4.719966397538147285e-01 4.687333314519904204e-01
+6.622677049492370349e-02 4.756910136151853430e-01 4.701794827815656830e-01
+6.577673858968982601e-02 4.793824370720338179e-01 4.715941633832017588e-01
+6.552566064603559948e-02 4.830700650743400826e-01 4.729777438223161101e-01
+6.549820807888259711e-02 4.867530881918184504e-01 4.743305399824718216e-01
+6.571558023976076246e-02 4.904308747270616498e-01 4.756523204648347991e-01
+6.619782080433814220e-02 4.941027658684106760e-01 4.769429100625798834e-01
+6.696293828126623215e-02 4.977680989992983585e-01 4.782021118153178540e-01
+6.801610562745827315e-02 5.014269919387287500e-01 4.794267081520149909e-01
+6.938287907938911481e-02 5.050778255979795350e-01 4.806197953737798012e-01
+7.107372065756567547e-02 5.087198306495862576e-01 4.817814896929000779e-01
+7.309574065371191032e-02 5.123522156200341904e-01 4.829119931483520367e-01
+7.544312997722565917e-02 5.159750173542567708e-01 4.840076729265158639e-01
+7.812721320542403980e-02 5.195865216476734938e-01 4.850725749743695636e-01
+8.114572394888117102e-02 5.231858403590214923e-01 4.861073630469811557e-01
+8.448832972524200624e-02 5.267726392289812098e-01 4.871097239159773440e-01
+8.815110303261089464e-02 5.303457163263245455e-01 4.880817131293228583e-01
+9.212706115366336990e-02 5.339038791645212001e-01 4.890257976801760109e-01
+9.640117372078826907e-02 5.374467824904106683e-01 4.899392661237967350e-01
+1.009651127375016111e-01 5.409730397620680087e-01 4.908260102866368046e-01
+1.058058868411170528e-01 5.444817357603629615e-01 4.916873206428047927e-01
+1.109091719419828259e-01 5.479722539284174188e-01 4.925220286879308795e-01
+1.162631754482068569e-01 5.514432364311973034e-01 4.933355557142476422e-01
+1.218535592637135234e-01 5.548942058020517321e-01 4.941256571865651481e-01
+1.276672732366210816e-01 5.583239554235875923e-01 4.948978636889357907e-01
+1.336912106530599997e-01 5.617318570854707982e-01 4.956519172255148820e-01
+1.399119531735926458e-01 5.651170059000043544e-01 4.963918396953513335e-01
+1.463171276735238113e-01 5.684787369209851615e-01 4.971190242696297834e-01
+1.528937099908951325e-01 5.718163393279495077e-01 4.978371217540351057e-01
+1.596300036906863895e-01 5.751292412901443107e-01 4.985481743532478860e-01
+1.665133003434038084e-01 5.784169089899582339e-01 4.992561455145328453e-01
+1.735328783097749850e-01 5.816789154432452369e-01 4.999631315071642601e-01
+1.806761031013389140e-01 5.849149331180006905e-01 5.006736479698321585e-01
+1.879334378838529440e-01 5.881246912104457492e-01 5.013896313522919757e-01
+1.952924636272905801e-01 5.913080959200207598e-01 5.021159025525618880e-01
+2.027443124327554802e-01 5.944650539898058694e-01 5.028546409645925364e-01
+2.102776619158149840e-01 5.975956842983582984e-01 5.036102222376415138e-01
+2.178835011739876371e-01 6.007001216855215597e-01 5.043855354959408954e-01
+2.255521696872271886e-01 6.037786523436265984e-01 5.051841613954050070e-01
+2.332749143253212143e-01 6.068316286127126702e-01 5.060092633925864503e-01
+2.410430130087069522e-01 6.098595200479223211e-01 5.068641518721540562e-01
+2.488489441844971561e-01 6.128628192186393875e-01 5.077515718650474907e-01
+2.566840197606024554e-01 6.158422311486778655e-01 5.086750547256451149e-01
+2.645425291505308918e-01 6.187983086880044503e-01 5.096365792929340444e-01
+2.724162323640093031e-01 6.217319406932720893e-01 5.106395912364674050e-01
+2.803003746086680792e-01 6.246437759477415641e-01 5.116857725517640620e-01
+2.881881143962810587e-01 6.275347641630057982e-01 5.127779478270290126e-01
+2.960748324121407205e-01 6.304057046767445049e-01 5.139178767894679867e-01
+3.039555214161791530e-01 6.332575133378499643e-01 5.151075596956975478e-01
+3.118254758119217707e-01 6.360911463304157465e-01 5.163488722475468862e-01
+3.196814435511296515e-01 6.389074409416231060e-01 5.176430585409529384e-01
+3.275188103490194735e-01 6.417074699067215615e-01 5.189919719540163623e-01
+3.353355552299603914e-01 6.444920106677175520e-01 5.203963563323180663e-01
+3.431277348645550562e-01 6.472621506436356809e-01 5.218577640245062321e-01
+3.508936232465371674e-01 6.500187029053001719e-01 5.233768303957324619e-01
+3.586308928051362699e-01 6.527625972609284455e-01 5.249544352005411918e-01
+3.663368289249827603e-01 6.554948605761221625e-01 5.265915743478537525e-01
+3.740119682194762429e-01 6.582160193662682790e-01 5.282880419647097980e-01
+3.816510562742471135e-01 6.609275747235534570e-01 5.300456830101799577e-01
+3.892580517875900981e-01 6.636294950347043642e-01 5.318631054022345817e-01
+3.968261890078971788e-01 6.663236061846555813e-01 5.337425455110953454e-01
+4.043593499172888350e-01 6.690098785171258999e-01 5.356826761355167887e-01
+4.118554481683104340e-01 6.716893377862352965e-01 5.376841277217632165e-01
+4.193119538935562440e-01 6.743631277083362852e-01 5.397475699351562684e-01
+4.267325988888523436e-01 6.770311866202418649e-01 5.418718349209995511e-01
+4.341129901223799714e-01 6.796950319734580415e-01 5.440580596655568701e-01
+4.414547339722453279e-01 6.823550079810395408e-01 5.463056567639269501e-01
+4.487598229028739172e-01 6.850113432670585922e-01 5.486140038956078824e-01
+4.560240745098563253e-01 6.876655632831355502e-01 5.509839689679422170e-01
+4.632498634530364812e-01 6.903178139102768007e-01 5.534147775766539157e-01
+4.704389351347622594e-01 6.929683367461523247e-01 5.559058726658481220e-01
+4.775890398856753039e-01 6.956182556045346077e-01 5.584575291026864230e-01
+4.846997162615552246e-01 6.982683108816961637e-01 5.610695620964348818e-01
+4.917741270603506742e-01 7.009183842407572529e-01 5.637411222277634026e-01
+4.988124547076915882e-01 7.035690215604037956e-01 5.664719533702552434e-01
+5.058115298480653221e-01 7.062215879970826782e-01 5.692622613027222833e-01
+5.127738759690677606e-01 7.088760718122417703e-01 5.721113127309581659e-01
+5.197010257328686933e-01 7.115326679134365007e-01 5.750185876848199484e-01
+5.265932673521412921e-01 7.141918646847531527e-01 5.779837442967735717e-01
+5.334494816269396145e-01 7.168545129510710545e-01 5.810065526719623286e-01
+5.402690647877386176e-01 7.195213413684249382e-01 5.840866494502513495e-01
+5.470548736207613283e-01 7.221921468817737999e-01 5.872233804977959881e-01
+5.538072551957783363e-01 7.248673679611095100e-01 5.904163410524770894e-01
+5.605265661533928023e-01 7.275474322700724583e-01 5.936651120515976654e-01
+5.672131712764029166e-01 7.302327570205698892e-01 5.969692609600730782e-01
+5.738649923321349489e-01 7.329244536181049874e-01 6.003283620189617809e-01
+5.804845702488933279e-01 7.356223182652517067e-01 6.037418650719156288e-01
+5.870727421002424062e-01 7.383266077479672118e-01 6.072092971993915400e-01
+5.936298933201957784e-01 7.410376988478269977e-01 6.107301851240671819e-01
+6.001564124519274124e-01 7.437559595200373685e-01 6.143040456187923715e-01
+6.066526905401021796e-01 7.464817491552263595e-01 6.179303860708607044e-01
+6.131191206125891080e-01 7.492154188267443615e-01 6.216087050224498034e-01
+6.195560972423146406e-01 7.519573115237726535e-01 6.253384926911926822e-01
+6.259635861936422296e-01 7.547078996712067722e-01 6.291191822939783407e-01
+6.323414409254812796e-01 7.574676913865331374e-01 6.329501570682624090e-01
+6.386911927456534466e-01 7.602366470910791874e-01 6.368310037415121361e-01
+6.450132383997043695e-01 7.630150778921287458e-01 6.407611911364364810e-01
+6.513079749051275957e-01 7.658032878094622742e-01 6.447401822997557153e-01
+6.575757994324034073e-01 7.686015739346664377e-01 6.487674349657708284e-01
+6.638171092147175933e-01 7.714102265818907345e-01 6.528424020163275943e-01
+6.700323014813579503e-01 7.742295294309987641e-01 6.569645319377305226e-01
+6.762217734101813038e-01 7.770597596640953508e-01 6.611332692747456941e-01
+6.823859220949484161e-01 7.799011880964143995e-01 6.653480550814426797e-01
+6.885251445237092760e-01 7.827540793025653532e-01 6.696083273682165160e-01
+6.946398375648411561e-01 7.856186917391158042e-01 6.739135215439332471e-01
+7.007303979576740005e-01 7.884952778644843674e-01 6.782630708517513041e-01
+7.067972223051004477e-01 7.913840842570615264e-01 6.826564067967675342e-01
+7.128407070658809852e-01 7.942853517324697243e-01 6.870929595632513376e-01
+7.188612485448663270e-01 7.971993154607720511e-01 6.915721584188375681e-01
+7.248592428796667431e-01 8.001262050844080154e-01 6.960934321026465144e-01
+7.308350860228653989e-01 8.030662448375227580e-01 7.006562091939169123e-01
+7.367891737192681090e-01 8.060196536672460388e-01 7.052599184573171698e-01
+7.427219014782563411e-01 8.089866453573647531e-01 7.099039891607071828e-01
+7.486327256130643759e-01 8.119678017125729896e-01 7.145873998348200029e-01
+7.545223076817887398e-01 8.149632306197714948e-01 7.193096566367255251e-01
+7.603915796412942241e-01 8.179729213555224643e-01 7.240704295566047222e-01
+7.662409381414175824e-01 8.209970689783633313e-01 7.288691437189614986e-01
+7.720707796269933310e-01 8.240358639329949941e-01 7.337052258319404219e-01
+7.778815003305534770e-01 8.270894921786368092e-01 7.385781042557458820e-01
+7.836734962813408645e-01 8.301581353160575327e-01 7.434872090029538416e-01
+7.894471633387081244e-01 8.332419707110174656e-01 7.484319716624078245e-01
+7.952028972601549173e-01 8.363411716110775718e-01 7.534118252377455249e-01
+8.009401766621723207e-01 8.394563042330350777e-01 7.584255820860429376e-01
+8.066584706735069332e-01 8.425879497641356464e-01 7.634719632765348818e-01
+8.123599093553812711e-01 8.457355276105180675e-01 7.685515296147656938e-01
+8.180448941186928558e-01 8.488991950022984900e-01 7.736637090147417961e-01
+8.237138279483190439e-01 8.520791051833870311e-01 7.788079287668441264e-01
+8.293671160911614271e-01 8.552754073408689317e-01 7.839836146965878383e-01
+8.350048677827189847e-01 8.584883831868801440e-01 7.891899443847590900e-01
+8.406246724049463159e-01 8.617194786977677712e-01 7.944239257301034529e-01
+8.462299834685677036e-01 8.649674562084326279e-01 7.996873827745283325e-01
+8.518212329614019973e-01 8.682324447773152043e-01 8.049797193798620132e-01
+8.573988637074910768e-01 8.715145671024431273e-01 8.103003320898716222e-01
+8.629633327895804840e-01 8.748139384163003962e-01 8.156486084917724533e-01
+8.685112937853189941e-01 8.781325055194139084e-01 8.210202040569095638e-01
+8.740469282893844616e-01 8.814686228402575097e-01 8.264178662740626624e-01
+8.795708463666609411e-01 8.848223352046364898e-01 8.318410153090299852e-01
+8.850836254841629724e-01 8.881937049832523412e-01 8.372889893254339411e-01
+8.905836610629007666e-01 8.915838848352710677e-01 8.427587078675609078e-01
+8.960718329388820402e-01 8.949928217018373600e-01 8.482495190363266158e-01
+9.015509263802756745e-01 8.984195016922670307e-01 8.537628451897162352e-01
+9.070218374764418279e-01 9.018638497314315217e-01 8.592980228813623667e-01
+9.124832972967743538e-01 9.053269113370198129e-01 8.648517190341429295e-01
+9.179365336943248188e-01 9.088084827838653901e-01 8.704232606428425889e-01
+9.233851804191220980e-01 9.123071100087158936e-01 8.760148319228351355e-01
+9.288308811012930821e-01 9.158223472192428272e-01 8.816263177427966502e-01
+9.342716413123769437e-01 9.193556495997508016e-01 8.872531405900644375e-01
+9.397124373542273812e-01 9.229047657151164819e-01 8.928998260600508052e-01
+9.451563753217823161e-01 9.264682865796181055e-01 8.985697730985615639e-01
+9.506035559047821826e-01 9.300461763422669392e-01 9.042646579991682199e-01
+9.560531046363628382e-01 9.336385357088663461e-01 9.099886803187530182e-01
+9.615066616129493982e-01 9.372434217616608665e-01 9.157560566822336989e-01
+9.669573847273637002e-01 9.408624710997687268e-01 9.215795307640300971e-01
+9.723870692594612786e-01 9.445024597948724621e-01 9.274670258562995873e-01
+9.777785730890226068e-01 9.481687534308861354e-01 9.334364948680430318e-01
+9.831050718338244510e-01 9.518727670560837018e-01 9.394860306213083101e-01
+9.883417388454437402e-01 9.556282921109976458e-01 9.455836323325411685e-01
+9.934918422996558141e-01 9.594375624216472387e-01 9.516983192548315040e-01
+9.985763296811461798e-01 9.632965417140263442e-01 9.577895036430327247e-01
+9.942114721489739848e-01 9.649414783718816002e-01 9.591713509300946461e-01
+9.916915526798163460e-01 9.600677293546330260e-01 9.527406681900515428e-01
+9.892073759214962125e-01 9.552017644060696311e-01 9.462702365737246657e-01
+9.867719407557972167e-01 9.503380654950176476e-01 9.397586228881678050e-01
+9.843739071729306067e-01 9.454788135288768602e-01 9.332265558186634280e-01
+9.820182926871906526e-01 9.406217084851765664e-01 9.266730991029579201e-01
+9.797019478013845317e-01 9.357670195072623764e-01 9.201050706729160256e-01
+9.774207980730996725e-01 9.309154126689619391e-01 9.135293740478817037e-01
+9.751815609868391688e-01 9.260643851639969171e-01 9.069399044850446900e-01
+9.729704910473376822e-01 9.212176417076594070e-01 9.003536220502811327e-01
+9.708034919455280631e-01 9.163699401531895106e-01 8.937532865598888376e-01
+9.686635749176782939e-01 9.115260705110270756e-01 8.871590238431372732e-01
+9.665594650012595546e-01 9.066829842770773862e-01 8.805615104307024099e-01
+9.644872784946666444e-01 9.018415117599095643e-01 8.739656672915365743e-01
+9.624420742140847862e-01 8.970028582796596428e-01 8.673774626543144795e-01
+9.604345584612016262e-01 8.921632903093835720e-01 8.607852860310053478e-01
+9.584498054598472594e-01 8.873272041947983801e-01 8.542061390733795001e-01
+9.564989754176022041e-01 8.824906944948268661e-01 8.476279025304513937e-01
+9.545749598026603833e-01 8.776557062005478915e-01 8.410587414202306267e-01
+9.526745457712032517e-01 8.728229738617154787e-01 8.345024009748316374e-01
+9.508087846256844111e-01 8.679885222040847337e-01 8.279470532549256800e-01
+9.489631025192423186e-01 8.631568397645421609e-01 8.214088147188137734e-01
+9.471457599180185261e-01 8.583248540920686009e-01 8.148789280451533834e-01
+9.453550305765402451e-01 8.534927996091392632e-01 8.083595091982623826e-01
+9.435830323389927665e-01 8.486630445127123501e-01 8.018591800395635794e-01
+9.418425662160879730e-01 8.438308651791852633e-01 7.953645386207840451e-01
+9.401224124677813876e-01 8.389997911592477209e-01 7.888877269212305476e-01
+9.384205871436177571e-01 8.341702205035793627e-01 7.824309818729748844e-01
+9.367501034134483318e-01 8.293372224294222050e-01 7.759809608693934990e-01
+9.350962812812430025e-01 8.245056601392387607e-01 7.695531958095181979e-01
+9.334610667718560295e-01 8.196745424298020888e-01 7.631458380069808811e-01
+9.318539060108851357e-01 8.148400979617762552e-01 7.567494905851217535e-01
+9.302622555140654947e-01 8.100065567310004155e-01 7.503772218901773039e-01
+9.286876056094349741e-01 8.051730724177085241e-01 7.440277117015546837e-01
+9.271395831502474705e-01 8.003357056772891776e-01 7.376916134646933632e-01
+9.256059253327618697e-01 7.954987025858116789e-01 7.313814866564718464e-01
+9.240863437601837260e-01 7.906618776065421628e-01 7.250978248201844778e-01
+9.225925658427436282e-01 7.858203843156221780e-01 7.188294627149656169e-01
+9.211126169365579930e-01 7.809784744974170856e-01 7.125884635347393692e-01
+9.196455684792974594e-01 7.761362045971830215e-01 7.063759865046427278e-01
+9.181979022265810420e-01 7.712906810954774928e-01 7.001861662941214481e-01
+9.167672001571998130e-01 7.664424894801199484e-01 6.940217357022171463e-01
+9.153481567945904729e-01 7.615934195093969628e-01 6.878880649909780987e-01
+9.139404639768551331e-01 7.567432836340363123e-01 6.817857667786046960e-01
+9.125539294301500126e-01 7.518876928783747582e-01 6.757062380855892725e-01
+9.111780957235272593e-01 7.470305845086899765e-01 6.696595752391263368e-01
+9.098122501649290594e-01 7.421719339914916169e-01 6.636468136699643638e-01
+9.084563128768237128e-01 7.373114504136536462e-01 6.576684342801734084e-01
+9.071185731273107011e-01 7.324452193667679856e-01 6.517176237314421527e-01
+9.057893354554222842e-01 7.275770233727173464e-01 6.458034937673092779e-01
+9.044682125236334080e-01 7.227067015228565428e-01 6.399268508324190696e-01
+9.031548045364521382e-01 7.178340969900336432e-01 6.340885324865254136e-01
+9.018536281154535539e-01 7.129568373829493488e-01 6.282852974032566706e-01
+9.005618093543485969e-01 7.080758191596225881e-01 6.225202235043866272e-01
+8.992759701121831872e-01 7.031922144373208283e-01 6.167967177972875081e-01
+8.979956379512032960e-01 6.983059000713781606e-01 6.111157531581823399e-01
+8.967203212860314077e-01 6.934167616666734313e-01 6.054783383481375791e-01
+8.954526708976771054e-01 6.885231926405954717e-01 5.998830635410449252e-01
+8.941915566016080952e-01 6.836253365962329243e-01 5.943315847613384051e-01
+8.929334172678807802e-01 6.787245284319090022e-01 5.888273795844850556e-01
+8.916776705242244194e-01 6.738207055230612808e-01 5.833715948784413685e-01
+8.904237095992360018e-01 6.689138192653601989e-01 5.779654133729836829e-01
+8.891709022410747565e-01 6.640038362746348843e-01 5.726100532447696567e-01
+8.879187220887899690e-01 6.590906724758603952e-01 5.673066752652388134e-01
+8.866700510547862457e-01 6.541724962989774461e-01 5.620541403257021118e-01
+8.854200814778028228e-01 6.492513861023391231e-01 5.568566631651752363e-01
+8.841680786914359880e-01 6.443273831269403784e-01 5.517155748042765762e-01
+8.829132805112128723e-01 6.394005490891804255e-01 5.466322335097351104e-01
+8.816548969914349554e-01 6.344709672901969189e-01 5.416080224154796730e-01
+8.803921103664992254e-01 6.295387436822825755e-01 5.366443467601184070e-01
+8.791240751896489680e-01 6.246040078804957485e-01 5.317426307330340718e-01
+8.778499186810901911e-01 6.196669141071349252e-01 5.269043139249947050e-01
+8.765687412960717628e-01 6.147276420564155019e-01 5.221308473833028430e-01
+8.752796175219744734e-01 6.097863976665317542e-01 5.174236892760738504e-01
+8.739815969115529715e-01 6.048434137862945814e-01 5.127843001752147023e-01
+8.726737941588253999e-01 5.998988989392898263e-01 5.082140946168248741e-01
+8.713557496267209102e-01 5.949528226638209905e-01 5.037142772058214035e-01
+8.700256052408116281e-01 5.900059904309469250e-01 4.992866995883939452e-01
+8.686823445912698061e-01 5.850587401058766623e-01 4.949327569364067592e-01
+8.673249354213553586e-01 5.801114372307474287e-01 4.906538189940125583e-01
+8.659523319452930856e-01 5.751644748762787529e-01 4.864512237593011101e-01
+8.645634773771747605e-01 5.702182733234352208e-01 4.823262709991545383e-01
+8.631573066573615671e-01 5.652732795695735168e-01 4.782802156484906031e-01
+8.617327493598900823e-01 5.603299666552966629e-01 4.743142611496265482e-01
+8.602887327613949475e-01 5.553888328102728478e-01 4.704295527914130193e-01
+8.588244189007790963e-01 5.504502458314576296e-01 4.666271134383851993e-01
+8.573388771464994784e-01 5.455146532392860514e-01 4.629079425847138496e-01
+8.558307110590109845e-01 5.405828402802138610e-01 4.592730689337449212e-01
+8.542988567054966564e-01 5.356554029582069054e-01 4.557233480219839428e-01
+8.527422657992969057e-01 5.307329553519699594e-01 4.522595444303549317e-01
+8.511599092771463537e-01 5.258161276783985816e-01 4.488823265086418490e-01
+8.495507808257551918e-01 5.209055642285482790e-01 4.455922615760174454e-01
+8.479139003246871642e-01 5.160019211927755478e-01 4.423898116530999292e-01
+8.462483171732270160e-01 5.111058643932878676e-01 4.392753297751230135e-01
+8.445531134701587117e-01 5.062180669436533442e-01 4.362490569289804720e-01
+8.428274070171406507e-01 5.013392068558483183e-01 4.333111196492664408e-01
+8.410703541185753362e-01 4.964699646160714575e-01 4.304615283001137493e-01
+8.392811521535089581e-01 4.916110207509353791e-01 4.277001760608312164e-01
+8.374593644075595256e-01 4.867627987429819503e-01 4.250269048992098009e-01
+8.356043139975503076e-01 4.819259312622626301e-01 4.224414243859783702e-01
+8.337148868611683472e-01 4.771014353948369036e-01 4.199431953989596344e-01
+8.317904658009995789e-01 4.722899701137897588e-01 4.175316375108732991e-01
+8.298304844983901418e-01 4.674921821164159108e-01 4.152060584430907197e-01
+8.278344282915189867e-01 4.627087037890093568e-01 4.129656573155296440e-01
+8.258018346451376779e-01 4.579401513029328075e-01 4.108095284678619508e-01
+8.237322933175019735e-01 4.531871228543432051e-01 4.087366658020525345e-01
+8.216256878784896633e-01 4.484499819155622347e-01 4.067461112065531847e-01
+8.194815690724320811e-01 4.437294051177347876e-01 4.048366204140803060e-01
+8.172995050178583076e-01 4.390260854893064946e-01 4.030068099238640067e-01
+8.150792968857805132e-01 4.343405321271661679e-01 4.012553165972070901e-01
+8.128207950280410543e-01 4.296732294003547947e-01 3.995807052170325946e-01
+8.105238975108269850e-01 4.250246362540385792e-01 3.979814747698801614e-01
+8.081885484630557670e-01 4.203951856851556590e-01 3.964560648094507256e-01
+8.058148470586988799e-01 4.157851737769109879e-01 3.950029765120905423e-01
+8.034026962411985329e-01 4.111951046689115152e-01 3.936204324142628108e-01
+8.009521378981909745e-01 4.066253627118514569e-01 3.923066947182650144e-01
+7.984632874676697023e-01 4.020762706733001512e-01 3.910600267933756480e-01
+7.959362958998934534e-01 3.975481251157440554e-01 3.898786646276527490e-01
+7.933713473226599033e-01 3.930411968130258504e-01 3.887608225579017307e-01
+7.907686574783574507e-01 3.885557303926693296e-01 3.877046999689159890e-01
+7.881284544156301752e-01 3.840919640902587529e-01 3.867084595587381712e-01
+7.854510012103226302e-01 3.796501032751679605e-01 3.857702673246294345e-01
+7.827365958532629397e-01 3.752303177293505598e-01 3.848883050999601374e-01
+7.799855573279415033e-01 3.708327552306592834e-01 3.840607581802352732e-01
+7.771982233463431422e-01 3.664575425267851405e-01 3.832858192234025463e-01
+7.743749481448563010e-01 3.621047863617611329e-01 3.825616918198675998e-01
+7.715160518337467188e-01 3.577746368683014655e-01 3.818864831434901075e-01
+7.686219524815265380e-01 3.534671195520193154e-01 3.812584982442814296e-01
+7.656930517948008497e-01 3.491822750013692245e-01 3.806760122706670524e-01
+7.627297518608332494e-01 3.449201381780978570e-01 3.801373059981723590e-01
+7.597324610418284552e-01 3.406807299395016586e-01 3.796406843015277532e-01
+7.567015922742318379e-01 3.364640582281425152e-01 3.791844777860022275e-01
+7.536375467881040180e-01 3.322701411099439062e-01 3.787669970190922220e-01
+7.505407196227874556e-01 3.280990002753491619e-01 3.783865433211569540e-01
+7.474115712082280982e-01 3.239505493622616417e-01 3.780416634360889150e-01
+7.442505183508412170e-01 3.198247550352249502e-01 3.777308063416947026e-01
+7.410579750279425726e-01 3.157215772518807695e-01 3.774524509829353947e-01
+7.378343512384677449e-01 3.116409704467773545e-01 3.772051064266770948e-01
+7.345800519344474200e-01 3.075828847103421748e-01 3.769873118279194468e-01
+7.312954622460766663e-01 3.035472925968438762e-01 3.767975677519167510e-01
+7.279809779377566237e-01 2.995341347142527755e-01 3.766344783074295766e-01
+7.246370003939071047e-01 2.955433232127043786e-01 3.764967560209065978e-01
+7.212639047983969709e-01 2.915748020657008555e-01 3.763830604225979481e-01
+7.178620569041518351e-01 2.876285169108695472e-01 3.762920784118068407e-01
+7.144318123927204667e-01 2.837044162122266955e-01 3.762225233422813453e-01
+7.109735162895217675e-01 2.798024524280844916e-01 3.761731340017399616e-01
+7.074875003639726767e-01 2.759225885803616163e-01 3.761426556123988463e-01
+7.039740902088845731e-01 2.720647802144139371e-01 3.761299015349165442e-01
+7.004335983291459788e-01 2.682289908573779469e-01 3.761337091569335600e-01
+6.968663212773178461e-01 2.644152012227610760e-01 3.761529095527339495e-01
+6.932725426766019883e-01 2.606234021780075572e-01 3.761863526116585033e-01
+6.896525329109274294e-01 2.568535960113472738e-01 3.762329055321002591e-01
+6.860065488492232966e-01 2.531057977294109973e-01 3.762914512548127810e-01
+6.823348363761195801e-01 2.493800214422073891e-01 3.763609500820121467e-01
+6.786376242649662105e-01 2.456763038128263466e-01 3.764403535110733556e-01
+6.749151231751110425e-01 2.419947210999891518e-01 3.765285264384131692e-01
+6.711675324616499516e-01 2.383353539955441192e-01 3.766243994612780699e-01
+6.673950369964636309e-01 2.346983031289386346e-01 3.767269100578239382e-01
+6.635978070649097837e-01 2.310836906390836831e-01 3.768350007100279009e-01
+6.597759982863891093e-01 2.274916618065601082e-01 3.769476169820946132e-01
+6.559297473209481089e-01 2.239223513030393353e-01 3.770639116649144307e-01
+6.520591754729223588e-01 2.203759654266244650e-01 3.771828077558652681e-01
+6.481643941443696599e-01 2.168527541906234979e-01 3.773031206968150975e-01
+6.442454984979625321e-01 2.133529749202845993e-01 3.774237883397635329e-01
+6.403025689859566105e-01 2.098769174022531714e-01 3.775437410683403772e-01
+6.363356714241054091e-01 2.064249059420060206e-01 3.776618996147099727e-01
+6.323448551853009247e-01 2.029972985879547887e-01 3.777771986896097389e-01
+6.283301122985771592e-01 1.995944416686266654e-01 3.778890664877021521e-01
+6.242914965761068302e-01 1.962168403108488501e-01 3.779958773221168133e-01
+6.202290151835444521e-01 1.928649814733044143e-01 3.780964890449534654e-01
+6.161426615427991749e-01 1.895393981082279800e-01 3.781897379927290359e-01
+6.120324156302930918e-01 1.862406715933664081e-01 3.782744366000001524e-01
+6.078982443238682976e-01 1.829694341941491276e-01 3.783493709986866516e-01
+6.037399990506459035e-01 1.797263486622488471e-01 3.784140428470601503e-01
+5.995576965897967403e-01 1.765121975913181707e-01 3.784665259488561584e-01
+5.953512720943007208e-01 1.733277858871770660e-01 3.785054621982753553e-01
+5.911206437729070728e-01 1.701739770998706713e-01 3.785295035265708874e-01
+5.868657195674668037e-01 1.670516976788867514e-01 3.785372630540221883e-01
+5.825863435035250060e-01 1.639619511220119508e-01 3.785276019365447775e-01
+5.782823203682633251e-01 1.609058321765788335e-01 3.784994295515334839e-01
+5.739536466014196758e-01 1.578844538430557720e-01 3.784505787767488694e-01
+5.696001981012460691e-01 1.548990153349074916e-01 3.783794775494400686e-01
+5.652218458222221242e-01 1.519507861175737884e-01 3.782845039525286057e-01
+5.608184279263467298e-01 1.490411220014642157e-01 3.781641038386275300e-01
+5.563896048179566289e-01 1.461715605343842650e-01 3.780173288805740439e-01
+5.519354537512982661e-01 1.433434802585686063e-01 3.778414852793369194e-01
+5.474558435278772395e-01 1.405584279152288785e-01 3.776347269993366451e-01
+5.429506470730138812e-01 1.378180135121435668e-01 3.773951523619960002e-01
+5.384196501144510316e-01 1.351239813932839096e-01 3.771211030874267456e-01
+5.338626135422905872e-01 1.324781762459926737e-01 3.768109124380045194e-01
+5.292796498492590151e-01 1.298822067930652524e-01 3.764618033826110377e-01
+5.246706783487381509e-01 1.273378756852094063e-01 3.760716446399895441e-01
+5.200356363922209457e-01 1.248470120733735367e-01 3.756382551974452033e-01
+5.153742367301422656e-01 1.224117140591406694e-01 3.751600258018771838e-01
+5.106866581816573714e-01 1.200336468026920456e-01 3.746341300161435961e-01
+5.059729862980435477e-01 1.177145617740232852e-01 3.740580772636119544e-01
+5.012332745984564575e-01 1.154562389937715539e-01 3.734295174784395543e-01
+4.964674957217509177e-01 1.132605442683873864e-01 3.727463195168757570e-01
+4.916758190194626121e-01 1.111290906599490258e-01 3.720059818290880060e-01
+4.868585609140311798e-01 1.090632523851999269e-01 3.712058226357082269e-01
+4.820159589014604840e-01 1.070644243738244350e-01 3.703434438399521023e-01
+4.771482837998479165e-01 1.051338742417683159e-01 3.694164970204523168e-01
+4.722559296975721854e-01 1.032725993184717139e-01 3.684225499867860298e-01
+4.673393879073711177e-01 1.014813305146687883e-01 3.673591735272957459e-01
+4.623991454541829804e-01 9.976065343840129218e-02 3.662241176536292220e-01
+4.574358041489324234e-01 9.811082191626963045e-02 3.650151416090168244e-01
+4.524502157463570762e-01 9.653152558968838837e-02 3.637298817526759542e-01
+4.474429556959144683e-01 9.502266265951053725e-02 3.623665563347658880e-01
+4.424148033564082039e-01 9.358361785401031474e-02 3.609233190012756665e-01
+4.373666093617918915e-01 9.221344371517425920e-02 3.593984619211612608e-01
+4.323000061476657274e-01 9.090969474799345806e-02 3.577897503619592023e-01
+4.272154852828886629e-01 8.967151542383772211e-02 3.560963875772367726e-01
+4.221140984792258188e-01 8.849693359303587026e-02 3.543172112905775273e-01
+4.169969758462759302e-01 8.738362154375492463e-02 3.524512375858371849e-01
+4.118658301965831270e-01 8.632803919827600203e-02 3.504973239811765007e-01
+4.067221669675408213e-01 8.532676500724681312e-02 3.484548346345710534e-01
+4.015666852977432533e-01 8.437757766440442952e-02 3.463238990387739746e-01
+3.964007130297593218e-01 8.347701754004596686e-02 3.441044235724556866e-01
+3.912256097683191602e-01 8.262141527259461715e-02 3.417965388380971303e-01
+3.860430941874281596e-01 8.180633277581816909e-02 3.394004639140563162e-01
+3.808555339288969832e-01 8.102605665725876039e-02 3.369164884312597086e-01
+3.756631594887540060e-01 8.027857713191724476e-02 3.343459517649038371e-01
+3.704673590324250032e-01 7.955977986332424257e-02 3.316898655204278401e-01
+3.652695090362573227e-01 7.886552703397090025e-02 3.289494343067977944e-01
+3.600709660701238435e-01 7.819169210462800779e-02 3.261260438198446687e-01
+3.548730588141333908e-01 7.753419260275734581e-02 3.232212473818363851e-01
+3.496770804198256477e-01 7.688902041627435069e-02 3.202367511798585031e-01
+3.444853557545813350e-01 7.625034119537774102e-02 3.171743822649770728e-01
+3.392982604990861795e-01 7.561586038621423422e-02 3.140362188799208365e-01
+3.341166082970875029e-01 7.498254313274954619e-02 3.108243324765390669e-01
+3.289414559917514524e-01 7.434697155739058982e-02 3.075408588184366798e-01
+3.237737954171283072e-01 7.370590341662106026e-02 3.041879989569576392e-01
+3.186145498482620964e-01 7.305628171756148315e-02 3.007680026557595920e-01
+3.134645711821229530e-01 7.239524117563511663e-02 2.972831523530131137e-01
+3.083246378402036969e-01 7.172011173017686647e-02 2.937357478389135412e-01
+3.031954533707552635e-01 7.102841937235576664e-02 2.901280917978547591e-01
+2.980776457172774063e-01 7.031788456468926474e-02 2.864624763353166292e-01
+2.929717671102379239e-01 6.958641854495320467e-02 2.827411705802333475e-01
+2.878782945311796904e-01 6.883211781082057557e-02 2.789664094251954607e-01
+2.827976306923836725e-01 6.805325707674123037e-02 2.751403834400568682e-01
+2.777301054710668571e-01 6.724828098296936618e-02 2.712652299698696257e-01
+2.726759777346169922e-01 6.641579481976991883e-02 2.673430254060571443e-01
+2.676354374924288515e-01 6.555455450916861104e-02 2.633757786005420098e-01
+2.626097591395918363e-01 6.466149844681601255e-02 2.593660533804174051e-01
+2.575992689989206608e-01 6.373522644476575794e-02 2.553159580518031269e-01
+2.526028775756383737e-01 6.277674824557366584e-02 2.512267303676423147e-01
+2.476205211412589313e-01 6.178532806314660647e-02 2.471000835041496368e-01
+2.426520784951842757e-01 6.076032925135082391e-02 2.429376426307544024e-01
+2.376973739685813714e-01 5.970120319443159712e-02 2.387409437758167274e-01
+2.327561803770203386e-01 5.860747847771281133e-02 2.345114333677875140e-01
+2.278285229664566147e-01 5.747825339035907838e-02 2.302506881609430733e-01
+2.229180662380075839e-01 5.630663136815370479e-02 2.259630047830259447e-01
+2.180204522985965676e-01 5.509893160286010588e-02 2.216467626153181270e-01
+2.131352588343927157e-01 5.385491895770589538e-02 2.173030574920574165e-01
+2.082620235717315138e-01 5.257438772048273617e-02 2.129328977906284059e-01
+2.034002463374002811e-01 5.125715285178860520e-02 2.085372063771265272e-01]; 
+
+   case 'amp' 
+      RGB = [9.463470914425774483e-01 9.290101343908121478e-01 9.257532417012246384e-01
+9.437115115548888600e-01 9.244624965319422349e-01 9.206701514370421169e-01
+9.413263164430620833e-01 9.198473615841167295e-01 9.154240958990897958e-01
+9.390547090113202655e-01 9.152093965940418796e-01 9.101090387889319011e-01
+9.368634575300728295e-01 9.105592179043572321e-01 9.047473920040983719e-01
+9.347358946162058757e-01 9.059020202913443676e-01 8.993502288257003707e-01
+9.326614522721177192e-01 9.012410121503533489e-01 8.939244930449518067e-01
+9.306333250978273686e-01 8.965781745298962990e-01 8.884745648022901454e-01
+9.286461606427048876e-01 8.919150224616214651e-01 8.830038737434344753e-01
+9.266960476646858291e-01 8.872526027444326280e-01 8.775148739503740858e-01
+9.247795820079757201e-01 8.825918040419664656e-01 8.720097084454925263e-01
+9.228944807039246578e-01 8.779331456742857087e-01 8.664897344910690302e-01
+9.210380342808240917e-01 8.732773006486703737e-01 8.609566713320465636e-01
+9.192087851735465387e-01 8.686245228987975464e-01 8.554113284148980867e-01
+9.174048150925064871e-01 8.639752297661511538e-01 8.498548926033711037e-01
+9.156244455582711606e-01 8.593297631172468476e-01 8.442883976261035262e-01
+9.138671371679708555e-01 8.546880756641417332e-01 8.387120160257571788e-01
+9.121305737300281491e-01 8.500507404321120397e-01 8.331273220967562176e-01
+9.104149075499773369e-01 8.454174764656698926e-01 8.275339791691540547e-01
+9.087182868982504047e-01 8.407887046755945226e-01 8.219332381316957203e-01
+9.070398066265998871e-01 8.361645202367321561e-01 8.163256242481420344e-01
+9.053796160871283583e-01 8.315446471258203243e-01 8.107108259382036497e-01
+9.037352419915254398e-01 8.269297416714002091e-01 8.050906531516163200e-01
+9.021080083908009639e-01 8.223191128622155954e-01 7.994638601040017223e-01
+9.004956244333240933e-01 8.177133605075642686e-01 7.938321412777887831e-01
+8.988977241110835958e-01 8.131124010808855607e-01 7.881956419539296599e-01
+8.973148627806266653e-01 8.085158161746068828e-01 7.825537446961500221e-01
+8.957442417382828204e-01 8.039244072828748422e-01 7.769086245337948338e-01
+8.941881096565635900e-01 7.993371392915321616e-01 7.712582600059587623e-01
+8.926437234223070227e-01 7.947548018176209261e-01 7.656048088583016220e-01
+8.911109613594879741e-01 7.901772295732085727e-01 7.599482475326526654e-01
+8.895909134152744091e-01 7.856038035950861920e-01 7.542875143411862382e-01
+8.880802871606852111e-01 7.810355387672826000e-01 7.486252986030703660e-01
+8.865819248532246233e-01 7.764711589075004028e-01 7.429590373479496579e-01
+8.850930260657449145e-01 7.719115034698935673e-01 7.372910251414285243e-01
+8.836131402967402071e-01 7.673565360639147404e-01 7.316215502737657417e-01
+8.821444223454562028e-01 7.628052217660783452e-01 7.259486135652994943e-01
+8.806827953756125593e-01 7.582589101067193083e-01 7.202756895379377466e-01
+8.792311851397603961e-01 7.537162649935950087e-01 7.146000961578288235e-01
+8.777875677079440830e-01 7.491778548550656058e-01 7.089235227883947665e-01
+8.763501988878248383e-01 7.446441541668697983e-01 7.032474436364752890e-01
+8.749232756241082098e-01 7.401133023432254765e-01 6.975679937396324082e-01
+8.735014600514631189e-01 7.355871888710872053e-01 6.918898915870100863e-01
+8.720870217729678187e-01 7.310647072768980959e-01 6.862110066741609060e-01
+8.706800348126626510e-01 7.265456103843925817e-01 6.805311805702053407e-01
+8.692770022519556994e-01 7.220310948598716028e-01 6.748535454654478460e-01
+8.678827146915726320e-01 7.175190094979648769e-01 6.691736166956238074e-01
+8.664927921052477666e-01 7.130109157552886323e-01 6.634953613259193528e-01
+8.651068719926267025e-01 7.085067580022798017e-01 6.578190657407729791e-01
+8.637289803901067042e-01 7.040046558915140640e-01 6.521408976142408775e-01
+8.623534679961476490e-01 6.995067341461493893e-01 6.464660893001026309e-01
+8.609830606578612322e-01 6.950116457163946215e-01 6.407920274183934728e-01
+8.596180478330472940e-01 6.905190440208218705e-01 6.351183727606340979e-01
+8.582544825018789680e-01 6.860303869186620274e-01 6.294488360238388314e-01
+8.568970944227636277e-01 6.815434400545420379e-01 6.237788543057761759e-01
+8.555425925651013452e-01 6.770593865574592307e-01 6.181115291897923969e-01
+8.541886800910097888e-01 6.725790118919016125e-01 6.124490539806487499e-01
+8.528418735895523239e-01 6.680992506239646911e-01 6.067850786519378703e-01
+8.514956700712879023e-01 6.636227191543088155e-01 6.011258775897345696e-01
+8.501500355486913962e-01 6.591492264653023847e-01 5.954714806881288292e-01
+8.488106382652110815e-01 6.546760150904927800e-01 5.898162979999663769e-01
+8.474706581846417341e-01 6.502059048227525340e-01 5.841670108646530579e-01
+8.461313452075343022e-01 6.457381204225883797e-01 5.785223911431566224e-01
+8.447969154607379849e-01 6.412705018379197819e-01 5.728782339090506825e-01
+8.434612056654142709e-01 6.368056357299208825e-01 5.672406638938772838e-01
+8.421258352164873173e-01 6.323425572542190620e-01 5.616080798917625350e-01
+8.407944708783339216e-01 6.278793105389963713e-01 5.559767932481035624e-01
+8.394611847956942041e-01 6.234184331258648681e-01 5.503527766345649441e-01
+8.381273683455257029e-01 6.189590462186138620e-01 5.447346560426542528e-01
+8.367972635859407537e-01 6.144988712509784623e-01 5.391181340824646728e-01
+8.354646463246349075e-01 6.100406459813725313e-01 5.335095625632335636e-01
+8.341299717058989760e-01 6.055839279215072812e-01 5.279085280772741751e-01
+8.327994021627661558e-01 6.011254425561419756e-01 5.223087380798424606e-01
+8.314657754399900069e-01 5.966684488411785336e-01 5.167175843922774403e-01
+8.301288592609736838e-01 5.922128365915518833e-01 5.111353769747372100e-01
+8.287951011685089631e-01 5.877551092176589442e-01 5.055554913593263144e-01
+8.274588476811213233e-01 5.832978393600145584e-01 4.999838390239015884e-01
+8.261188250087038165e-01 5.788414339387950580e-01 4.944218283197156505e-01
+8.247786369803286055e-01 5.743837798031475872e-01 4.888657757771856516e-01
+8.234381838800088893e-01 5.699246359812502050e-01 4.833158537977020885e-01
+8.220935149852323098e-01 5.654657957469002572e-01 4.777762994077761616e-01
+8.207444566974767541e-01 5.610071021581608530e-01 4.722474096096786478e-01
+8.193981033425531413e-01 5.565444762341525964e-01 4.667217962382390062e-01
+8.180472685091408902e-01 5.520814646564632389e-01 4.612071590527028753e-01
+8.166916431769154494e-01 5.476179715812223847e-01 4.557039631596026541e-01
+8.153328745786677656e-01 5.431528161626910656e-01 4.502105997079735578e-01
+8.139743540529152943e-01 5.386837997184832361e-01 4.447235925743368568e-01
+8.126106579688792131e-01 5.342136249170785778e-01 4.392488743242201066e-01
+8.112416585089723409e-01 5.297420805368263652e-01 4.337867573467541482e-01
+8.098689150112462487e-01 5.252679783528519941e-01 4.283357546423488538e-01
+8.084956135344389949e-01 5.207891399756702233e-01 4.228926326123328416e-01
+8.071166424763304148e-01 5.163081809730883931e-01 4.174630770396351442e-01
+8.057318945579315939e-01 5.118248549122679236e-01 4.120474263101407963e-01
+8.043412708255589516e-01 5.073389039757838503e-01 4.066460228640024210e-01
+8.029498733805645605e-01 5.028469116894594970e-01 4.012536130705923743e-01
+8.015531888402489535e-01 4.983512104818560995e-01 3.958753217358975118e-01
+8.001502657810105612e-01 4.938520308181937879e-01 3.905124577505094119e-01
+7.987410157112331266e-01 4.893490771437783438e-01 3.851654167818974739e-01
+7.973253554907255847e-01 4.848420416222078422e-01 3.798346066585175373e-01
+7.959075773999774173e-01 4.803278114438007118e-01 3.745157291750967898e-01
+7.944838857609586302e-01 4.758083650556605426e-01 3.692132449197628175e-01
+7.930533836294737515e-01 4.712838795689627269e-01 3.639285059842314873e-01
+7.916159847493996482e-01 4.667540085796573757e-01 3.586620124504662499e-01
+7.901716040813833164e-01 4.622183930878590030e-01 3.534142884263108408e-01
+7.887201567691978221e-01 4.576766614569128255e-01 3.481858850345221357e-01
+7.872638957915846225e-01 4.531268310219068174e-01 3.429748729037092048e-01
+7.858016971109998972e-01 4.485691650403910713e-01 3.377829921447058070e-01
+7.843319196766078694e-01 4.440043051111859929e-01 3.326125640359084423e-01
+7.828544529945841157e-01 4.394318439857143876e-01 3.274643000606006771e-01
+7.813691807701973469e-01 4.348513628187685720e-01 3.223389566893520852e-01
+7.798759793897394044e-01 4.302624315207902450e-01 3.172373399087716761e-01
+7.783747162977331380e-01 4.256646092089760858e-01 3.121603100704657408e-01
+7.768652482649208713e-01 4.210574447687118194e-01 3.071087870719240720e-01
+7.753474195428932125e-01 4.164404775377301138e-01 3.020837558793280642e-01
+7.738210599017090185e-01 4.118132381262810671e-01 2.970862723999735389e-01
+7.722859825475274498e-01 4.071752493875019363e-01 2.921174697090146433e-01
+7.707419819180442166e-01 4.025260275530667675e-01 2.871785646313976814e-01
+7.691888313545882649e-01 3.978650835500125438e-01 2.822708646751007633e-01
+7.676262806509283054e-01 3.931919245154482101e-01 2.773957753058901021e-01
+7.660540534803422785e-01 3.885060555265225091e-01 2.725548075466420750e-01
+7.644718447042359033e-01 3.838069815635994364e-01 2.677495858756240299e-01
+7.628793175676447103e-01 3.790942097250059595e-01 2.629818563878072446e-01
+7.612761007893139586e-01 3.743672517119065457e-01 2.582534951710902527e-01
+7.596617855567490141e-01 3.696256266018116965e-01 2.535665168349998111e-01
+7.580359224396768791e-01 3.648688639288839575e-01 2.489230831128432242e-01
+7.563980182387591844e-01 3.600965070884658559e-01 2.443255114391649219e-01
+7.547475327902162245e-01 3.553081170821107415e-01 2.397762833825934359e-01
+7.530838757510928128e-01 3.505032766177708092e-01 2.352780527895846907e-01
+7.514064033944252152e-01 3.456815945775675858e-01 2.308336534671754370e-01
+7.497144154482878742e-01 3.408427108627715696e-01 2.264461062026797977e-01
+7.480093931719870026e-01 3.359841374696425076e-01 2.221167453210010634e-01
+7.462904219476443890e-01 3.311055722690471881e-01 2.178492138304993775e-01
+7.445546708594931173e-01 3.262086086142511610e-01 2.136488350090644528e-01
+7.428011522578348291e-01 3.212930797652773784e-01 2.095194932063288440e-01
+7.410289292300998865e-01 3.163587556773898579e-01 2.054651883130465539e-01
+7.392422371017411953e-01 3.113999367010875097e-01 2.014864526930904010e-01
+7.374344355234756510e-01 3.064221768888288899e-01 1.975919663992890540e-01
+7.356041908206575330e-01 3.014256456718681365e-01 1.937864841719280640e-01
+7.337546411878117514e-01 2.964055318272263428e-01 1.900722381207737011e-01
+7.318814451569350954e-01 2.913651536558918287e-01 1.864564514321402355e-01
+7.299813549163196580e-01 2.863068267986909055e-01 1.829454454677189867e-01
+7.280589696708802405e-01 2.812237436541007995e-01 1.795417572234761505e-01
+7.261058295804370122e-01 2.761243371138519809e-01 1.762545002124356330e-01
+7.241247102013246284e-01 2.710038520778982329e-01 1.730875525793737491e-01
+7.221106804386585587e-01 2.658668602953934146e-01 1.700480125370592843e-01
+7.200637636280236009e-01 2.607119201605753722e-01 1.671411340183387162e-01
+7.179797241720924372e-01 2.555430923618877692e-01 1.643731951674216596e-01
+7.158585660201038925e-01 2.503590497486887223e-01 1.617494125495184398e-01
+7.136946458601574061e-01 2.451661844345556784e-01 1.592752687470095629e-01
+7.114894074734618989e-01 2.399613853901303440e-01 1.569555549892431845e-01
+7.092368038757341786e-01 2.347521795395665634e-01 1.547943364998323190e-01
+7.069352804131667778e-01 2.295401028324536297e-01 1.527950884695459255e-01
+7.045831993890990796e-01 2.243269505217069248e-01 1.509608633015488421e-01
+7.021764206472544956e-01 2.191186683316911910e-01 1.492928085088980894e-01
+6.997128684389145592e-01 2.139184608731344861e-01 1.477916611410667047e-01
+6.971911916356166028e-01 2.087286324898059431e-01 1.464577951274126655e-01
+6.946080256946649545e-01 2.035552197097931226e-01 1.452888805599515110e-01
+6.919615635162069678e-01 1.984021504802455094e-01 1.442823442764895880e-01
+6.892502621260994111e-01 1.932732898312458647e-01 1.434346916240710201e-01
+6.864728173440260983e-01 1.881724668500568132e-01 1.427415573021981465e-01
+6.836276497375878280e-01 1.831044861638990162e-01 1.421968539256191488e-01
+6.807138936899735926e-01 1.780732451543534933e-01 1.417942947939738185e-01
+6.777309286205458472e-01 1.730825547177755885e-01 1.415269568275668299e-01
+6.746783856387729150e-01 1.681360921159456845e-01 1.413874528291547972e-01
+6.715560313350845689e-01 1.632376302346780217e-01 1.413677792054587046e-01
+6.683639211377226941e-01 1.583906644890515358e-01 1.414598772073469568e-01
+6.651023056640176234e-01 1.535985670708633066e-01 1.416556412086291405e-01
+6.617715794982882427e-01 1.488646699200451562e-01 1.419469640184388703e-01
+6.583721731985413550e-01 1.441925388486675619e-01 1.423253876471278490e-01
+6.549047613747174257e-01 1.395853626420375526e-01 1.427832909133252004e-01
+6.513700233144809060e-01 1.350465677963595956e-01 1.433130440041158193e-01
+6.477686724727176326e-01 1.305797355595543496e-01 1.439072462489923432e-01
+6.441014028993071738e-01 1.261888040474711814e-01 1.445583185074540422e-01
+6.403689740006455189e-01 1.218777495533199251e-01 1.452593821489098769e-01
+6.365721433135939078e-01 1.176507620626412731e-01 1.460041387809807023e-01
+6.327116135602410818e-01 1.135124987936143026e-01 1.467862349801432043e-01
+6.287880597206695343e-01 1.094681045314993273e-01 1.475989566519263774e-01
+6.248021600743940418e-01 1.055229431116234684e-01 1.484364140781085362e-01
+6.207545450778898521e-01 1.016827736772349666e-01 1.492933020681679601e-01
+6.166458126074587653e-01 9.795388132578869422e-02 1.501640386258630555e-01
+6.124766416655831325e-01 9.434293988806133346e-02 1.510418818628477822e-01
+6.082475860694411818e-01 9.085689252672626837e-02 1.519224424106922766e-01
+6.039592307964848361e-01 8.750309254173271878e-02 1.528005492303129986e-01
+5.996123270243045589e-01 8.428892340087804080e-02 1.536699242631612283e-01
+5.952075850399283219e-01 8.122188415501030434e-02 1.545253736600938343e-01
+5.907456431322212209e-01 7.830966313722748096e-02 1.553624952709374007e-01
+5.862275380722600238e-01 7.555913263658070589e-02 1.561749022891834038e-01
+5.816543085194019191e-01 7.297679500504322680e-02 1.569571524895727321e-01
+5.770267606447557762e-01 7.056924923284621509e-02 1.577054842373717958e-01
+5.723466647463710810e-01 6.834024207619035507e-02 1.584124407437495219e-01
+5.676151929412465158e-01 6.629402087598951221e-02 1.590741634973840690e-01
+5.628336935771917071e-01 6.443348056543876656e-02 1.596865619581833706e-01
+5.580050003714496221e-01 6.275633232081309631e-02 1.602413164863800144e-01
+5.531297300263749994e-01 6.126496600367018625e-02 1.607383872225261745e-01
+5.482116402359448193e-01 5.995167246350390639e-02 1.611686284256901580e-01
+5.432516061451815315e-01 5.881547808076787592e-02 1.615323341086055964e-01
+5.382535120903690906e-01 5.784532671126727671e-02 1.618221724924289173e-01
+5.332186175206464762e-01 5.703660923770780683e-02 1.620384025483199708e-01
+5.281513818389996784e-01 5.637398150597446728e-02 1.621742451273615881e-01
+5.230520756324539278e-01 5.585383743496476899e-02 1.622329744665089168e-01
+5.179273401770114749e-01 5.545235617321788574e-02 1.622049347095048388e-01
+5.127760391281988017e-01 5.516900039838320419e-02 1.620968226308776017e-01
+5.076034324141470711e-01 5.498326606891081741e-02 1.619030677004743290e-01
+5.024122108869354397e-01 5.488240340299161552e-02 1.616236282627719067e-01
+4.972028565812885437e-01 5.486041454189729411e-02 1.612621553479370584e-01
+4.919800125101927990e-01 5.489873490341760226e-02 1.608156853259256336e-01
+4.867469976088732442e-01 5.498319810891529741e-02 1.602839538682285792e-01
+4.815035401048063934e-01 5.511074616505500651e-02 1.596718589083305773e-01
+4.762519241645499224e-01 5.527092475320084103e-02 1.589804323039821221e-01
+4.709943156232950234e-01 5.545404644646995812e-02 1.582109529908402590e-01
+4.657362887691403608e-01 5.564106402926658618e-02 1.573608184133624133e-01
+4.604760106385220042e-01 5.583489737898188893e-02 1.564363997859181399e-01
+4.552150906427448462e-01 5.602873466021515009e-02 1.554396278095509509e-01
+4.499550509587917912e-01 5.621638605393316362e-02 1.543724780354263082e-01
+4.446972616844994119e-01 5.639243657216582578e-02 1.532370205267698793e-01
+4.394429409822757093e-01 5.655220574247237647e-02 1.520353945457279254e-01
+4.341931570608791313e-01 5.669170022106548995e-02 1.507697850177304177e-01
+4.289488317782668703e-01 5.680756188500035025e-02 1.494424009624717165e-01
+4.237107456338875533e-01 5.689701352302534848e-02 1.480554560097830374e-01
+4.184795439135307604e-01 5.695780383827742793e-02 1.466111510548973595e-01
+4.132557437526688804e-01 5.698815310778364979e-02 1.451116590521219496e-01
+4.080397418937663501e-01 5.698670052046273665e-02 1.435591118993865545e-01
+4.028318229277383922e-01 5.695245393890951274e-02 1.419555893285963655e-01
+3.976321678282654926e-01 5.688474259913823411e-02 1.403031096878759043e-01
+3.924408626085833518e-01 5.678317307342812398e-02 1.386036224809996942e-01
+3.872615129675306966e-01 5.663896210711539397e-02 1.368568732654815434e-01
+3.820928251575063661e-01 5.645532265747305739e-02 1.350656214594591342e-01
+3.769329700865952648e-01 5.623657775378711893e-02 1.332326547817182794e-01
+3.717817181595340914e-01 5.598316066775241989e-02 1.313596470261583493e-01
+3.666387821359218258e-01 5.569561666867810928e-02 1.294481844724836295e-01
+3.615063297404105258e-01 5.536890534251808632e-02 1.274985831214487109e-01
+3.563880603817025094e-01 5.499475479736596478e-02 1.255105734342905621e-01
+3.512776042297060530e-01 5.458755525687735560e-02 1.234884411194991649e-01
+3.461744793988128510e-01 5.414817693699586904e-02 1.214334602338749125e-01
+3.410813090262644343e-01 5.367068674831452363e-02 1.193455923090092352e-01
+3.360026615292399654e-01 5.314516420281268499e-02 1.172242123426087412e-01
+3.309302966511110111e-01 5.258939733233552322e-02 1.150735180048746420e-01
+3.258636162106021694e-01 5.200433045735335796e-02 1.128944817728364247e-01
+3.208133832347068171e-01 5.136699574271335472e-02 1.106843415414836551e-01
+3.157696216592825178e-01 5.069836482305852682e-02 1.084473347788683095e-01
+3.107301266925714400e-01 5.000263599039595636e-02 1.061847548036680688e-01
+3.057061331880795430e-01 4.925629172594595678e-02 1.038940386221758327e-01
+3.006879268630521240e-01 4.847913366710451116e-02 1.015787046192155041e-01
+2.956726217207689689e-01 4.767654364208809975e-02 9.923998323658683729e-02
+2.906746306466351792e-01 4.681900231021129261e-02 9.687492161154248604e-02
+2.856782002647242358e-01 4.593789236755790178e-02 9.448789214269404102e-02
+2.806890017083342181e-01 4.502128372335665457e-02 9.207800935320636926e-02
+2.757102955542003464e-01 4.406225179606895054e-02 8.964513100796869804e-02
+2.707312541226000180e-01 4.308157177910076213e-02 8.719176105781661912e-02
+2.657667372933599781e-01 4.204947038025994704e-02 8.471559044612611555e-02
+2.608025053402583393e-01 4.099314121499578883e-02 8.221947676879418077e-02
+2.558451747035172530e-01 3.989182795135969711e-02 7.970262452812598708e-02
+2.508938137991353901e-01 3.876029441108298085e-02 7.716551375026653448e-02
+2.459428063629143790e-01 3.762148549775875400e-02 7.460911056507216199e-02
+2.410021600694670640e-01 3.645746689804394564e-02 7.203245689473128377e-02
+2.360563646646140490e-01 3.529747994604028744e-02 6.943744239412558139e-02]; 
+
+   case 'tem' 
+      RGB = [9.985763296811461798e-01 9.632965417140263442e-01 9.577895036430327247e-01
+9.934918422996558141e-01 9.594375624216472387e-01 9.516983192548315040e-01
+9.883417388454437402e-01 9.556282921109976458e-01 9.455836323325411685e-01
+9.831050718338244510e-01 9.518727670560837018e-01 9.394860306213083101e-01
+9.777785730890226068e-01 9.481687534308861354e-01 9.334364948680430318e-01
+9.723870692594612786e-01 9.445024597948724621e-01 9.274670258562995873e-01
+9.669573847273637002e-01 9.408624710997687268e-01 9.215795307640300971e-01
+9.615066616129493982e-01 9.372434217616608665e-01 9.157560566822336989e-01
+9.560531046363628382e-01 9.336385357088663461e-01 9.099886803187530182e-01
+9.506035559047821826e-01 9.300461763422669392e-01 9.042646579991682199e-01
+9.451563753217823161e-01 9.264682865796181055e-01 8.985697730985615639e-01
+9.397124373542273812e-01 9.229047657151164819e-01 8.928998260600508052e-01
+9.342716413123769437e-01 9.193556495997508016e-01 8.872531405900644375e-01
+9.288308811012930821e-01 9.158223472192428272e-01 8.816263177427966502e-01
+9.233851804191220980e-01 9.123071100087158936e-01 8.760148319228351355e-01
+9.179365336943248188e-01 9.088084827838653901e-01 8.704232606428425889e-01
+9.124832972967743538e-01 9.053269113370198129e-01 8.648517190341429295e-01
+9.070218374764418279e-01 9.018638497314315217e-01 8.592980228813623667e-01
+9.015509263802756745e-01 8.984195016922670307e-01 8.537628451897162352e-01
+8.960718329388820402e-01 8.949928217018373600e-01 8.482495190363266158e-01
+8.905836610629007666e-01 8.915838848352710677e-01 8.427587078675609078e-01
+8.850836254841629724e-01 8.881937049832523412e-01 8.372889893254339411e-01
+8.795708463666609411e-01 8.848223352046364898e-01 8.318410153090299852e-01
+8.740469282893844616e-01 8.814686228402575097e-01 8.264178662740626624e-01
+8.685112937853189941e-01 8.781325055194139084e-01 8.210202040569095638e-01
+8.629633327895804840e-01 8.748139384163003962e-01 8.156486084917724533e-01
+8.573988637074910768e-01 8.715145671024431273e-01 8.103003320898716222e-01
+8.518212329614019973e-01 8.682324447773152043e-01 8.049797193798620132e-01
+8.462299834685677036e-01 8.649674562084326279e-01 7.996873827745283325e-01
+8.406246724049463159e-01 8.617194786977677712e-01 7.944239257301034529e-01
+8.350048677827189847e-01 8.584883831868801440e-01 7.891899443847590900e-01
+8.293671160911614271e-01 8.552754073408689317e-01 7.839836146965878383e-01
+8.237138279483190439e-01 8.520791051833870311e-01 7.788079287668441264e-01
+8.180448941186928558e-01 8.488991950022984900e-01 7.736637090147417961e-01
+8.123599093553812711e-01 8.457355276105180675e-01 7.685515296147656938e-01
+8.066584706735069332e-01 8.425879497641356464e-01 7.634719632765348818e-01
+8.009401766621723207e-01 8.394563042330350777e-01 7.584255820860429376e-01
+7.952028972601549173e-01 8.363411716110775718e-01 7.534118252377455249e-01
+7.894471633387081244e-01 8.332419707110174656e-01 7.484319716624078245e-01
+7.836734962813408645e-01 8.301581353160575327e-01 7.434872090029538416e-01
+7.778815003305534770e-01 8.270894921786368092e-01 7.385781042557458820e-01
+7.720707796269933310e-01 8.240358639329949941e-01 7.337052258319404219e-01
+7.662409381414175824e-01 8.209970689783633313e-01 7.288691437189614986e-01
+7.603915796412942241e-01 8.179729213555224643e-01 7.240704295566047222e-01
+7.545223076817887398e-01 8.149632306197714948e-01 7.193096566367255251e-01
+7.486327256130643759e-01 8.119678017125729896e-01 7.145873998348200029e-01
+7.427219014782563411e-01 8.089866453573647531e-01 7.099039891607071828e-01
+7.367891737192681090e-01 8.060196536672460388e-01 7.052599184573171698e-01
+7.308350860228653989e-01 8.030662448375227580e-01 7.006562091939169123e-01
+7.248592428796667431e-01 8.001262050844080154e-01 6.960934321026465144e-01
+7.188612485448663270e-01 7.971993154607720511e-01 6.915721584188375681e-01
+7.128407070658809852e-01 7.942853517324697243e-01 6.870929595632513376e-01
+7.067972223051004477e-01 7.913840842570615264e-01 6.826564067967675342e-01
+7.007303979576740005e-01 7.884952778644843674e-01 6.782630708517513041e-01
+6.946398375648411561e-01 7.856186917391158042e-01 6.739135215439332471e-01
+6.885251445237092760e-01 7.827540793025653532e-01 6.696083273682165160e-01
+6.823859220949484161e-01 7.799011880964143995e-01 6.653480550814426797e-01
+6.762217734101813038e-01 7.770597596640953508e-01 6.611332692747456941e-01
+6.700323014813579503e-01 7.742295294309987641e-01 6.569645319377305226e-01
+6.638171092147175933e-01 7.714102265818907345e-01 6.528424020163275943e-01
+6.575757994324034073e-01 7.686015739346664377e-01 6.487674349657708284e-01
+6.513079749051275957e-01 7.658032878094622742e-01 6.447401822997557153e-01
+6.450132383997043695e-01 7.630150778921287458e-01 6.407611911364364810e-01
+6.386911927456534466e-01 7.602366470910791874e-01 6.368310037415121361e-01
+6.323414409254812796e-01 7.574676913865331374e-01 6.329501570682624090e-01
+6.259635861936422296e-01 7.547078996712067722e-01 6.291191822939783407e-01
+6.195560972423146406e-01 7.519573115237726535e-01 6.253384926911926822e-01
+6.131191206125891080e-01 7.492154188267443615e-01 6.216087050224498034e-01
+6.066526905401021796e-01 7.464817491552263595e-01 6.179303860708607044e-01
+6.001564124519274124e-01 7.437559595200373685e-01 6.143040456187923715e-01
+5.936298933201957784e-01 7.410376988478269977e-01 6.107301851240671819e-01
+5.870727421002424062e-01 7.383266077479672118e-01 6.072092971993915400e-01
+5.804845702488933279e-01 7.356223182652517067e-01 6.037418650719156288e-01
+5.738649923321349489e-01 7.329244536181049874e-01 6.003283620189617809e-01
+5.672131712764029166e-01 7.302327570205698892e-01 5.969692609600730782e-01
+5.605265661533928023e-01 7.275474322700724583e-01 5.936651120515976654e-01
+5.538072551957783363e-01 7.248673679611095100e-01 5.904163410524770894e-01
+5.470548736207613283e-01 7.221921468817737999e-01 5.872233804977959881e-01
+5.402690647877386176e-01 7.195213413684249382e-01 5.840866494502513495e-01
+5.334494816269396145e-01 7.168545129510710545e-01 5.810065526719623286e-01
+5.265932673521412921e-01 7.141918646847531527e-01 5.779837442967735717e-01
+5.197010257328686933e-01 7.115326679134365007e-01 5.750185876848199484e-01
+5.127738759690677606e-01 7.088760718122417703e-01 5.721113127309581659e-01
+5.058115298480653221e-01 7.062215879970826782e-01 5.692622613027222833e-01
+4.988124547076915882e-01 7.035690215604037956e-01 5.664719533702552434e-01
+4.917741270603506742e-01 7.009183842407572529e-01 5.637411222277634026e-01
+4.846997162615552246e-01 6.982683108816961637e-01 5.610695620964348818e-01
+4.775890398856753039e-01 6.956182556045346077e-01 5.584575291026864230e-01
+4.704389351347622594e-01 6.929683367461523247e-01 5.559058726658481220e-01
+4.632498634530364812e-01 6.903178139102768007e-01 5.534147775766539157e-01
+4.560240745098563253e-01 6.876655632831355502e-01 5.509839689679422170e-01
+4.487598229028739172e-01 6.850113432670585922e-01 5.486140038956078824e-01
+4.414547339722453279e-01 6.823550079810395408e-01 5.463056567639269501e-01
+4.341129901223799714e-01 6.796950319734580415e-01 5.440580596655568701e-01
+4.267325988888523436e-01 6.770311866202418649e-01 5.418718349209995511e-01
+4.193119538935562440e-01 6.743631277083362852e-01 5.397475699351562684e-01
+4.118554481683104340e-01 6.716893377862352965e-01 5.376841277217632165e-01
+4.043593499172888350e-01 6.690098785171258999e-01 5.356826761355167887e-01
+3.968261890078971788e-01 6.663236061846555813e-01 5.337425455110953454e-01
+3.892580517875900981e-01 6.636294950347043642e-01 5.318631054022345817e-01
+3.816510562742471135e-01 6.609275747235534570e-01 5.300456830101799577e-01
+3.740119682194762429e-01 6.582160193662682790e-01 5.282880419647097980e-01
+3.663368289249827603e-01 6.554948605761221625e-01 5.265915743478537525e-01
+3.586308928051362699e-01 6.527625972609284455e-01 5.249544352005411918e-01
+3.508936232465371674e-01 6.500187029053001719e-01 5.233768303957324619e-01
+3.431277348645550562e-01 6.472621506436356809e-01 5.218577640245062321e-01
+3.353355552299603914e-01 6.444920106677175520e-01 5.203963563323180663e-01
+3.275188103490194735e-01 6.417074699067215615e-01 5.189919719540163623e-01
+3.196814435511296515e-01 6.389074409416231060e-01 5.176430585409529384e-01
+3.118254758119217707e-01 6.360911463304157465e-01 5.163488722475468862e-01
+3.039555214161791530e-01 6.332575133378499643e-01 5.151075596956975478e-01
+2.960748324121407205e-01 6.304057046767445049e-01 5.139178767894679867e-01
+2.881881143962810587e-01 6.275347641630057982e-01 5.127779478270290126e-01
+2.803003746086680792e-01 6.246437759477415641e-01 5.116857725517640620e-01
+2.724162323640093031e-01 6.217319406932720893e-01 5.106395912364674050e-01
+2.645425291505308918e-01 6.187983086880044503e-01 5.096365792929340444e-01
+2.566840197606024554e-01 6.158422311486778655e-01 5.086750547256451149e-01
+2.488489441844971561e-01 6.128628192186393875e-01 5.077515718650474907e-01
+2.410430130087069522e-01 6.098595200479223211e-01 5.068641518721540562e-01
+2.332749143253212143e-01 6.068316286127126702e-01 5.060092633925864503e-01
+2.255521696872271886e-01 6.037786523436265984e-01 5.051841613954050070e-01
+2.178835011739876371e-01 6.007001216855215597e-01 5.043855354959408954e-01
+2.102776619158149840e-01 5.975956842983582984e-01 5.036102222376415138e-01
+2.027443124327554802e-01 5.944650539898058694e-01 5.028546409645925364e-01
+1.952924636272905801e-01 5.913080959200207598e-01 5.021159025525618880e-01
+1.879334378838529440e-01 5.881246912104457492e-01 5.013896313522919757e-01
+1.806761031013389140e-01 5.849149331180006905e-01 5.006736479698321585e-01
+1.735328783097749850e-01 5.816789154432452369e-01 4.999631315071642601e-01
+1.665133003434038084e-01 5.784169089899582339e-01 4.992561455145328453e-01
+1.596300036906863895e-01 5.751292412901443107e-01 4.985481743532478860e-01
+1.528937099908951325e-01 5.718163393279495077e-01 4.978371217540351057e-01
+1.463171276735238113e-01 5.684787369209851615e-01 4.971190242696297834e-01
+1.399119531735926458e-01 5.651170059000043544e-01 4.963918396953513335e-01
+1.336912106530599997e-01 5.617318570854707982e-01 4.956519172255148820e-01
+1.276672732366210816e-01 5.583239554235875923e-01 4.948978636889357907e-01
+1.218535592637135234e-01 5.548942058020517321e-01 4.941256571865651481e-01
+1.162631754482068569e-01 5.514432364311973034e-01 4.933355557142476422e-01
+1.109091719419828259e-01 5.479722539284174188e-01 4.925220286879308795e-01
+1.058058868411170528e-01 5.444817357603629615e-01 4.916873206428047927e-01
+1.009651127375016111e-01 5.409730397620680087e-01 4.908260102866368046e-01
+9.640117372078826907e-02 5.374467824904106683e-01 4.899392661237967350e-01
+9.212706115366336990e-02 5.339038791645212001e-01 4.890257976801760109e-01
+8.815110303261089464e-02 5.303457163263245455e-01 4.880817131293228583e-01
+8.448832972524200624e-02 5.267726392289812098e-01 4.871097239159773440e-01
+8.114572394888117102e-02 5.231858403590214923e-01 4.861073630469811557e-01
+7.812721320542403980e-02 5.195865216476734938e-01 4.850725749743695636e-01
+7.544312997722565917e-02 5.159750173542567708e-01 4.840076729265158639e-01
+7.309574065371191032e-02 5.123522156200341904e-01 4.829119931483520367e-01
+7.107372065756567547e-02 5.087198306495862576e-01 4.817814896929000779e-01
+6.938287907938911481e-02 5.050778255979795350e-01 4.806197953737798012e-01
+6.801610562745827315e-02 5.014269919387287500e-01 4.794267081520149909e-01
+6.696293828126623215e-02 4.977680989992983585e-01 4.782021118153178540e-01
+6.619782080433814220e-02 4.941027658684106760e-01 4.769429100625798834e-01
+6.571558023976076246e-02 4.904308747270616498e-01 4.756523204648347991e-01
+6.549820807888259711e-02 4.867530881918184504e-01 4.743305399824718216e-01
+6.552566064603559948e-02 4.830700650743400826e-01 4.729777438223161101e-01
+6.577673858968982601e-02 4.793824370720338179e-01 4.715941633832017588e-01
+6.622677049492370349e-02 4.756910136151853430e-01 4.701794827815656830e-01
+6.685019795786503738e-02 4.719966397538147285e-01 4.687333314519904204e-01
+6.763272639280798471e-02 4.682993582933911436e-01 4.672575858662252890e-01
+6.855374817251533304e-02 4.645996843636931994e-01 4.657526519729214276e-01
+6.959365457471067273e-02 4.608981063279830592e-01 4.642189680611767399e-01
+7.073403782879061907e-02 4.571950861446216208e-01 4.626570010388615928e-01
+7.195781915786156335e-02 4.534910598140922677e-01 4.610672429543411499e-01
+7.324931366840245484e-02 4.497864378980456768e-01 4.594502077591564038e-01
+7.459424408415230023e-02 4.460816060979165276e-01 4.578064283072901808e-01
+7.597971511267428979e-02 4.423769258816079852e-01 4.561364535850265800e-01
+7.739415915996109008e-02 4.386727351476746306e-01 4.544408461640829233e-01
+7.882726258105521300e-02 4.349693489173894201e-01 4.527201798696426915e-01
+8.026987997778653461e-02 4.312670600459782566e-01 4.509750376540915817e-01
+8.171394242970148047e-02 4.275661399451892164e-01 4.492060096666721791e-01
+8.315236408743081897e-02 4.238668393102046350e-01 4.474136915088433031e-01
+8.457895032121595658e-02 4.201693888446985103e-01 4.455986826648858368e-01
+8.598830961259482097e-02 4.164739999785817548e-01 4.437615850971945997e-01
+8.737577058920215078e-02 4.127808655736769361e-01 4.419030019956885491e-01
+8.873730500447504776e-02 4.090901606132017476e-01 4.400235366709063789e-01
+9.006945702453716951e-02 4.054020428715323643e-01 4.381237915805220595e-01
+9.136927887187012987e-02 4.017166535612498035e-01 4.362043674792987491e-01
+9.263427266200571775e-02 3.980341179549674036e-01 4.342658626828024837e-01
+9.386233813144639893e-02 3.943545459798681874e-01 4.323088724355508838e-01
+9.505172587236093706e-02 3.906780327832828914e-01 4.303339883746660766e-01
+9.620003933222870396e-02 3.870047637840662302e-01 4.283416262899890081e-01
+9.729997123759509536e-02 3.833354963232004087e-01 4.263312615677605777e-01
+9.835741884413440328e-02 3.796695548525758634e-01 4.243046936775203282e-01
+9.937169919107982641e-02 3.760069784468507703e-01 4.222625006231348066e-01
+1.003423119365809690e-01 3.723477936835040136e-01 4.202052548968338574e-01
+1.012689167529539358e-01 3.686920150348446112e-01 4.181335233490640069e-01
+1.021513134274243950e-01 3.650396452261166491e-01 4.160478671051655586e-01
+1.029884320307208612e-01 3.613907991323849767e-01 4.139486582680417803e-01
+1.037719209811681642e-01 3.577465259466254266e-01 4.118348877541359032e-01
+1.045112201334900126e-01 3.541056562885774861e-01 4.097088092956981398e-01
+1.052065591856250482e-01 3.504681464569319171e-01 4.075709632165070984e-01
+1.058582376509708545e-01 3.468339423292918222e-01 4.054218838433404359e-01
+1.064666158592602885e-01 3.432029795356145718e-01 4.032620996037361571e-01
+1.070239159802940931e-01 3.395763147211236510e-01 4.010905648833596460e-01
+1.075355258379605550e-01 3.359532282299735328e-01 3.989087127976621017e-01
+1.080052802278752000e-01 3.323331728550899533e-01 3.967176863054378000e-01
+1.084337294201929702e-01 3.287160421828903556e-01 3.945179917556369542e-01
+1.088202096165073185e-01 3.251019032868823211e-01 3.923098843692563453e-01
+1.091556968975302966e-01 3.214920812428978536e-01 3.900919340676701208e-01
+1.094518269158459012e-01 3.178848431435130073e-01 3.878667847148202785e-01
+1.097092559883022234e-01 3.142800415550652815e-01 3.856349205402823110e-01
+1.099286556573810802e-01 3.106775192369479188e-01 3.833968205472055302e-01
+1.100986315611906241e-01 3.070790351009552999e-01 3.811504545068737926e-01
+1.102317288825286901e-01 3.034825829921489193e-01 3.788986922133656954e-01
+1.103290785873510815e-01 2.998879083652261635e-01 3.766420819050353419e-01
+1.103893448894039397e-01 2.962951553198432397e-01 3.743806401368951486e-01
+1.104047114339987423e-01 2.927055780381122019e-01 3.721129484539063559e-01
+1.103867349279119559e-01 2.891171759115234718e-01 3.698417464033080804e-01
+1.103361572207214036e-01 2.855297163446686715e-01 3.675674754730824945e-01
+1.102460152182262176e-01 2.819443225282238785e-01 3.652888319764409086e-01
+1.101198294511886444e-01 2.783603021914852760e-01 3.630068099573608986e-01
+1.099635342633853707e-01 2.747764822051754763e-01 3.607229892872333421e-01
+1.097748910210358808e-01 2.711931376089152246e-01 3.584370856671010852e-01
+1.095478763802813504e-01 2.676112773022403801e-01 3.561478615212890775e-01
+1.092932808921200649e-01 2.640287615628073015e-01 3.538580573547516761e-01
+1.090116287119651528e-01 2.604453159192556266e-01 3.515680214913912693e-01
+1.086913329090623825e-01 2.568630402753477870e-01 3.492750549670107785e-01
+1.083460004297124302e-01 2.532791299120676354e-01 3.469826761312421182e-01
+1.079763885418836000e-01 2.496932209057829977e-01 3.446912766824791197e-01
+1.075713140889580088e-01 2.461073946949010050e-01 3.423980926413837667e-01
+1.071428862568302165e-01 2.425189920877232619e-01 3.401063918909076889e-01
+1.066927192498384747e-01 2.389274243968986799e-01 3.378167764830257158e-01
+1.062093640276061124e-01 2.353348932541681759e-01 3.355262248019345583e-01
+1.057055066316897329e-01 2.317384538919968207e-01 3.332383062494437276e-01
+1.051814556007013568e-01 2.281377376539149293e-01 3.309532535866355762e-01
+1.046272664909374817e-01 2.245346804307608024e-01 3.286682704446855507e-01
+1.040556247342821483e-01 2.209261472703716311e-01 3.263871052200472134e-01
+1.034637486817424901e-01 2.173124203806320875e-01 3.241090419310820314e-01
+1.028468845169810686e-01 2.136942776676366007e-01 3.218326666201724029e-01
+1.022150454689789434e-01 2.100689913462399083e-01 3.195611195376787395e-01
+1.015620277820400430e-01 2.064376400065636719e-01 3.172925125709148420e-01
+1.008900241588315538e-01 2.027992883367119026e-01 3.150275553737127421e-01
+1.002054858430543316e-01 1.991518634625495388e-01 3.127684262427183892e-01
+9.949803783218733044e-02 1.954975058870322413e-01 3.105116763778897337e-01
+9.877832247043097369e-02 1.918329889556127654e-01 3.082609202522414993e-01
+9.804493118338306057e-02 1.881580898967480098e-01 3.060157402408537064e-01
+9.729328810023782359e-02 1.844734436312414905e-01 3.037745103921251633e-01
+9.653316478613682694e-02 1.807757562460599599e-01 3.015407883893915231e-01
+9.575619444438937533e-02 1.770666290075273708e-01 2.993115284087380368e-01
+9.496899572502048859e-02 1.733434725855039771e-01 2.970892156823352059e-01
+9.417284157369981701e-02 1.696050767223750977e-01 2.948744162588470830e-01
+9.336173420340779239e-02 1.658523274558137695e-01 2.926648040593683997e-01
+9.254607948203208423e-02 1.620811665705463311e-01 2.904645825457518593e-01
+9.171714479257989105e-02 1.582931942356169963e-01 2.882702798507874586e-01
+9.088231952195491292e-02 1.544850037627045203e-01 2.860850125083750362e-01
+9.004099984169053328e-02 1.506555099870153513e-01 2.839086654207542693e-01
+8.919012906146844832e-02 1.468043594975814992e-01 2.817400195447572475e-01
+8.833858505105957049e-02 1.429270910011002649e-01 2.795831537842536352e-01
+8.747533041314431435e-02 1.390258052165279645e-01 2.774332852121961235e-01
+8.661249189260347703e-02 1.350944971238551839e-01 2.752961432065319514e-01
+8.574385298640457842e-02 1.311333174761502018e-01 2.731691209373900975e-01
+8.487294239495335457e-02 1.271387529060027943e-01 2.710541708402016137e-01
+8.400180885962132971e-02 1.231074880892656653e-01 2.689526699064171411e-01
+8.312616532498406929e-02 1.190383729463048712e-01 2.668628892216621806e-01
+8.225559928700268419e-02 1.149244079727295142e-01 2.647901677800857390e-01]; 
+
+   case 'ice'
+      RGB = [1.531167435543729846e-02 2.252059388699531942e-02 7.272873735907764425e-02
+1.800549591959003243e-02 2.544551608389769570e-02 7.841879116825511975e-02
+2.090133006203173313e-02 2.852652245071044673e-02 8.407771577420969367e-02
+2.399818650587986005e-02 3.176264327218273481e-02 8.970750416351327972e-02
+2.729775749004114890e-02 3.514909496851363613e-02 9.532647230499821656e-02
+3.080428146052393429e-02 3.867708164670261017e-02 1.009662673440025749e-01
+3.450984373415445089e-02 4.229955636714784889e-02 1.065828165743578915e-01
+3.841359784116892689e-02 4.587404239998996852e-02 1.121776340643418912e-01
+4.245789616397358662e-02 4.939963679832150983e-02 1.177960773094180458e-01
+4.645777532344794875e-02 5.288489849108807955e-02 1.234176036286754041e-01
+5.041621762087678676e-02 5.633788824565918313e-02 1.290216830927681801e-01
+5.433779516873311205e-02 5.975737503280462853e-02 1.346239246672657763e-01
+5.823000255128838593e-02 6.313585840823013329e-02 1.402651739202840087e-01
+6.208647351275981691e-02 6.648865889594307577e-02 1.458921724026617794e-01
+6.590890827576056932e-02 6.981759532833076154e-02 1.515056185497818952e-01
+6.970669712558172360e-02 7.310909804078333241e-02 1.571701055775910905e-01
+7.347360805650121618e-02 7.637815581467355397e-02 1.628308265129313204e-01
+7.720982185882321880e-02 7.962820406611839652e-02 1.684800394051645944e-01
+8.092190572547824923e-02 8.284856571837034833e-02 1.741697304708636207e-01
+8.460722520622676601e-02 8.604719820880801784e-02 1.798725773914293391e-01
+8.826407983557263415e-02 8.923087230589588081e-02 1.855652548242135713e-01
+9.189748856643911723e-02 9.238991627825218766e-02 1.912953251540190358e-01
+9.550605637353798416e-02 9.552936548231369396e-02 1.970466344723810770e-01
+9.908760199831237458e-02 9.865735598928837558e-02 2.027885080271309981e-01
+1.026464276979975609e-01 1.017632832609889626e-01 2.085729006866037794e-01
+1.061807481293115807e-01 1.048533987828409453e-01 2.143771619600378098e-01
+1.096889023760894977e-01 1.079351702016392300e-01 2.201721871249775475e-01
+1.131748168296289048e-01 1.109951338044804781e-01 2.260236443434878173e-01
+1.166355654717963208e-01 1.140448383112346031e-01 2.318836318580280165e-01
+1.200706770784045196e-01 1.170883693387409774e-01 2.377372345137335197e-01
+1.234831126917021182e-01 1.201095785266100835e-01 2.436640854600494177e-01
+1.268694769189046001e-01 1.231271973707054601e-01 2.495809234356071160e-01
+1.302307935855599175e-01 1.261348273230401829e-01 2.555217697948003464e-01
+1.335669536543798996e-01 1.291293381943951213e-01 2.615060473838256017e-01
+1.368768735891793542e-01 1.321228390190112012e-01 2.674792268238664894e-01
+1.401607222303006828e-01 1.351007751267265800e-01 2.735164638309879881e-01
+1.434177197831119077e-01 1.380764808543884503e-01 2.795564348972031099e-01
+1.466474902267766722e-01 1.410468359199091026e-01 2.856183790033576808e-01
+1.498489657362017669e-01 1.440082826282148287e-01 2.917246687573430419e-01
+1.530229361070791771e-01 1.469729643095797900e-01 2.978170527656492372e-01
+1.561658891044421793e-01 1.499237839873007738e-01 3.039884751881400948e-01
+1.592803696822101267e-01 1.528796824181726244e-01 3.101441051875748478e-01
+1.623627513097627983e-01 1.558287612260276789e-01 3.163512211275710251e-01
+1.654142439360292427e-01 1.587796212856360245e-01 3.225680108254420086e-01
+1.684327965090609003e-01 1.617293084063355368e-01 3.288148930781844004e-01
+1.714174532656698446e-01 1.646790560305917694e-01 3.350897686326997915e-01
+1.743682562241114509e-01 1.676319105902342177e-01 3.413798820958920399e-01
+1.772818953778146633e-01 1.705846382439054620e-01 3.477088809140311265e-01
+1.801603634233710782e-01 1.735435075165488450e-01 3.540447583078508709e-01
+1.829984949769703495e-01 1.765034834295459432e-01 3.604229741636628126e-01
+1.857993799242090571e-01 1.794715454820642320e-01 3.668060399217007994e-01
+1.885572370561371114e-01 1.824432159549585208e-01 3.732275719698777694e-01
+1.912746410827655397e-01 1.854240146696699842e-01 3.796579628109393312e-01
+1.939472187446417972e-01 1.884119984733164943e-01 3.861158710011389772e-01
+1.965746218202921169e-01 1.914094687319768118e-01 3.925922579541862301e-01
+1.991567237202455654e-01 1.944185425759841768e-01 3.990785276243757895e-01
+2.016870280617926170e-01 1.974370231299186207e-01 4.055979452145534458e-01
+2.041733231959791395e-01 2.004720971993999568e-01 4.121034638774260794e-01
+2.065989175964332847e-01 2.035163285945146838e-01 4.186611530978023854e-01
+2.089769981124778853e-01 2.065792251897101139e-01 4.252032229400294350e-01
+2.112968541690966595e-01 2.096575161864902004e-01 4.317649751357993670e-01
+2.135580062034990179e-01 2.127534028876823524e-01 4.383374070580626225e-01
+2.157654857120719361e-01 2.158705959834085197e-01 4.448946358553702574e-01
+2.179027467031688925e-01 2.190056896370822792e-01 4.514821666358075913e-01
+2.199801557481101399e-01 2.221640817576028826e-01 4.580565150394946827e-01
+2.219970327313536274e-01 2.253470663668500351e-01 4.646129330923238210e-01
+2.239359400161920477e-01 2.285528452407099564e-01 4.711900504070519191e-01
+2.258093253298022463e-01 2.317859657097744996e-01 4.777445723729306093e-01
+2.276150386234590539e-01 2.350474802331274371e-01 4.842749179389621017e-01
+2.293411129842480300e-01 2.383375691596468227e-01 4.908001225098672093e-01
+2.309905102772738528e-01 2.416584626823640725e-01 4.973037406011600603e-01
+2.325653899945122616e-01 2.450118207268658921e-01 5.037733153263704855e-01
+2.340634217066668299e-01 2.483988011172711396e-01 5.102061969115925244e-01
+2.354739391855478203e-01 2.518205609488499142e-01 5.166133649735229483e-01
+2.368010268106580107e-01 2.552786891057904350e-01 5.229787612622226467e-01
+2.380459056014049835e-01 2.587743537954566575e-01 5.292929958163873350e-01
+2.392069166726323859e-01 2.623086175634496420e-01 5.355517448643010159e-01
+2.402826487140223288e-01 2.658824888638082751e-01 5.417502762699162311e-01
+2.412690379036540600e-01 2.694971451746652202e-01 5.478870668064361737e-01
+2.421646534827242569e-01 2.731536075359688454e-01 5.539567283353189486e-01
+2.429737663975502504e-01 2.768521950965758815e-01 5.599478852923390759e-01
+2.436964271327693443e-01 2.805934002738960653e-01 5.658549936523274981e-01
+2.443331406488099544e-01 2.843775500649446952e-01 5.716723986670918523e-01
+2.448849019911867875e-01 2.882047861966390290e-01 5.773944132373918237e-01
+2.453532261044997220e-01 2.920750479307156477e-01 5.830154006066263772e-01
+2.457401707423141346e-01 2.959880581924350662e-01 5.885298594478888257e-01
+2.460483514874983180e-01 2.999433136125404520e-01 5.939325092217595525e-01
+2.462809480744551638e-01 3.039400789577370587e-01 5.992183735671519074e-01
+2.464417014302806019e-01 3.079773862803035778e-01 6.043828594654379049e-01
+2.465349011179689409e-01 3.120540389489538935e-01 6.094218299971551067e-01
+2.465653631589233563e-01 3.161686205399514837e-01 6.143316686920637926e-01
+2.465383985194727345e-01 3.203195083804638021e-01 6.191093337508785099e-01
+2.464597728499572371e-01 3.245048913568406301e-01 6.237524007769893464e-01
+2.463356583484295759e-01 3.287227914401089635e-01 6.282590930787467220e-01
+2.461725788681820570e-01 3.329710882494058555e-01 6.326282990625464731e-01
+2.459773495859159942e-01 3.372475458788758984e-01 6.368595767065934332e-01
+2.457570126857825388e-01 3.415498411593856920e-01 6.409531455573861392e-01
+2.455187705883344895e-01 3.458755925146314025e-01 6.449098671004442895e-01
+2.452699182619971774e-01 3.502223885999685149e-01 6.487312147029243858e-01
+2.450177761015216449e-01 3.545878159769456084e-01 6.524192345935843074e-01
+2.447696247503935441e-01 3.589694851701816236e-01 6.559764995268344556e-01
+2.445326430925611194e-01 3.633650545677170052e-01 6.594060568707836856e-01
+2.443138504548736933e-01 3.677722517524962265e-01 6.627113728687089589e-01
+2.441200538578628954e-01 3.721888919827969766e-01 6.658962747586536501e-01
+2.439578009410017234e-01 3.766128936655925852e-01 6.689648923098728828e-01
+2.438333389800677597e-01 3.810422907829071337e-01 6.719216001624749302e-01
+2.437527166088169217e-01 3.854752048525493247e-01 6.747709927211151815e-01
+2.437215868067584834e-01 3.899098965838322384e-01 6.775178104933975431e-01
+2.437449691034339061e-01 3.943448306666547665e-01 6.801668228779059744e-01
+2.438275942988586409e-01 3.987785785872524635e-01 6.827228592773180171e-01
+2.439737834704199804e-01 4.032098481987659855e-01 6.851907482426946583e-01
+2.441874434968405727e-01 4.076374812199010655e-01 6.875752826204606372e-01
+2.444720671645514987e-01 4.120604493040472271e-01 6.898811893971661391e-01
+2.448307373736109405e-01 4.164778489638755743e-01 6.921131040949622948e-01
+2.452661349520961487e-01 4.208888956165576789e-01 6.942755494834951246e-01
+2.457805495927352646e-01 4.252929169900244166e-01 6.963729183108620102e-01
+2.463758934401020784e-01 4.296893461032649797e-01 6.984094597147249006e-01
+2.470537168787759197e-01 4.340777140051458871e-01 7.003892689515083259e-01
+2.478152261001809742e-01 4.384576424279668649e-01 7.023162800736911793e-01
+2.486613020564674703e-01 4.428288364849563008e-01 7.041942611893784454e-01
+2.495925204424470634e-01 4.471910775158167151e-01 7.060268119517866259e-01
+2.506091723801374682e-01 4.515442161617032046e-01 7.078173629464002969e-01
+2.517112855138260996e-01 4.558881657309074575e-01 7.095691766682096224e-01
+2.528986452564736531e-01 4.602228958990267071e-01 7.112853498087290394e-01
+2.541708159598920491e-01 4.645484267725444316e-01 7.129688166009963135e-01
+2.555271618114321464e-01 4.688648233323279846e-01 7.146223529992972168e-01
+2.569668672886404326e-01 4.731721902633665988e-01 7.162485814980906751e-01
+2.584889570301312500e-01 4.774706671689665227e-01 7.178499764208978728e-01
+2.600923150060586719e-01 4.817604241612176152e-01 7.194288695343957762e-01
+2.617757028946650633e-01 4.860416578147523370e-01 7.209874558653309728e-01
+2.635377775926647237e-01 4.903145874672710236e-01 7.225277996180770046e-01
+2.653771078065290112e-01 4.945794518478790480e-01 7.240518401086443179e-01
+2.672921896891591875e-01 4.988365060127348261e-01 7.255613976468211490e-01
+2.692814615020625024e-01 5.030860185666778950e-01 7.270581793119333947e-01
+2.713433172968592322e-01 5.073282691492603247e-01 7.285437845796602918e-01
+2.734761196220429347e-01 5.115635461637654258e-01 7.300197107675363561e-01
+2.756782112712242161e-01 5.157921447283394523e-01 7.314873582754417569e-01
+2.779479260979498267e-01 5.200143648290899145e-01 7.329480356046209621e-01
+2.802835989294344965e-01 5.242305096559424227e-01 7.344029641448335255e-01
+2.826835746175559994e-01 5.284408841030631132e-01 7.358532827242095786e-01
+2.851462162701056124e-01 5.326457934167407871e-01 7.373000519204292447e-01
+2.876699127088762631e-01 5.368455419747276691e-01 7.387442581351216786e-01
+2.902530852036724895e-01 5.410404321821302709e-01 7.401868174359758079e-01
+2.928941935330091062e-01 5.452307634699987693e-01 7.416285791730816701e-01
+2.955917414230262996e-01 5.494168313837994866e-01 7.430703293775968721e-01
+2.983442814164117829e-01 5.535989267498891975e-01 7.445127939520038707e-01
+3.011504192226619470e-01 5.577773349090259236e-01 7.459566416621068452e-01
+3.040088176001567444e-01 5.619523350067550105e-01 7.474024869415085703e-01
+3.069181998192390681e-01 5.661241993312904341e-01 7.488508925197547850e-01
+3.098773527540035766e-01 5.702931926901545490e-01 7.503023718855809099e-01
+3.128851296485514188e-01 5.744595718174968502e-01 7.517573915968616127e-01
+3.159404526017212111e-01 5.786235848045079289e-01 7.532163734489466522e-01
+3.190423148119757579e-01 5.827854705458642703e-01 7.546796965130810886e-01
+3.221897826221614136e-01 5.869454581955374506e-01 7.561476990566410317e-01
+3.253819974015382255e-01 5.911037666256608869e-01 7.576206803568952264e-01
+3.286181773003176154e-01 5.952606038824642676e-01 7.590989024200323065e-01
+3.318976189096972118e-01 5.994161666335501293e-01 7.605825916172537227e-01
+3.352196988582024639e-01 6.035706396009887786e-01 7.620719402498039585e-01
+3.385838753729217276e-01 6.077241949749224714e-01 7.635671080549891743e-01
+3.419896898320652912e-01 6.118769918024981047e-01 7.650682236654324786e-01
+3.454367683330621941e-01 6.160291753470886755e-01 7.665753860341149029e-01
+3.489248232981658759e-01 6.201808764128988738e-01 7.680886658381395060e-01
+3.524536551372777216e-01 6.243322106301375518e-01 7.696081068746097875e-01
+3.560231539852872773e-01 6.284832776960781464e-01 7.711337274625911231e-01
+3.596333015286877766e-01 6.326341605674558055e-01 7.726655218657797475e-01
+3.632841729334435055e-01 6.367849245998262742e-01 7.742034617512983941e-01
+3.669759388831845826e-01 6.409356166297031088e-01 7.757474977008770312e-01
+3.707088677332940896e-01 6.450862639955934341e-01 7.772975607916928764e-01
+3.744833277827505080e-01 6.492368734944050646e-01 7.788535642652039126e-01
+3.782997896612683153e-01 6.533874302701627723e-01 7.804154053034927374e-01
+3.821588288242804832e-01 6.575378966326091978e-01 7.819829669338883571e-01
+3.860611281425825880e-01 6.616882108040403887e-01 7.835561200839490370e-01
+3.900074788490647260e-01 6.658383310313947812e-01 7.851343555476577585e-01
+3.939988161696960089e-01 6.699882294160507401e-01 7.867167620565498343e-01
+3.980361943268375668e-01 6.741376428249236108e-01 7.883041180552029514e-01
+4.021207666563880734e-01 6.782863970632155848e-01 7.898962603978111341e-01
+4.062538088695973326e-01 6.824342860499125196e-01 7.914930279577012673e-01
+4.104367215482290221e-01 6.865810701317770492e-01 7.930942653099937178e-01
+4.146710323688317379e-01 6.907264743609855540e-01 7.946998267750712275e-01
+4.189583979456862339e-01 6.948701867544626598e-01 7.963095808534970121e-01
+4.233007615496491849e-01 6.990119462600449252e-01 7.979223720379219342e-01
+4.277003131396773239e-01 7.031514402219964932e-01 7.995369318160842065e-01
+4.321588772737992579e-01 7.072880516513097016e-01 8.011551464379941256e-01
+4.366786594847170133e-01 7.114212963902242226e-01 8.027769966740599950e-01
+4.412619934972313862e-01 7.155506445548852623e-01 8.044025095123854552e-01
+4.459117519235324401e-01 7.196756076604832186e-01 8.060302209280784114e-01
+4.506310977664646500e-01 7.237956107627850910e-01 8.076586979980320269e-01
+4.554220533607292176e-01 7.279097909870729799e-01 8.092910180447286939e-01
+4.602874296132978826e-01 7.320174174690982083e-01 8.109274975540664565e-01
+4.652312929955615961e-01 7.361178015074247849e-01 8.125654680881110314e-01
+4.702567132124945704e-01 7.402100378643735601e-01 8.142058631482380626e-01
+4.753658389170350440e-01 7.442931579112735951e-01 8.158518248191980460e-01
+4.805629989896973986e-01 7.483662565565446512e-01 8.175014285494428545e-01
+4.858519412014848382e-01 7.524283052190463561e-01 8.191547180510726500e-01
+4.912340123610521858e-01 7.564782715855419282e-01 8.208164230788980165e-01
+4.967149567998503934e-01 7.605150334733405959e-01 8.224828836016547795e-01
+5.022958597070651399e-01 7.645375459922270078e-01 8.241590313627700226e-01
+5.079798024989584659e-01 7.685447202464326111e-01 8.258458806918314021e-01
+5.137703056538149848e-01 7.725354056237694333e-01 8.275437918161917539e-01
+5.196672668780889515e-01 7.765087356564679411e-01 8.292580362563429786e-01
+5.256748803701343231e-01 7.804635126371105569e-01 8.309874864714956733e-01
+5.317909415132198170e-01 7.843991695298314637e-01 8.327389435984492438e-01
+5.380183963455860141e-01 7.883146743347385632e-01 8.345120959574837682e-01
+5.443539980151446134e-01 7.922097498034269547e-01 8.363133084981756449e-01
+5.507978944105677011e-01 7.960838061951434064e-01 8.381442735434428970e-01
+5.573464847507825226e-01 7.999368256977259506e-01 8.400099169225816453e-01
+5.639964685183691540e-01 8.037688733081099768e-01 8.419139099857662067e-01
+5.707439504576503619e-01 8.075802108116317823e-01 8.438596871365160457e-01
+5.775827793152761291e-01 8.113715803382598457e-01 8.458518352418533670e-01
+5.845080419432422403e-01 8.151436572177973572e-01 8.478930504633812593e-01
+5.915124079987543748e-01 8.188976525325087907e-01 8.499872730184475644e-01
+5.985892343607183141e-01 8.226347979507546704e-01 8.521371651406997039e-01
+6.057310635784716180e-01 8.263566000070049489e-01 8.543453938014868854e-01
+6.129312041392928068e-01 8.300645419348708920e-01 8.566135671784518291e-01
+6.201810118833709362e-01 8.337606033851390208e-01 8.589441737734759830e-01
+6.274752226888651307e-01 8.374461999354567698e-01 8.613371235909390577e-01
+6.348052546879014990e-01 8.411235111538640785e-01 8.637941988526561810e-01
+6.421662450761786989e-01 8.447940336859747212e-01 8.663146822269915948e-01
+6.495514829538971968e-01 8.484597208451428729e-01 8.688988750843767983e-01
+6.569557263949438175e-01 8.521222755106645508e-01 8.715461474797051578e-01
+6.643745794481599187e-01 8.557832593714448377e-01 8.742554091588357057e-01
+6.718027324561179903e-01 8.594444859176019191e-01 8.770260761340837874e-01
+6.792376399817107169e-01 8.631071655185147407e-01 8.798561771298264444e-01
+6.866744996748753715e-01 8.667730629390760777e-01 8.827449654904524490e-01
+6.941118238786820882e-01 8.704431765687035139e-01 8.856901351703097003e-01
+7.015458707010223671e-01 8.741190620646153153e-01 8.886905723641257415e-01
+7.089754732757992395e-01 8.778016574148082007e-01 8.917440383282461136e-01
+7.163982330943452492e-01 8.814922113687924110e-01 8.948489665590808606e-01
+7.238129051546876580e-01 8.851916892315870866e-01 8.980033539675886800e-01
+7.312183003174410612e-01 8.889010427774228784e-01 9.012052612065797330e-01
+7.386131643998257168e-01 8.926212432189428725e-01 9.044528466250297827e-01
+7.459969493141647146e-01 8.963530775374040083e-01 9.077440285167398537e-01
+7.533688986576650981e-01 9.000973872698678768e-01 9.110768604175860652e-01
+7.607282142588290830e-01 9.038550280130126513e-01 9.144494382489702922e-01
+7.680754104857114850e-01 9.076264985347726189e-01 9.178593407704264129e-01
+7.754086380463782735e-01 9.114129489376284754e-01 9.213050832886523489e-01
+7.827298656902449414e-01 9.152144780056820084e-01 9.247836307542580681e-01
+7.900362445563153813e-01 9.190325332798994218e-01 9.282937907772289554e-01
+7.973305798287271262e-01 9.228669845876559252e-01 9.318320585938411060e-01
+8.046093603619434154e-01 9.267195025159972177e-01 9.353972761089011101e-01
+8.118762521869845594e-01 9.305897288106829146e-01 9.389853083637165199e-01
+8.191262403047088192e-01 9.344798221317863751e-01 9.425952041745783161e-01
+8.263649511242520118e-01 9.383888950299160703e-01 9.462215400179357916e-01
+8.335857899787124659e-01 9.423196480542496145e-01 9.498633823775902707e-01
+8.407925617377357552e-01 9.462718000641171523e-01 9.535152044674145566e-01
+8.479820749115867251e-01 9.502471776949116267e-01 9.571737430642662803e-01
+8.551509499643907830e-01 9.542477482079624318e-01 9.608352118692636834e-01
+8.623025919332756306e-01 9.582735696851335527e-01 9.644920284238761576e-01
+8.694298092423108359e-01 9.623279528450340292e-01 9.681401921277593692e-01
+8.765283703934805271e-01 9.664134798374283131e-01 9.717733036205912223e-01
+8.835932645286533882e-01 9.705331352089504593e-01 9.753839343072715495e-01
+8.906174074108087479e-01 9.746907136098538205e-01 9.789640951138071090e-01
+8.975917485137434593e-01 9.788908041054119602e-01 9.825051528035059212e-01
+9.045013427138774986e-01 9.831399005223971921e-01 9.860005773650694083e-01
+9.113300542301955298e-01 9.874449459956177177e-01 9.894442642623689776e-01
+9.180592960081255249e-01 9.918135358838490179e-01 9.928328638314803944e-01]; 
+
+   case 'rai' % rain
+      RGB = [9.345899218079473103e-01 9.308468535401923649e-01 9.527121598234155053e-01
+9.317427384147130009e-01 9.265559169859566291e-01 9.461412847112190549e-01
+9.288323151212234396e-01 9.222903185306413620e-01 9.397258851930316848e-01
+9.259014656554976908e-01 9.180422099085187027e-01 9.333811647328228434e-01
+9.229490910874459386e-01 9.138118271011793636e-01 9.271087656276950639e-01
+9.199777474389575493e-01 9.095987388769878335e-01 9.209029155030628022e-01
+9.169834318717224875e-01 9.054037550731951489e-01 9.147707495523473842e-01
+9.139687227512254264e-01 9.012264798371935060e-01 9.087060404880972220e-01
+9.109285940266572679e-01 8.970679577253415360e-01 9.027176878689184836e-01
+9.078584183128727281e-01 8.929291295619988800e-01 8.968142426813552337e-01
+9.047531063535361184e-01 8.888107271516731966e-01 8.910081776220351024e-01
+9.016111241776750829e-01 8.847109979588536621e-01 8.853222084733923802e-01
+8.984773600020180551e-01 8.806072441106347348e-01 8.798005863890318023e-01
+8.957156578807984326e-01 8.763733055795923654e-01 8.742439953591307766e-01
+8.934429895784954390e-01 8.720376849990935098e-01 8.679132827136474271e-01
+8.911862289430210193e-01 8.677553071034195264e-01 8.611451293770118198e-01
+8.889359451831089221e-01 8.635014856893418189e-01 8.542095914675652546e-01
+8.867116938006094351e-01 8.592609509355686459e-01 8.471741066544885568e-01
+8.845266087736632921e-01 8.550269405833543779e-01 8.400488385945689140e-01
+8.823737459191345334e-01 8.507991274319443020e-01 8.328611900775441113e-01
+8.802551767793974635e-01 8.465759973509723313e-01 8.256144073735601774e-01
+8.781723156295014876e-01 8.423565112404021171e-01 8.183096182593350143e-01
+8.761185057025142608e-01 8.381415609718929627e-01 8.109618862038079357e-01
+8.740930473614691998e-01 8.339308508975332712e-01 8.035739688319240015e-01
+8.720952068860511330e-01 8.297241543120810192e-01 7.961481162736230299e-01
+8.701280658536796331e-01 8.255204305809771270e-01 7.886787238448926818e-01
+8.681860361945246130e-01 8.213205960844648379e-01 7.811769076946536439e-01
+8.662688819092574377e-01 8.171244030607883735e-01 7.736431720476375506e-01
+8.643746025935312716e-01 8.129320197586197283e-01 7.660813810727764572e-01
+8.625034879855904002e-01 8.087431068747142904e-01 7.584907829855329631e-01
+8.606546147206539654e-01 8.045576097831967921e-01 7.508729509413730741e-01
+8.588266729702948021e-01 8.003755742930238615e-01 7.432301838409289818e-01
+8.569623869913148839e-01 7.962191366375533930e-01 7.355859431728856146e-01
+8.550504938518290743e-01 7.920970771858082404e-01 7.278998746292554278e-01
+8.530849581648412006e-01 7.880123772917803082e-01 7.201683837184543746e-01
+8.510553489556228479e-01 7.839691860217244956e-01 7.123959661845170599e-01
+8.489330228346508855e-01 7.799787143731991002e-01 7.045972788504087925e-01
+8.467217087867040526e-01 7.760402896946996254e-01 6.967642500138357953e-01
+8.444094675146763818e-01 7.721590919106836592e-01 6.888992560450724056e-01
+8.419826946126204303e-01 7.683408791881058963e-01 6.810067521686843373e-01
+8.393858369850137890e-01 7.646065720377731578e-01 6.731281946153443441e-01
+8.366346261960659891e-01 7.609512703952114876e-01 6.652451363576846743e-01
+8.336844747046829873e-01 7.573915193569474846e-01 6.573955009267002936e-01
+8.305100496696308232e-01 7.539367518776275423e-01 6.496025429014220531e-01
+8.270795595522559829e-01 7.505979386186598656e-01 6.419039537235261550e-01
+8.233795339766563082e-01 7.473786068829111340e-01 6.343290132703457429e-01
+8.193527781515338448e-01 7.442973494709732574e-01 6.269543660928612594e-01
+8.150187381418861898e-01 7.413436869430644061e-01 6.197992186956774452e-01
+8.103671933740643762e-01 7.385171999523609809e-01 6.129154791955783166e-01
+8.053792270659873020e-01 7.358201042585071905e-01 6.063662921639977332e-01
+8.001091487009975856e-01 7.332281055474541009e-01 6.001460682932164836e-01
+7.945789023747689139e-01 7.307291829728559396e-01 5.942715305031909256e-01
+7.888006960769626819e-01 7.283155171589156263e-01 5.887591680450797726e-01
+7.828500773466386953e-01 7.259575374530320424e-01 5.835578074632412626e-01
+7.767061505166655833e-01 7.236609437130246958e-01 5.786949863565322705e-01
+7.704515166608618681e-01 7.213952841209190225e-01 5.740985082128049477e-01
+7.640735967706561160e-01 7.191644341873529855e-01 5.697767469661422224e-01
+7.576101573082332230e-01 7.169548408227417458e-01 5.656900597267850994e-01
+7.510868163729491620e-01 7.147576249864890929e-01 5.618076267722970085e-01
+7.445073291928260284e-01 7.125716412063957117e-01 5.581177337866775057e-01
+7.378726341804960898e-01 7.103967525656292858e-01 5.546105609434751615e-01
+7.312079622811540336e-01 7.082247740235839695e-01 5.512528292120718598e-01
+7.245223864166319139e-01 7.060527915800670629e-01 5.480303444985812344e-01
+7.178179126910454455e-01 7.038807344069457628e-01 5.449299707841194218e-01
+7.111005957174848513e-01 7.017068393561574080e-01 5.419396078954504814e-01
+7.043748082863551252e-01 6.995299965106114293e-01 5.390480504976655762e-01
+6.976428841540770476e-01 6.973498542230505137e-01 5.362451349156007741e-01
+6.909082389019516324e-01 6.951656049847189101e-01 5.335213672589386169e-01
+6.841729694681116802e-01 6.929769158960692454e-01 5.308681129719833303e-01
+6.774389689374403778e-01 6.907834967201277321e-01 5.282774232028493167e-01
+6.707084440130518521e-01 6.885849153944831880e-01 5.257418638258782861e-01
+6.639830918601468124e-01 6.863809064730829190e-01 5.232546086946955333e-01
+6.572628938239016838e-01 6.841717926007404582e-01 5.208097057295569821e-01
+6.505310175956583452e-01 6.819627798840676158e-01 5.184181252103758908e-01
+6.438052208637921048e-01 6.797486679084566719e-01 5.160591646972285673e-01
+6.370832823378153043e-01 6.775304469295674314e-01 5.137285370282342889e-01
+6.303705085075785863e-01 6.753064791862326555e-01 5.114205507376848869e-01
+6.236618961603839217e-01 6.730786409287115024e-01 5.091324121853675333e-01
+6.169335288716588650e-01 6.708537547863058226e-01 5.068827462564762243e-01
+6.102104324218552422e-01 6.686246254359063945e-01 5.046462757174120517e-01
+6.034898306929903367e-01 6.663922665431509795e-01 5.024201930501221991e-01
+5.967676345670763771e-01 6.641578140003113750e-01 5.002054482667135371e-01
+5.900234330755329548e-01 6.619267690502547152e-01 4.980175294001410458e-01
+5.832786395653163369e-01 6.596933136673572839e-01 4.958328661006338733e-01
+5.765340663187056292e-01 6.574571405303393234e-01 4.936489952759946509e-01
+5.697582662671993869e-01 6.552266499575032377e-01 4.914884851056534054e-01
+5.629730101905379147e-01 6.529958318145387963e-01 4.893302200215370878e-01
+5.561847270851512093e-01 6.507627829419350141e-01 4.871678208383450337e-01
+5.493551097307179942e-01 6.485375215149538075e-01 4.850265872147694890e-01
+5.425256305514831734e-01 6.463076874918682879e-01 4.828887171920029364e-01
+5.356612977693596678e-01 6.440835181737865067e-01 4.807599721985225671e-01
+5.287922197832997107e-01 6.418536560641270317e-01 4.786600904179345028e-01
+5.218850344197893953e-01 6.396291731218471943e-01 4.765733407479101902e-01
+5.149376539505706729e-01 6.374099915253575999e-01 4.745006244225868364e-01
+5.079766080089844760e-01 6.351862479551418916e-01 4.724595195428232253e-01
+5.009755431565769968e-01 6.329662155198152451e-01 4.704378162646060679e-01
+4.939285311779693655e-01 6.307509252620584483e-01 4.684356727521749586e-01
+4.868490205117793068e-01 6.285349533886431805e-01 4.664642845323079823e-01
+4.797346535241335252e-01 6.263183759111613513e-01 4.645235778249863778e-01
+4.725684462540446495e-01 6.241056609282084056e-01 4.626084796977160685e-01
+4.653487483821732718e-01 6.218962626011749206e-01 4.607211778296827487e-01
+4.580958304602617548e-01 6.196828431511897106e-01 4.588752179328909331e-01
+4.507924598809112671e-01 6.174698402959368781e-01 4.570641185207933721e-01
+4.434287999890613730e-01 6.152589986197224414e-01 4.552877084880677105e-01
+4.360045483020283386e-01 6.130492733714320019e-01 4.535480340189612103e-01
+4.285254867993349426e-01 6.108377350391323013e-01 4.518515677783579432e-01
+4.209986373257934011e-01 6.086212623350139017e-01 4.502044135688367255e-01
+4.134050226321455135e-01 6.064040523424363283e-01 4.486012173551829352e-01
+4.057442294957287476e-01 6.041849412176459877e-01 4.470442374703665345e-01
+3.980103804981384719e-01 6.019638983605486438e-01 4.455375274544488007e-01
+3.902063406549050040e-01 5.997389567937310151e-01 4.440824403586798308e-01
+3.823330219069303038e-01 5.975084478594807624e-01 4.426827692274404313e-01
+3.743994820234466392e-01 5.952685939479632760e-01 4.413464089373288490e-01
+3.663895342858319859e-01 5.930221303804210642e-01 4.400695063624517345e-01
+3.583027331816978078e-01 5.907676584219552218e-01 4.388545840675231458e-01
+3.501387968837356146e-01 5.885037242420276815e-01 4.377041322664636525e-01
+3.418974318117430355e-01 5.862288538856508247e-01 4.366206692939140765e-01
+3.335788357145262895e-01 5.839414671596280249e-01 4.356065575056938810e-01
+3.251833166933908448e-01 5.816399536413853211e-01 4.346641338993996184e-01
+3.167127839080131069e-01 5.793224392963164382e-01 4.337951239114763990e-01
+3.081690890879107969e-01 5.769870856598143805e-01 4.330012470667766733e-01
+2.995554017471688812e-01 5.746318865559506550e-01 4.322836619258556556e-01
+2.908749326626684506e-01 5.722548869131893756e-01 4.316434590630243706e-01
+2.821317603555529852e-01 5.698540727656976612e-01 4.310813189213763552e-01
+2.733327132702973450e-01 5.674271544637526921e-01 4.305966557525391369e-01
+2.644844543662756564e-01 5.649720080402284017e-01 4.301888298931589305e-01
+2.555934335426425785e-01 5.624866759386734083e-01 4.298572085857526592e-01
+2.466705752105852745e-01 5.599688410786282100e-01 4.295989836123562111e-01
+2.377250969065505815e-01 5.574166090031631438e-01 4.294119794031988069e-01
+2.287974288505327247e-01 5.548237349096721838e-01 4.292976581628650257e-01
+2.198778468774868489e-01 5.521921840191843511e-01 4.292473634163982976e-01
+2.109782428379559649e-01 5.495207384038700571e-01 4.292558006274433957e-01
+2.021129920761091103e-01 5.468081421831656463e-01 4.293174959448664008e-01
+1.932970840289524594e-01 5.440534055393755342e-01 4.294264526279761851e-01
+1.845458994968318112e-01 5.412558313792091846e-01 4.295762645205056240e-01
+1.758747242186788073e-01 5.384150471574241648e-01 4.297604082769522771e-01
+1.672992650076766952e-01 5.355309682751767664e-01 4.299719066013750202e-01
+1.588637533307953875e-01 5.326007152638789766e-01 4.302077664091210063e-01
+1.505683016211286918e-01 5.296267950764182997e-01 4.304586487604788458e-01
+1.424122559523727238e-01 5.266116064108816719e-01 4.307170632116699704e-01
+1.344085890794944338e-01 5.235562755642496624e-01 4.309766346935359205e-01
+1.265690627070247265e-01 5.204621553185740934e-01 4.312317121888489257e-01
+1.189042023704675322e-01 5.173307669769749984e-01 4.314776038001592595e-01
+1.114246335252623010e-01 5.141637863856259871e-01 4.317091179175960858e-01
+1.041396630107440102e-01 5.109629971472293697e-01 4.319221604647225932e-01
+9.705780332103111641e-02 5.077302369436778040e-01 4.321134999997184867e-01
+9.018737534593762595e-02 5.044674058535019157e-01 4.322799148264460101e-01
+8.353621797943017180e-02 5.011764305824176757e-01 4.324186435951988816e-01
+7.711177607780977938e-02 4.978592446938872595e-01 4.325273326417442554e-01
+7.092118659398483071e-02 4.945177606318418850e-01 4.326041097483195319e-01
+6.497112946544478240e-02 4.911539160136639270e-01 4.326469613219918742e-01
+5.926836252985791947e-02 4.877695081001428012e-01 4.326551664213393877e-01
+5.381952845223608034e-02 4.843663141865421351e-01 4.326279059471102584e-01
+4.863121397792258965e-02 4.809460446320443228e-01 4.325646545440974822e-01
+4.370962682231178259e-02 4.775103648435110038e-01 4.324649641775900610e-01
+3.905112341714592900e-02 4.740608794693825234e-01 4.323285604649402813e-01
+3.496888770654411893e-02 4.705940487017962748e-01 4.321582669839647561e-01
+3.143475353593022659e-02 4.671148853349996188e-01 4.319569510186779815e-01
+2.822939081579376591e-02 4.636310861634273528e-01 4.317228454236091695e-01
+2.532316922257733458e-02 4.601429344885760719e-01 4.314611817794063997e-01
+2.271621196496529868e-02 4.566502451321696188e-01 4.311704916368828688e-01
+2.041021909707332535e-02 4.531526976651161776e-01 4.308500436842361836e-01
+1.840750332198089895e-02 4.496499166924270985e-01 4.304993286811824582e-01
+1.672948316457980103e-02 4.461408970806849950e-01 4.301165746135667267e-01
+1.538958862814012937e-02 4.426249994353490536e-01 4.296990539873294934e-01
+1.435413070644788770e-02 4.391028750771387434e-01 4.292495981309878972e-01
+1.362474263231045098e-02 4.355741563391084537e-01 4.287674174473046218e-01
+1.320277209836126682e-02 4.320384817616971795e-01 4.282516463471394697e-01
+1.308981022524788491e-02 4.284954582700414294e-01 4.277015087056333931e-01
+1.328604261598065328e-02 4.249447744648222614e-01 4.271158498149437155e-01
+1.379162556189269216e-02 4.213861028127094399e-01 4.264935743343106211e-01
+1.460601943539846688e-02 4.178191447440461337e-01 4.258334705527410113e-01
+1.572829683901560624e-02 4.142436086986017174e-01 4.251343095806048300e-01
+1.715690277980158954e-02 4.106592256461835122e-01 4.243947975574930975e-01
+1.888987211594707338e-02 4.070657340951429060e-01 4.236136390627659454e-01
+2.092392860184388512e-02 4.034629389123669529e-01 4.227893563025114654e-01
+2.325551642690237841e-02 3.998506428553240677e-01 4.219205349032726371e-01
+2.587976864011615197e-02 3.962287140215077774e-01 4.210056239775798459e-01
+2.879190433075056593e-02 3.925969951003727698e-01 4.200432223313694258e-01
+3.198535565039070661e-02 3.889554251322902556e-01 4.190317351172953564e-01
+3.545196060096311025e-02 3.853040266354982313e-01 4.179694561300110189e-01
+3.918323414610008770e-02 3.816428245764514893e-01 4.168548033419602339e-01
+4.307413522281567514e-02 3.779718375548203335e-01 4.156863315515785251e-01
+4.697176598438539824e-02 3.742911911603020725e-01 4.144624688814931845e-01
+5.086969232374114608e-02 3.706011159074634187e-01 4.131815676575790186e-01
+5.475506718563923764e-02 3.669018229746837667e-01 4.118421970922833131e-01
+5.861718450656796392e-02 3.631935427420149298e-01 4.104430479071176641e-01
+6.244486447080809660e-02 3.594767157385404532e-01 4.089825820635137332e-01
+6.623026614707036575e-02 3.557516605834906143e-01 4.074596950461942813e-01
+6.998642301215993178e-02 3.520178004091850665e-01 4.058682797037249657e-01
+7.368349105094931795e-02 3.482766831924774542e-01 4.042119944889063232e-01
+7.731558236370641990e-02 3.445288253637411868e-01 4.024900881431115462e-01
+8.087676210173380675e-02 3.407748586458358986e-01 4.007018083483494530e-01
+8.436223121714692130e-02 3.370153951525706182e-01 3.988466436336530196e-01
+8.776750670667690657e-02 3.332510976549885595e-01 3.969242240138116662e-01
+9.108869400118912996e-02 3.294826406371675898e-01 3.949343703704463748e-01
+9.432201977980475549e-02 3.257107550258697137e-01 3.928770441587735585e-01
+9.746469555428810549e-02 3.219361155964274857e-01 3.907524596946260753e-01
+1.005137065660947904e-01 3.181594785366577693e-01 3.885609392070024093e-01
+1.034667829102825787e-01 3.143815541170876804e-01 3.863030299565164416e-01
+1.063234262084384596e-01 3.106029224571804637e-01 3.839789892033815266e-01
+1.090886774331554510e-01 3.068237947954853828e-01 3.815863917579840892e-01
+1.117516829166099457e-01 3.030455295972052654e-01 3.791303642957770670e-01
+1.143116567201993838e-01 2.992687663919490482e-01 3.766121406045498943e-01
+1.167670145114603486e-01 2.954942819265780063e-01 3.740330281243106070e-01
+1.191180972380510850e-01 2.917225736922783308e-01 3.713945692144456912e-01
+1.213648735453208283e-01 2.879541937006656616e-01 3.686983734293431958e-01
+1.235072626972245069e-01 2.841897016932966036e-01 3.659461400710485868e-01
+1.255450172977832790e-01 2.804296856157670326e-01 3.631396556775801088e-01
+1.274793353662031781e-01 2.766744826581494787e-01 3.602808188600382100e-01
+1.293108779906596839e-01 2.729245043006408022e-01 3.573715653564341621e-01
+1.310404714307908669e-01 2.691801184313953876e-01 3.544138839210129732e-01
+1.326690608188904053e-01 2.654416544155482338e-01 3.514098053356367601e-01
+1.341977870856449484e-01 2.617093858425083575e-01 3.483613905337877847e-01
+1.356276601953987637e-01 2.579835900091309586e-01 3.452707288070074876e-01
+1.369600353052619901e-01 2.542644558590421155e-01 3.421399178935836116e-01
+1.381965371841252788e-01 2.505520924183904374e-01 3.389710465513224302e-01
+1.393387446776407912e-01 2.468465884786986142e-01 3.357661977904279893e-01
+1.403881322096931505e-01 2.431480256484742086e-01 3.325274517113971373e-01
+1.413463644264434660e-01 2.394564173026069165e-01 3.292568607367298839e-01
+1.422150204492807768e-01 2.357717647764656088e-01 3.259564633033559256e-01
+1.430241411872627821e-01 2.320878753057155075e-01 3.226241875019154048e-01
+1.437206808568328997e-01 2.284105260214233102e-01 3.193108148264102164e-01
+1.443167183567656553e-01 2.247376722352139033e-01 3.160160321612740519e-01
+1.448172234122950819e-01 2.210687136739122871e-01 3.127401980544551319e-01
+1.452270337553944191e-01 2.174029799543943375e-01 3.094836465796388381e-01
+1.455503303753529210e-01 2.137398650159642033e-01 3.062467330039463920e-01
+1.457916124736327868e-01 2.100785929129088681e-01 3.030297495827782850e-01
+1.459553844105018761e-01 2.064182886269750883e-01 2.998329600953320573e-01
+1.460450738341802501e-01 2.027582683855788659e-01 2.966566757283218836e-01
+1.460639705951699008e-01 1.990978105534875198e-01 2.935011720342979302e-01
+1.460132039806032178e-01 1.954367333080272440e-01 2.903667875231270012e-01
+1.458975819392981654e-01 1.917737643090239308e-01 2.872535927880979223e-01
+1.457218019293262112e-01 1.881075422549224607e-01 2.841616643549851884e-01
+1.454887645921259243e-01 1.844371298576089335e-01 2.810911343097461934e-01
+1.452032543446299950e-01 1.807609202544633309e-01 2.780420590388025248e-01
+1.448676044101755434e-01 1.770779511005421691e-01 2.750145417929056313e-01
+1.444780219943526678e-01 1.733892008568175547e-01 2.720086027887532176e-01
+1.440413431328422811e-01 1.696921848838350289e-01 2.690241039839223469e-01
+1.435643975093518765e-01 1.659841914110155581e-01 2.660610427935709565e-01
+1.430436238988290198e-01 1.622659427289601941e-01 2.631191819624335571e-01
+1.424820569142489501e-01 1.585358695252926109e-01 2.601982981359077240e-01
+1.418869430340855831e-01 1.547906985932924473e-01 2.572984244859990999e-01
+1.412504255878399562e-01 1.510326235840303566e-01 2.544186879929528633e-01
+1.405847553781910952e-01 1.472562100690701925e-01 2.515594367076940396e-01
+1.398866955406879442e-01 1.434617145934828086e-01 2.487199683062358835e-01
+1.391555552990901834e-01 1.396484041206631221e-01 2.458995874149805250e-01
+1.383972370289156262e-01 1.358126929549585971e-01 2.430982825013351944e-01
+1.376119899169210015e-01 1.319530974585303440e-01 2.403154706816485464e-01
+1.368012914537950486e-01 1.280674462139133607e-01 2.375506853082148262e-01
+1.359688085852648887e-01 1.241523347647442155e-01 2.348038243218179000e-01
+1.351079666263714507e-01 1.202088638287985289e-01 2.320731097859522474e-01
+1.342294527149119343e-01 1.162298274455028368e-01 2.293596493763065958e-01
+1.333340174081290574e-01 1.122121767595207487e-01 2.266630565550546428e-01
+1.324249399956005380e-01 1.081511805079039545e-01 2.239835024348004189e-01
+1.315721561940036699e-01 1.040055590640546201e-01 2.213363669373892839e-01];
+
+   case {'dem','top'} % dem or topo
+      RGB = [1.561019746507273376e-01 1.026082525875711138e-01 1.727215696232307918e-01
+1.614878059346168959e-01 1.086331782717616379e-01 1.834416540200605461e-01
+1.668117590877864764e-01 1.145994139402238821e-01 1.942594655847655616e-01
+1.720703275074147443e-01 1.205129174047056828e-01 2.051860710532931176e-01
+1.772595702951434704e-01 1.263792859047284667e-01 2.162309361702130506e-01
+1.823751828761793481e-01 1.322038111876145949e-01 2.274020989868827392e-01
+1.874125186315797886e-01 1.379915476831030108e-01 2.387062880680187460e-01
+1.923665760685599468e-01 1.437473901381048913e-01 2.501489823140411461e-01
+1.972319620276792862e-01 1.494761585027865047e-01 2.617344119314569673e-01
+2.020028382233076125e-01 1.551826890051333785e-01 2.734655011163185101e-01
+2.066728560428846562e-01 1.608719311731062473e-01 2.853437530392856081e-01
+2.112350828916275125e-01 1.665490510713014960e-01 2.973690772834624574e-01
+2.156819223383368844e-01 1.722195412332822306e-01 3.095395593647118360e-01
+2.200027865362182422e-01 1.778889096627078448e-01 3.218593457818205161e-01
+2.241821302892643142e-01 1.835626593748518609e-01 3.343431537784405938e-01
+2.282155151615900546e-01 1.892493734782149939e-01 3.469585312854190362e-01
+2.320913707908846546e-01 1.949572807641995476e-01 3.596924727656225507e-01
+2.357791582066215419e-01 2.006936504843463420e-01 3.725810406048237766e-01
+2.392760085101002243e-01 2.064712127546999287e-01 3.855616338648150121e-01
+2.425474613143962510e-01 2.123011804696942062e-01 3.986531809377649171e-01
+2.455817950644241798e-01 2.181991605590304917e-01 4.117955160707330586e-01
+2.483306606950595463e-01 2.241817667402334346e-01 4.250033167249620547e-01
+2.507721436866522935e-01 2.302701237479483076e-01 4.382036814126420432e-01
+2.528659964243425984e-01 2.364882912834416206e-01 4.513446141213755536e-01
+2.545675711557803811e-01 2.428643843006248471e-01 4.643557571030281772e-01
+2.558322794870629413e-01 2.494300496133808887e-01 4.771399728195321877e-01
+2.566151212870083631e-01 2.562195453869526296e-01 4.895770754997314511e-01
+2.568729082739400482e-01 2.632680806498599591e-01 5.015251413221865073e-01
+2.566051651711689918e-01 2.706008890121900934e-01 5.127963599343589030e-01
+2.558254018044066047e-01 2.782328077909240194e-01 5.232189983935346955e-01
+2.545978636988186494e-01 2.861560770732184955e-01 5.326370186681820273e-01
+2.530378388279626023e-01 2.943355684042912035e-01 5.409499814033098541e-01
+2.512817651002536290e-01 3.027167370222472731e-01 5.481422664464320471e-01
+2.494682375867288693e-01 3.112353605277175528e-01 5.542766318947622839e-01
+2.477157002362878613e-01 3.198299095156284522e-01 5.594704462476630669e-01
+2.461121481740833894e-01 3.284495884603169102e-01 5.638648470620498676e-01
+2.447220255685461088e-01 3.370546900675063240e-01 5.676029832475817383e-01
+2.435790408918375727e-01 3.456199709880173332e-01 5.708127541670769967e-01
+2.426978313653707087e-01 3.541305556383861908e-01 5.736016010478480753e-01
+2.420946965383475313e-01 3.625739944720036134e-01 5.760653956197256953e-01
+2.417595622535183009e-01 3.709493751547713325e-01 5.782729391945388153e-01
+2.416897018162703636e-01 3.792548337300427064e-01 5.802858143751018494e-01
+2.418784445905285962e-01 3.874910027793410650e-01 5.821542521747482546e-01
+2.423091294682429564e-01 3.956627542073260506e-01 5.839131390484204598e-01
+2.429695407602900925e-01 4.037738393736669540e-01 5.855939512690606641e-01
+2.438461792188084676e-01 4.118287207942545325e-01 5.872218507211212080e-01
+2.449256139784778408e-01 4.198319765418777605e-01 5.888176525512366366e-01
+2.461926332303804310e-01 4.277888629705645096e-01 5.903967722170088139e-01
+2.476314436738927260e-01 4.357048438328084417e-01 5.919706842419948378e-01
+2.492275176071283571e-01 4.435849323073600692e-01 5.935491293785424283e-01
+2.509665668417216944e-01 4.514340415062205181e-01 5.951395103673859932e-01
+2.528346862021874641e-01 4.592569393176054171e-01 5.967472668238706923e-01
+2.548184740794410263e-01 4.670582183399953347e-01 5.983761730113198452e-01
+2.569051367797046126e-01 4.748422758923547815e-01 6.000285749995881712e-01
+2.590825816132030779e-01 4.826133005480903182e-01 6.017055804809932074e-01
+2.613396987489819967e-01 4.903751992421883643e-01 6.034074237284018372e-01
+2.636659810857353015e-01 4.981317406526836744e-01 6.051330956906521008e-01
+2.660516582874621339e-01 5.058865272594796902e-01 6.068805013837572648e-01
+2.684882380171457750e-01 5.136428405367017280e-01 6.086470522439324515e-01
+2.709683308416185876e-01 5.214037172983150281e-01 6.104294711750373192e-01
+2.734857257205313141e-01 5.291719440816851083e-01 6.122238564648385672e-01
+2.760354668808263079e-01 5.369500509042623992e-01 6.140257392505246159e-01
+2.786139324558262742e-01 5.447403043452749838e-01 6.158301364812402978e-01
+2.812189151446758406e-01 5.525446999518639490e-01 6.176316008625786225e-01
+2.838497050469647731e-01 5.603649539888247988e-01 6.194242689076802089e-01
+2.865071747347951447e-01 5.682024945496734203e-01 6.212019079466474247e-01
+2.891935293105973304e-01 5.760585509806988025e-01 6.229575870601862242e-01
+2.919132661023912667e-01 5.839338872257091584e-01 6.246846842638799080e-01
+2.946726143633343065e-01 5.918289843891730850e-01 6.263762188290394883e-01
+2.974797079780254205e-01 5.997440045832753697e-01 6.280249877540684533e-01
+3.003447193279823457e-01 6.076787658883653354e-01 6.296236627075371128e-01
+3.032799496578738041e-01 6.156327286641396501e-01 6.311648425953061414e-01
+3.062999162775806861e-01 6.236049805794583456e-01 6.326411091031564071e-01
+3.094214341373541788e-01 6.315942201545601264e-01 6.340450861601970578e-01
+3.126636885203824545e-01 6.395987386132337971e-01 6.353695045172913503e-01
+3.160482946464280851e-01 6.476163998706647718e-01 6.366072729215248582e-01
+3.195993388733257556e-01 6.556446185422359907e-01 6.377515576836865208e-01
+3.233433949344308722e-01 6.636803359579184214e-01 6.387958727683986648e-01
+3.273095072934468774e-01 6.717199943156246800e-01 6.397341828681051279e-01
+3.315291322901112725e-01 6.797595093162658308e-01 6.405610222271946874e-01
+3.360351011011302735e-01 6.877945827659479594e-01 6.412695960850323118e-01
+3.408640318201912600e-01 6.958197818437616977e-01 6.418569321473704958e-01
+3.460540467004642462e-01 7.038291754672099110e-01 6.423205839967465192e-01
+3.516446005650431528e-01 7.118162697085735902e-01 6.426589560156208414e-01
+3.576762479926827720e-01 7.197739138067411613e-01 6.428719883285997083e-01
+3.641894512092864744e-01 7.276949011320993366e-01 6.429557270674552960e-01
+3.712266123106295335e-01 7.355700686179795778e-01 6.429189618774799886e-01
+3.788278449989629926e-01 7.433902546660990929e-01 6.427683061328856029e-01
+3.870322615152646528e-01 7.511462095764531721e-01 6.425055472082883412e-01
+3.958750262046074608e-01 7.588270315806920907e-01 6.421508285001665817e-01
+4.053883482522956383e-01 7.664223146281371468e-01 6.417151578859574546e-01
+4.155968407812616339e-01 7.739210344346504344e-01 6.412227317683711902e-01
+4.265195639210723755e-01 7.813124732411278472e-01 6.406960731925235297e-01
+4.381634653667463852e-01 7.885863788123392837e-01 6.401694292235835526e-01
+4.505287643111087204e-01 7.957333261733031682e-01 6.396742566585853496e-01
+4.635986539031755060e-01 8.027456073395251579e-01 6.392548734619343254e-01
+4.773469739538908629e-01 8.096172922533247940e-01 6.389538165444101914e-01
+4.917330703220189059e-01 8.163450533427777378e-01 6.388184799685107107e-01
+5.067050118087177424e-01 8.229283397233977393e-01 6.388963162980869637e-01
+5.221997330825246530e-01 8.293697946738645133e-01 6.392346216632595057e-01
+5.381481232862911357e-01 8.356748924828519831e-01 6.398763669277579558e-01
+5.544783665092802849e-01 8.418515860497588488e-01 6.408587965640016870e-01
+5.711115213696185133e-01 8.479112775740021979e-01 6.422171169895777298e-01
+5.879840953182007279e-01 8.538646600753627691e-01 6.439710905713145195e-01
+6.050194699551968425e-01 8.597270135144634562e-01 6.461439080647282118e-01
+6.221681809999368706e-01 8.655099786991408140e-01 6.487403091120448329e-01
+6.393757001353049807e-01 8.712277338509245572e-01 6.517658303256151919e-01
+6.565929334411800822e-01 8.768947704523611941e-01 6.552210497573525139e-01
+6.737933070789577927e-01 8.825213731875580780e-01 6.590961736178440056e-01
+6.909478082204841831e-01 8.881191135591984809e-01 6.633823202371271766e-01
+7.080340865696405084e-01 8.936985513356989763e-01 6.680678941563225059e-01
+7.250358375800118882e-01 8.992691342626382145e-01 6.731393536848668813e-01
+7.419421046029871514e-01 9.048391559449654453e-01 6.785819005039074314e-01
+7.587465580267132026e-01 9.104157595099175992e-01 6.843800748081978469e-01
+7.754467945117471395e-01 9.160049747102424478e-01 6.905182510191696377e-01
+7.920436855303579771e-01 9.216117772405966191e-01 6.969810377273069069e-01
+8.085407925860420564e-01 9.272401607530683654e-01 7.037535913222745521e-01
+8.249438571064254822e-01 9.328932140048489252e-01 7.108218561594963347e-01
+8.412422934868647451e-01 9.385792958890862847e-01 7.181734629573161000e-01
+8.574559441871676402e-01 9.442965454208677167e-01 7.257948454644865821e-01
+8.735986658557798323e-01 9.500445573198598170e-01 7.336747582572585857e-01
+8.896512126622908578e-01 9.558344072358454513e-01 7.418023698547455691e-01
+9.056514559384564178e-01 9.616567079910524063e-01 7.501688017241657791e-01
+9.215850348376466439e-01 9.675205198521025229e-01 7.587646801057830181e-01
+9.374799177499437697e-01 9.734191074102575003e-01 7.675843461643131471e-01
+9.533233708513803029e-01 9.793607550577946297e-01 7.766197776697654209e-01
+9.691488355955474310e-01 9.853357520972024775e-01 7.858697059005903540e-01
+9.849374457410008388e-01 9.913545172197536504e-01 7.953271573982337861e-01
+5.237510688652501772e-02 1.452546228317073418e-01 7.751950190923809214e-02
+5.622628551680566161e-02 1.523457500722602831e-01 8.040279400454641845e-02
+6.007072166263575236e-02 1.593963705834963718e-01 8.324827330002768089e-02
+6.385205670255669763e-02 1.664232541404700172e-01 8.599651952193751447e-02
+6.756460338718012215e-02 1.734310951493893138e-01 8.864073081078854832e-02
+7.121409992638502717e-02 1.804216402085259963e-01 9.118655316732873772e-02
+7.479859509186639888e-02 1.873981595163995706e-01 9.363114185870033412e-02
+7.832196854697648369e-02 1.943623428359516903e-01 9.597819921125996800e-02
+8.178249510428708957e-02 2.013169715395964343e-01 9.822505767280115263e-02
+8.518219102467458614e-02 2.082637805063026204e-01 1.003733079455831900e-01
+8.852454157738801066e-02 2.152040105951080751e-01 1.024263253707545229e-01
+9.181013978863614144e-02 2.221394247672267563e-01 1.043841327744766678e-01
+9.503809838243432173e-02 2.290719902760253168e-01 1.062449430282469132e-01
+9.821010670676499910e-02 2.360029705984670323e-01 1.080100113958255836e-01
+1.013286574784400540e-01 2.429333482333665417e-01 1.096815914631605327e-01
+1.043934471701543076e-01 2.498646410896294690e-01 1.112585290437959340e-01
+1.074478296880792549e-01 2.567911108934768372e-01 1.127437202480449374e-01
+1.106260709129789077e-01 2.636946096457899458e-01 1.140997527427590474e-01
+1.139531706355643714e-01 2.705743606077580798e-01 1.152896296272559462e-01
+1.174768136636618332e-01 2.774250521408649361e-01 1.162908535730605153e-01
+1.213000971217181034e-01 2.842316842811704602e-01 1.170941428738193346e-01
+1.255340801183247312e-01 2.909784812573655843e-01 1.176678790007481823e-01
+1.303876420091158728e-01 2.976323416853482451e-01 1.179910028329904936e-01
+1.361775080109454139e-01 3.041399107394244794e-01 1.180416347026809198e-01
+1.434815209152097981e-01 3.103930959766884601e-01 1.179050440739785321e-01
+1.530522840464018097e-01 3.162194219215394564e-01 1.180658427800789778e-01
+1.647443020935283886e-01 3.215541086259602332e-01 1.195833209716834211e-01
+1.771224001134716619e-01 3.266051714744359624e-01 1.228383029974784990e-01
+1.893186680349762951e-01 3.315543486926041949e-01 1.273271390832197980e-01
+2.011470216295637714e-01 3.364693524047602802e-01 1.325809211223410999e-01
+2.126201126913634942e-01 3.413717760208538898e-01 1.383257062913032798e-01
+2.237814929443558420e-01 3.462703085838705896e-01 1.444001987716135027e-01
+2.346826504126838242e-01 3.511667839317458850e-01 1.507119862068962424e-01
+2.453653984352425765e-01 3.560619397292786315e-01 1.572020472843533856e-01
+2.558610883411705506e-01 3.609568875025493395e-01 1.638280010474283122e-01
+2.662540618029768935e-01 3.658464720551902194e-01 1.703646574946249270e-01
+2.766375890957337713e-01 3.707202928157689592e-01 1.766042606681927363e-01
+2.870120792807265286e-01 3.755815421723879277e-01 1.825448147300349488e-01
+2.973798701367175723e-01 3.804331662296118188e-01 1.881754975600970214e-01
+3.077385714853347887e-01 3.852782482569529487e-01 1.935061166107706343e-01
+3.180883154404229307e-01 3.901193934855016199e-01 1.985393196990216658e-01
+3.284295845809043213e-01 3.949589033692603168e-01 2.032788009798182638e-01
+3.387636524478269684e-01 3.997986013442899611e-01 2.077297610727937283e-01
+3.490920713533000597e-01 4.046399832445768951e-01 2.118988339848660862e-01
+3.594164000962936090e-01 4.094843090462684243e-01 2.157940430809284771e-01
+3.697392907451491073e-01 4.143322752680254073e-01 2.194241817700406383e-01
+3.800629535453087238e-01 4.191845097543299148e-01 2.227990620346612660e-01
+3.903897648146955057e-01 4.240414062699767728e-01 2.259290789901750585e-01
+4.007222760346346169e-01 4.289031445516293117e-01 2.288249032905495528e-01
+4.110629393231473583e-01 4.337698031247444463e-01 2.314973656174672545e-01
+4.214141346107081465e-01 4.386413758769234783e-01 2.339572260458537833e-01
+4.317776944235289238e-01 4.435179532313937023e-01 2.362153631413001498e-01
+4.421554582272910761e-01 4.483995629988481446e-01 2.382822640902987343e-01
+4.525491728091692312e-01 4.532862202325000367e-01 2.401679621083726013e-01
+4.629617793452492358e-01 4.581777295849584486e-01 2.418766613523773423e-01
+4.733964081044912953e-01 4.630738873787103027e-01 2.434097398165305792e-01
+4.838512407114513025e-01 4.679753825260214994e-01 2.447870115640884969e-01
+4.943280333549550654e-01 4.728822194350857377e-01 2.460147775573224282e-01
+5.048329973069679566e-01 4.777936355059679285e-01 2.470786486003125892e-01
+5.153613297132805249e-01 4.827109910092828859e-01 2.480074378391989298e-01
+5.259177888805488532e-01 4.876337443949864681e-01 2.487920646168808037e-01
+5.365028531047130178e-01 4.925622747803105050e-01 2.494384427855986242e-01
+5.471168004411860464e-01 4.974969337464568153e-01 2.499544447192391661e-01
+5.577636102245655536e-01 5.024372790562059432e-01 2.503320304175396527e-01
+5.684402705004985012e-01 5.073846875194365502e-01 2.505862169320990929e-01
+5.791517884291441653e-01 5.123382474891868821e-01 2.507078127142677859e-01
+5.898977118592134694e-01 5.172986884163369714e-01 2.507019666506383193e-01
+6.006780609928230596e-01 5.222664305265023454e-01 2.505758843768319810e-01
+6.114977839232860202e-01 5.272408795639659251e-01 2.503116806147138718e-01
+6.223533151135658414e-01 5.322233326069301107e-01 2.499311738427514862e-01
+6.332678499493179514e-01 5.372050254585409856e-01 2.494034423308610915e-01
+6.442492302385145475e-01 5.421770814367210534e-01 2.488390322915944863e-01
+6.553235853574364000e-01 5.471283166651099705e-01 2.482154543042252026e-01
+6.664663550324848584e-01 5.520678623990600276e-01 2.475959486163559209e-01
+6.777036161655425328e-01 5.569846941304811283e-01 2.469507035732461664e-01
+6.890381603900364027e-01 5.618763691265282745e-01 2.463040749474359470e-01
+7.004711944468632323e-01 5.667403668940831363e-01 2.456991151603213352e-01
+7.120126265469914895e-01 5.715693590145963787e-01 2.451873584080898616e-01
+7.236929482815777082e-01 5.763444689764196660e-01 2.448364505953754544e-01
+7.355168651190714391e-01 5.810504769862679941e-01 2.449163925191181757e-01
+7.475258033710173722e-01 5.856296804733571726e-01 2.462013043800762579e-01
+7.577499494457186069e-01 5.908503548553694085e-01 2.547905571379186496e-01
+7.635824979182088690e-01 5.981540408918001317e-01 2.695060335496625714e-01
+7.685008057442868079e-01 6.059656669084559910e-01 2.841339736308181596e-01
+7.731069113227515555e-01 6.139683821427790456e-01 2.985534874705023101e-01
+7.775652489236080100e-01 6.220751351043045663e-01 3.127742014086093980e-01
+7.819223609772602002e-01 6.302590951035305089e-01 3.268597741416817137e-01
+7.862053950616281206e-01 6.385051507786967395e-01 3.408479839175493908e-01
+7.904426037822046558e-01 6.467997885569605199e-01 3.547436291978552925e-01
+7.946574580110756791e-01 6.551326370117361853e-01 3.685463547975237342e-01
+7.988337796012735526e-01 6.635096250178373900e-01 3.823162323281250607e-01
+8.030088001380106810e-01 6.719161948372565085e-01 3.960118210517307724e-01
+8.071531032877933276e-01 6.803638144055433878e-01 4.097046504341926854e-01
+8.113041001849377043e-01 6.888386707654255980e-01 4.233460558902438220e-01
+8.154602754828877975e-01 6.973419981167042758e-01 4.369537331203900976e-01
+8.196058627154122478e-01 7.058802025749554288e-01 4.505666902424197429e-01
+8.237568818874844156e-01 7.144480574336203871e-01 4.641691373089507633e-01
+8.279197418246522222e-01 7.230440823922363869e-01 4.777602014010458586e-01
+8.320913582455962132e-01 7.316701160638459100e-01 4.913552497157864241e-01
+8.362534254444016213e-01 7.403317836360435722e-01 5.050123599879642322e-01
+8.404445466425872757e-01 7.490163102116410565e-01 5.186797759271363217e-01
+8.446648066780128028e-01 7.577248034134459465e-01 5.323633003798176055e-01
+8.489177724746317377e-01 7.664572638824626027e-01 5.460621193928290040e-01
+8.532123511454875464e-01 7.752120992980529035e-01 5.597655879096986586e-01
+8.575441658298394998e-01 7.839918355417494489e-01 5.734875036821195371e-01
+8.619146064360614368e-01 7.927971784487287676e-01 5.872309291049341295e-01
+8.663250853209770730e-01 8.016288174204664330e-01 6.009988751772729065e-01
+8.707820725499390013e-01 8.104859794311163323e-01 6.147852119944903215e-01
+8.752928841127598503e-01 8.193677275097041024e-01 6.285824125979521115e-01
+8.798495959466368088e-01 8.282774528639023082e-01 6.424105990843714808e-01
+8.844600743726268588e-01 8.372140407050960853e-01 6.562614074750376947e-01
+8.891318088448872947e-01 8.461765685160849149e-01 6.701273264224787418e-01
+8.938558100770686021e-01 8.551685709847908212e-01 6.840307207014526547e-01
+8.986544949798678239e-01 8.641851727809914951e-01 6.979374582474833222e-01
+9.035103927619371200e-01 8.732320822602240851e-01 7.118855904188222672e-01
+9.084448340107732500e-01 8.823048446731206473e-01 7.258432784575933328e-01
+9.134526188903524524e-01 8.914059055188421343e-01 7.398268438202468822e-01
+9.185353828258727704e-01 9.005358905803305669e-01 7.538405390559674846e-01
+9.237018976170942031e-01 9.096936780016002810e-01 7.678758238575987827e-01
+9.289597403884261029e-01 9.188785152907725795e-01 7.819264008239902308e-01
+9.343121189309133712e-01 9.280907276838803455e-01 7.959940980655445530e-01
+9.397648981125013012e-01 9.373300331729016444e-01 8.100759042872343052e-01
+9.453185269797627077e-01 9.465973949550759992e-01 8.241789901926560580e-01
+9.509801771850346919e-01 9.558922732509941289e-01 8.382978631896051969e-01
+9.567560362262098606e-01 9.652144306850017896e-01 8.524284880105463813e-01
+9.626518136622860267e-01 9.745638255706342568e-01 8.665671328953633568e-01
+9.686647318914142213e-01 9.839422330504176140e-01 8.807260550903986962e-01
+9.747892173640951841e-01 9.933519398287798952e-01 8.949228432580742520e-01];
+
+   case 'dif' % diff
+      RGB = [3.080165225110909760e-02 1.368487040065790861e-01 2.498464445599150041e-01
+3.427654989146505099e-02 1.437127028532935447e-01 2.573239494162229413e-01
+3.787813715751361943e-02 1.505402390894255427e-01 2.647902048135927777e-01
+4.156812010333730406e-02 1.573357824203455158e-01 2.722473736730874894e-01
+4.517179532760850352e-02 1.641035092921928340e-01 2.796979818302940402e-01
+4.870180895529663961e-02 1.708454227759541588e-01 2.871401983091831367e-01
+5.214717289956722485e-02 1.775659175978645810e-01 2.945787303179320804e-01
+5.551364141943334468e-02 1.842674761732781552e-01 3.020142881481510666e-01
+5.878267145509050856e-02 1.909546841623958602e-01 3.094531346302050734e-01
+6.203222237219494645e-02 1.976272549553735325e-01 3.168486096722107348e-01
+6.521944756836103863e-02 2.042923786219034143e-01 3.242073651148437707e-01
+6.833928990190613062e-02 2.109538539883098474e-01 3.315240779733869547e-01
+7.142525636138788436e-02 2.176109417067573770e-01 3.387875021305949974e-01
+7.444813366291075374e-02 2.242694950814881905e-01 3.459978826653878348e-01
+7.742364240945528997e-02 2.309308575473027481e-01 3.531440825838942366e-01
+8.038349666926730697e-02 2.375958135712563091e-01 3.602034285272879832e-01
+8.335927002300280719e-02 2.442657843736594225e-01 3.671480689795030838e-01
+8.636609239069936717e-02 2.509437864845217581e-01 3.739531368808389766e-01
+8.948430357745071340e-02 2.576279992007458053e-01 3.805657110274591748e-01
+9.284058523033036914e-02 2.643149709823168769e-01 3.868990078988859826e-01
+9.668345778728781870e-02 2.709875997226547928e-01 3.928398106800405909e-01
+1.013388564145758508e-01 2.776155815858447617e-01 3.982760426582682145e-01
+1.072606416994524026e-01 2.841399259508246011e-01 4.031326823215036770e-01
+1.144021508332261350e-01 2.905306843282992602e-01 4.075704938470787742e-01
+1.224943240061644456e-01 2.967876633109050588e-01 4.117594183512530703e-01
+1.310866885733582565e-01 3.029446515900964254e-01 4.158631835078765437e-01
+1.399259448624195767e-01 3.090284381668210734e-01 4.199407082636338884e-01
+1.488880808179499637e-01 3.150548708758020844e-01 4.240166515702193939e-01
+1.578509724192573571e-01 3.210422517899584882e-01 4.281197299059529837e-01
+1.668002459411131178e-01 3.269969805380745775e-01 4.322421588278035354e-01
+1.756791094481522930e-01 3.329300099876690844e-01 4.364047384684796027e-01
+1.845067584338563049e-01 3.388436977327556332e-01 4.405895801655569377e-01
+1.932823885204988379e-01 3.447414431949823999e-01 4.447966430522279913e-01
+2.019870459778479455e-01 3.506290556082184984e-01 4.490357338061347625e-01
+2.106258150884706692e-01 3.565090549124025343e-01 4.533046032331278785e-01
+2.192099721057354511e-01 3.623829850143509002e-01 4.575959954859014078e-01
+2.277275445301833456e-01 3.682546023486205078e-01 4.619233127548696971e-01
+2.361939130992141700e-01 3.741245762230066552e-01 4.662760464071296629e-01
+2.446124256489054516e-01 3.799946234495278352e-01 4.706542744097454434e-01
+2.529874638889413330e-01 3.858660993963552444e-01 4.750577339190826254e-01
+2.613341048773878406e-01 3.917383910736120800e-01 4.794796637798960925e-01
+2.696394299537646644e-01 3.976153747948966699e-01 4.839303534081906277e-01
+2.779049881050036919e-01 4.034985563305431566e-01 4.884111449080716372e-01
+2.861363993124647065e-01 4.093887667782184492e-01 4.929196308795206760e-01
+2.943389940220551004e-01 4.152865778556348864e-01 4.974548265548736636e-01
+3.025334250389247748e-01 4.211897194688838386e-01 5.020046120542877022e-01
+3.106982442651501364e-01 4.271034039757660716e-01 5.065852469354352738e-01
+3.188368260273997667e-01 4.330284571606364818e-01 5.111959566876937977e-01
+3.269657343217935996e-01 4.389628772920392552e-01 5.158284147455556301e-01
+3.350816436419064015e-01 4.449085811856242079e-01 5.204856000258065718e-01
+3.431739289326510289e-01 4.508688325370560634e-01 5.251766674651570099e-01
+3.512656069646695189e-01 4.568402506918622374e-01 5.298868083741347101e-01
+3.593506132834142774e-01 4.628250736129231879e-01 5.346217853574988244e-01
+3.674172478556836929e-01 4.688267836740107053e-01 5.393913336663840319e-01
+3.754973469427250743e-01 4.748398228270848676e-01 5.441739055327718955e-01
+3.835625614368970981e-01 4.808709517650425203e-01 5.489922576544932209e-01
+3.916201861820892138e-01 4.869196696786777800e-01 5.538424587653016928e-01
+3.996888560566008164e-01 4.929829902359726401e-01 5.587113837570589769e-01
+4.077452976164708254e-01 4.990668992329919118e-01 5.636172499463452112e-01
+4.158238363550112449e-01 5.051647578473101863e-01 5.685356950340605398e-01
+4.238869442834262147e-01 5.112855069066921665e-01 5.734980302852201728e-01
+4.319617699154935098e-01 5.174241819464946435e-01 5.784833267853278782e-01
+4.400436018491948320e-01 5.235826893170786311e-01 5.834960386464431714e-01
+4.481312796407512233e-01 5.297621053719542283e-01 5.885383546494945550e-01
+4.562263279894743229e-01 5.359626809225542798e-01 5.936121659102355785e-01
+4.643239808635050703e-01 5.421865887597332456e-01 5.987202656129063660e-01
+4.724486870344450362e-01 5.484289164378903791e-01 6.038441893417568762e-01
+4.805822297704738788e-01 5.546948405817618832e-01 6.089980501349065989e-01
+4.887172410474664441e-01 5.609869159623338541e-01 6.141889435023867305e-01
+4.968703980230008699e-01 5.673022611108096136e-01 6.194017678807255400e-01
+5.050230443352835552e-01 5.736457002325791033e-01 6.246566996141469374e-01
+5.132020014296254651e-01 5.800120364495556791e-01 6.299281926614284099e-01
+5.213837697997298903e-01 5.864072076681272616e-01 6.352414056079356275e-01
+5.295840791882617804e-01 5.928284223714805901e-01 6.405818144094436173e-01
+5.377985006631785803e-01 5.992773867217912054e-01 6.459553074236056291e-01
+5.460310568089291605e-01 6.057538951510261782e-01 6.513591302487201640e-01
+5.542803602235417681e-01 6.122589708601943181e-01 6.567960616850564426e-01
+5.625427909572455754e-01 6.187941687382881861e-01 6.622712272448196824e-01
+5.708318382965930082e-01 6.253570561449082188e-01 6.677719395169281480e-01
+5.791326606499368479e-01 6.319518087895650282e-01 6.733150010032186161e-01
+5.874594162608378634e-01 6.385758077347706285e-01 6.788869295566190010e-01
+5.958021954354665306e-01 6.452321052037962579e-01 6.844994504225663245e-01
+6.041669493667392032e-01 6.519200031142581286e-01 6.901476288957911764e-01
+6.125605719486232337e-01 6.586385467570500252e-01 6.958254420726305289e-01
+6.209702599139194090e-01 6.653915355400340514e-01 7.015478000189213637e-01
+6.294086543235715148e-01 6.721766263526947061e-01 7.073025514622064414e-01
+6.378691230472761653e-01 6.789961486811091351e-01 7.130980827587862780e-01
+6.463529402277414793e-01 6.858505203730194122e-01 7.189343580950778856e-01
+6.548667336608775535e-01 6.927388303718031715e-01 7.248055449230874636e-01
+6.634047329440709850e-01 6.996632326198537477e-01 7.307191763991576217e-01
+6.719706356478575282e-01 7.066235438274829361e-01 7.366725743067246146e-01
+6.805691273316444301e-01 7.136193210595811465e-01 7.426619469578672472e-01
+6.891901686164448870e-01 7.206538297392898196e-01 7.486995567627365844e-01
+6.978417441976546565e-01 7.277258099214434228e-01 7.547780354337728648e-01
+7.065266827690414031e-01 7.348352863051689221e-01 7.608955968203486853e-01
+7.152395659488615109e-01 7.419843878319358765e-01 7.670595168287617227e-01
+7.239821407052556834e-01 7.491734241473727574e-01 7.732692164928602896e-01
+7.327590970387688474e-01 7.564019312463790001e-01 7.795208278459410112e-01
+7.415714112445037642e-01 7.636703716037079870e-01 7.858145260879668692e-01
+7.504112152902991939e-01 7.709814701087125410e-01 7.921602549877707622e-01
+7.592858091842216162e-01 7.783339526866095426e-01 7.985510124613616201e-01
+7.681958083667864701e-01 7.857281516038946423e-01 8.049869935018724165e-01
+7.771415943289318173e-01 7.931642615485536840e-01 8.114683168046802342e-01
+7.861210234635496175e-01 8.006428249211288151e-01 8.179973940806203325e-01
+7.951301023947144886e-01 8.081643845947440452e-01 8.245778955860991744e-01
+8.041728469938760337e-01 8.157266105617665408e-01 8.312032233576642781e-01
+8.132456568435891819e-01 8.233280673585187115e-01 8.378734408880845752e-01
+8.223487919825404058e-01 8.309646782111167473e-01 8.445815347091445435e-01
+8.314739162371332926e-01 8.386323940000459665e-01 8.513263697699344767e-01
+8.406130156021551780e-01 8.463239863842642041e-01 8.581012298825883011e-01
+8.497544923553936869e-01 8.540290636742366992e-01 8.648964939043677358e-01
+8.588848363304528721e-01 8.617324046759308187e-01 8.716956826827835236e-01
+8.679835640163260368e-01 8.694139530371515212e-01 8.784788921095023628e-01
+8.770201283066206832e-01 8.770482020713447069e-01 8.852238656983413279e-01
+8.859648522194258913e-01 8.845997703979764371e-01 8.918910598190278316e-01
+8.947687008355051930e-01 8.920276102541201402e-01 8.984445530744430419e-01
+9.033850238565973578e-01 8.992781133601027710e-01 9.048255526813022698e-01
+9.117454267355319386e-01 9.062912781484097069e-01 9.109792984365244761e-01
+9.197772674046712504e-01 9.129962371365842877e-01 9.168355520637951894e-01
+9.273989381574117008e-01 9.193137785263337802e-01 9.223160826098045773e-01
+9.345265056154450356e-01 9.251567923877340727e-01 9.273308757297369365e-01
+9.410568294999761552e-01 9.304383120413204367e-01 9.318033109548278237e-01
+9.469054517188711939e-01 9.350653892052174232e-01 9.356338452806639561e-01
+9.519782306847331954e-01 9.389521024465230514e-01 9.387414682758670192e-01
+9.561855219785392324e-01 9.420212349770757942e-01 9.410568432390962190e-01
+9.594583919916889192e-01 9.442053410129402913e-01 9.425129916890260251e-01
+9.617359608985257546e-01 9.454553544501299589e-01 9.430685634745854529e-01
+9.629655575123797773e-01 9.457446361853111272e-01 9.427146073591580189e-01
+9.629717304152120017e-01 9.451630117299317790e-01 9.411078740469980275e-01
+9.619086196808096512e-01 9.436969537999753133e-01 9.379427077261371926e-01
+9.599163272304170880e-01 9.412870435035790573e-01 9.337158672983336682e-01
+9.570384080931425563e-01 9.379846152444032414e-01 9.285135912753641474e-01
+9.533354457428268036e-01 9.338571023316933895e-01 9.224353821916627671e-01
+9.488865060103991445e-01 9.289840890976138743e-01 9.155685277230518615e-01
+9.437794827762752137e-01 9.234529155688914193e-01 9.080043258769950887e-01
+9.381021433775925678e-01 9.173543171347293690e-01 8.998514836828582775e-01
+9.319492013404071518e-01 9.107783993290641256e-01 8.911882560099286810e-01
+9.254038313424192141e-01 9.038112443270013285e-01 8.821180550321400249e-01
+9.185496533096065841e-01 8.965322509059643341e-01 8.727092681908217298e-01
+9.114540331246678839e-01 8.890124126067980859e-01 8.630519170031795140e-01
+9.041820632910790856e-01 8.813132734312176808e-01 8.531979805537907025e-01
+8.967869578435456734e-01 8.734867291901790010e-01 8.431978773211421530e-01
+8.893098149893794435e-01 8.655753876269207669e-01 8.331030513350975442e-01
+8.817848418192094639e-01 8.576132802667703059e-01 8.229492517613266056e-01
+8.742401985712474621e-01 8.496268650289525715e-01 8.127582978377587697e-01
+8.666945370128648074e-01 8.416362324606945222e-01 8.025572922175608914e-01
+8.591642949649661576e-01 8.336561546444334336e-01 7.923557697274130618e-01
+8.516606462490278195e-01 8.256972216872984216e-01 7.821629896098961643e-01
+8.441881675648532646e-01 8.177668584523517525e-01 7.719978747167733912e-01
+8.367546003836178192e-01 8.098699298493980958e-01 7.618548556771399527e-01
+8.293628053720738524e-01 8.020095841729102393e-01 7.517385870991303287e-01
+8.220122974103521996e-01 7.941877657343777708e-01 7.416604820361886174e-01
+8.147055831041186691e-01 7.864054338886661277e-01 7.316158935999518276e-01
+8.074428695046120819e-01 7.786629991741689238e-01 7.216062017816766705e-01
+8.002239536861533997e-01 7.709604828947951294e-01 7.116324410842282955e-01
+7.930486047248805903e-01 7.632976487972781277e-01 7.016945092401379869e-01
+7.859155444098100407e-01 7.556741407493390295e-01 6.917956122566603083e-01
+7.788239785472398369e-01 7.480894917424205648e-01 6.819365996758520732e-01
+7.717761666842225532e-01 7.405430431500328314e-01 6.721061511286441359e-01
+7.647695126504651109e-01 7.330343101062176681e-01 6.623117248985945782e-01
+7.578024759469249583e-01 7.255627582077430748e-01 6.525565861539863732e-01
+7.508747011746044198e-01 7.181277940669236193e-01 6.428393514066714776e-01
+7.439860296366358483e-01 7.107288105275537671e-01 6.331578659286328792e-01
+7.371380352230317845e-01 7.033650997305714858e-01 6.235032380461981161e-01
+7.303267295539673798e-01 6.960362660858002704e-01 6.138882457032197593e-01
+7.235516370761116978e-01 6.887417344158411892e-01 6.043120048450656423e-01
+7.168136574616641443e-01 6.814808447026716731e-01 5.947682975771849678e-01
+7.101132300652239770e-01 6.742529573780132734e-01 5.852527166373640011e-01
+7.034464832580180627e-01 6.670577263264326762e-01 5.757776499898806799e-01
+6.968134241386333416e-01 6.598945644190796767e-01 5.663404055906162693e-01
+6.902175511682563380e-01 6.527626219057073298e-01 5.569247166393624937e-01
+6.836530241251399520e-01 6.456617329968893371e-01 5.475506786771059398e-01
+6.771191923792275746e-01 6.385913765706551226e-01 5.382182031186726334e-01
+6.706213406334817773e-01 6.315505441676552145e-01 5.289041000996647091e-01
+6.641534350911151297e-01 6.245391367090507018e-01 5.196292578451316979e-01
+6.577148635275871236e-01 6.175566394334415232e-01 5.103934681036723653e-01
+6.513106015597026621e-01 6.106020304081083427e-01 5.011747507363846221e-01
+6.449339394177714402e-01 6.036753299959042307e-01 4.919966626063084214e-01
+6.385861657554016135e-01 5.967758543247165814e-01 4.828515990278902659e-01
+6.322678284337878152e-01 5.899029749242099552e-01 4.737348355247164577e-01
+6.259767255318442469e-01 5.830569263656453227e-01 4.646452891563762067e-01
+6.197016579332955688e-01 5.762398779913381341e-01 4.556052788341879434e-01
+6.134474028946137469e-01 5.694504347953359691e-01 4.465979423650075497e-01
+6.072178659159134240e-01 5.626871366850844103e-01 4.376111326566481941e-01
+6.010012505217495749e-01 5.559520936787821777e-01 4.286719487404299644e-01
+5.948055640046073789e-01 5.492429546962157572e-01 4.197575498195730836e-01
+5.886326075840858651e-01 5.425588558149744278e-01 4.108591465488395378e-01
+5.824702130202078498e-01 5.359018268492113934e-01 4.020079470557531565e-01
+5.763248263841350694e-01 5.292699281179926718e-01 3.931837482598241618e-01
+5.701972311820494577e-01 5.226623693222695044e-01 3.843824114977716366e-01
+5.640831336223245396e-01 5.160796590123359895e-01 3.756116269725132129e-01
+5.579774433964941327e-01 5.095224539424874077e-01 3.668822207066750885e-01
+5.518860265359687434e-01 5.029888698004121306e-01 3.581753826709989652e-01
+5.458070559295251645e-01 4.964787819395978796e-01 3.494931200704951557e-01
+5.397391255491313933e-01 4.899920506546056598e-01 3.408352402134943726e-01
+5.336730625437067221e-01 4.835304037810426725e-01 3.322231435985951165e-01
+5.276152444526773788e-01 4.770918383518058525e-01 3.236356057173125356e-01
+5.215648631466205387e-01 4.706762498171280229e-01 3.150682292920859440e-01
+5.155189794095078604e-01 4.642837707070938680e-01 3.065265223389798677e-01
+5.094751216031231378e-01 4.579145264501231494e-01 2.980134272377937266e-01
+5.034310278715931064e-01 4.515686733480185899e-01 2.895302566325898552e-01
+4.973847636608849654e-01 4.452464140846874030e-01 2.810755531259728768e-01
+4.913352410442906604e-01 4.389480201490584821e-01 2.726410128949737222e-01
+4.852774212045994351e-01 4.326740360757653225e-01 2.642407735080369302e-01
+4.792095319460407121e-01 4.264249820482975961e-01 2.558674925325885585e-01
+4.731283857839347351e-01 4.202016073968968812e-01 2.475197805445442101e-01
+4.670296949396188224e-01 4.140048440647509653e-01 2.392012072518971966e-01
+4.609095096289907434e-01 4.078358796897652017e-01 2.309089502347338452e-01
+4.547601620003904332e-01 4.016973741434559098e-01 2.226435585187958033e-01
+4.485682425668168771e-01 3.955931855786054552e-01 2.144296211245620976e-01
+4.423342563272031902e-01 3.895240159345254582e-01 2.062390835191822425e-01
+4.360296791131279548e-01 3.834992742811840771e-01 1.981208646399195139e-01
+4.296458451439821302e-01 3.775230805131955525e-01 1.900605950657147936e-01
+4.231474637241839920e-01 3.716087794574343128e-01 1.820957501112273613e-01
+4.164868167567738477e-01 3.657737180218046391e-01 1.742972729554080058e-01
+4.095973903281860951e-01 3.600427549828760787e-01 1.667592074668843294e-01
+4.023838616513769062e-01 3.544471779032521419e-01 1.597054883781360846e-01
+3.947814112345453541e-01 3.489995705485997579e-01 1.534550340717726336e-01
+3.868766298266183568e-01 3.436490149527227644e-01 1.482247271514051945e-01
+3.788659234446942747e-01 3.383142918487055395e-01 1.438533685673206441e-01
+3.708789643993818941e-01 3.329519259272508136e-01 1.400354190966675849e-01
+3.629572903164399733e-01 3.275541151937279016e-01 1.365461363519130944e-01
+3.551085081353937412e-01 3.221231228094754706e-01 1.332624917481727012e-01
+3.473247934253401170e-01 3.166654234722757755e-01 1.301119558630651207e-01
+3.396071981367110304e-01 3.111828368128046196e-01 1.270354172742856058e-01
+3.319394021514575632e-01 3.056815149128923048e-01 1.240384908643338280e-01
+3.243282276863680424e-01 3.001605128554065693e-01 1.210640172441826978e-01
+3.167622056152286647e-01 2.946237048061004504e-01 1.181174627342822525e-01
+3.092325069255885128e-01 2.890737927737177526e-01 1.152025540049777530e-01
+3.017324462072743518e-01 2.835140481503690690e-01 1.122895803439803164e-01
+2.942527745713884313e-01 2.779485572093680079e-01 1.093519738743563285e-01
+2.867898062904237211e-01 2.723775024827345681e-01 1.063941382240281286e-01
+2.793462654071084406e-01 2.667988809657529936e-01 1.034093116060303130e-01
+2.719194579070843831e-01 2.612124593378840620e-01 1.004000094727539039e-01
+2.645072257635520119e-01 2.556177666826844330e-01 9.736769715746559917e-02
+2.571104715415328812e-01 2.500132794565106398e-01 9.430849274229180512e-02
+2.497278694500691398e-01 2.443981535173898045e-01 9.122222486885092629e-02
+2.423563418593929208e-01 2.387720412133358949e-01 8.811155590734742749e-02
+2.350006052093227549e-01 2.331320446993035422e-01 8.496581087820043177e-02
+2.276523216303719677e-01 2.274793513535450784e-01 8.179625154164907319e-02
+2.203179455088669636e-01 2.218103948803600289e-01 7.858901255132699770e-02
+2.129902634426870667e-01 2.161258230519468304e-01 7.535305204258735401e-02
+2.056701553920205483e-01 2.104236534304168016e-01 7.208351221952713495e-02
+1.983573399507774226e-01 2.047021786467214111e-01 6.877728527916648904e-02
+1.910498721129175737e-01 1.989600929322370426e-01 6.543378475478747736e-02
+1.837444391314300429e-01 1.931963704923697345e-01 6.205437817912465986e-02
+1.764424601043844409e-01 1.874084358013911600e-01 5.863230865340122305e-02
+1.691401736478186091e-01 1.815951106612115895e-01 5.516899293098562890e-02
+1.618355962290499162e-01 1.757545129863619104e-01 5.166248843687707565e-02
+1.545273276784393246e-01 1.698844060286744673e-01 4.810942800782175982e-02
+1.472136064507999498e-01 1.639824533449356636e-01 4.450649296503813440e-02
+1.398915640220567136e-01 1.580463968635001659e-01 4.085151092791106803e-02
+1.325571921668454445e-01 1.520740186438245822e-01 3.716809665985362082e-02
+1.252084444586500644e-01 1.460622428214301272e-01 3.362553317766520805e-02
+1.178384206042670801e-01 1.400089579293633535e-01 3.023931012520724576e-02
+1.104210154536264532e-01 1.339166670121798297e-01 2.703939689144004010e-02]; 
+
+   case 'tar' % tarn, the rain anomaly map
+      RGB = [8.982325470083904473e-02 1.386884202488073425e-01 5.339634747542102572e-02
+9.490477059882479471e-02 1.456373382629968793e-01 5.489581825948507826e-02
+9.996820923335580922e-02 1.525451879246892684e-01 5.635425405965687612e-02
+1.049932629133125961e-01 1.594260027028096272e-01 5.767943871793178995e-02
+1.099844886715972414e-01 1.662815862271170841e-01 5.888156855042592924e-02
+1.149326133871393096e-01 1.731199934404946961e-01 5.990900196219744317e-02
+1.198471368660654901e-01 1.799400614735769122e-01 6.079328815375505818e-02
+1.247299637162895547e-01 1.867439924225139936e-01 6.153299800422255134e-02
+1.295805228510759355e-01 1.935349340052088807e-01 6.211473969231569997e-02
+1.343996539632437981e-01 2.003151607373700460e-01 6.253114410253807209e-02
+1.391929081922307909e-01 2.070845521371987852e-01 6.279848839795282300e-02
+1.439554110569007950e-01 2.138477306592140859e-01 6.288007868082229335e-02
+1.487348911403759133e-01 2.205914714224685436e-01 6.284098523281120285e-02
+1.535498540172954285e-01 2.273157827161538247e-01 6.260141657412987559e-02
+1.584099704346516035e-01 2.340203331404673293e-01 6.214047826160282867e-02
+1.633293887964821223e-01 2.407033599878570240e-01 6.143905222634648416e-02
+1.683325411333271293e-01 2.473603962447930571e-01 6.047333430287041983e-02
+1.734516487390746486e-01 2.539840110977820697e-01 5.924078177592304734e-02
+1.787290092053028800e-01 2.605653696981221068e-01 5.769398812038967900e-02
+1.842226903108559743e-01 2.670914347726459082e-01 5.577103201204060973e-02
+1.900442575104325516e-01 2.735335271652731270e-01 5.343902039527659992e-02
+1.964012889997470146e-01 2.798383207240314197e-01 5.059091721484253873e-02
+2.038180981569160388e-01 2.858582487774559699e-01 4.734796165359243109e-02
+2.134803580554236468e-01 2.912137742752328173e-01 4.542335962452376946e-02
+2.246379258326957618e-01 2.959985720226946948e-01 4.791967673999841110e-02
+2.357078843306291693e-01 3.007243105772285929e-01 5.139927647716215769e-02
+2.466644952616644515e-01 3.054215218481723948e-01 5.513668228793693754e-02
+2.575461415550749367e-01 3.100881502728962680e-01 5.896503676513652897e-02
+2.683585986429155579e-01 3.147286848554897709e-01 6.282164605955981029e-02
+2.791275572039774722e-01 3.193399608455813055e-01 6.667246926393996520e-02
+2.898358184319489994e-01 3.239318024263264095e-01 7.050980744893517449e-02
+3.004984152503225037e-01 3.285032192279036534e-01 7.432550653130615137e-02
+3.111553190646883515e-01 3.330438874028457952e-01 7.810231939881484564e-02
+3.218034422925408755e-01 3.375573450510525597e-01 8.184304787716339957e-02
+3.324333011718812458e-01 3.420495081780127733e-01 8.555280814984053683e-02
+3.430769162896195046e-01 3.465110261365142996e-01 8.922112292532158317e-02
+3.537299359050021241e-01 3.509453072047716837e-01 9.285241010232825332e-02
+3.643894401193512600e-01 3.553552732120655588e-01 9.645119893644621412e-02
+3.750453108858616824e-01 3.597467221513847013e-01 1.000256142638818735e-01
+3.857100245562226637e-01 3.641166297482588132e-01 1.035734980914473635e-01
+3.963858021351523986e-01 3.684657518577320601e-01 1.070973667641381966e-01
+4.071213221517259173e-01 3.727752094149718864e-01 1.105826082064781946e-01
+4.178758479312351115e-01 3.770629074315066109e-01 1.140472314573759138e-01
+4.286423372903069851e-01 3.813332614724057046e-01 1.174974726735356911e-01
+4.394433776892578969e-01 3.855777866767184925e-01 1.209275883437508081e-01
+4.502962927333878373e-01 3.897896541113713975e-01 1.243344105962937429e-01
+4.611581205683302209e-01 3.939890872463367444e-01 1.277374475879362037e-01
+4.720563913472620166e-01 3.981648558562365103e-01 1.311281116044327733e-01
+4.830210005713382881e-01 4.023038157279973936e-01 1.344963783804615232e-01
+4.939986962481786592e-01 4.064316868089741797e-01 1.378665047316342263e-01
+5.050443453644228864e-01 4.105232839216421126e-01 1.412177516567701130e-01
+5.161305471961733504e-01 4.145923196985767945e-01 1.445638179668259637e-01
+5.272226932670311950e-01 4.186568461649191053e-01 1.479227047630213288e-01
+5.384231737920478489e-01 4.226667334740543680e-01 1.512491796667267130e-01
+5.496735303963581343e-01 4.266509012024514158e-01 1.545811460866533815e-01
+5.608924552760781168e-01 4.306494794221744082e-01 1.580220317035593569e-01
+5.721888701475891237e-01 4.346087953039819429e-01 1.614907462658664583e-01
+5.835602689975579738e-01 4.385299786869343297e-01 1.649946574397075372e-01
+5.949141655760096237e-01 4.424610896723609743e-01 1.686236738948057867e-01
+6.063474969101482204e-01 4.463528192152232399e-01 1.722929976151095499e-01
+6.178322186277155348e-01 4.502196887286237792e-01 1.760393057804460759e-01
+6.293072576484797231e-01 4.540947330149664452e-01 1.799322501799610063e-01
+6.408487929862468624e-01 4.579376406332680838e-01 1.839101076250921896e-01
+6.524478209436700427e-01 4.617530075872406381e-01 1.879952778619465859e-01
+6.640840089637001231e-01 4.655519164846439462e-01 1.922225103058495532e-01
+6.757077110120256469e-01 4.693624324344119469e-01 1.966573342842017347e-01
+6.873619660726970615e-01 4.731606777592323732e-01 2.012786215471898954e-01
+6.990381205121832808e-01 4.769509785672518265e-01 2.061259388500985001e-01
+7.107469254673900450e-01 4.807250920628522439e-01 2.112467599398395457e-01
+7.224230526312156453e-01 4.845218253861356961e-01 2.167123076670600113e-01
+7.340988344738968996e-01 4.883178461040553198e-01 2.226023859070605515e-01
+7.456126256093577043e-01 4.922084125716105762e-01 2.291293878090427394e-01
+7.569950884983198680e-01 4.961693298634363702e-01 2.364236914878575235e-01
+7.680178179592376253e-01 5.003309692977765399e-01 2.449057676522546911e-01
+7.783432998143535730e-01 5.048913767328344626e-01 2.551145881355684764e-01
+7.872937751334541101e-01 5.102708429127015277e-01 2.676604181065562749e-01
+7.941838547011116356e-01 5.169436808272552808e-01 2.821513140071189585e-01
+7.994756138083272123e-01 5.246737693689591531e-01 2.970255774031809182e-01
+8.039010002452274817e-01 5.330024415850749264e-01 3.115266985520254717e-01
+8.078274978677594254e-01 5.416811012734407127e-01 3.255924452137653469e-01
+8.115188822314253203e-01 5.505337325024400874e-01 3.392264225271887645e-01
+8.149565405173153643e-01 5.595497555166275561e-01 3.527260919316282384e-01
+8.184200486555966991e-01 5.685470713353225625e-01 3.661765482687758810e-01
+8.218871005380722350e-01 5.775395855002405376e-01 3.796232120570560142e-01
+8.253524104820136875e-01 5.865320478639367563e-01 3.930813348872184143e-01
+8.288195980598317414e-01 5.955244594650943579e-01 4.065541730450397684e-01
+8.322893500409468404e-01 6.045186250474157141e-01 4.200438297618293571e-01
+8.357658919205435133e-01 6.135146821751165103e-01 4.335463882212042819e-01
+8.392529397355924514e-01 6.225129167459599877e-01 4.470604854774085646e-01
+8.427490015153409342e-01 6.315159424794672960e-01 4.605928597504284627e-01
+8.462593242877498589e-01 6.405233492783437566e-01 4.741391831670908608e-01
+8.497829397434528698e-01 6.495374502823044738e-01 4.877048504982988697e-01
+8.533243184659659031e-01 6.585581699790050703e-01 5.012868094865198243e-01
+8.568819326669031566e-01 6.675878581525517275e-01 5.148924377083944348e-01
+8.604592156604728981e-01 6.766270650074718285e-01 5.285174957354723535e-01
+8.640624159744237920e-01 6.856750887735367783e-01 5.421555222813166930e-01
+8.676874794762717835e-01 6.947353397221285309e-01 5.558159820355237368e-01
+8.713433578641075483e-01 7.038060956465443940e-01 5.694881225731345253e-01
+8.750269237065777528e-01 7.128903502475765208e-01 5.831797789138876142e-01
+8.787417347404306023e-01 7.219884934452005520e-01 5.968884207063740455e-01
+8.824929186507559642e-01 7.311003788594004904e-01 6.106091378045375162e-01
+8.862780839217170303e-01 7.402286277522096558e-01 6.243484010896452885e-01
+8.901025319225768229e-01 7.493730430239593510e-01 6.381009856311857797e-01
+8.939696421167129259e-01 7.585341679611918853e-01 6.518645964033017437e-01
+8.978784332841047711e-01 7.677140679252760780e-01 6.656434485771917098e-01
+9.018326061682566674e-01 7.769131645138506181e-01 6.794347199822515782e-01
+9.058380869535479496e-01 7.861311730497033690e-01 6.932323184728660381e-01
+9.098936269941250155e-01 7.953702376174893729e-01 7.070408050591605598e-01
+9.140018319746877618e-01 8.046311927664194785e-01 7.208589990654702406e-01
+9.181667424043119530e-01 8.139144268565462470e-01 7.346836216449236234e-01
+9.223937440297114154e-01 8.232199407988282092e-01 7.485094577713424790e-01
+9.266329848317796936e-01 8.325649094757640034e-01 7.624119242822527953e-01
+9.309587852706298072e-01 8.419294436897262202e-01 7.762663931757451952e-01
+9.353308095703787295e-01 8.513275998621367968e-01 7.901346256764255616e-01
+9.397666205989465560e-01 8.607552896628867245e-01 8.039940207918337967e-01
+9.442852447524148207e-01 8.702076963082445715e-01 8.178194726640143353e-01
+9.488564272552421075e-01 8.796932993686320534e-01 8.316532922424306751e-01
+9.535132490174164088e-01 8.891984622715306541e-01 8.454417866111457736e-01
+9.582183040236339489e-01 8.987227701762496856e-01 8.592166709390754997e-01
+9.629681108746700469e-01 9.082408064338201026e-01 8.729337059863773174e-01
+9.677369708112718572e-01 9.177061780026050108e-01 8.865286101605559521e-01
+9.724470492478461958e-01 9.270421466879262828e-01 8.999251032877214618e-01
+9.769577532404692954e-01 9.361234679319003771e-01 9.130099659367507670e-01
+9.810936756020608440e-01 9.447503559760432879e-01 9.255607060964068378e-01
+9.846187877628681528e-01 9.526495821380999152e-01 9.372697834100743863e-01
+9.872037589208276787e-01 9.594994318553785595e-01 9.478188041909386685e-01
+9.885417842181484227e-01 9.649430355113016722e-01 9.568049207415391111e-01
+9.884013930268252812e-01 9.686440358418687557e-01 9.637998740972807399e-01
+9.884162623276403492e-01 9.700501042547021724e-01 9.646078752920302923e-01
+9.882481988456427446e-01 9.691949840717196674e-01 9.590849806168054714e-01
+9.862202098271878326e-01 9.664497051565109631e-01 9.513022380762837793e-01
+9.825317256976796587e-01 9.620307807128735123e-01 9.416222408221766038e-01
+9.774953228979595954e-01 9.562506189604750295e-01 9.303982168749544979e-01
+9.714512581163280425e-01 9.494527517929901572e-01 9.180386343083645206e-01
+9.647328782040082151e-01 9.419601909858620337e-01 9.048410781832560978e-01
+9.576029833882070408e-01 9.340364327380904497e-01 8.911071594609687452e-01
+9.502540208567341606e-01 9.258747025552572785e-01 8.770597493210310347e-01
+9.428203850658012364e-01 9.176036605916164657e-01 8.628094676385467121e-01
+9.353802079259059266e-01 9.093000877222664480e-01 8.484369289828109784e-01
+9.279731512595491560e-01 9.010054158372772237e-01 8.340022711999641736e-01
+9.206162430864484048e-01 8.927397568877493139e-01 8.195491149365338179e-01
+9.133281854005529388e-01 8.845128541542209843e-01 8.050384948242300664e-01
+9.061049708588290175e-01 8.763271129727117081e-01 7.905141123067558340e-01
+8.988722526026153847e-01 8.682095990978259126e-01 7.760244884018141498e-01
+8.913604989190128114e-01 8.602593575538733939e-01 7.616936251859220963e-01
+8.834947766491649812e-01 8.525076069101691356e-01 7.475141723430621665e-01
+8.751348356324997191e-01 8.450011895094009517e-01 7.335968964229397926e-01
+8.660362122016208586e-01 8.378139590610478304e-01 7.202229230673017346e-01
+8.560628191678395504e-01 8.309783491388803567e-01 7.076282794978067114e-01
+8.450850551605781913e-01 8.245041095837670753e-01 6.962540521527236237e-01
+8.331237773418240788e-01 8.183393744081108867e-01 6.865239180889655124e-01
+8.205576283471390786e-01 8.123351983566962087e-01 6.783182715666855600e-01
+8.077229876914296947e-01 8.063801435632871328e-01 6.713153485176399649e-01
+7.947461515019460521e-01 8.004373108778479740e-01 6.653252445665102099e-01
+7.818234645252460924e-01 7.944593749272963468e-01 6.599830880041622772e-01
+7.690043949000203716e-01 7.884424060393956379e-01 6.551042701424648618e-01
+7.562981288404810876e-01 7.823918885846237181e-01 6.505794347324633797e-01
+7.437166688251096724e-01 7.763107155814537030e-01 6.463185559404119873e-01
+7.312864875465606707e-01 7.701962491575811143e-01 6.422364303657139839e-01
+7.189850527082707332e-01 7.640604119000086181e-01 6.382908369799579207e-01
+7.068142314422918293e-01 7.579064471112740842e-01 6.344344908612202794e-01
+6.947742510783049275e-01 7.517375363827888402e-01 6.306282821287318985e-01
+6.828537141789142728e-01 7.455586837934410349e-01 6.268596706266046370e-01
+6.710011548564486228e-01 7.393836600422335481e-01 6.231736409952126632e-01
+6.592657914925743601e-01 7.332038660876558644e-01 6.194650744353706884e-01
+6.476362335539276316e-01 7.270240901258274713e-01 6.157213868460473805e-01
+6.360362802101585666e-01 7.208613432160450030e-01 6.120373156027114625e-01
+6.245080854916185142e-01 7.147082392942302187e-01 6.083234269572357356e-01
+6.130488547076046180e-01 7.085668274101213360e-01 6.045591744160895287e-01
+6.015892322420162142e-01 7.024496994714828357e-01 6.008489625961975777e-01
+5.901987677923722364e-01 6.963445147045469463e-01 5.970628836865409239e-01
+5.787942193155654058e-01 6.902683578483006510e-01 5.932973990580240331e-01
+5.673843957655613224e-01 6.842194608428608937e-01 5.895220675517639508e-01
+5.559759005656629283e-01 6.781954870319548689e-01 5.857224142025272418e-01
+5.445452293547278222e-01 6.721991418209628533e-01 5.819309981473995697e-01
+5.330284999192810291e-01 6.662471887845208274e-01 5.781518614893066399e-01
+5.216118831320554206e-01 6.602860177867492242e-01 5.743450969986969579e-01
+5.100461930662858467e-01 6.543801579393034862e-01 5.705892298512411642e-01
+4.985462196160774240e-01 6.484680127740434230e-01 5.668522387113605898e-01
+4.869212854485653330e-01 6.426004706277155254e-01 5.631503671835994540e-01
+4.753175948425168440e-01 6.367342039857054603e-01 5.594833076156262575e-01
+4.635884121260610002e-01 6.309044987522948178e-01 5.558810414566710545e-01
+4.517937357110975438e-01 6.250933232803836948e-01 5.523287210439038475e-01
+4.399781445380013811e-01 6.192864046496112662e-01 5.488272822016192487e-01
+4.280176465668665831e-01 6.135117804844451017e-01 5.453889520686707737e-01
+4.160613175390713292e-01 6.077287406576958873e-01 5.420126140975655149e-01
+4.039857150007630238e-01 6.019638930796089582e-01 5.387130326489297794e-01
+3.917475183228279478e-01 5.962226288699170595e-01 5.354998204993742794e-01
+3.795396260545044753e-01 5.904576990603345177e-01 5.323562706006824685e-01
+3.671980489650730761e-01 5.847026249394290387e-01 5.292995421656493393e-01
+3.547169039649492039e-01 5.789540227003182604e-01 5.263324098770649773e-01
+3.421991518101316077e-01 5.731858973997910889e-01 5.234530196411122382e-01
+3.296321613618491964e-01 5.673978264587494769e-01 5.206643628468334839e-01
+3.169539434232791497e-01 5.615982678332219757e-01 5.179739584214747561e-01
+3.041848831902358996e-01 5.557790841809171489e-01 5.153814622924314248e-01
+2.913580245785495904e-01 5.499302942311713460e-01 5.128866030358065764e-01
+2.786210115475045712e-01 5.440237902965463501e-01 5.104770287408624263e-01
+2.658767813620477316e-01 5.380746002424073859e-01 5.081635613728290313e-01
+2.531728049963842264e-01 5.320730905152252221e-01 5.059419345415738789e-01
+2.405801746352321802e-01 5.260084224989675095e-01 5.037958873725133513e-01
+2.281731742156575815e-01 5.198710287686101328e-01 5.017115180274238639e-01
+2.160357564123031038e-01 5.136521477693153370e-01 4.996732344467323395e-01
+2.042553268175122949e-01 5.073441845910725556e-01 4.976709295334373340e-01
+1.929455786157068808e-01 5.009402502860922368e-01 4.956743078037426087e-01
+1.822159137211172564e-01 4.944360671084672698e-01 4.936576912144489682e-01
+1.721720047662203268e-01 4.878296612331804449e-01 4.915973661753361701e-01
+1.629121950514905992e-01 4.811217814834132800e-01 4.894661845895681984e-01
+1.545167219577190942e-01 4.743156260955230796e-01 4.872413962325574111e-01
+1.470425142510033700e-01 4.674166983864977420e-01 4.849028953714263346e-01
+1.405113128544070999e-01 4.604338355815827399e-01 4.824271757570474661e-01
+1.349217530726786463e-01 4.533748092665628726e-01 4.798101955391982920e-01
+1.302797342394179658e-01 4.462455116423036938e-01 4.770426757084247904e-01
+1.265939811024292538e-01 4.390496902560914738e-01 4.741166274104288703e-01
+1.236843852121248255e-01 4.318074599363258548e-01 4.710274926158040665e-01
+1.214646610875383670e-01 4.245259430194671113e-01 4.677892044131184979e-01
+1.198403481002758841e-01 4.172122902240388842e-01 4.644123639304529871e-01
+1.184609210323855077e-01 4.098925950294425857e-01 4.609615952184937249e-01
+1.168754986210283897e-01 4.026022451761210874e-01 4.575160089880971337e-01
+1.151007877850314109e-01 3.953385852310392079e-01 4.540805121238136732e-01
+1.131413084296974680e-01 3.881005310447923073e-01 4.506558243985225309e-01
+1.110221391582094097e-01 3.808834919340156611e-01 4.472532258515609649e-01
+1.087511055351796929e-01 3.736854209969548424e-01 4.438760147968137115e-01
+1.063262941094024749e-01 3.665057054845847206e-01 4.405230161394063093e-01
+1.037537167610996236e-01 3.593424059991345287e-01 4.371963158215718681e-01
+1.010396012430455071e-01 3.521934333571229425e-01 4.338979957908608021e-01
+9.820785452879465804e-02 3.450535925989220432e-01 4.306390199340546787e-01
+9.524886735285809092e-02 3.379231538671472745e-01 4.274136452659025309e-01
+9.216708027427711336e-02 3.307999936437661659e-01 4.242225680363120865e-01
+8.898719812499519821e-02 3.236783223748895821e-01 4.210773055644454477e-01
+8.570498821294705860e-02 3.165572544150943024e-01 4.179737087144154706e-01
+8.232861945095013012e-02 3.094336626170069993e-01 4.149138402418848237e-01
+7.888091832597513009e-02 3.023016385852106969e-01 4.119079586942359095e-01
+7.535426196281005962e-02 2.951606915265346798e-01 4.089483103763945637e-01
+7.178216232425585486e-02 2.880027122692483954e-01 4.060506695454764170e-01
+6.815855459758968227e-02 2.808269749834076956e-01 4.032054679392391150e-01
+6.448898508226078019e-02 2.736310489100942100e-01 4.004060238485768752e-01
+6.082018328964860360e-02 2.664035583373736138e-01 3.976774815474886093e-01
+5.716124112921574379e-02 2.591406963233486849e-01 3.950170320465338780e-01
+5.351466965820251415e-02 2.518414268825251989e-01 3.924068662312853450e-01
+4.993186694626653571e-02 2.444935102031051688e-01 3.898697442701583027e-01
+4.643877317377426844e-02 2.370912873691644052e-01 3.873999194228605614e-01
+4.308214165698193848e-02 2.296247589871482364e-01 3.850043813960570827e-01
+3.988193032745831340e-02 2.220895846072232227e-01 3.826648500695101207e-01
+3.696588053809187618e-02 2.144711117753294594e-01 3.803951582141073540e-01
+3.503963119120004355e-02 2.067382236169432175e-01 3.779948138188178319e-01
+3.478421889488789165e-02 1.988679039642712310e-01 3.751470684509792819e-01
+3.605446405610013977e-02 1.908764917041337605e-01 3.717394054831296146e-01
+3.860378491452313293e-02 1.827911805345073526e-01 3.676697392369102646e-01
+4.204158194669544574e-02 1.746484839257387567e-01 3.628639802125444569e-01
+4.580769332477269834e-02 1.664868235304900745e-01 3.572935027519454909e-01
+4.953046775643197425e-02 1.583391239953714225e-01 3.509783278645146609e-01
+5.294794616753940170e-02 1.502287847236943308e-01 3.439780107867805858e-01
+5.589746873554810730e-02 1.421689980048106428e-01 3.363784527482869824e-01
+5.832364005801801005e-02 1.341588757852459068e-01 3.282715328574966618e-01
+6.018929987904993867e-02 1.261942031427702726e-01 3.197538950865533303e-01
+6.152266558088163168e-02 1.182670459661474271e-01 3.108793933905304452e-01];
+      
+   otherwise 
+      error('Unrecognized colormap name.') 
+     
+
+end
+
+
+
+function varargout = colorspace(Conversion,varargin)
+%COLORSPACE  Transform a color image between color representations.
+%   B = COLORSPACE(S,A) transforms the color representation of image A
+%   where S is a string specifying the conversion.  The input array A 
+%   should be a real full double array of size Mx3 or MxNx3.  The output B 
+%   is the same size as A.
+%
+%   S tells the source and destination color spaces, S = 'dest<-src', or 
+%   alternatively, S = 'src->dest'.  Supported color spaces are
+%
+%     'RGB'              sRGB IEC 61966-2-1
+%     'YCbCr'            Luma + Chroma ("digitized" version of Y'PbPr)
+%     'JPEG-YCbCr'       Luma + Chroma space used in JFIF JPEG
+%     'YDbDr'            SECAM Y'DbDr Luma + Chroma
+%     'YPbPr'            Luma (ITU-R BT.601) + Chroma 
+%     'YUV'              NTSC PAL Y'UV Luma + Chroma
+%     'YIQ'              NTSC Y'IQ Luma + Chroma
+%     'HSV' or 'HSB'     Hue Saturation Value/Brightness
+%     'HSL' or 'HLS'     Hue Saturation Luminance
+%     'HSI'              Hue Saturation Intensity
+%     'XYZ'              CIE 1931 XYZ
+%     'Lab'              CIE 1976 L*a*b* (CIELAB)
+%     'Luv'              CIE L*u*v* (CIELUV)
+%     'LCH'              CIE L*C*H* (CIELCH)
+%     'CAT02 LMS'        CIE CAT02 LMS
+%
+%  All conversions assume 2 degree observer and D65 illuminant.
+%
+%  Color space names are case insensitive and spaces are ignored.  When 
+%  sRGB is the source or destination, it can be omitted. For example 
+%  'yuv<-' is short for 'yuv<-rgb'.
+%
+%  For sRGB, the values should be scaled between 0 and 1.  Beware that 
+%  transformations generally do not constrain colors to be "in gamut."  
+%  Particularly, transforming from another space to sRGB may obtain 
+%  R'G'B' values outside of the [0,1] range.  So the result should be 
+%  clamped to [0,1] before displaying:
+%     image(min(max(B,0),1));  % Clamp B to [0,1] and display
+%
+%  sRGB (Red Green Blue) is the (ITU-R BT.709 gamma-corrected) standard
+%  red-green-blue representation of colors used in digital imaging.  The 
+%  components should be scaled between 0 and 1.  The space can be 
+%  visualized geometrically as a cube.
+%  
+%  Y'PbPr, Y'CbCr, Y'DbDr, Y'UV, and Y'IQ are related to sRGB by linear
+%  transformations.  These spaces separate a color into a grayscale
+%  luminance component Y and two chroma components.  The valid ranges of
+%  the components depends on the space.
+%
+%  HSV (Hue Saturation Value) is related to sRGB by
+%     H = hexagonal hue angle   (0 <= H < 360),
+%     S = C/V                   (0 <= S <= 1),
+%     V = max(R',G',B')         (0 <= V <= 1),
+%  where C = max(R',G',B') - min(R',G',B').  The hue angle H is computed on
+%  a hexagon.  The space is geometrically a hexagonal cone.
+%
+%  HSL (Hue Saturation Lightness) is related to sRGB by
+%     H = hexagonal hue angle                (0 <= H < 360),
+%     S = C/(1 - |2L-1|)                     (0 <= S <= 1),
+%     L = (max(R',G',B') + min(R',G',B'))/2  (0 <= L <= 1),
+%  where H and C are the same as in HSV.  Geometrically, the space is a
+%  double hexagonal cone.
+%
+%  HSI (Hue Saturation Intensity) is related to sRGB by
+%     H = polar hue angle        (0 <= H < 360),
+%     S = 1 - min(R',G',B')/I    (0 <= S <= 1),
+%     I = (R'+G'+B')/3           (0 <= I <= 1).
+%  Unlike HSV and HSL, the hue angle H is computed on a circle rather than
+%  a hexagon. 
+%
+%  CIE XYZ is related to sRGB by inverse gamma correction followed by a
+%  linear transform.  Other CIE color spaces are defined relative to XYZ.
+%
+%  CIE L*a*b*, L*u*v*, and L*C*H* are nonlinear functions of XYZ.  The L*
+%  component is designed to match closely with human perception of
+%  lightness.  The other two components describe the chroma.
+%
+%  CIE CAT02 LMS is the linear transformation of XYZ using the MCAT02 
+%  chromatic adaptation matrix.  The space is designed to model the 
+%  response of the three types of cones in the human eye, where L, M, S,
+%  correspond respectively to red ("long"), green ("medium"), and blue
+%  ("short").
+
+% Pascal Getreuer 2005-2010
+
+
+%%% Input parsing %%%
+if nargin < 2, error('Not enough input arguments.'); end
+[SrcSpace,DestSpace] = parse(Conversion);
+
+if nargin == 2
+   Image = varargin{1};
+elseif nargin >= 3
+   Image = cat(3,varargin{:});
+else
+   error('Invalid number of input arguments.');
+end
+
+FlipDims = (size(Image,3) == 1);
+
+if FlipDims, Image = permute(Image,[1,3,2]); end
+if ~isa(Image,'double'), Image = double(Image)/255; end
+if size(Image,3) ~= 3, error('Invalid input size.'); end
+
+SrcT = gettransform(SrcSpace);
+DestT = gettransform(DestSpace);
+
+if ~ischar(SrcT) && ~ischar(DestT)
+   % Both source and destination transforms are affine, so they
+   % can be composed into one affine operation
+   T = [DestT(:,1:3)*SrcT(:,1:3),DestT(:,1:3)*SrcT(:,4)+DestT(:,4)];      
+   Temp = zeros(size(Image));
+   Temp(:,:,1) = T(1)*Image(:,:,1) + T(4)*Image(:,:,2) + T(7)*Image(:,:,3) + T(10);
+   Temp(:,:,2) = T(2)*Image(:,:,1) + T(5)*Image(:,:,2) + T(8)*Image(:,:,3) + T(11);
+   Temp(:,:,3) = T(3)*Image(:,:,1) + T(6)*Image(:,:,2) + T(9)*Image(:,:,3) + T(12);
+   Image = Temp;
+elseif ~ischar(DestT)
+   Image = rgb(Image,SrcSpace);
+   Temp = zeros(size(Image));
+   Temp(:,:,1) = DestT(1)*Image(:,:,1) + DestT(4)*Image(:,:,2) + DestT(7)*Image(:,:,3) + DestT(10);
+   Temp(:,:,2) = DestT(2)*Image(:,:,1) + DestT(5)*Image(:,:,2) + DestT(8)*Image(:,:,3) + DestT(11);
+   Temp(:,:,3) = DestT(3)*Image(:,:,1) + DestT(6)*Image(:,:,2) + DestT(9)*Image(:,:,3) + DestT(12);
+   Image = Temp;
+else
+   Image = feval(DestT,Image,SrcSpace);
+end
+
+%%% Output format %%%
+if nargout > 1
+   varargout = {Image(:,:,1),Image(:,:,2),Image(:,:,3)};
+else
+   if FlipDims, Image = permute(Image,[1,3,2]); end
+   varargout = {Image};
+end
+
+return;
+
+
+function [SrcSpace,DestSpace] = parse(Str)
+% Parse conversion argument
+
+if ischar(Str)
+   Str = lower(strrep(strrep(Str,'-',''),'=',''));
+   k = find(Str == '>');
+   
+   if length(k) == 1         % Interpret the form 'src->dest'
+      SrcSpace = Str(1:k-1);
+      DestSpace = Str(k+1:end);
+   else
+      k = find(Str == '<');
+      
+      if length(k) == 1      % Interpret the form 'dest<-src'
+         DestSpace = Str(1:k-1);
+         SrcSpace = Str(k+1:end);
+      else
+         error(['Invalid conversion, ''',Str,'''.']);
+      end   
+   end
+   
+   SrcSpace = alias(SrcSpace);
+   DestSpace = alias(DestSpace);
+else
+   SrcSpace = 1;             % No source pre-transform
+   DestSpace = Conversion;
+   if any(size(Conversion) ~= 3), error('Transformation matrix must be 3x3.'); end
+end
+return;
+
+
+function Space = alias(Space)
+Space = strrep(strrep(Space,'cie',''),' ','');
+
+if isempty(Space)
+   Space = 'rgb';
+end
+
+switch Space
+case {'ycbcr','ycc'}
+   Space = 'ycbcr';
+case {'hsv','hsb'}
+   Space = 'hsv';
+case {'hsl','hsi','hls'}
+   Space = 'hsl';
+case {'rgb','yuv','yiq','ydbdr','ycbcr','jpegycbcr','xyz','lab','luv','lch'}
+   return;
+end
+return;
+
+
+function T = gettransform(Space)
+% Get a colorspace transform: either a matrix describing an affine transform,
+% or a string referring to a conversion subroutine
+switch Space
+case 'ypbpr'
+   T = [0.299,0.587,0.114,0;-0.1687367,-0.331264,0.5,0;0.5,-0.418688,-0.081312,0];
+case 'yuv'
+   % sRGB to NTSC/PAL YUV
+   % Wikipedia: http://en.wikipedia.org/wiki/YUV
+   T = [0.299,0.587,0.114,0;-0.147,-0.289,0.436,0;0.615,-0.515,-0.100,0];
+case 'ydbdr'
+   % sRGB to SECAM YDbDr
+   % Wikipedia: http://en.wikipedia.org/wiki/YDbDr
+   T = [0.299,0.587,0.114,0;-0.450,-0.883,1.333,0;-1.333,1.116,0.217,0];
+case 'yiq'
+   % sRGB in [0,1] to NTSC YIQ in [0,1];[-0.595716,0.595716];[-0.522591,0.522591];
+   % Wikipedia: http://en.wikipedia.org/wiki/YIQ
+   T = [0.299,0.587,0.114,0;0.595716,-0.274453,-0.321263,0;0.211456,-0.522591,0.311135,0];
+case 'ycbcr'
+   % sRGB (range [0,1]) to ITU-R BRT.601 (CCIR 601) Y'CbCr
+   % Wikipedia: http://en.wikipedia.org/wiki/YCbCr
+   % Poynton, Equation 3, scaling of R'G'B to Y'PbPr conversion
+   T = [65.481,128.553,24.966,16;-37.797,-74.203,112.0,128;112.0,-93.786,-18.214,128];
+case 'jpegycbcr'
+   % Wikipedia: http://en.wikipedia.org/wiki/YCbCr
+   T = [0.299,0.587,0.114,0;-0.168736,-0.331264,0.5,0.5;0.5,-0.418688,-0.081312,0.5]*255;
+case {'rgb','xyz','hsv','hsl','lab','luv','lch','cat02lms'}
+   T = Space;
+otherwise
+   error(['Unknown color space, ''',Space,'''.']);
+end
+return;
+
+
+function Image = rgb(Image,SrcSpace)
+% Convert to sRGB from 'SrcSpace'
+switch SrcSpace
+case 'rgb'
+   return;
+case 'hsv'
+   % Convert HSV to sRGB
+   Image = huetorgb((1 - Image(:,:,2)).*Image(:,:,3),Image(:,:,3),Image(:,:,1));
+case 'hsl'
+   % Convert HSL to sRGB
+   L = Image(:,:,3);
+   Delta = Image(:,:,2).*min(L,1-L);
+   Image = huetorgb(L-Delta,L+Delta,Image(:,:,1));
+case {'xyz','lab','luv','lch','cat02lms'}
+   % Convert to CIE XYZ
+   Image = xyz(Image,SrcSpace);
+   % Convert XYZ to RGB
+   T = [3.2406, -1.5372, -0.4986; -0.9689, 1.8758, 0.0415; 0.0557, -0.2040, 1.057];
+   R = T(1)*Image(:,:,1) + T(4)*Image(:,:,2) + T(7)*Image(:,:,3);  % R
+   G = T(2)*Image(:,:,1) + T(5)*Image(:,:,2) + T(8)*Image(:,:,3);  % G
+   B = T(3)*Image(:,:,1) + T(6)*Image(:,:,2) + T(9)*Image(:,:,3);  % B
+   % Desaturate and rescale to constrain resulting RGB values to [0,1]   
+   AddWhite = -min(min(min(R,G),B),0);
+   R = R + AddWhite;
+   G = G + AddWhite;
+   B = B + AddWhite;
+   % Apply gamma correction to convert linear RGB to sRGB
+   Image(:,:,1) = gammacorrection(R);  % R'
+   Image(:,:,2) = gammacorrection(G);  % G'
+   Image(:,:,3) = gammacorrection(B);  % B'
+otherwise  % Conversion is through an affine transform
+   T = gettransform(SrcSpace);
+   temp = inv(T(:,1:3));
+   T = [temp,-temp*T(:,4)];
+   R = T(1)*Image(:,:,1) + T(4)*Image(:,:,2) + T(7)*Image(:,:,3) + T(10);
+   G = T(2)*Image(:,:,1) + T(5)*Image(:,:,2) + T(8)*Image(:,:,3) + T(11);
+   B = T(3)*Image(:,:,1) + T(6)*Image(:,:,2) + T(9)*Image(:,:,3) + T(12);
+   Image(:,:,1) = R;
+   Image(:,:,2) = G;
+   Image(:,:,3) = B;
+end
+
+% Clip to [0,1]
+Image = min(max(Image,0),1);
+return;
+
+
+function Image = xyz(Image,SrcSpace)
+% Convert to CIE XYZ from 'SrcSpace'
+WhitePoint = [0.950456,1,1.088754];  
+
+switch SrcSpace
+case 'xyz'
+   return;
+case 'luv'
+   % Convert CIE L*uv to XYZ
+   WhitePointU = (4*WhitePoint(1))./(WhitePoint(1) + 15*WhitePoint(2) + 3*WhitePoint(3));
+   WhitePointV = (9*WhitePoint(2))./(WhitePoint(1) + 15*WhitePoint(2) + 3*WhitePoint(3));
+   L = Image(:,:,1);
+   Y = (L + 16)/116;
+   Y = invf(Y)*WhitePoint(2);
+   U = Image(:,:,2)./(13*L + 1e-6*(L==0)) + WhitePointU;
+   V = Image(:,:,3)./(13*L + 1e-6*(L==0)) + WhitePointV;
+   Image(:,:,1) = -(9*Y.*U)./((U-4).*V - U.*V);                  % X
+   Image(:,:,2) = Y;                                             % Y
+   Image(:,:,3) = (9*Y - (15*V.*Y) - (V.*Image(:,:,1)))./(3*V);  % Z
+case {'lab','lch'}
+   Image = lab(Image,SrcSpace);
+   % Convert CIE L*ab to XYZ
+   fY = (Image(:,:,1) + 16)/116;
+   fX = fY + Image(:,:,2)/500;
+   fZ = fY - Image(:,:,3)/200;
+   Image(:,:,1) = WhitePoint(1)*invf(fX);  % X
+   Image(:,:,2) = WhitePoint(2)*invf(fY);  % Y
+   Image(:,:,3) = WhitePoint(3)*invf(fZ);  % Z
+case 'cat02lms'
+    % Convert CAT02 LMS to XYZ
+   T = inv([0.7328, 0.4296, -0.1624;-0.7036, 1.6975, 0.0061; 0.0030, 0.0136, 0.9834]);
+   L = Image(:,:,1);
+   M = Image(:,:,2);
+   S = Image(:,:,3);
+   Image(:,:,1) = T(1)*L + T(4)*M + T(7)*S;  % X 
+   Image(:,:,2) = T(2)*L + T(5)*M + T(8)*S;  % Y
+   Image(:,:,3) = T(3)*L + T(6)*M + T(9)*S;  % Z
+otherwise   % Convert from some gamma-corrected space
+   % Convert to sRGB
+   Image = rgb(Image,SrcSpace);
+   % Undo gamma correction
+   R = invgammacorrection(Image(:,:,1));
+   G = invgammacorrection(Image(:,:,2));
+   B = invgammacorrection(Image(:,:,3));
+   % Convert RGB to XYZ
+   T = inv([3.2406, -1.5372, -0.4986; -0.9689, 1.8758, 0.0415; 0.0557, -0.2040, 1.057]);
+   Image(:,:,1) = T(1)*R + T(4)*G + T(7)*B;  % X 
+   Image(:,:,2) = T(2)*R + T(5)*G + T(8)*B;  % Y
+   Image(:,:,3) = T(3)*R + T(6)*G + T(9)*B;  % Z
+end
+return;
+
+
+function Image = hsv(Image,SrcSpace)
+% Convert to HSV
+Image = rgb(Image,SrcSpace);
+V = max(Image,[],3);
+S = (V - min(Image,[],3))./(V + (V == 0));
+Image(:,:,1) = rgbtohue(Image);
+Image(:,:,2) = S;
+Image(:,:,3) = V;
+return;
+
+
+function Image = hsl(Image,SrcSpace)
+% Convert to HSL 
+switch SrcSpace
+case 'hsv'
+   % Convert HSV to HSL   
+   MaxVal = Image(:,:,3);
+   MinVal = (1 - Image(:,:,2)).*MaxVal;
+   L = 0.5*(MaxVal + MinVal);
+   temp = min(L,1-L);
+   Image(:,:,2) = 0.5*(MaxVal - MinVal)./(temp + (temp == 0));
+   Image(:,:,3) = L;
+otherwise
+   Image = rgb(Image,SrcSpace);  % Convert to sRGB
+   % Convert sRGB to HSL
+   MinVal = min(Image,[],3);
+   MaxVal = max(Image,[],3);
+   L = 0.5*(MaxVal + MinVal);
+   temp = min(L,1-L);
+   S = 0.5*(MaxVal - MinVal)./(temp + (temp == 0));
+   Image(:,:,1) = rgbtohue(Image);
+   Image(:,:,2) = S;
+   Image(:,:,3) = L;
+end
+return;
+
+
+function Image = lab(Image,SrcSpace)
+% Convert to CIE L*a*b* (CIELAB)
+WhitePoint = [0.950456,1,1.088754];
+
+switch SrcSpace
+case 'lab'
+   return;
+case 'lch'
+   % Convert CIE L*CH to CIE L*ab
+   C = Image(:,:,2);
+   Image(:,:,2) = cos(Image(:,:,3)*pi/180).*C;  % a*
+   Image(:,:,3) = sin(Image(:,:,3)*pi/180).*C;  % b*
+otherwise
+   Image = xyz(Image,SrcSpace);  % Convert to XYZ
+   % Convert XYZ to CIE L*a*b*
+   X = Image(:,:,1)/WhitePoint(1);
+   Y = Image(:,:,2)/WhitePoint(2);
+   Z = Image(:,:,3)/WhitePoint(3);
+   fX = f(X);
+   fY = f(Y);
+   fZ = f(Z);
+   Image(:,:,1) = 116*fY - 16;    % L*
+   Image(:,:,2) = 500*(fX - fY);  % a*
+   Image(:,:,3) = 200*(fY - fZ);  % b*
+end
+return;
+
+
+function Image = luv(Image,SrcSpace)
+% Convert to CIE L*u*v* (CIELUV)
+WhitePoint = [0.950456,1,1.088754];
+WhitePointU = (4*WhitePoint(1))./(WhitePoint(1) + 15*WhitePoint(2) + 3*WhitePoint(3));
+WhitePointV = (9*WhitePoint(2))./(WhitePoint(1) + 15*WhitePoint(2) + 3*WhitePoint(3));
+
+Image = xyz(Image,SrcSpace); % Convert to XYZ
+Denom = Image(:,:,1) + 15*Image(:,:,2) + 3*Image(:,:,3);
+U = (4*Image(:,:,1))./(Denom + (Denom == 0));
+V = (9*Image(:,:,2))./(Denom + (Denom == 0));
+Y = Image(:,:,2)/WhitePoint(2);
+L = 116*f(Y) - 16;
+Image(:,:,1) = L;                        % L*
+Image(:,:,2) = 13*L.*(U - WhitePointU);  % u*
+Image(:,:,3) = 13*L.*(V - WhitePointV);  % v*
+return;  
+
+
+function Image = lch(Image,SrcSpace)
+% Convert to CIE L*ch
+Image = lab(Image,SrcSpace);  % Convert to CIE L*ab
+H = atan2(Image(:,:,3),Image(:,:,2));
+H = H*180/pi + 360*(H < 0);
+Image(:,:,2) = sqrt(Image(:,:,2).^2 + Image(:,:,3).^2);  % C
+Image(:,:,3) = H;                                        % H
+return;
+
+
+function Image = cat02lms(Image,SrcSpace)
+% Convert to CAT02 LMS
+Image = xyz(Image,SrcSpace);
+T = [0.7328, 0.4296, -0.1624;-0.7036, 1.6975, 0.0061; 0.0030, 0.0136, 0.9834];
+X = Image(:,:,1);
+Y = Image(:,:,2);
+Z = Image(:,:,3);
+Image(:,:,1) = T(1)*X + T(4)*Y + T(7)*Z;  % L
+Image(:,:,2) = T(2)*X + T(5)*Y + T(8)*Z;  % M
+Image(:,:,3) = T(3)*X + T(6)*Y + T(9)*Z;  % S
+return;
+
+
+function Image = huetorgb(m0,m2,H)
+% Convert HSV or HSL hue to RGB
+N = size(H);
+H = min(max(H(:),0),360)/60;
+m0 = m0(:);
+m2 = m2(:);
+F = H - round(H/2)*2;
+M = [m0, m0 + (m2-m0).*abs(F), m2];
+Num = length(m0);
+j = [2 1 0;1 2 0;0 2 1;0 1 2;1 0 2;2 0 1;2 1 0]*Num;
+k = floor(H) + 1;
+Image = reshape([M(j(k,1)+(1:Num).'),M(j(k,2)+(1:Num).'),M(j(k,3)+(1:Num).')],[N,3]);
+return;
+
+
+function H = rgbtohue(Image)
+% Convert RGB to HSV or HSL hue
+[M,i] = sort(Image,3);
+i = i(:,:,3);
+Delta = M(:,:,3) - M(:,:,1);
+Delta = Delta + (Delta == 0);
+R = Image(:,:,1);
+G = Image(:,:,2);
+B = Image(:,:,3);
+H = zeros(size(R));
+k = (i == 1);
+H(k) = (G(k) - B(k))./Delta(k);
+k = (i == 2);
+H(k) = 2 + (B(k) - R(k))./Delta(k);
+k = (i == 3);
+H(k) = 4 + (R(k) - G(k))./Delta(k);
+H = 60*H + 360*(H < 0);
+H(Delta == 0) = nan;
+return;
+
+
+function Rp = gammacorrection(R)
+Rp = zeros(size(R));
+i = (R <= 0.0031306684425005883);
+Rp(i) = 12.92*R(i);
+Rp(~i) = real(1.055*R(~i).^0.416666666666666667 - 0.055);
+return;
+
+
+function R = invgammacorrection(Rp)
+R = zeros(size(Rp));
+i = (Rp <= 0.0404482362771076);
+R(i) = Rp(i)/12.92;
+R(~i) = real(((Rp(~i) + 0.055)/1.055).^2.4);
+return;
+
+
+function fY = f(Y)
+fY = real(Y.^(1/3));
+i = (Y < 0.008856);
+fY(i) = Y(i)*(841/108) + (4/29);
+return;
+
+
+function Y = invf(fY)
+Y = fY.^3;
+i = (Y < 0.008856);
+Y(i) = (fY(i) - 4/29)*(108/841);
+return;
Index: issm/trunk/src/m/plot/colormaps/demmap.py
===================================================================
--- issm/trunk/src/m/plot/colormaps/demmap.py	(revision 25994)
+++ issm/trunk/src/m/plot/colormaps/demmap.py	(revision 26744)
@@ -64,6 +64,4 @@
         cmx = nland * interval
 
-    clim = [cmn, cmx]
-
     if strcmpi(colorscheme, 'dem'):
         # concatenate and transpose to match matplotlib's colormap format
Index: issm/trunk/src/m/plot/colormaps/turbo.m
===================================================================
--- issm/trunk/src/m/plot/colormaps/turbo.m	(revision 26744)
+++ issm/trunk/src/m/plot/colormaps/turbo.m	(revision 26744)
@@ -0,0 +1,279 @@
+function map = turbo(m)
+%TURBO   Turbo colormap.
+%   TURBO(M) returns an M-by-3 matrix containing the turbo colormap, a
+%   variant of the jet colormap that is more perceptually uniform.
+%
+%   See also JET, COLORMAP.
+%	 
+%		Daniel Fortunato (2021). turbo (https://www.mathworks.com/matlabcentral/fileexchange/74662-turbo), MATLAB Central File Exchange. Retrieved August 4, 2021. 
+%
+%	more info: https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html
+%
+if nargin < 1
+   f = get(groot,'CurrentFigure');
+   if isempty(f)
+      m = size(get(groot,'DefaultFigureColormap'),1);
+   else
+      m = size(f.Colormap,1);
+   end
+end
+values = [
+     0.18995, 0.07176, 0.23217;
+     0.19483, 0.08339, 0.26149;
+     0.19956, 0.09498, 0.29024;
+     0.20415, 0.10652, 0.31844;
+     0.20860, 0.11802, 0.34607;
+     0.21291, 0.12947, 0.37314;
+     0.21708, 0.14087, 0.39964;
+     0.22111, 0.15223, 0.42558;
+     0.22500, 0.16354, 0.45096;
+     0.22875, 0.17481, 0.47578;
+     0.23236, 0.18603, 0.50004;
+     0.23582, 0.19720, 0.52373;
+     0.23915, 0.20833, 0.54686;
+     0.24234, 0.21941, 0.56942;
+     0.24539, 0.23044, 0.59142;
+     0.24830, 0.24143, 0.61286;
+     0.25107, 0.25237, 0.63374;
+     0.25369, 0.26327, 0.65406;
+     0.25618, 0.27412, 0.67381;
+     0.25853, 0.28492, 0.69300;
+     0.26074, 0.29568, 0.71162;
+     0.26280, 0.30639, 0.72968;
+     0.26473, 0.31706, 0.74718;
+     0.26652, 0.32768, 0.76412;
+     0.26816, 0.33825, 0.78050;
+     0.26967, 0.34878, 0.79631;
+     0.27103, 0.35926, 0.81156;
+     0.27226, 0.36970, 0.82624;
+     0.27334, 0.38008, 0.84037;
+     0.27429, 0.39043, 0.85393;
+     0.27509, 0.40072, 0.86692;
+     0.27576, 0.41097, 0.87936;
+     0.27628, 0.42118, 0.89123;
+     0.27667, 0.43134, 0.90254;
+     0.27691, 0.44145, 0.91328;
+     0.27701, 0.45152, 0.92347;
+     0.27698, 0.46153, 0.93309;
+     0.27680, 0.47151, 0.94214;
+     0.27648, 0.48144, 0.95064;
+     0.27603, 0.49132, 0.95857;
+     0.27543, 0.50115, 0.96594;
+     0.27469, 0.51094, 0.97275;
+     0.27381, 0.52069, 0.97899;
+     0.27273, 0.53040, 0.98461;
+     0.27106, 0.54015, 0.98930;
+     0.26878, 0.54995, 0.99303;
+     0.26592, 0.55979, 0.99583;
+     0.26252, 0.56967, 0.99773;
+     0.25862, 0.57958, 0.99876;
+     0.25425, 0.58950, 0.99896;
+     0.24946, 0.59943, 0.99835;
+     0.24427, 0.60937, 0.99697;
+     0.23874, 0.61931, 0.99485;
+     0.23288, 0.62923, 0.99202;
+     0.22676, 0.63913, 0.98851;
+     0.22039, 0.64901, 0.98436;
+     0.21382, 0.65886, 0.97959;
+     0.20708, 0.66866, 0.97423;
+     0.20021, 0.67842, 0.96833;
+     0.19326, 0.68812, 0.96190;
+     0.18625, 0.69775, 0.95498;
+     0.17923, 0.70732, 0.94761;
+     0.17223, 0.71680, 0.93981;
+     0.16529, 0.72620, 0.93161;
+     0.15844, 0.73551, 0.92305;
+     0.15173, 0.74472, 0.91416;
+     0.14519, 0.75381, 0.90496;
+     0.13886, 0.76279, 0.89550;
+     0.13278, 0.77165, 0.88580;
+     0.12698, 0.78037, 0.87590;
+     0.12151, 0.78896, 0.86581;
+     0.11639, 0.79740, 0.85559;
+     0.11167, 0.80569, 0.84525;
+     0.10738, 0.81381, 0.83484;
+     0.10357, 0.82177, 0.82437;
+     0.10026, 0.82955, 0.81389;
+     0.09750, 0.83714, 0.80342;
+     0.09532, 0.84455, 0.79299;
+     0.09377, 0.85175, 0.78264;
+     0.09287, 0.85875, 0.77240;
+     0.09267, 0.86554, 0.76230;
+     0.09320, 0.87211, 0.75237;
+     0.09451, 0.87844, 0.74265;
+     0.09662, 0.88454, 0.73316;
+     0.09958, 0.89040, 0.72393;
+     0.10342, 0.89600, 0.71500;
+     0.10815, 0.90142, 0.70599;
+     0.11374, 0.90673, 0.69651;
+     0.12014, 0.91193, 0.68660;
+     0.12733, 0.91701, 0.67627;
+     0.13526, 0.92197, 0.66556;
+     0.14391, 0.92680, 0.65448;
+     0.15323, 0.93151, 0.64308;
+     0.16319, 0.93609, 0.63137;
+     0.17377, 0.94053, 0.61938;
+     0.18491, 0.94484, 0.60713;
+     0.19659, 0.94901, 0.59466;
+     0.20877, 0.95304, 0.58199;
+     0.22142, 0.95692, 0.56914;
+     0.23449, 0.96065, 0.55614;
+     0.24797, 0.96423, 0.54303;
+     0.26180, 0.96765, 0.52981;
+     0.27597, 0.97092, 0.51653;
+     0.29042, 0.97403, 0.50321;
+     0.30513, 0.97697, 0.48987;
+     0.32006, 0.97974, 0.47654;
+     0.33517, 0.98234, 0.46325;
+     0.35043, 0.98477, 0.45002;
+     0.36581, 0.98702, 0.43688;
+     0.38127, 0.98909, 0.42386;
+     0.39678, 0.99098, 0.41098;
+     0.41229, 0.99268, 0.39826;
+     0.42778, 0.99419, 0.38575;
+     0.44321, 0.99551, 0.37345;
+     0.45854, 0.99663, 0.36140;
+     0.47375, 0.99755, 0.34963;
+     0.48879, 0.99828, 0.33816;
+     0.50362, 0.99879, 0.32701;
+     0.51822, 0.99910, 0.31622;
+     0.53255, 0.99919, 0.30581;
+     0.54658, 0.99907, 0.29581;
+     0.56026, 0.99873, 0.28623;
+     0.57357, 0.99817, 0.27712;
+     0.58646, 0.99739, 0.26849;
+     0.59891, 0.99638, 0.26038;
+     0.61088, 0.99514, 0.25280;
+     0.62233, 0.99366, 0.24579;
+     0.63323, 0.99195, 0.23937;
+     0.64362, 0.98999, 0.23356;
+     0.65394, 0.98775, 0.22835;
+     0.66428, 0.98524, 0.22370;
+     0.67462, 0.98246, 0.21960;
+     0.68494, 0.97941, 0.21602;
+     0.69525, 0.97610, 0.21294;
+     0.70553, 0.97255, 0.21032;
+     0.71577, 0.96875, 0.20815;
+     0.72596, 0.96470, 0.20640;
+     0.73610, 0.96043, 0.20504;
+     0.74617, 0.95593, 0.20406;
+     0.75617, 0.95121, 0.20343;
+     0.76608, 0.94627, 0.20311;
+     0.77591, 0.94113, 0.20310;
+     0.78563, 0.93579, 0.20336;
+     0.79524, 0.93025, 0.20386;
+     0.80473, 0.92452, 0.20459;
+     0.81410, 0.91861, 0.20552;
+     0.82333, 0.91253, 0.20663;
+     0.83241, 0.90627, 0.20788;
+     0.84133, 0.89986, 0.20926;
+     0.85010, 0.89328, 0.21074;
+     0.85868, 0.88655, 0.21230;
+     0.86709, 0.87968, 0.21391;
+     0.87530, 0.87267, 0.21555;
+     0.88331, 0.86553, 0.21719;
+     0.89112, 0.85826, 0.21880;
+     0.89870, 0.85087, 0.22038;
+     0.90605, 0.84337, 0.22188;
+     0.91317, 0.83576, 0.22328;
+     0.92004, 0.82806, 0.22456;
+     0.92666, 0.82025, 0.22570;
+     0.93301, 0.81236, 0.22667;
+     0.93909, 0.80439, 0.22744;
+     0.94489, 0.79634, 0.22800;
+     0.95039, 0.78823, 0.22831;
+     0.95560, 0.78005, 0.22836;
+     0.96049, 0.77181, 0.22811;
+     0.96507, 0.76352, 0.22754;
+     0.96931, 0.75519, 0.22663;
+     0.97323, 0.74682, 0.22536;
+     0.97679, 0.73842, 0.22369;
+     0.98000, 0.73000, 0.22161;
+     0.98289, 0.72140, 0.21918;
+     0.98549, 0.71250, 0.21650;
+     0.98781, 0.70330, 0.21358;
+     0.98986, 0.69382, 0.21043;
+     0.99163, 0.68408, 0.20706;
+     0.99314, 0.67408, 0.20348;
+     0.99438, 0.66386, 0.19971;
+     0.99535, 0.65341, 0.19577;
+     0.99607, 0.64277, 0.19165;
+     0.99654, 0.63193, 0.18738;
+     0.99675, 0.62093, 0.18297;
+     0.99672, 0.60977, 0.17842;
+     0.99644, 0.59846, 0.17376;
+     0.99593, 0.58703, 0.16899;
+     0.99517, 0.57549, 0.16412;
+     0.99419, 0.56386, 0.15918;
+     0.99297, 0.55214, 0.15417;
+     0.99153, 0.54036, 0.14910;
+     0.98987, 0.52854, 0.14398;
+     0.98799, 0.51667, 0.13883;
+     0.98590, 0.50479, 0.13367;
+     0.98360, 0.49291, 0.12849;
+     0.98108, 0.48104, 0.12332;
+     0.97837, 0.46920, 0.11817;
+     0.97545, 0.45740, 0.11305;
+     0.97234, 0.44565, 0.10797;
+     0.96904, 0.43399, 0.10294;
+     0.96555, 0.42241, 0.09798;
+     0.96187, 0.41093, 0.09310;
+     0.95801, 0.39958, 0.08831;
+     0.95398, 0.38836, 0.08362;
+     0.94977, 0.37729, 0.07905;
+     0.94538, 0.36638, 0.07461;
+     0.94084, 0.35566, 0.07031;
+     0.93612, 0.34513, 0.06616;
+     0.93125, 0.33482, 0.06218;
+     0.92623, 0.32473, 0.05837;
+     0.92105, 0.31489, 0.05475;
+     0.91572, 0.30530, 0.05134;
+     0.91024, 0.29599, 0.04814;
+     0.90463, 0.28696, 0.04516;
+     0.89888, 0.27824, 0.04243;
+     0.89298, 0.26981, 0.03993;
+     0.88691, 0.26152, 0.03753;
+     0.88066, 0.25334, 0.03521;
+     0.87422, 0.24526, 0.03297;
+     0.86760, 0.23730, 0.03082;
+     0.86079, 0.22945, 0.02875;
+     0.85380, 0.22170, 0.02677;
+     0.84662, 0.21407, 0.02487;
+     0.83926, 0.20654, 0.02305;
+     0.83172, 0.19912, 0.02131;
+     0.82399, 0.19182, 0.01966;
+     0.81608, 0.18462, 0.01809;
+     0.80799, 0.17753, 0.01660;
+     0.79971, 0.17055, 0.01520;
+     0.79125, 0.16368, 0.01387;
+     0.78260, 0.15693, 0.01264;
+     0.77377, 0.15028, 0.01148;
+     0.76476, 0.14374, 0.01041;
+     0.75556, 0.13731, 0.00942;
+     0.74617, 0.13098, 0.00851;
+     0.73661, 0.12477, 0.00769;
+     0.72686, 0.11867, 0.00695;
+     0.71692, 0.11268, 0.00629;
+     0.70680, 0.10680, 0.00571;
+     0.69650, 0.10102, 0.00522;
+     0.68602, 0.09536, 0.00481;
+     0.67535, 0.08980, 0.00449;
+     0.66449, 0.08436, 0.00424;
+     0.65345, 0.07902, 0.00408;
+     0.64223, 0.07380, 0.00401;
+     0.63082, 0.06868, 0.00401;
+     0.61923, 0.06367, 0.00410;
+     0.60746, 0.05878, 0.00427;
+     0.59550, 0.05399, 0.00453;
+     0.58336, 0.04931, 0.00486;
+     0.57103, 0.04474, 0.00529;
+     0.55852, 0.04028, 0.00579;
+     0.54583, 0.03593, 0.00638;
+     0.53295, 0.03169, 0.00705;
+     0.51989, 0.02756, 0.00780;
+     0.50664, 0.02354, 0.00863;
+     0.49321, 0.01963, 0.00955;
+     0.47960, 0.01583, 0.01055];
+P = size(values,1);
+map = interp1(1:P, values, linspace(1,P,m), 'linear');
+end
Index: issm/trunk/src/m/plot/googlemaps.m
===================================================================
--- issm/trunk/src/m/plot/googlemaps.m	(revision 25994)
+++ issm/trunk/src/m/plot/googlemaps.m	(revision 26744)
@@ -175,8 +175,8 @@
 delete('temp.png');
 
-%If not gdal, exit
+%If not GDAL, exit
 if status~=0,
 	disp(result);
-	disp('googlemaps info: gdal not found or not working properly, the Google image will not be transformed');
+	disp('googlemaps info: GDAL not found or not working properly, the Google image will not be transformed');
 	[gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1);
 	[LAT LON]=pixelstolatlon(gX,gY, zoom);
@@ -204,5 +204,5 @@
 if ~isempty(strfind(result,'ERROR')),
 	disp(result);
-	disp(' ');disp('googlemaps info: gdal not working properly (missing proj.4 library?), Google image will not be transformed');
+	disp(' ');disp('googlemaps info: GDAL not working properly (missing PROJ.4 library?), Google image will not be transformed');
 	disp(result);
 	[gX gY]=meshgrid(ulx:ulx+size(final,2)-1,uly:-1:uly-size(final,1)+1);
Index: issm/trunk/src/m/plot/plot_contour.js
===================================================================
--- issm/trunk/src/m/plot/plot_contour.js	(revision 26744)
+++ issm/trunk/src/m/plot/plot_contour.js	(revision 26744)
@@ -0,0 +1,300 @@
+function plot_contour(md, datain, options, canvas) { //{{{
+	//PLOT_MESH - Function for plotting wireframe contour.
+	//
+	//   Usage:
+	//      plot_contour(md, options, canvas);
+	//
+	//   See also: PLOTMODEL, PLOT_MANAGER
+
+	//{{{
+	//Process data and model
+	//let meshresults = processmesh(md, [], options);
+	//let [x, y, z, index, is2d, isplanet, vertices, scale] = scaleMesh(md, meshresults, options);
+	let [x, y, z, index, is2d, isplanet]=processmesh(md,[],options);
+	options.removefield('log',0);;
+	let [data, datatype]=processdata(md,datain,options);
+	if (vesl.helpers.isEmptyOrUndefined(data)) error('data provided is empty');
+	
+	//check is2d
+	if (!is2d && !isplanet) {
+		error('plot_contour error message: contour not supported for 3d meshes, project on a layer');
+	}
+
+	//first, process data: must be on nodes
+	if (datatype==1) {
+		//elements -> take average
+		//data=averaging(md,data,0);
+		error('plot_contour error message: contour not supported for element data yet');
+	} else if (datatype==2) {
+		//nodes -> do nothing
+	} else if (datatype==3) {
+		//quiver -> take norm
+		//data=sqrt(sum(datain.*datain,2)); //(original)
+		//data=ArraySqrt(ArraySum(ArrayMultiply(datain, datain),2)); //js version
+		error('plot_contour error message: contour not supported for quiver data yet');
+	} else {
+		error('datatype not supported yet');
+	}
+
+	//prepare colors
+	if (options.exist('contouronly')) {
+		//remove the previous plots
+		//cla
+		error('contouronly not supported yet');
+	}
+	let color=options.getfieldvalue('contourcolor','yellow');
+	let linewidth=options.getfieldvalue('linewidth',1);
+
+	//get contours levels
+	let contourlevels=options.getfieldvalue('contourlevels');
+	let levels;
+	if (typeof(contourlevels) == 'number') {
+		//levels=round_ice(linspace(max(data),min(data),contourlevels),2);
+		error('numeric contourlevels not supported yet - must provide levels as an array');
+	} else {
+		//levels=sort(unique(levels),'descend');
+		levels=ArraySort(ArrayUnique(contourlevels)).reverse();
+	}
+	let numlevels=levels.length;
+
+	//initialization of some variables
+	let numberofelements=index.length; //same as size(index,1)
+	let elementslist=NewArrayFillIncrement(0,numberofelements,1); //1:numberofelements;
+	let c=[];
+	let h=[];;
+
+	//get unique edges in mesh
+	//1: list of edges
+	index = ArraySubtract2D(index, 1);
+	//edges=[index[:,[1,2]); index(:,[2,3]); index(:,[3,1])];
+	let edges=ArrayConcat(ArrayConcat(ArrayCol(index,[0,1]), ArrayCol(index,[1,2])), ArrayCol(index,[2,0]));
+	//2: find unique edges
+	//[edges,I,J]=unique(sort(edges,2),'rows');
+	[edges,I,J]=ArrayUnique(ArraySort(edges,2),'rows');
+	//3: unique edge numbers
+	let vec=J;
+	//4: unique edges numbers in each triangle (2 triangles sharing the same edge will have
+	//   the same edge number)
+	let edges_tria=ArrayTranspose([ArrayIndex(vec,elementslist), ArrayIndex(vec,ArrayAdd(elementslist,numberofelements)), ArrayIndex(vec,ArrayAdd(elementslist,2*numberofelements))]);
+
+	//segments [nodes1 nodes2]
+	let Seg1=ArrayCol(index,[0,1]);
+	let Seg2=ArrayCol(index,[1,2]);
+	let Seg3=ArrayCol(index,[2,0]);
+	
+	//segment numbers [1;4;6;...]
+	let Seg1_num=ArrayCol(edges_tria,0);
+	let Seg2_num=ArrayCol(edges_tria,1);
+	let Seg3_num=ArrayCol(edges_tria,2);
+
+	//value of data on each tips of the segments
+	let Data1=ArrayIndex(data,Seg1);
+	let Data2=ArrayIndex(data,Seg2);
+	let Data3=ArrayIndex(data,Seg3);
+
+	//get the ranges for each segment
+	let Range1=ArraySort(Data1,2);
+	let Range2=ArraySort(Data2,2);
+	let Range3=ArraySort(Data3,2);
+	
+	let hx = [];
+	let hy = [];
+	let hz = [];
+	for (let i=0; i<numlevels; i++) {
+		let level=levels[i];
+
+		//find the segments that contain this value
+		let pos1=ArrayAnd(ArrayLessThan(ArrayCol(Range1,0),level), ArrayGreaterThan(ArrayCol(Range1,1),level)); //pos1=(Range1(:,1)<level & Range1(:,2)>level);
+		let pos2=ArrayAnd(ArrayLessThan(ArrayCol(Range2,0),level), ArrayGreaterThan(ArrayCol(Range2,1),level)); //pos2=(Range2(:,1)<level & Range2(:,2)>level);
+		let pos3=ArrayAnd(ArrayLessThan(ArrayCol(Range3,0),level), ArrayGreaterThan(ArrayCol(Range3,1),level)); //pos3=(Range3(:,1)<level & Range3(:,2)>level);
+
+		//get elements
+		let poselem12=ArrayAnd(pos1, pos2);
+		let poselem13=ArrayAnd(pos1, pos3);
+		let poselem23=ArrayAnd(pos2, pos3);
+		let poselem=find(ArrayOr(ArrayOr(poselem12, poselem13), poselem23));
+		let numelems=length(poselem);
+
+		//if no element has been flagged, skip to the next level
+		if (numelems==0) {
+			continue;
+		}
+
+		//go through the elements and build the coordinates for each segment (1 by element)
+		let x1=zeros(numelems,1);
+		let x2=zeros(numelems,1);
+		let y1=zeros(numelems,1);
+		let y2=zeros(numelems,1);
+		let z1=zeros(numelems,1);
+		let z2=zeros(numelems,1);
+
+		let edge_l=zeros(numelems,2);
+
+		for (let j=0; j < numelems; j++) {
+
+			let weight1=(level-Data1[poselem[j]][0])/(Data1[poselem[j]][1]-Data1[poselem[j]][0]);
+			let weight2=(level-Data2[poselem[j]][0])/(Data2[poselem[j]][1]-Data2[poselem[j]][0]);
+			let weight3=(level-Data3[poselem[j]][0])/(Data3[poselem[j]][1]-Data3[poselem[j]][0]);
+
+			if (poselem12[poselem[j]]) {
+				x1[j]=x[Seg1[poselem[j]][0]]+weight1*(x[Seg1[poselem[j]][1]]-x[Seg1[poselem[j]][0]]);
+				x2[j]=x[Seg2[poselem[j]][0]]+weight2*(x[Seg2[poselem[j]][1]]-x[Seg2[poselem[j]][0]]);
+				y1[j]=y[Seg1[poselem[j]][0]]+weight1*(y[Seg1[poselem[j]][1]]-y[Seg1[poselem[j]][0]]);
+				y2[j]=y[Seg2[poselem[j]][0]]+weight2*(y[Seg2[poselem[j]][1]]-y[Seg2[poselem[j]][0]]);
+				z1[j]=z[Seg1[poselem[j]][0]]+weight1*(z[Seg1[poselem[j]][1]]-z[Seg1[poselem[j]][0]]);
+				z2[j]=z[Seg2[poselem[j]][0]]+weight2*(z[Seg2[poselem[j]][1]]-z[Seg2[poselem[j]][0]]);
+				edge_l[j][0]=Seg1_num[poselem[j]];
+				edge_l[j][1]=Seg2_num[poselem[j]];
+
+			} else if (poselem13[poselem[j]]) {
+                x1[j]=x[Seg1[poselem[j]][0]]+weight1*(x[Seg1[poselem[j]][1]]-x[Seg1[poselem[j]][0]]);
+				x2[j]=x[Seg3[poselem[j]][0]]+weight3*(x[Seg3[poselem[j]][1]]-x[Seg3[poselem[j]][0]]);
+				y1[j]=y[Seg1[poselem[j]][0]]+weight1*(y[Seg1[poselem[j]][1]]-y[Seg1[poselem[j]][0]]);
+				y2[j]=y[Seg3[poselem[j]][0]]+weight3*(y[Seg3[poselem[j]][1]]-y[Seg3[poselem[j]][0]]);
+				z1[j]=z[Seg1[poselem[j]][0]]+weight1*(z[Seg1[poselem[j]][1]]-z[Seg1[poselem[j]][0]]);
+				z2[j]=z[Seg3[poselem[j]][0]]+weight3*(z[Seg3[poselem[j]][1]]-z[Seg3[poselem[j]][0]]);
+				edge_l[j][0]=Seg1_num[poselem[j]];
+				edge_l[j][1]=Seg3_num[poselem[j]];
+
+			} else if (poselem23[poselem[j]]) {
+                x1[j]=x[Seg2[poselem[j]][0]]+weight2*(x[Seg2[poselem[j]][1]]-x[Seg2[poselem[j]][0]]);
+				x2[j]=x[Seg3[poselem[j]][0]]+weight3*(x[Seg3[poselem[j]][1]]-x[Seg3[poselem[j]][0]]);
+				y1[j]=y[Seg2[poselem[j]][0]]+weight2*(y[Seg2[poselem[j]][1]]-y[Seg2[poselem[j]][0]]);
+				y2[j]=y[Seg3[poselem[j]][0]]+weight3*(y[Seg3[poselem[j]][1]]-y[Seg3[poselem[j]][0]]);
+				z1[j]=z[Seg2[poselem[j]][0]]+weight2*(z[Seg2[poselem[j]][1]]-z[Seg2[poselem[j]][0]]);
+				z2[j]=z[Seg3[poselem[j]][0]]+weight3*(z[Seg3[poselem[j]][1]]-z[Seg3[poselem[j]][0]]);
+				edge_l[j][0]=Seg2_num[poselem[j]];
+				edge_l[j][1]=Seg3_num[poselem[j]];
+			} else {
+				//it shoud not go here
+			}
+			let test = new THREE.Vector3(x1[j], y1[j], z1[j]);
+			//console.log('helo', test.length());
+		}
+		//now that we have the segments, we must try to connect them...
+
+		//loop over the subcontours
+		while (!isempty(edge_l)) {
+			//take the right edge of the second segment and connect it to the next segments if any
+			let e1=edge_l[0][0];   let e2=edge_l[0][1];
+			let xc=[x1[0],x2[0]]; let yc=[y1[0],y2[0]]; let zc=[z1[0],z2[0]]; 
+
+			//erase the lines corresponding to this edge
+			//edge_l(1,:)=[];
+			//x1(1)=[]; x2(1)=[];
+			//y1(1)=[]; y2(1)=[];
+			//z1(1)=[]; z2(1)=[]
+			edge_l.splice(0,1);
+			x1.splice(0,1); x2.splice(0,1);
+			y1.splice(0,1); y2.splice(0,1);
+			z1.splice(0,1); z2.splice(0,1);
+			let [ro1,co1]=find(ArrayEqual(edge_l,e1));
+
+			while (!isempty(ro1)) {
+				if (co1==0) {
+					xc=[x2[ro1]].concat(xc); yc=[y2[ro1]].concat(yc); zc=[z2[ro1]].concat(zc);
+
+					//next edge:
+					e1=edge_l[ro1][1];
+
+				} else {
+					xc=[x1[ro1]].concat(xc); yc=[y1[ro1]].concat(yc); zc=[z1[ro1]].concat(zc);
+
+					//next edge:
+					e1=edge_l[ro1][0];
+				}
+
+				//erase the lines of this
+				edge_l.splice(ro1,1);
+				x1.splice(ro1,1); x2.splice(ro1,1);
+				y1.splice(ro1,1); y2.splice(ro1,1);
+				z1.splice(ro1,1); z2.splice(ro1,1);
+
+				//next connection
+				[ro1,co1]=find(ArrayEqual(edge_l,e1));
+			}
+
+			//same thing the other way (to the right)
+			let [ro2,co2]=find(ArrayEqual(edge_l,e2));
+
+			while (!isempty(ro2)) {
+
+				if (co2==0) {
+					xc=[x2[ro2]].concat(xc); yc=[y2[ro2]].concat(yc); zc=[z2[ro2]].concat(zc);
+
+					//next edge:
+					e2=edge_l[ro2][1];
+
+				} else {
+					xc=[x1[ro2]].concat(xc); yc=[y1[ro2]].concat(yc); zc=[z1[ro2]].concat(zc);
+
+					//next edge:
+					e2=edge_l[ro2][0];
+				}
+
+				//erase the lines of this
+				edge_l.splice(ro2,1);
+				x1.splice(ro2,1); x2.splice(ro2,1);
+				y1.splice(ro2,1); y2.splice(ro2,1);
+				z1.splice(ro2,1); z2.splice(ro2,1);
+
+				//next connection
+				[ro2,co2]=find(ArrayEqual(edge_l,e2));
+			}
+
+			//we now have one subcontour ready to be plotted
+			if (options.getfieldvalue('contouronly',0)) {
+				if (isplanet) {
+					hx = ArrayConcat(hx, ArrayConcat(xc, [NaN]));
+					hy = ArrayConcat(hy, ArrayConcat(yc, [NaN]));
+					hz = ArrayConcat(hz, ArrayConcat(zc, [NaN]));
+					//h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',[zc;NaN],'facecolor','none','linewidth',linewidth)];
+				} else {
+					hx = ArrayConcat(hx, ArrayConcat(xc, [NaN]));
+					hy = ArrayConcat(hy, ArrayConcat(yc, [NaN]));
+					hz = ArrayConcat(hz, ArrayConcat(zc, [NaN]));
+					//h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat','linewidth',linewidth)];
+				}
+				//hold on      
+			} else {
+				//dist = 5000;
+				dist = 0;
+				if (isplanet) {
+					if ((max(xc)-min(xc)+max(yc)-min(yc)+max(zc)-min(zc))<dist) { continue; }
+					hx = ArrayConcat(hx, ArrayConcat(xc, [NaN]));
+					hy = ArrayConcat(hy, ArrayConcat(yc, [NaN]));
+					hz = ArrayConcat(hz, ArrayConcat(zc, [NaN]));
+					//h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',[zc;NaN],'facecolor','none','edgecolor',color,'linewidth',linewidth)];
+					//c = horzcat([level, xc'; length(xc), yc'; length(xc), zc']);
+				} else {
+					if ((max(xc)-min(xc)+max(yc)-min(yc))<dist) { continue; }
+					hx = ArrayConcat(hx, ArrayConcat(xc, [NaN]));
+					hy = ArrayConcat(hy, ArrayConcat(yc, [NaN]));
+					hz = ArrayConcat(hz, ArrayConcat(zc, [NaN]));
+					//h=patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'facecolor','none','edgecolor',color,'linewidth',linewidth);
+					//c = horzcat([level, xc'; length(xc), yc']);
+				}
+				//clabel(c,h,'FontSize',10,'labelspacing',20000,'color',color);
+				//hold on
+			}
+			//break;
+		}
+	}
+
+	//Compute gl variables:
+	let scale = options.getfieldvalue('contourscale', 1.0005);
+	let node = new Node(
+		'canvas', canvas,
+		'options', options,
+		'md', md,
+		'name', 'contours',
+		'replaceNaN', false,
+		'shaderName', 'line_strip',
+		'lineWidth', options.getfieldvalue('linewidth', 1),
+		'scale', [scale, scale, scale]
+	);
+
+	node.patch('Vertices', [hx, hy, hz], 'FaceColor', 'none', 'EdgeColor', color);
+	//node.patch('Faces', elements, 'Vertices', vertices, 'FaceColor', 'none', 'EdgeColor', edgecolor);
+	//}}}
+} //}}}
Index: issm/trunk/src/m/plot/plot_manager.js
===================================================================
--- issm/trunk/src/m/plot/plot_manager.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_manager.js	(revision 26744)
@@ -1,130 +1,162 @@
-function plot_manager(md,options,subplotwidth,nlines,ncols,i){ //{{{
+'use strict';
+
+function plot_manager(md, options, subplotwidth, nlines, ncols, i) { //{{{
 	//PLOT__MANAGER - distribute the plots, called by plotmodel
 	//
 	//   Usage:
-	//      plot_manager(md,options,subplotwidth,i);
+	//      plot_manager(md, options, subplotwidth, i);
 	//
 	//   See also: PLOTMODEL, PLOT_UNIT
+	let canvas      = document.getElementById(options.getfieldvalue('canvasid'));
+	let data        = options.getfieldvalue('data'); // Get data to be displayed
+	let dataresults = null; 
+	let datatype    = 0;
+	let	data2       = null;
 			
-	//parse options and get a structure of options. 
-	checkplotoptions(md,options);
-	
-	//get data to be displayed
-	var data = options.getfieldvalue('data');
-	var canvas = initCanvas(options);
-	var gl = canvas.gl;
-
-	//figure out if this is a special plot
-	if (typeof data === 'string'){
-		
-		switch(data){
-
+	// Parse options and get a structure of options
+	checkplotoptions(md, options);
+
+	// Figure out if this is a special plot
+	if (typeof data === 'string') {
+		switch(data) {
 			case 'boundaries':
-				plot_boundaries(md,options,subplotwidth,i);
-				return;
+				plot_boundaries(md, options, subplotwidth, i);
+				return;
+				
 			case 'BC':
-				plot_BC(md,options,subplotwidth,i,data);
-				return;
+				plot_BC(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'edges':
-				plot_edges(md,options,subplotwidth,i,data);
-				return;
+				plot_edges(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'elementnumbering':
-				plot_elementnumbering(md,options,subplotwidth,i);
-				return;
+				plot_elementnumbering(md, options, subplotwidth, i);
+				return;
+				
 			case 'highlightelements':
-				plot_highlightelements(md,options,subplotwidth,i);
-				return;
+				plot_highlightelements(md, options, subplotwidth, i);
+				return;
+				
 			case 'qmumean':
-				plot_qmumean(md,options,nlines,ncols,i);
-				return;
+				plot_qmumean(md, options, nlines, ncols, i);
+				return;
+				
 			case 'qmustddev':
-				plot_qmustddev(md,options,nlines,ncols,i);
-				return;
+				plot_qmustddev(md, options, nlines, ncols, i);
+				return;
+				
 			case 'qmuhistnorm':
-				plot_qmuhistnorm(md,options,nlines,ncols,i);
-				return;
+				plot_qmuhistnorm(md, options, nlines, ncols, i);
+				return;
+				
 			case 'qmu_mass_flux_segments':
-				plot_qmu_mass_flux_segments(md,options,nlines,ncols,i);
-				return;
+				plot_qmu_mass_flux_segments(md, options, nlines, ncols, i);
+				return;
+				
 			case 'part_hist':
-				plot_parthist(md,options,nlines,ncols,i);
-				return;
+				plot_parthist(md, options, nlines, ncols, i);
+				return;
+				
 			case 'part_hist_n':
-				plot_parthistn(md,options,nlines,ncols,i);
-				return;
+				plot_parthistn(md, options, nlines, ncols, i);
+				return;
+				
 			case 'part_hist_w':
-				plot_parthistw(md,options,nlines,ncols,i);
-				return;
+				plot_parthistw(md, options, nlines, ncols, i);
+				return;
+				
 			case 'elements_type':
-				plot_elementstype(md,options,subplotwidth,i);
-				return;
+				plot_elementstype(md, options, subplotwidth, i);
+				return;
+				
 			case 'vertexnumbering':
-				plot_vertexnumbering(md,options,subplotwidth,i);
-				return;
+				plot_vertexnumbering(md, options, subplotwidth, i);
+				return;
+				
 			case 'highlightvertices':
-				plot_highlightvertices(md,options,subplotwidth,i);
-				return;
+				plot_highlightvertices(md, options, subplotwidth, i);
+				return;
+				
 			case 'basal_drag':
-				plot_basaldrag(md,options,subplotwidth,i,data);
-				return;
+				plot_basaldrag(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'basal_dragx':
-				plot_basaldrag(md,options,subplotwidth,i,data);
-				return;
+				plot_basaldrag(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'basal_dragy':
-				plot_basaldrag(md,options,subplotwidth,i,data);
-				return;
+				plot_basaldrag(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'driving_stress':
-				plot_drivingstress(md,options,subplotwidth,i);
-				return;
+				plot_drivingstress(md, options, subplotwidth, i);
+				return;
+				
 			case 'mesh':
-				plot_mesh(md,options,canvas);
-				return;
+				plot_mesh(md, options, canvas);
+				return;
+				
 			case 'none':
-				//if (!(options.exist('overlay'))){
-				//	plot_none(md,options,nlines,ncols,i);
-				//}
-				return;
+				return;
+				
 			case 'penalties':
-				plot_penalties(md,options,subplotwidth,i);
-				return;
+				plot_penalties(md, options, subplotwidth, i);
+				return;
+				
 			case 'partition':
-				plot_partition(md,options,nlines,ncols,i);
-				return;
+				plot_partition(md, options, nlines, ncols, i);
+				return;
+				
 			case 'referential':
-				plot_referential(md,options,nlines,ncols,i);
-				return;
+				plot_referential(md, options, nlines, ncols, i);
+				return;
+				
 			case 'riftvel':
-				plot_riftvel(md,options,nlines,ncols,i);
-				return;
+				plot_riftvel(md, options, nlines, ncols, i);
+				return;
+				
 			case 'riftnumbering':
-				plot_riftnumbering(md,options,nlines,ncols,i);
-				return;
+				plot_riftnumbering(md, options, nlines, ncols, i);
+				return;
+				
 			case 'rifts':
-				plot_rifts(md,options,nlines,ncols,i);
-				return;
+				plot_rifts(md, options, nlines, ncols, i);
+				return;
+				
 			case 'riftrelvel':
-				plot_riftrelvel(md,options,nlines,ncols,i);
-				return;
+				plot_riftrelvel(md, options, nlines, ncols, i);
+				return;
+				
 			case 'riftpenetration':
-				plot_riftpenetration(md,options,nlines,ncols,i);
-				return;
+				plot_riftpenetration(md, options, nlines, ncols, i);
+				return;
+				
 			case 'riftfraction':
-				plot_riftfraction(md,options,nlines,ncols,i);
-				return;
+				plot_riftfraction(md, options, nlines, ncols, i);
+				return;
+				
 			case 'sarpwr':
-				plot_sarpwr(md,options,subplotwidth,i);
-				return;
+				plot_sarpwr(md, options, subplotwidth, i);
+				return;
+				
 			case 'time_dependant':
-				plot_vstime(md,options,nlines,ncols,i);
-				return;
+				plot_vstime(md, options, nlines, ncols, i);
+				return;
+				
 			case 'icefront':
-				plot_icefront(md,options,subplotwidth,i,data);
-				return;
+				plot_icefront(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'segments':
-				plot_segments(md,options,subplotwidth,i,data);
-				return;
+				plot_segments(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'quiver':
-				plot_quiver(md,options,canvas);
-				return;
+				plot_quiver(md, options, canvas);
+				return;
+				
 			case 'strainrate_tensor':
 			case 'strainrate':
@@ -145,23 +177,27 @@
 			case 'deviatoricstress_principalaxis2':
 			case 'deviatoricstress_principalaxis3':
-				plot_tensor(md,options,subplotwidth,i,data);
-				return;
+				plot_tensor(md, options, subplotwidth, i, data);
+				return;
+				
 			case 'thermaltransient_results':
-				plot_thermaltransient_results(md,options,subplotwidth,i);
-				return;
+				plot_thermaltransient_results(md, options, subplotwidth, i);
+				return;
+				
 			case 'transient_movie':
-				plot_transient_movie(md,options,canvas);
-				return;
+				plot_transient_movie(md, options, canvas);
+				return;
+				
 			case 'transient_results':
-				plot_transient_results(md,options,subplotwidth,i);
-				return;
+				plot_transient_results(md, options, subplotwidth, i);
+				return;
+				
 			case 'transient_field':
-				plot_transient_field(md,options,subplotwidth,i);
-				return;
+				plot_transient_field(md, options, subplotwidth, i);
+				return;
+				
 			default:
-				if (data in md){
-					data=md[data];
-				}
-				else{
+				if (data in md) {
+					data = md[data];
+				} else {
 					error('plot error message: data provided not supported yet. Type plotdoc for help');
 				}
@@ -169,40 +205,41 @@
 	}
 
-	//Figure out if this is a semi-transparent plot.
-	if (options.getfieldvalue('overlay','off')=='on'){
-		plot_overlay(md,data,options,canvas);
-	}
-
-	//Figure out if this is a semi-transparent plot.
-	if (options.exist('googlemaps')){
-		plot_googlemaps(md,data,options,nlines,ncols,i);
-		return;
-	}
-
-	//Figure out if this is a semi-transparent plot.
-	if (options.exist('gridded')){
-		plot_gridded(md,data,options,nlines,ncols,i);
-		return;
-	}
-
-	//Figure out if this is a Section plot
-	if (options.exist('sectionvalue')){
-		plot_section(md,data,options,nlines,ncols,i);
+	// Figure out if this is a semi-transparent plot.
+	if (options.getfieldvalue('overlay', 'off') === 'on') {
+		plot_overlay(md, data, options, canvas);
+		//return;
+	}
+
+	// Figure out if this is a semi-transparent plot.
+	if (options.exist('googlemaps')) {
+		plot_googlemaps(md, data, options, nlines, ncols, i);
+		return;
+	}
+
+	// Figure out if this is a semi-transparent plot.
+	if (options.exist('gridded')) {
+		plot_gridded(md, data, options, nlines, ncols, i);
+		return;
+	}
+
+	// Figure out if this is a Section plot
+	if (options.exist('sectionvalue')) {
+		plot_section(md, data, options, nlines, ncols, i);
 		return;
 	}
 
 	//Figure out if this is a Profile plot
-	if (options.exist('profile')){
-		plot_profile(md,data,options,nlines,ncols,i);
+	if (options.exist('profile')) {
+		plot_profile(md, data, options, nlines, ncols, i);
 		return;
 	}
 	
-	var	dataresults = processdata(md,data,options);
-	var	data2 = dataresults[0]; 
-	var	datatype = dataresults[1];
+	dataresults = processdata(md, data, options);
+	data2       = dataresults[0]; 
+	datatype    = dataresults[1];
 	
-	//plot unit
-	plot_unit(md,data2,datatype,options,canvas);
-
-	applyoptions(md,data2,options,canvas);
+	// Plot unit
+	plot_unit(md, data2, datatype, options, canvas);
+
+	applyoptions(md, data2, options, canvas);
 } //}}}
Index: issm/trunk/src/m/plot/plot_manager.py
===================================================================
--- issm/trunk/src/m/plot/plot_manager.py	(revision 25994)
+++ issm/trunk/src/m/plot/plot_manager.py	(revision 26744)
@@ -3,5 +3,5 @@
     overlaysupport = True
 except ImportError:
-    print('osgeo/gdal for python not installed, overlay plots are not enabled')
+    print('OSGeo/GDAL for Python not installed, overlay plots are not enabled')
     overlaysupport = False
 
@@ -20,6 +20,5 @@
 
 def plot_manager(md, options, fig, axgrid, gridindex):
-    '''
-    PLOT_MANAGER - distribute the plots called by plotmodel
+    """PLOT_MANAGER - distribute the plots called by plotmodel
 
     'fig' is a handle to the figure instance created by plotmodel.
@@ -35,5 +34,5 @@
 
     See also: PLOTMODEL, PLOT_UNIT
-    '''
+    """
     #parse options and get a structure of options
     options = checkplotoptions(md, options)
@@ -46,4 +45,5 @@
     # TODO: Check why we are doing this and if it is absolutely necessary (see
     #       also src/m/plot/plot_mesh.py, src/m/plot/applyoptions.py)
+    #
     options.addfielddefault('ticklabels', 'on')
 
Index: issm/trunk/src/m/plot/plot_mesh.js
===================================================================
--- issm/trunk/src/m/plot/plot_mesh.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_mesh.js	(revision 26744)
@@ -7,64 +7,47 @@
 	//   See also: PLOTMODEL, PLOT_MANAGER
 
-	// If we already have the overlay and are using caching, short circuit
-	if ('mesh' in canvas.nodes && options.getfieldvalue('cachenodes', 'off') === 'on') {
-		return;
-	}
-	
-	/*
-		Local variables
-	*/
 	//{{{
 	//Process data and model
-	var meshresults = processmesh(md, [], options);
-	var x = meshresults[0]; 
-	var y = meshresults[1]; 
-	var z = meshresults[2]; 
-	var elements = meshresults[3]; 
-	var is2d = meshresults[4]; 
-	var isplanet = meshresults[5];
-		
-	//Compute coordinates and data range:
-	var xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
-	var ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
-	var zlim = options.getfieldvalue('zlim', [ArrayMin(z), ArrayMax(z)]);
-	
-	//Handle heightscale
-	var vertices, scale;
-	if (md.mesh.classname() !== 'mesh3dsurface') {
-		vertices = [x, y, z];
-		scale = [1, 1, options.getfieldvalue('heightscale', 1)];
-	}
-	else {
-		vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false}));
-		scale = [1, 1, 1];
-	}
+	let meshresults = processmesh(md, [], options);
+	meshresults = scaleMesh(md, meshresults, options);
+	let x = meshresults[0]; 
+	let y = meshresults[1]; 
+	let z = meshresults[2]; 
+	let elements = meshresults[3];
+	let is2d = meshresults[4]; 
+	let isplanet = meshresults[5];
+	let vertices = meshresults[6];
+	let scale = meshresults[7];
 	
 	//Compute gl variables:
-	var edgecolor = options.getfieldvalue('edgecolor', 'black');
-	var node = new Node(
+	let edgecolor = options.getfieldvalue('edgecolor', 'black');
+	let node = new Node(
 		'canvas', canvas,
 		'options', options,
+		'md', md,
 		'name', 'mesh',
-		'shaderName', 'Colored',
-		'alpha', options.getfieldvalue('alpha', 1.0),
-		//'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, md.mesh.classname() === 'mesh3dsurface' ? (zlim[0] + zlim[1]) / 2 : zlim[0]],
-		'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2],
-		'drawMode', canvas.gl.LINES,
-		'diffuseColor', edgecolor,
+		'cullFace', THREE.DoubleSide,
+		'shaderName', 'lines',
+		'opacity', options.getfieldvalue('opacity', 1.0),
 		'lineWidth', options.getfieldvalue('linewidth', 1),
-		'maskEnabled', options.getfieldvalue('innermask','off') == 'on',
-		'maskHeight', options.getfieldvalue('innermaskheight', 150.0) / options.getfieldvalue('heightscale', 1),
-		'maskColor', options.getfieldvalue('innermaskcolor',[0.0, 0.0, 1.0, 1.0]),
-		'rotation', [-90, 0, 0],
 		'scale', scale
 	);
 	//}}}
 	//{{{ node plot
-	if (elements[0].length==6){ //prisms
-	}
-	else if (elements[0].length==4){ //tetras
-	}
-	else{ //2D triangular elements
+	if (elements[0].length === 6) { //prisms
+		//We can skip bottom and every other side to avoid drawing edges twice.
+		let abc = elements.map(function(value, index) { return [value[0], value[1], value[2]]; }); //top
+		// let dfe = elements.map(function(value, index) { return [value[3], value[5], value[4]]; }); //bottom
+		// let aeb = elements.map(function(value, index) { return [value[0], value[4], value[1]]; }); //1st side upper right
+		let ade = elements.map(function(value, index) { return [value[0], value[3], value[4]]; }); //1st side lower left
+		// let bfc = elements.map(function(value, index) { return [value[1], value[5], value[2]]; }); //2nd side upper right
+		let bef = elements.map(function(value, index) { return [value[1], value[4], value[5]]; }); //2nd side lower left
+		// let cda = elements.map(function(value, index) { return [value[2], value[3], value[0]]; }); //3rd side upper right
+		let cfd = elements.map(function(value, index) { return [value[2], value[5], value[3]]; }); //3rd side lower left
+		let prismElements = abc.concat(ade, bef, cfd);
+		node.patch('Faces', prismElements, 'Vertices', vertices, 'FaceColor', 'none', 'EdgeColor', edgecolor);
+	} else if (elements[0].length === 4) { //tetras
+        // TODO: Implement handling for tetras
+	} else { // 2D triangular elements
 		node.patch('Faces', elements, 'Vertices', vertices, 'FaceColor', 'none', 'EdgeColor', edgecolor);
 	}
Index: issm/trunk/src/m/plot/plot_overlay.js
===================================================================
--- issm/trunk/src/m/plot/plot_overlay.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_overlay.js	(revision 26744)
@@ -1,98 +1,157 @@
-function plot_overlay(md, data, options, canvas){ //{{{
-	//PLOT_OVERLAY - Function for plotting a georeferenced image.  
-	//
-	//   Usage:
-	//      plot_overlay(md, data, options, canvas);
-	//
-	//   See also: PLOTMODEL, PLOT_MANAGER
+'use strict';
 
-	// If we already have the overlay and are using caching, short circuit
-	if ('overlay' in canvas.nodes && options.getfieldvalue('cachenodes', 'off') === 'on') {
-		return;
+/**
+ * Global Function: plotOverlay
+ *
+ * Plot a georeferenced image 
+ *
+ * Dependencies:
+ *      - /ext/proj4-<version>
+ *
+ * See Also:
+ *      - /js/plotmodel.js
+ *      - /js/plotmanager.js
+ */
+function plot_overlay(md, data, options, canvas) {
+    let elements        = null;
+    let meshresults     = null; // results from call to processmesh
+    let newX            = null; // scaled x-coordinates (array)
+    let newY            = null; // scaled y-coordinates (array)
+    let newZ            = null; // scaled z-coordinates (array)
+    let position        = null; // x-, y-, and z-coordinates of vertex (object)
+    let renderObject    = null; 
+    let reproject       = false; // default; whether or not to reproject overlay
+    let result          = null; // First, projection of radar overlay onto mesh; then, projection of overlay onto mesh
+    let scale           = null; // coordinate scalars (array)
+	let vertices        = null;
+    let x               = null; // x-coordinates from results (array)
+    let xlim            = null; // x-cooridinate limits (array)
+    let y               = null; // y-coordinates from results (array)
+    let ylim            = null; // y-cooridinate limits (array)
+    let z               = null; // z-coordinates from results (array)
+    
+	// Process data and model
+    meshresults = processmesh(md, [], options);
+	x           = meshresults[0]; 
+	y           = meshresults[1]; 
+	z           = meshresults[2]; 
+	elements    = meshresults[3];
+	
+	if (md.mesh.classname().startsWith('mesh2d')) {
+		if (vesl.helpers.isNaN(md.geometry.surface) || (md.geometry.surface[0] !== undefined && vesl.helpers.isNaN(md.geometry.surface[0]))) {
+			md.geometry.surface = NewArrayFill(x.length, 0);
+			z = NewArrayFill(x.length, 0);
+		} else {
+			z = md.geometry.surface;
+		}
 	}
 	
-	/*
-		Local variables
-	*/
-	//{{{
-	//Process data and model
-	var meshresults = processmesh(md, [], options);
-	var x = meshresults[0]; 
-	var y = meshresults[1]; 
-	var z = meshresults[2]; 
-	var elements = meshresults[3]; 
-	var is2d = meshresults[4]; 
-	var isplanet = meshresults[5];
-	if (md.mesh.classname() !== 'mesh3dsurface') z = md.geometry.surface;
+	// Compute coordinates and data range
+	xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
+	ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
 	
-	//Compute coordinates and data range:
-	var xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
-	var ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
-	var zlim = options.getfieldvalue('zlim', [ArrayMin(md.geometry.surface), ArrayMax(md.geometry.surface)]);
-	
-	//Handle radaroverlay
+	// Handle radaroverlay
 	if (md.radaroverlay.outerx) {
-		var result = Node.prototype.mergeVertices(x, y, z, elements, md.radaroverlay.outerx, md.radaroverlay.outery, md.radaroverlay.outerheight, md.radaroverlay.outerindex);
-		x = result.x;
-		y = result.y;
-		z = result.z;
-		elements = result.elements;
+		result      = Node.prototype.mergeVertices(x, y, z, elements, md.radaroverlay.outerx, md.radaroverlay.outery, md.radaroverlay.outerheight, md.radaroverlay.outerindex);
+		x           = result.x;
+		y           = result.y;
+		z           = result.z;
+		elements    = result.elements;
 	}
 	
-	//Handle heightscale
-	var vertices, scale;
-	if (md.mesh.classname() !== 'mesh3dsurface') {
-		vertices = [x, y, z];
-		scale = [1, 1, options.getfieldvalue('heightscale', 1)];
-	}
-	else {
-		vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false}));
-		scale = [1, 1, 1];
+	// Handle heightscale
+	renderObject = options.getfieldvalue('render', {});
+	
+	if ('overlay' in renderObject && renderObject.overlay.reproject !== undefined) {
+		reproject = renderObject.overlay.reproject;
 	}
 	
-	//Compute gl variables:
-	var edgecolor = options.getfieldvalue('edgecolor', 'black');
-	var texture = initTexture(gl, options.getfieldvalue('overlay_image'));
-	var node = new Node(
+	if (reproject) {
+		//NOTE: This is being hardcoded for now, as we want to display Josh's greenland-ice-retreat model on a globe.
+		// If mesh3dprisims do not need to be displayed on a globe, add an option to the view/render objects to specify the reprojection.
+		// Currently, we are also hardcoding the reprojection from EPSG:3413 (WGS 84 / NSIDC Sea Ice Polar Stereographic North) to EPSG:4326 (WGS 84, standard 2d spherical projection))
+		// projection definitions are taken from http://epsg.io/XXXXX.js, where XXXXX is the projection number.
+		// Can be dynamically taken and retrieved via md.mesh.epsg, but again, hardcoded for efficiency.
+		proj4.defs("EPSG:3413","+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"); // http://epsg.io/3413.js
+		//Don't need to redefine EPSG:4326, as it is defined by default - however, this is still included just in case.
+		// proj4.defs("EPSG:4326","+proj=longlat +datum=WGS84 +no_defs"); // http://epsg.io/4326.js
+		//Create empty copies of XYZ to avoid rescaling md.geomtery.surface in the case that z = md.geomtery.surface
+		newX = NewArrayFill(x.length, 0);
+		newY = NewArrayFill(x.length, 0);
+		newZ = NewArrayFill(x.length, 0);
+		
+		for (let i = 0; i < x.length; ++i) {
+			result      = proj4('EPSG:3413','EPSG:4326', [x[i], y[i]]);
+			position    = vesl.geo.geographicToCartesian(vesl.EARTH_RADIUS + z[i], result[1], result[0], true);
+			newX[i]     = position.x;
+			newY[i]     = position.y;
+			newZ[i]     = position.z;
+		}
+		
+		x           = newX;
+		y           = newY;
+		z           = newZ;
+		vertices    = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false, 'reproject':reproject}), true);
+		scale       = [1, 1, 1];
+    } else {
+		vertices    = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false, 'reproject':reproject}), true);
+		scale       = [1, 1, 1];
+	}
+	
+	// Compute coordinates and data range
+	xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
+	ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
+	
+	// Compute GL variables
+	let texture         = new THREE.TextureLoader().load(options.getfieldvalue('overlay_image'));
+	let groundEnabled   = false;
+	let name            = 'overlay';
+	
+	if ('ground' in renderObject) {
+    	groundEnabled = renderObject.ground.enabled;
+    }
+    
+	if ('overlay' in renderObject) {
+    	name = renderObject.overlay.name;
+    }
+    
+	let shaderName = groundEnabled ? 'ground' : 'overlay';
+	
+	let node = new Node(
 		'canvas', canvas,
 		'options', options,
-		'name', 'overlay',
-		'shaderName', 'ground' in options.getfieldvalue('render', {}) ? 'GroundFromSpace' : 'TexturedDiffuse',
-		'alpha', options.getfieldvalue('outeralpha', 1.0),
-		//'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, md.mesh.classname() === 'mesh3dsurface' ? (zlim[0] + zlim[1]) / 2 : zlim[0]],
-		'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2],
-		'ambientColor', [0.1, 0.1, 0.1 ,1.0],
-		'diffuseColor', [1.0, 1.0, 1.0 ,1.0],
-		'specularStrength', 0.0,
-		'maskEnabled', options.getfieldvalue('outermask','off') == 'on',
-		'maskHeight', options.getfieldvalue('outermaskheight', 150.0),
-		'maskColor', options.getfieldvalue('outermaskcolor',[0.0, 0.0, 1.0, 1.0]),
+		'md', md,
+		'name', name,
+		'shaderName', shaderName,
+		'opacity', options.getfieldvalue('outeropacity', 1.0),
+		'cullFace', THREE.DoubleSide,
 		'texture', texture,
-		'rotation', [-90, 0, 0],
 		'scale', scale
 	);
-	//}}}
+	canvas.overlayNode = node;
 
-	var xRange = xlim[1] - xlim[0];
-	var yRange = ylim[1] - ylim[0];
-	var coordArray = [new Array(x.length), new Array(x.length)];
+	let xRange      = xlim[1] - xlim[0];
+	let yRange      = ylim[1] - ylim[0];
+	let coordArray  = [new Array(x.length), new Array(x.length)];
 	
-	//generate mesh:
-	if (md.mesh.classname() == 'mesh3dsurface') {
-		var xyz, magnitude;
-		for(var i = 0; i < x.length; i++){
-			xyz = vec3.fromValues(vertices[0][i], vertices[1][i], vertices[2][i]);
-			magnitude = vec3.length(xyz);
+	// Generate mesh
+	if (reproject || md.mesh.classname().startsWith('mesh3d')) {
+		let magnitude   = 0;
+		let xyz         = null;
 		
-			coordArray[0][i] = Math.atan2(xyz[1], xyz[0]) / (2 * Math.PI) + 0.5;
-			coordArray[1][i] = Math.asin(xyz[2] / magnitude) / Math.PI + 0.5;
+		for (let i = 0; i < x.length; ++i) {
+			xyz                 = vec3.fromValues(vertices[0][i], vertices[1][i], vertices[2][i]);
+			magnitude           = vec3.length(xyz);
+		
+			coordArray[0][i]    = Math.atan2(xyz[1], xyz[0]) / (2 * Math.PI) + 0.5;
+			coordArray[1][i]    = Math.asin(xyz[2] / magnitude) / Math.PI + 0.5;
 		}
-	}
-	else {
-		for(var i = 0; i < x.length; i++){
+	} else {
+		for (let i = 0; i < x.length; ++i) {
 			coordArray[0][i] = (vertices[0][i] - xlim[0]) / xRange;
 			coordArray[1][i] = (vertices[1][i] - ylim[0]) / yRange;
 		}
 	}
+	
 	node.patch('Faces', elements, 'Vertices', vertices, 'FaceVertexCData', coordArray, 'FaceColor', 'interp');
-} //}}}
+}
Index: issm/trunk/src/m/plot/plot_overlay.py
===================================================================
--- issm/trunk/src/m/plot/plot_overlay.py	(revision 25994)
+++ issm/trunk/src/m/plot/plot_overlay.py	(revision 26744)
@@ -11,5 +11,5 @@
     from osgeo import gdal
 except ImportError:
-    print('osgeo/gdal for python not installed, plot_overlay is disabled')
+    print('OSGeo/GDAL for python not installed, plot_overlay is disabled')
 
 from processdata import processdata
@@ -19,6 +19,5 @@
 
 def plot_overlay(md, data, options, ax):
-    '''
-    Function for plotting a georeferenced image. Called from plot_manager by 
+    """Function for plotting a georeferenced image. Called from plot_manager by 
     call to plotmodel.
 
@@ -27,5 +26,5 @@
 
     See also: PLOTMODEL
-    '''
+    """
 
     x, y, z, elements, is2d, isplanet = processmesh(md, [], options)
Index: issm/trunk/src/m/plot/plot_quiver.js
===================================================================
--- issm/trunk/src/m/plot/plot_quiver.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_quiver.js	(revision 26744)
@@ -21,5 +21,7 @@
 	var is2d = meshresults[4]; 
 	var isplanet = meshresults[5];
-	if (md.mesh.classname() !== 'mesh3dsurface') z = md.geometry.surface;
+	if (!md.mesh.classname().startsWith('mesh3d')) {
+		z = md.geometry.surface;
+	}
 		
 	//Compute coordinates and data range:
@@ -35,10 +37,10 @@
 	//Handle heightscale
 	var vertices, scale;
-	if (md.mesh.classname() !== 'mesh3dsurface') {
+	if (!md.mesh.classname().startsWith('mesh3d')) {
 		vertices = [x, y, z];
 		scale = [1, 1, options.getfieldvalue('heightscale', 1)];
 	}
 	else {
-		vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false}));
+		vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false}), true);
 		scale = [1, 1, 1];
 	}
@@ -51,5 +53,5 @@
 		'name', 'quiver',
 		'shaderName', 'Colored',
-		'alpha', options.getfieldvalue('alpha', 1.0),
+		'opacity', options.getfieldvalue('opacity', 1.0),
 		//'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, md.mesh.classname() === 'mesh3dsurface' ? (zlim[0] + zlim[1]) / 2 : zlim[0]],
 		'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2],
Index: issm/trunk/src/m/plot/plot_transient_movie.js
===================================================================
--- issm/trunk/src/m/plot/plot_transient_movie.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_transient_movie.js	(revision 26744)
@@ -1,119 +1,177 @@
-function plot_transient_movie(md, options, canvas) {//{{{
-	/**
-	 * PLOT_TRANSIENT_MOVIE - plot a transient result as a movie
-	 *
-	 * Usage:
-	 *	plot_transient_movie(md, options, canvas);
-	 *
-	 * See also: PLOTMODEL, PLOT_MANAGER
-	 */
+'use strict';
 
-	// Loop over the time steps
-	let data	 	= options.getfieldvalue('transient_field_data');
-	let dataType	= {};
-	let steps 		= new Array(data.length);
-
-	for (let i = 0, numSteps = steps.length; i < numSteps; ++i) {
+/**
+ * Global Function: plot_transient_movie
+ *
+ * Parameters:
+ *		options			- Object containing a number of property/value pairs.
+ *		animation		- Object containing a number of property/value pairs related to transient solution animation.
+ *		progressText	- Object containing a number of property/value pairs related to updating the playback slider text on frame change.
+ *		unit 			- String (default: '') which is appended to the frame index with a single white space before updating #playback-progress-text on frame change.
+ *		update			- Boolean (default: true) indicating whether or not to update #playback-progress-text on frame change with the frame index. Set this to 'false' if you would rather manage the update of #playback-progress-text via 'onMovieUpdate' handler (or by some other means).
+ * 
+ * See Also:
+ *		- /web/js/plotmodel.js
+ *		- /web/js/plot_manager.js
+ *
+ * TODO:
+ *		- Update function signature/handling to use ES6 default parameters for 'unit' and 'handling'.
+ */
+function plot_transient_movie(md, options, canvas) {
+	//loop over the time steps
+	let data = options.getfieldvalue('transient_field_data');
+	let steps = new Array(data.length);
+	
+	for (let i = 0; i < steps.length; i++) {
 		steps[i] = i;
 	}
-
-	// Calculate caxis
+	
+	//calculate caxis
 	if (!options.exist('caxis')) {
-		let range 			= [Infinity, -Infinity];
-		let	dataResults;
-
+		let range = [Infinity, -Infinity];
+		let dataresults;
 		for (let i in steps) {
-			dataResults = processdata(md, data[i], options);
-			range[0] = Math.min(range[0], ArrayMin(dataResults[1]));
-			range[1] = Math.max(range[1], ArrayMax(dataResults[1]));
+			dataresults = processdata(md, data[i], options);
+			range[0] = Math.min(range[0], ArrayMin(dataresults[1]));
+			range[1] = Math.max(range[1], ArrayMax(dataresults[1]));
 		}
-
-		dataType = dataResults[1];
 		options.addfielddefault('caxis', range);
 	}
+	
+	//Create unit node 
+	let dataresults = processdata(md, data[0], options);
+	let data2 = dataresults[0]; 
+	let datatype = dataresults[1];
+	plot_unit(md, data2, datatype, options, canvas);
+	let unitOptions = options.getfieldvalue('unitOptions', {'name' : 'unit'});
+	let unitName 	= unitOptions.name;
+	let node 		= canvas.unitNodes[unitName];
+	
+	//process data
+	let processedData = [];
+	for (let i in steps) {
+		dataresults = processdata(md, data[i].slice(), options);
+		processedData[i] = dataresults[0];
+	}
+	
+	//process mesh
+	let meshresults = processmesh(md, data2, options);
+	meshresults = scaleMesh(md, meshresults, options);
+	let x = meshresults[0]; 
+	let y = meshresults[1]; 
+	let z = meshresults[2]; 
+	let elements = meshresults[3];
+	let is2d = meshresults[4]; 
+	let isplanet = meshresults[5];
+	let vertices = meshresults[6];
+	let scale = meshresults[7];
+	
+	//process options
+	if (canvas.animation !== undefined && canvas.animation.handler !== undefined) {
+		clearInterval(canvas.animation.handler);
+	}
+	let animation = options.getfieldvalue('animation', {});
+	
+	let progressText = null;
+	if (!vesl.helpers.isEmptyOrUndefined(animation.progressText)) {
+		progressText = {
+					update	: defaultFor(animation.progressText.update, true),
+					unit	: defaultFor(animation.progressText.unit,  	'')
+				};
+	} else {
+		progressText = {
+					update	: false,
+					unit	: ''
+				};
+	}
+	canvas.animation = {
+		frame: defaultFor(animation.frame, 			0),
+		play: defaultFor(animation.play, 			true),
+		fps: defaultFor(animation.fps, 				4),
+		interval: defaultFor(animation.interval, 	1000 / defaultFor(animation.fps, 4)),
+		loop: defaultFor(animation.loop, 			true),
+		handler: 						{}, // Initialized below
+		progressText: 						progressText
+	}
+	//display movie
+	canvas.unitMovieData = processedData;
+	canvas.animation.totalFrames = processedData.length;
+	canvas.animation.frame = 0;
 
-	// Create unit node if it does not already exist
-	if (!('unit' in canvas.nodes)) {
-		let	dataResults = processdata(md, data[0],options);
-		let	data2 		= dataResults[0];
-		let	dataType 	= dataResults[1];
-
-		// Plot unit
-		plot_unit(md,data2,dataType,options,canvas);
+	let slider = null;
+	
+	if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls)) {
+		if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls.slider)) {
+			slider = canvas.playbackControls.slider;
+		}
+		
+		
+		if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls.progressText)) {
+			progressText = canvas.playbackControls.progressText;
+		}
 	}
-
-	// Setup rendering node
-	let node = canvas.nodes.unit;
-
-	node.options 	= options;
-	node.alpha 		= options.getfieldvalue('alpha', 1.0);
-	node.caxis 		= options.getfieldvalue('caxis');
-	node.enabled 	= options.getfieldvalue('nodata', 'off') === 'off';
-	node.log 		= options.getfieldvalue('log', false);
-
-	// Process data
-	let	dataResults;
-	let processedData = [];
-
-	for (let i in steps) {
-		dataResults 		= processdata(md, data[i].slice(), options);
-		processedData[i] 	= dataResults[0];
-	}
-
-	// Display movie
-	canvas.unitMovieData		= processedData;
-	canvas.animation.frame 		= 0;
-	canvas.animation.handler 	= setInterval(function () {
+	
+	clearInterval(canvas.animation.handler);
+	canvas.animation.handler = setInterval(function() {
 		// Update current animation frame
-		let frame 		= canvas.animation.frame;
-		let numFrames 	= steps.length;
-
+		let frame = canvas.animation.frame;
+		
 		if (canvas.animation.play) {
-			if (canvas.animation.increment) {
-				if (frame >= numFrames - 1) {
-					if (canvas.animation.loop) {
-						frame = 0;
-					} else {
-						toggleMoviePlay(canvas);
-					}
+			if (frame >= steps.length - 1) {
+				if (canvas.animation.loop) {
+					frame = 0;
 				} else {
-					frame = (frame + 1) % numFrames;
+					canvas.animation.play = !canvas.animation.play;
 				}
+			} else {
+				frame = (frame + 1) % steps.length;
 			}
 		}
-
-		// If frame has changed, update unit node and data marker display
+		
+		//If frame has changed, update unit node and data marker display.
 		if (frame !== canvas.animation.lastFrame) {
+			canvas.state.dispatchEvent('onMovieUpdate', canvas, frame, node);
+			
+			//Rescale in case surface has changed
+			if (md.mesh.classname() === 'mesh3dsurface' || md.mesh.classname() === 'mesh3dprisms') {
+				vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false, 'reproject':false}), true);
+			} else {
+				vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false, 'reproject':false}), true);
+				//vertices = [x, y, z];
+			}
+	
+			node.updateBuffer('Vertices', vertices);
 			node.updateBuffer('Coords', processedData[frame]);
-			canvas.unitData = processedData[frame];
-
+			canvas.unitData[unitName] = processedData[frame];
 			if (canvas.graph.enabled) {
 				vesl.graph.draw(canvas);
 			}
-
-			if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls.slider)) {
-				canvas.playbackControls.slider.val(frame);
+			if (slider != null) {
+				slider.val(frame);
 			}
-
-			if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls.progressText)) {
-				canvas.playbackControls.progressText.html(steps[frame].toFixed(0) + ' ' + options.getfieldvalue('movietimeunit', 'yr'));
+			if (!vesl.helpers.isEmptyOrUndefined(progressText) && canvas.animation.progressText.update) {
+				if (canvas.animation.progressText.unit === '') {
+					progressText.html(steps[frame].toFixed(0));
+				} else {
+					progressText.html(steps[frame].toFixed(0) + ' ' + canvas.animation.progressText.unit);
+				}
 			}
-
-			if (!vesl.helpers.isEmptyOrUndefined(canvas.nodes.quiver)) {
-				plot_quiver(md, options, canvas, false);
-			}
+			//if (!vesl.helpers.isEmptyOrUndefined(canvas.nodes.quiver)) {
+			//	plot_quiver(md,options,canvas,false);
+			//}
+			
 		}
-
-		// Save new frame info
-		canvas.animation.lastFrame 	= canvas.animation.frame;
-		canvas.animation.frame 		= frame;
+		
+		//Save new frame info.
+		canvas.animation.lastFrame = canvas.animation.frame;
+		canvas.animation.frame = frame;
 	}, canvas.animation.interval);
-
-	// Update progress bar with new frame info
-	if (!vesl.helpers.isEmptyOrUndefined(canvas.playbackControls.slider)) {
-		canvas.playbackControls.slider.val(canvas.animation.frame);
-		canvas.playbackControls.slider.setUpperBound(steps.length - 1);
+	
+	//Update progress bar with new frame info.
+	if (!vesl.helpers.isEmptyOrUndefined(slider)) {
+		slider.max(steps.length - 1);
+		slider.val(canvas.animation.frame);
 	}
-
+				
 	applyoptions(md, [], options, canvas);
-}//}}}
+}
Index: issm/trunk/src/m/plot/plot_unit.js
===================================================================
--- issm/trunk/src/m/plot/plot_unit.js	(revision 25994)
+++ issm/trunk/src/m/plot/plot_unit.js	(revision 26744)
@@ -1,2 +1,4 @@
+'use strict';
+
 function plot_unit(md, data, datatype, options, canvas) { //{{{
 	//PLOT_UNIT - unit plot, display data
@@ -6,121 +8,123 @@
 	//
 	//   See also: PLOTMODEL, PLOT_MANAGER
-
-	var name = 'unit';
-	if ('unit' in canvas.nodes) {
-		if (options.getfieldvalue('clf','on')=='on') {
-			for (var node in canvas.nodes) {
-				if (vesl.string.startsWith(node, 'unit')) {
-					delete canvas.octrees[node];
-					delete canvas.nodes[node];
-				}
+	
+	//{{{
+	// Process data and model
+	let meshresults = processmesh(md, data, options);
+	meshresults = scaleMesh(md, meshresults, options);
+	let x = meshresults[0]; 
+	let y = meshresults[1]; 
+	let z = meshresults[2]; 
+	let elements = meshresults[3];
+	let is2d = meshresults[4]; 
+	let isplanet = meshresults[5];
+	let vertices = meshresults[6];
+	let scale = meshresults[7];
+	
+	//Compute gl variables:
+	let edgecolor = options.getfieldvalue('edgecolor', [1.0, 1.0, 1.0, 1.0]);
+	let maskzeros = options.getfieldvalue('maskzeros', {});
+	
+	let unitOptions = options.getfieldvalue('unitOptions', {'name' : 'unit'});
+	let unitName 	= unitOptions.name;
+	
+	let node = new Node(
+		'canvas', canvas,
+		'options', options,
+		'md', md,
+		'name', unitName,
+		'shaderName', 'unit',
+		'opacity', options.getfieldvalue('opacity', 1.0),
+		'caxis', options.getfieldvalue('caxis',[ArrayMin(data), ArrayMax(data)]),
+		'cullFace', THREE.FrontSide,
+		'enabled', options.getfieldvalue('nodata', 'off') === 'off',
+		'log', options.getfieldvalue('log',false),
+		'maskObject', options.getfieldvalue('maskregion', {'enabled': false}),
+		'maskZerosColor', defaultFor(maskzeros.color, [1.0, 1.0, 1.0, 1.0]),
+		'maskZerosEnabled', defaultFor(maskzeros.enabled, false),
+		'maskZerosTolerance', defaultFor(maskzeros.tolerance, 1e-3),
+		'maskZerosZeroValue', defaultFor(maskzeros.zeroValue, 0.5),
+		'scale', scale
+	);
+	//}
+	
+	if (vesl.helpers.isEmptyOrUndefined(canvas.unitNodes)) {
+		canvas.unitNodes = {};
+	}
+	
+	if (vesl.helpers.isEmptyOrUndefined(canvas.unitData)) {
+		canvas.unitData = {};
+	}
+	
+	// If option 'clf' is on, remove all cached data associated with this unit
+	if (options.getfieldvalue('clf', 'on') === 'on') {
+		delete canvas.unitNodes[unitName];
+		canvas.unitData[unitName] = data;
+		
+		for (let i = 0, numUnits = canvas.state.scene.children.length; i < numUnits; ++i) {
+			if (canvas.state.scene.children[i].name === unitName) {
+				canvas.state.scene.children.splice(i, 1);
+				break;
 			}
 		}
-		else {
-			name = 'unit' + Object.keys(canvas.nodes).length;
-		}
-	}
-
-	//{{{ declare variables:
-	//Process data and model
-	var meshresults = processmesh(md, data, options);
-	var x = meshresults[0]; 
-	var y = meshresults[1]; 
-	var z = meshresults[2]; 
-	var elements = meshresults[3];
-	var is2d = meshresults[4]; 
-	var isplanet = meshresults[5];
-	if (md.mesh.classname() !== 'mesh3dsurface') {
-		if (vesl.helpers.isNaN(md.geometry.surface) || (md.geometry.surface[0] !== undefined && vesl.helpers.isNaN(md.geometry.surface[0]))) {
-			md.geometry.surface = NewArrayFill(x.length, 0);
-		}
-		z = md.geometry.surface;
 	}
 	
-	//Compute coordinates and data range:
-	var xlim = options.getfieldvalue('xlim', [ArrayMin(x), ArrayMax(x)]);
-	var ylim = options.getfieldvalue('ylim', [ArrayMin(y), ArrayMax(y)]);
-	var zlim = options.getfieldvalue('zlim', [ArrayMin(z), ArrayMax(z)]);
+	canvas.unitNodes[unitName] = node;
 	
-	//Handle heightscale
-	var vertices, scale;
-	if (md.mesh.classname() !== 'mesh3dsurface') {
-		vertices = [x, y, z];
-		scale = [1, 1, options.getfieldvalue('heightscale', 1)];
-	}
-	else {
-		vertices = Node.prototype.scaleVertices(md, x, y, z, elements, options.getfieldvalue('heightscale', 1), options.getfieldvalue('maskregion',{'enabled':false}));
-		scale = [1, 1, 1];
-	}
-
-	//Compute gl variables:
-	var edgecolor = options.getfieldvalue('edgecolor', [1.0, 1.0, 1.0 ,1.0]);
-	var maskzeros = options.getfieldvalue('maskzeros', {});
-	var render = options.getfieldvalue('render', {});
-	var cullFace = ("unit" in render) ? canvas.gl[render.unit.cullFace] : canvas.gl.BACK;
-	var node = new Node(
-		'canvas', canvas,
-		'options', options,
-		'name', name,
-		'shaderName', 'TexturedDiffuse',
-		'alpha', options.getfieldvalue('alpha', 1.0),
-		'caxis', options.getfieldvalue('caxis',[ArrayMin(data), ArrayMax(data)]),
-		'center', [(xlim[0] + xlim[1]) / 2, (ylim[0] + ylim[1]) / 2, (zlim[0] + zlim[1]) / 2],
-		'cullFace', cullFace,
-		'lightingBias', canvas.view.lightingBias,
-		'diffuseColor', edgecolor,
-		'specularStrength', 0.0,
-		'enabled', options.getfieldvalue('nodata','off') == 'off' || (("unit" in render) && render.unit.enabled),
-		'log', options.getfieldvalue('log',false),
-		'maskEnabled', options.getfieldvalue('innermask','off') == 'on',
-		'maskHeight', options.getfieldvalue('innermaskheight', 150.0) / options.getfieldvalue('heightscale', 1),
-		'maskColor', options.getfieldvalue('innermaskcolor',[0.0, 0.0, 1.0, 1.0]),
-		'maskObject', options.getfieldvalue('maskregion',{'enabled':false}),
-		'maskZerosColor', defaultFor(maskzeros.color,[1.0, 1.0, 1.0, 1.0]),
-		'maskZerosEnabled', defaultFor(maskzeros.enabled,false),
-		'maskZerosTolerance', defaultFor(maskzeros.tolerance,1e-3),
-		'maskZerosZeroValue', defaultFor(maskzeros.zeroValue,0.5),
-		'rotation', [-90, 0, 0],
-		'scale', ("unit" in render) ? [render.unit.scale, render.unit.scale, render.unit.scale] : scale
-	);
-	//}
-	if (options.getfieldvalue('clf','on')=='on') {
-		canvas.unitNode = node;
-		canvas.unitData = data;
-	}
 	//}}}
-	switch(datatype){
+	switch(datatype) {
 		//{{{ element plot
 		case 1:
 			//WARNING: NaN are not properly found (NaN != NaN = true)
-			pos=ArrayFindNot(data, NaN); //needed for element on water
-			if (elements[0].length==6){ //prisms
-			}
-			else if (elements[0].length==4){ //tetras
-			}
-			else{ //triangular elements
+			let pos = ArrayFindNot(data, NaN); //needed for element on water
+			
+			if (elements[0].length === 6) { // prisms
+				let abc = elements.map(function(value, index) { return [value[0], value[1], value[2]]; }); //top
+				let dfe = elements.map(function(value, index) { return [value[3], value[5], value[4]]; }); //bottom
+				let aeb = elements.map(function(value, index) { return [value[0], value[4], value[1]]; }); //1st side upper right
+				let ade = elements.map(function(value, index) { return [value[0], value[3], value[4]]; }); //1st side lower left
+				let bfc = elements.map(function(value, index) { return [value[1], value[5], value[2]]; }); //2nd side upper right
+				let bef = elements.map(function(value, index) { return [value[1], value[4], value[5]]; }); //2nd side lower left
+				let cda = elements.map(function(value, index) { return [value[2], value[3], value[0]]; }); //3rd side upper right
+				let cfd = elements.map(function(value, index) { return [value[2], value[5], value[3]]; }); //3rd side lower left
+				let prismElements = abc.concat(dfe, aeb, ade, bfc, bef, cda, cfd);
+				node.patch('Faces', prismElements, 'Vertices', vertices, 'FaceVertexCData', data, 'FaceColor', 'flat', 'EdgeColor', edgecolor);
+			} else if (elements[0].length === 4) { // tetras
+    			// TODO: Implement handling for tetras
+			} else { // triangular elements
 				node.patch('Faces', elements, 'Vertices', vertices, 'FaceVertexCData', data, 'FaceColor', 'flat', 'EdgeColor', edgecolor);
 			}
+			
 			break;
 		//}}}
 		//{{{ node plot
 		case 2:
-			if (elements[0].length==6){ //prisms
-			}
-			else if (elements[0].length==4){ //tetras
-			}
-			else{ //triangular elements	
+			if (elements[0].length === 6) { // prisms
+				let abc = elements.map(function(value, index) { return [value[0], value[1], value[2]]; }); //top
+				let dfe = elements.map(function(value, index) { return [value[3], value[5], value[4]]; }); //bottom
+				let aeb = elements.map(function(value, index) { return [value[0], value[4], value[1]]; }); //1st side upper right
+				let ade = elements.map(function(value, index) { return [value[0], value[3], value[4]]; }); //1st side lower left
+				let bfc = elements.map(function(value, index) { return [value[1], value[5], value[2]]; }); //2nd side upper right
+				let bef = elements.map(function(value, index) { return [value[1], value[4], value[5]]; }); //2nd side lower left
+				let cda = elements.map(function(value, index) { return [value[2], value[3], value[0]]; }); //3rd side upper right
+				let cfd = elements.map(function(value, index) { return [value[2], value[5], value[3]]; }); //3rd side lower left
+				let prismElements = abc.concat(dfe, aeb, ade, bfc, bef, cda, cfd);
+				node.patch('Faces', prismElements, 'Vertices', vertices, 'FaceVertexCData', data, 'FaceColor', 'interp', 'EdgeColor', edgecolor);
+			} else if (elements[0].length === 4) { // tetras
+    			// TODO: Implement handling for tetras
+			} else { // triangular elements	
 				node.patch('Faces', elements, 'Vertices', vertices, 'FaceVertexCData', data, 'FaceColor', 'interp', 'EdgeColor', edgecolor);
 			}
+			
 			break;
 		//}}}
 		//{{{ quiver plot 
 		case 3:
-			if (is2d){
+			if (is2d) {
 				//plot_quiver(x, y, data(:, 1), data(:, 2), options);
-			}
-			else{
+			} else {
 				//plot_quiver3(x, y, z, data(:, 1), data(:, 2), data(:, 3), options);
 			}
+			
 			break;
 		//}}}
Index: issm/trunk/src/m/plot/plotdoc.js
===================================================================
--- issm/trunk/src/m/plot/plotdoc.js	(revision 25994)
+++ issm/trunk/src/m/plot/plotdoc.js	(revision 26744)
@@ -24,5 +24,5 @@
 	console.log('       	"height": height to spawn clouds at (ex: 7500)');
 	console.log('       	"quantity": quantity of clouds to spawn (ex: 10)');
-	console.log('       "caxis": modify  colorbar range. (array of type [a, b] where b>=a)');
+	console.log('       "caxis": modify colorbar range (array of type [a, b] where b>=a)');
 	console.log('       "colorbar": add colorbar (default "off", ex: "on", "off")');
 	console.log('       "colorbarid": colorbar canvas id (string)');
@@ -39,9 +39,10 @@
 	console.log('       "dataMarker": object cotaining data marker parameters. See webgl.js for defaults. (ex: {"enabled":true,"format":["<div id="sim-plot"></div>"],"labels":["thickness","velocity","value"],"animated":true})');
 	console.log('       	"enabled": toggle data marker displays (default true, ex: false)');
-	console.log('       	"image": image used for marking the clicked point (ex: "/canvas/data-markers/data-marker.svg")');
-	console.log('       	"labels": when displaying a sim-plot graph, display these model fields. (ex: ["thickness","velocity","value"])');
-	console.log('       	"font": font to be used for display (ex: "24px "Comic Sans MS", cursive")');
-	console.log('       	"format": an array compatible with sprintf that will be displayed as html (ex: ["X: %.2e<br>Y: %.2e<br>Z: %.2e]<br>Value: %0.1f","x","y","z","value"])');
-	console.log('      		"size": specifiy the width and height of the data markers (default [32,32], ex: [24,32], [105,10])');
+	console.log('       	"hasMarker": whether or not the data marker has a marker (default true, ex: false)');
+	console.log('       	"markerImgPath": path to image to use for marker (default "/canvas/data-markers/data-marker.svg")');
+	console.log('       	"hasTooltip": whether or not the data marker has a tooltip (default false, ex: true)');
+	console.log('       	"tooltipFormat": C-style format string to be used when on calls to vesl.DataMarker.tooltipContent to format passed data points (default "", ex: ["X: %.2e<br>Y: %.2e<br>Z: %.2e])');	
+	console.log('       	"width": width, in pixels, of the data marker (default 32)');	
+	console.log('       	"height": height, in pixels, of the data marker (default 32)');
 	console.log('       "displayview": print view value to console (default "off", ex: "on", "off")');
 	console.log('       "displayzoom": print zoom value to console (default "off", ex: "on", "off")');
@@ -60,8 +61,8 @@
 	console.log('       "outermask*": Special mask that colors all parts of a overlay mesh below a height a certain color. provide outermaskheight and outermaskcolor options also (default "off", ex: "on", "off")');
 	console.log('       "overlay": overlay a radar amplitude image behind (default "off", ex: "on", "off")');
-	console.log('       "overlay_image": path to overlay image (default "", ex: "./images/radar.png")');
+	console.log('       "overlay_image": path to overlay image (default "", ex: "./img/radar.png")');
 	console.log('       "quiver": add quiver plot overlay for velocities. (default "off", ex: "on", "off")');
 	console.log('       "scaling": scaling factor used by quiver plots. Default is 0.4');
-	console.log('       "alpha": transparency coefficient 0.0 to 1.0, the lower, the more transparent. (default 1.0, ex: 0.5, 0.25)');
+	console.log('       "opacity": transparency coefficient 0.0 to 1.0, the lower, the more transparent. (default 1.0, ex: 0.5, 0.25)');
 	console.log('       "render": a object containing a list of default object to render. (default {}, ex: {"sky", "space"})');
 	console.log('       	"sky": render the atmosphere. (ex: {"enabled":true})');
Index: issm/trunk/src/m/plot/plotdoc.m
===================================================================
--- issm/trunk/src/m/plot/plotdoc.m	(revision 25994)
+++ issm/trunk/src/m/plot/plotdoc.m	(revision 26744)
@@ -122,5 +122,5 @@
 disp('       ''mask'': list of flags of size numberofnodes or numberofelements. Only ''true'' values are plotted ');
 disp('       ''nan'': value assigned to NaNs (convenient when plotting BC)');
-disp('       ''partitionedges'': ''off'' by default. overlay plot of partition edges');
+disp('       ''partition'': a partion vector. generates overlay plot of partition edges');
 disp('       ''log'': value of log');
 disp('       ''latlon'': ''on'' or {latstep lonstep [resolution [color]]} where latstep,longstep and resolution are in degrees, color is a [r g b] array');
Index: issm/trunk/src/m/plot/plotdoc.py
===================================================================
--- issm/trunk/src/m/plot/plotdoc.py	(revision 25994)
+++ issm/trunk/src/m/plot/plotdoc.py	(revision 26744)
@@ -127,5 +127,5 @@
     #                'border': " size of printlay border (in pixels). active only for overlay plots",
     #                'nan': " value assigned to NaNs (convenient when plotting BC)",
-    #                'partitionedges': " 'off' by default. overlay plot of partition edges",
+    #                'partition: " a partion vector. generates overlay plot of partition edges",
     #                'latlon': " 'on' or {latstep lonstep [resolution [color]]} where latstep, longstep and resolution are in degrees, color is a [r g b] array",
     #                'latlonnumbering': " 'on' or {latgap longap colornumber latangle lonangle} where latgap and longap are pixel gaps for the numbers",
Index: issm/trunk/src/m/plot/plotmodel.js
===================================================================
--- issm/trunk/src/m/plot/plotmodel.js	(revision 25994)
+++ issm/trunk/src/m/plot/plotmodel.js	(revision 26744)
@@ -1,45 +1,54 @@
-function plotmodel(md){ //{{{
-	//Convert arguments to array: 
-	var args = Array.prototype.slice.call(arguments);
+'use strict';
 
-	//First process options
-	var options = new plotoptions(args.slice(1,args.length));
+function plotmodel(md) { //{{{
+	let args            = Array.prototype.slice.call(arguments); // Convert arguments to array 
+    let canvas          = null;
+    let ncols           = 0;
+    let nlines          = 0;
+    let numberofplots   = 0;
+    let options         = new plotoptions(args.slice(1, args.length)); // Process options
+    let subplotwidth    = Math.ceil(Math.sqrt(options.numberofplots)); // Get number of subplots
+    
+	// Get figure number and number of plots
+	numberofplots = options.numberofplots;
+
+	// If nlines and ncols specified, then bypass.
+	if (options.list[0].exist('nlines')) {
+		nlines = options.list[0].getfieldvalue('nlines');
+	} else {
+		nlines = Math.ceil(numberofplots / subplotwidth);
+	}
 	
-	//get number of subplots
-	subplotwidth=Math.ceil(Math.sqrt(options.numberofplots)); 
-	
-	//Get figure number and number of plots
-	numberofplots=options.numberofplots;
-
-	//if nlines and ncols specified, then bypass.
-	var nlines,ncols;
-	if (options.list[0].exist('nlines')){
-		nlines=options.list[0].getfieldvalue('nlines');
-	}
-	else {
-		nlines=Math.ceil(numberofplots/subplotwidth);
-	}
 	if (options.list[0].exist('ncols')){
-		ncols=options.list[0].getfieldvalue('ncols');
-	}
-	else {
-		ncols=subplotwidth;
+		ncols = options.list[0].getfieldvalue('ncols');
+	} else {
+		ncols = subplotwidth;
 	}
 	
 	//check that nlines and ncols were given at the same time!
-	if ((options.list[0].exist('ncols') & !options.list[0].exist('nlines')) | (options.list[0].exist('nlines') & !options.list[0].exist('ncols'))) throw Error('plotmodel error message: nlines and ncols need to be specified together, or not at all');
+	if ((options.list[0].exist('ncols') && !options.list[0].exist('nlines')) 
+	    || ((options.list[0].exist('nlines') && !options.list[0].exist('ncols')))) {
+    	    throw Error('plotmodel error message: nlines and ncols need to be specified together, or not at all');
+    }
 
-	//go through subplots
-	if (numberofplots){
-		//Reinitialize all canvases
-		for (var i=0;i<numberofplots;i++){
-			if (options.list[i].getfieldvalue('clf','on')!='off') document.getElementById(options.list[i].getfieldvalue('canvasid')).initialized = false;
+	// Go through subplots
+	if (numberofplots) {
+		// Go through all data plottable and close window if an error occurs
+
+		let canvases = [];
+		for (let i = 0; i < numberofplots; ++i) {
+			canvases[i] = document.getElementById(options.list[i].getfieldvalue('canvasid'));
+			canvases[i].state.dispatchEvent('onPlotModelStart', canvases[i], options.list[i]);
 		}
-		//Go through all data plottable and close window if an error occurs
-		for (var i=0;i<numberofplots;i++){
-			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i);
+		for (let i = 0; i < numberofplots; ++i) {
+			canvases[i].state.dispatchEvent('onPlotManagerStart', canvases[i], options.list[i]);
+			plot_manager(options.list[i].getfieldvalue('model',md), options.list[i], subplotwidth, nlines, ncols, i);
+			canvases[i].state.dispatchEvent('onPlotManagerEnd', canvases[i], options.list[i]);
 
-			//List all unused options
+			// List all unused options
 			options.list[i].displayunused();
+		}
+		for (let i = 0; i < numberofplots; ++i) {
+			canvases[i].state.dispatchEvent('onPlotModelEnd', canvases[i], options.list[i]);
 		}
 	}
Index: issm/trunk/src/m/plot/plotmodel.py
===================================================================
--- issm/trunk/src/m/plot/plotmodel.py	(revision 25994)
+++ issm/trunk/src/m/plot/plotmodel.py	(revision 26744)
@@ -14,5 +14,5 @@
 def plotmodel(md, *args):
     '''
-    PLOTMODEL - At command prompt, type 'plotdoc()' for additional 
+    PLOTMODEL - At command prompt, type 'plotdoc()' for additional
     documentation.
 
@@ -31,5 +31,5 @@
     subplotwidth = ceil(sqrt(numberofplots))
 
-    # TODO: Check that commenting this out is correct; we do not need a hold 
+    # TODO: Check that commenting this out is correct; we do not need a hold
     # under matplotlib, right?
     #
@@ -60,5 +60,5 @@
     # Go through plots
     #
-    # NOTE: The following is where Python + matplolib differs substantially in 
+    # NOTE: The following is where Python + matplolib differs substantially in
     #       implementation and inteface from MATLAB.
     #
@@ -83,5 +83,5 @@
             plotnum = None
 
-        # NOTE: The inline comments for each of the following parameters are 
+        # NOTE: The inline comments for each of the following parameters are
         #       taken from https://matplotlib.org/api/_as_gen/mpl_toolkits.axes_grid1.axes_grid.ImageGrid.html
         #
@@ -95,5 +95,5 @@
         #
         # TODO:
-        # - Add 'edge' option (research if there is a corresponding option in 
+        # - Add 'edge' option (research if there is a corresponding option in
         #   MATLAB)?
         #
@@ -118,5 +118,5 @@
         #   rect(float, float, float, float) or int
         #
-        # The axes position, as a (left, bottom, width, height) tuple or as a 
+        # The axes position, as a (left, bottom, width, height) tuple or as a
         # three-digit subplot position code (e.g., "121").
         #
@@ -127,5 +127,4 @@
             direction=direction,
             axes_pad=axes_pad,
-            add_all=add_all,
             share_all=share_all,
             label_mode=label_mode,
Index: issm/trunk/src/m/plot/processdata.m
===================================================================
--- issm/trunk/src/m/plot/processdata.m	(revision 25994)
+++ issm/trunk/src/m/plot/processdata.m	(revision 26744)
@@ -164,5 +164,5 @@
 			data(pos,:)=maskvalue;
 		else
-			disp('plotmodel warning: mask length not supported yet (supported length are numberofvertices and numberofelements');
+			disp('Warning: processdata.m: mask length not supported yet (supported length are numberofvertices and numberofelements');
 		end
 	end
@@ -194,5 +194,5 @@
 			data(md.mesh.elements(pos,:),:)=maskvalue;
 		else
-			disp('plotmodel warning: mask length not supported yet (supported length are numberofvertices and numberofelements');
+			disp('Warning: processdata.m: mask length not supported yet (supported length are numberofvertices and numberofelements');
 		end
 	end
@@ -236,5 +236,5 @@
 			data(md.mesh.elements(pos,:),:)=NaN;
 		else
-			disp('plotmodel warning: mask length not supported yet (supported length are numberofvertices and numberofelements');
+			disp('Warning: processdata.m: mask length not supported yet (supported length are numberofvertices and numberofelements');
 		end
 	end
Index: issm/trunk/src/m/plot/processdata.py
===================================================================
--- issm/trunk/src/m/plot/processdata.py	(revision 25994)
+++ issm/trunk/src/m/plot/processdata.py	(revision 26744)
@@ -15,5 +15,5 @@
     See also: PLOTMODEL, PROCESSMESH
     """
-    # {{{ Initialization and grabbing auxiliaries
+    # Initialization and grabbing auxiliaries {{{
     # check format
     if (len(data) == 0 or (len(data) == 1 and not isinstance(data, dict) and np.isnan(data).all())):
@@ -22,8 +22,15 @@
     if 'numberofvertices2d' in dir(md.mesh):
         numberofvertices2d = md.mesh.numberofvertices2d
-        numberofelements2d = md.mesh.numberofelements2d
     else:
         numberofvertices2d = np.nan
-        numberofelements2d = np.nan
+
+    if options.exist('amr'):
+        step = options.getfieldvalue('amr', 0)
+        numberofvertices = len(md.results.TransientSolution[step].MeshX)
+        numberofelements = np.shape(md.results.TransientSolution[step].MeshElements)[0]
+    else:
+        numberofvertices = md.mesh.numberofvertices
+        numberofelements = md.mesh.numberofelements
+
     procdata = np.copy(data)
     #initialize datatype
@@ -44,5 +51,93 @@
         raise ValueError('data passed to plotmodel has bad dimensions; check that column vectors are rank - 1')
     # }}}
-    # {{{ process NaN's if any
+
+    #  log {{{
+    if options.exist('log'):
+        cutoff = options.getfieldvalue('log', 1)
+        procdata[np.where(procdata < cutoff)] = cutoff
+    # }}}
+
+    #  quiver plot {{{
+    if datasize[1] > 1 and datasize[0] != numberofvertices + 1:
+        if datasize[0] == numberofvertices and datasize[1] == 2:
+            datatype = 3
+        else:
+            raise ValueError('plotmodel error message: data should have two columns of length md.mesh.numberofvertices for a quiver plot')
+    # }}}
+
+    #  element data{{{
+    if datasize[0] == numberofelements and datasize[1] == 1:
+        #initialize datatype if non patch
+        if datatype != 4 and datatype != 5:
+            datatype = 1
+        # AMR {{{
+        if options.exist('amr'):
+            nonan = np.nonzero(~np.isnan(md.results.TransientSolution[step].MeshElements))
+            procdata = procdata[nonan]
+        # }}}
+        # mask {{{
+        if options.exist('mask'):
+            flags = options.getfieldvalue('mask')
+            hide = np.invert(flags)
+            if np.size(flags) == numberofvertices:
+                EltMask = np.asarray([np.any(np.in1d(index, np.where(hide))) for index in md.mesh.elements - 1])
+                procdata = np.ma.array(procdata, mask=EltMask)
+                options.addfielddefault('cmap_set_bad', 'w')
+            elif np.size(flags) == numberofelements:
+                procdata = np.ma.array(procdata, mask=hide)
+                options.addfielddefault('cmap_set_bad', 'w')
+            else:
+                print('Warning: processdata.py: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements')
+        # }}}
+
+    # }}}
+
+    #  node data {{{
+    if datasize[0] in [numberofvertices, numberofvertices2d] and datasize[1] == 1:
+        datatype = 2
+        # AMR {{{
+        if options.exist('amr'):
+            nonan = np.nonzero(~np.isnan(md.results.TransientSolution[step].MeshX))
+            procdata = procdata[nonan]
+        # }}}
+        #  Mask {{{
+        if options.exist('mask'):
+            flags = options.getfieldvalue('mask')
+            hide = np.invert(flags)
+            if np.size(flags) == numberofvertices:
+                procdata = np.ma.array(procdata, mask=hide)
+                options.addfielddefault('cmap_set_bad', 'w')
+            elif np.size(flags) == numberofelements:
+                NodeMask = np.zeros(np.shape(md.mesh.x), dtype=bool)
+                HideElt = md.mesh.elements[np.where(hide)[0]] - 1
+                NodeMask[HideElt] = True
+                procdata = np.ma.array(procdata, mask=NodeMask)
+                options.addfielddefault('cmap_set_bad', 'w')
+            else:
+                print('Warning: processdata.py: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements')
+        # }}}
+    # }}}
+
+    #  spc time series {{{
+    if datasize[0] == numberofvertices + 1:
+        datatype = 2
+        spccol = options.getfieldvalue('spccol', 0)
+        print('multiple-column spc field; specify column to plot using option "spccol"')
+        print(('column ', spccol, ' plotted for time: ', procdata[-1, spccol]))
+        procdata = procdata[0:-1, spccol]
+
+        #mask?
+
+        #layer projection?
+
+        #control arrow density if quiver plot
+    # }}}
+
+    # convert rank - 2 array to rank - 1 {{{
+    if np.ndim(procdata) == 2 and np.shape(procdata)[1] == 1:
+        procdata = procdata.reshape(-1, )
+    # }}}
+
+    #  process NaN's if any {{{
     nanfill = options.getfieldvalue('nan', -9999)
     if np.any(np.isnan(procdata)):
@@ -53,83 +148,13 @@
             ub = ub + 0.5
             nanfill = lb - 1
-    #procdata[np.isnan(procdata)] = nanfill
+        procdata[np.isnan(procdata)] = nanfill
         procdata = np.ma.array(procdata, mask=np.isnan(procdata))
-        options.addfielddefault('clim', [lb, ub])
+        #clim looks to be deprecated and replaced by caxis
+        #options.addfielddefault('clim', [lb, ub])
         options.addfielddefault('cmap_set_under', '1')
         print(("WARNING: nan's treated as", nanfill, "by default.  Change using pairoption 'nan', nan_fill_value in plotmodel call"))
     # }}}
-    # {{{ log
-    if options.exist('log'):
-        cutoff = options.getfieldvalue('log', 1)
-        procdata[np.where(procdata < cutoff)] = cutoff
-    # }}}
-    # {{{ quiver plot
-    if datasize[1] > 1 and datasize[0] != md.mesh.numberofvertices + 1:
-        if datasize[0] == md.mesh.numberofvertices and datasize[1] == 2:
-            datatype = 3
-        else:
-            raise ValueError('plotmodel error message: data should have two columns of length md.mesh.numberofvertices for a quiver plot')
-    # }}}
-    # {{{ element data
 
-    if datasize[0] == md.mesh.numberofelements and datasize[1] == 1:
-        #initialize datatype if non patch
-        if datatype != 4 and datatype != 5:
-            datatype = 1
-    # {{{mask
-        if options.exist('mask'):
-            flags = options.getfieldvalue('mask')
-            hide = np.invert(flags)
-            if np.size(flags) == md.mesh.numberofvertices:
-                EltMask = np.asarray([np.any(np.in1d(index, np.where(hide))) for index in md.mesh.elements - 1])
-                procdata = np.ma.array(procdata, mask=EltMask)
-                options.addfielddefault('cmap_set_bad', 'w')
-            elif np.size(flags) == md.mesh.numberofelements:
-                procdata = np.ma.array(procdata, mask=hide)
-                options.addfielddefault('cmap_set_bad', 'w')
-            else:
-                print('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements')
-    # }}}
-
-    # }}}
-    # {{{ node data
-    if datasize[0] == md.mesh.numberofvertices and datasize[1] == 1:
-        datatype = 2
-    # {{{ Mask
-        if options.exist('mask'):
-            flags = options.getfieldvalue('mask')
-            hide = np.invert(flags)
-            if np.size(flags) == md.mesh.numberofvertices:
-                procdata = np.ma.array(procdata, mask=hide)
-                options.addfielddefault('cmap_set_bad', 'w')
-            elif np.size(flags) == md.mesh.numberofelements:
-                NodeMask = np.zeros(np.shape(md.mesh.x), dtype=bool)
-                HideElt = md.mesh.elements[np.where(hide)[0]] - 1
-                NodeMask[HideElt] = True
-                procdata = np.ma.array(procdata, mask=NodeMask)
-                options.addfielddefault('cmap_set_bad', 'w')
-            else:
-                print('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements')
-    # }}}
-    # }}}
-    # {{{ spc time series
-    if datasize[0] == md.mesh.numberofvertices + 1:
-        datatype = 2
-        spccol = options.getfieldvalue('spccol', 0)
-        print('multiple-column spc field; specify column to plot using option "spccol"')
-        print(('column ', spccol, ' plotted for time: ', procdata[-1, spccol]))
-        procdata = procdata[0:-1, spccol]
-
-    #mask?
-
-    #layer projection?
-
-    #control arrow density if quiver plot
-    # }}}
-    # {{{ convert rank - 2 array to rank - 1
-    if np.ndim(procdata) == 2 and np.shape(procdata)[1] == 1:
-        procdata = procdata.reshape(-1, )
-    # }}}
-    # {{{ if datatype is still zero, error out
+    #  if datatype is still zero, error out {{{
     if datatype == 0:
         raise ValueError("processdata error: data provided not recognized or not supported")
Index: issm/trunk/src/m/plot/processmesh.py
===================================================================
--- issm/trunk/src/m/plot/processmesh.py	(revision 25994)
+++ issm/trunk/src/m/plot/processmesh.py	(revision 26744)
@@ -41,12 +41,22 @@
     if hasattr(md.mesh, 'elements2d'):
         elements2d = md.mesh.elements2d
+        numofvertices2d = md.mesh.numberofvertices2d
+        numofelements2d = md.mesh.numberofelements2d
+    else:
+        numofvertices2d = np.nan
+        numofelements2d = np.nan
 
     if options.exist('amr'):
         step = options.getfieldvalue('amr')
-        x = md.results.TransientSolution[step].MeshX
-        y = md.results.TransientSolution[step].MeshY
-        elements = md.results.TransientSolution[step].MeshElements
+        nonan = np.nonzero(~np.isnan(md.results.TransientSolution[step].MeshX))
+        x = md.results.TransientSolution[step].MeshX[nonan]
+        y = md.results.TransientSolution[step].MeshY[nonan]
+        nonan = np.nonzero(~np.isnan(md.results.TransientSolution[step].MeshElements))
+        elements = md.results.TransientSolution[step].MeshElements[nonan] - 1
+        eldim = np.shape(md.results.TransientSolution[step].MeshElements)[1]
+        elements = np.reshape(elements, ((int(len(elements) / eldim), eldim)))
+
     else:
-        elements = md.mesh.elements
+        elements = md.mesh.elements - 1
         if options.getfieldvalue('coord', 'xy') != 'latlon':
             x = md.mesh.x
@@ -65,14 +75,13 @@
         z = getattr(md, z)
 
+    force2D = numofelements2d in np.shape(data) or numofvertices2d in np.shape(data)
     #is it a 2D plot?
-    if md.mesh.dimension() == 2 or options.getfieldvalue('layer', 0) >= 1:
+    if md.mesh.dimension() == 2 or options.getfieldvalue('layer', 0) >= 1 or force2D:
         is2d = 1
     else:
         is2d = 0
 
-    elements = md.mesh.elements - 1
-
     #layer projection?
-    if options.getfieldvalue('layer', 0) >= 1:
+    if options.getfieldvalue('layer', 0) >= 1 or force2D:
         if options.getfieldvalue('coord', 'xy') == 'latlon':
             raise Exception('processmesh error message: cannot work with 3D meshes for now')
Index: issm/trunk/src/m/plot/radarpower.m
===================================================================
--- issm/trunk/src/m/plot/radarpower.m	(revision 25994)
+++ issm/trunk/src/m/plot/radarpower.m	(revision 26744)
@@ -29,5 +29,5 @@
 d = getfieldvalue(options,'overlay_adjust_d',1);
 
-%find gdal coordinates
+%find GDAL coordinates
 x0=min(xlim); x1=max(xlim);
 y0=min(ylim); y1=max(ylim);
@@ -38,13 +38,30 @@
 	elseif md.mesh.epsg==3031, %Antarctica
 			if highres,
-				paths = {'/Users/larour/ModelData/MosaicTiffRsat/amm125m_v2_200m.tif','/home/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_200m.tif'};
+				paths = {'/Users/larour/ModelData/MosaicTiffRsat/amm125m_v2_200m.tif',...
+					'/home/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_200m.tif',...
+					'/totten_1/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_200m.tif',...
+					'./amm125m_v2_200m.tif',...
+					};
 			else
-				paths = {'/Users/larour/ModelData/MosaicTiffRsat/amm125m_v2_1km.tif','/home/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_1km.tif'};
+				paths = {'/Users/larour/ModelData/MosaicTiffRsat/amm125m_v2_1km.tif',...
+					'/home/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_1km.tif',...
+					'/totten_1/ModelData/Antarctica/MosaicTiffRsat/amm125m_v2_1km.tif',...
+					'./amm125m_v2_1km.tif',...
+					};
 			end
 	elseif md.mesh.epsg==3413,   %Greenland 
 		if highres,
-			paths = {'/u/astrid-r1b/ModelData/MOG/mog100_r2_hp1.tif','/home/ModelData/Greenland/MOG/mog100_r2_hp1.tif'};
+			paths = {'/u/astrid-r1b/ModelData/MOG/mog100_r2_hp1.tif',...
+				'/home/ModelData/Greenland/MOG/mog100_r2_hp1.tif',...
+				'/totten_1/ModelData/Greenland/MOG/mog100_r2_hp1.tif',...
+				'./mog100_r2_hp1.tif',...
+				};
 		else
-			paths = {'/u/astrid-r1b/ModelData/MOG/mog500_r2_hp1.tif','/home/ModelData/Greenland/MOG/mog500_r2_hp1.tif'};
+			paths = {'/u/astrid-r1b/ModelData/MOG/mog500_r2_hp1.tif',...
+				'/home/ModelData/Greenland/MOG/mog500_r2_hp1.tif',...
+				'/totten_1/ModelData/Greenland/MOG/mog500_r2_hp1.tif',...
+				'/Users/larour/ModelData/MOG/mog500_r2_hp1.tif',...
+				'./mog500_r2_hp1.tif',...
+				};
 		end
 	else
Index: issm/trunk/src/m/plot/radarpower.py
===================================================================
--- issm/trunk/src/m/plot/radarpower.py	(revision 26744)
+++ issm/trunk/src/m/plot/radarpower.py	(revision 26744)
@@ -0,0 +1,16 @@
+def solveslm(slm, solutionstringi, *args):
+    """RADARPOWER - overlay a power radar image on an existing mesh
+
+    This routine will overlay a power radar image on an existing mesh.
+    The power amplitude will be output to vel for now.
+    In the future, think about a field to hold this value.
+
+    Usage:
+        md=radarpower(md,options);
+        md=radarpower(md)
+
+    TODO:
+    - Translate from MATLAB API as we bring Python plotting capabilities online
+    """
+
+    return md
Index: issm/trunk/src/m/plot/subplotmodel.m
===================================================================
--- issm/trunk/src/m/plot/subplotmodel.m	(revision 25994)
+++ issm/trunk/src/m/plot/subplotmodel.m	(revision 26744)
@@ -4,4 +4,20 @@
 %   Usage:
 %      h=subplotmodel(nlines,ncols,i,options)
+
+box=getfieldvalue(options,'box','off');
+if strcmpi(box,'on'),
+	visible='on';
+else
+	visible='off';
+end
+
+%Do we specify axes?
+if exist(options,'axes')
+	ax = getfieldvalue(options,'axes');
+	ha = axes('Units','normalized', ...
+		'Position',ax,'XTickLabel','','YTickLabel','',...
+		'Visible',visible,'box',box);
+	return
+end
 
 %Regular subplot
@@ -25,11 +41,4 @@
 ymin   = 1-vmargin(2)-height; 
 
-box=getfieldvalue(options,'box','off');
-if strcmpi(box,'on'),
-	visible='on';
-else
-	visible='off';
-end
-
 for i = 1:nlines
 	xmin = hmargin(1);
Index: issm/trunk/src/m/shp/shp2exp.m
===================================================================
--- issm/trunk/src/m/shp/shp2exp.m	(revision 25994)
+++ issm/trunk/src/m/shp/shp2exp.m	(revision 26744)
@@ -1,4 +1,4 @@
 function shp2exp(shpfilename,expfilename)
-%SHP2EXP- transform shape file to Argus .exp file
+%SHP2EXP - transform shape file to Argus .exp file
 %
 %   Usage:
@@ -48,17 +48,28 @@
 	elseif strcmpi(shp(i).Geometry,'Point'),
 		x=shp(i).X; y=shp(i).Y;
-		expstruct(end+1).x=x;
-		expstruct(end).y=y;
-		expstruct(end).nods=length(x);
-		expstruct(end).density=1;
-		expstruct(end).closed=0;
-		%exp(end).name=num2str(shp(i).id);
+		if ~isnan(x) && ~isnan(y)
+			expstruct(end+1).x=x;
+			expstruct(end).y=y;
+			expstruct(end).nods=length(x);
+			expstruct(end).density=1;
+			expstruct(end).closed=0;
+			%exp(end).name=num2str(shp(i).id);
+		end
+	elseif strcmpi(shp(i).Geometry,'PointZ'),
+		shp(i)
 	elseif strcmpi(shp(i).Geometry,'Line'),
-		x=shp(i).X; y=shp(i).Y;
-		expstruct(end+1).x=x;
-		expstruct(end).y=y;
-		expstruct(end).nods=length(x);
-		expstruct(end).density=1;
-		expstruct(end).closed=0;
+		x=shp(i).X(:); y=shp(i).Y(:);
+		pos = find(~isnan(x) & ~isnan(y));
+		idx=find(diff(pos)~=1);
+		A=[idx(1);diff(idx);numel(pos)-idx(end)];
+		Cx=mat2cell(x(pos),A,1);
+		Cy=mat2cell(y(pos),A,1);
+		for i=1:numel(Cx)
+			expstruct(end+1).x=Cx{i};
+			expstruct(end).y=Cy{i};
+			expstruct(end).nods=length(Cx{i});
+			expstruct(end).density=1;
+			expstruct(end).closed=0;
+		end
 	end
 end
Index: issm/trunk/src/m/shp/shp2exp.py
===================================================================
--- issm/trunk/src/m/shp/shp2exp.py	(revision 25994)
+++ issm/trunk/src/m/shp/shp2exp.py	(revision 26744)
@@ -1,12 +1,12 @@
+import os
 import shapefile
-import os
 from expwrite import expwrite
 
 
-def shp2exp(shapefilename, * expfilename):
-    '''
-    Convert a shapefile to an .exp file.  Optionally, expfilename can be
-    specified to give a name for the .exp file to be created, otherwise the
-    .exp file will have the same prefix as the .shp file.
+def shp2exp(shapefilename, *expfilename):
+    """SHP2EXP - Convert a shapefile to an Argus .exp file. Optionally, 
+    expfilename can be specified to give a name for the .exp file to be 
+    created, otherwise the .exp file will have the same prefix as the .shp 
+    file.
 
     Usage:
@@ -15,10 +15,12 @@
 
     Examples:
-        shp2exp('Domain.shp') % creates Domain.exp
-        shp2exp('Domain.shp', 'DomainForISSM.exp')
-    '''
+        shp2exp('Domain.shp') # Creates Domain.exp
+        shp2exp('Domain.shp', 'Domain.exp')
+
+    See also EXPMASTER, EXPDOC
+    """
 
     if not os.path.exists(shapefilename):
-        raise IOError("shp2exp error message: file '%s' not found!" % shapefilename)
+        raise IOError('shp2exp error message: file {} not found!'.format(shapefilename))
     if not len(expfilename):
         expfile = os.path.splitext(shapefilename)[0] + '.exp'
@@ -33,5 +35,5 @@
     for i in range(len(shp.shapes())):
         geom = shp.shapes()[i].shapeType
-        if geom == 5:  # polygon
+        if geom == 5: # polygon
             expdict['closed'] = 1
             tmpx = [p[0] for p in shp.shapes()[i].points]
@@ -39,5 +41,5 @@
             x.append(tmpx)
             y.append(tmpy)
-        elif geom == 3:  # line
+        elif geom == 3: # line
             expdict['closed'] = 0
             tmpx = [p[0] for p in shp.shapes()[i].points]
@@ -45,5 +47,5 @@
             x.append(tmpx)
             y.append(tmpy)
-        elif geom == 1:  # point
+        elif geom == 1: # point
             expdict['closed'] = 0
             x.append(shp.shapes()[i].points[0][0])
Index: issm/trunk/src/m/solve/WriteData.js
===================================================================
--- issm/trunk/src/m/solve/WriteData.js	(revision 25994)
+++ issm/trunk/src/m/solve/WriteData.js	(revision 26744)
@@ -1,3 +1,3 @@
-function WriteData(fid,prefix){
+function WriteData(fid,prefix){ //{{{
 //WRITEDATA - write model field into binary buffer 
 //
@@ -74,4 +74,9 @@
 	}
 
+	let recordlengthtype = 'int';
+	if (svnversion >= 22708) {
+		recordlengthtype = 'long long';
+	}
+
 	//Step 1: write the name to identify this record uniquely
 	fid.fwrite(name.length,'int'); 
@@ -83,5 +88,5 @@
 
 		//first write length of record
-		fid.fwrite(4+4,'int');  //1 bool (disguised as an int)+code
+		fid.fwrite(4+4,recordlengthtype);  //1 bool (disguised as an int)+code
 
 		//write data code: 
@@ -95,5 +100,5 @@
 
 		//first write length of record
-		fid.fwrite(4+4,'int');  //1 integer + code
+		fid.fwrite(4+4,recordlengthtype);  //1 integer + code
 
 		//write data code: 
@@ -107,5 +112,5 @@
 
 		//first write length of record
-		fid.fwrite(8+4,'int');  //1 double+code
+		fid.fwrite(8+4,recordlengthtype);  //1 double+code
 
 		//write data code: 
@@ -117,5 +122,5 @@
 	else if (format == 'String'){ // {{{
 		//first write length of record
-		fid.fwrite(data.length+4+4,'int');  //string + string size + code
+		fid.fwrite(data.length+4+4,recordlengthtype);  //string + string size + code
 
 		//write data code: 
@@ -128,18 +133,24 @@
 	else if (format == 'BooleanMat'){ // {{{
 
-		//Get size
-		var s=[data.length,1];
-		if(IsArray(data[0]))s[1]=data[0].length;
+		//Get size (TODO: use into matlab.js::size)
+		var s=[data.length,1]; //vector
+		if (IsArray(data[0])) { //matrix
+			s[1]=data[0].length;
+        } else if (typeof data == 'number') { //scalar
+        	s[0]=1; s[1]=1
+        } else if (data.length == 0) { //empty matrix/vector
+            s[1]=0;
+        }
 
 		//if matrix = NaN, then do not write anything
-		if (s[0]==1 & s[1]==1 & isNaN(data)){
-			s[0]=0; s[1]=0;
-		}
-		if (s[0]==1 & s[1]==1 & isNaN(data[0])){
-			s[0]=0; s[1]=0;
-		}
-
-		//first write length of record
-		fid.fwrite(4+4+8*s[0]*s[1]+4+4,'int');  //2 integers (32 bits) + the double matrix + code + matrix type
+		if (s[0]==1 && s[1]==1 && isNaN(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (typeof data != 'number' && s[0]==1 && s[1]==1 && isNaN(data[0])){
+			s[0]=0; s[1]=0;
+		}
+
+		//first write length of record
+		fid.fwrite(4+4+8*s[0]*s[1]+4+4,recordlengthtype);  //2 integers (32 bits) + the double matrix + code + matrix type
 
 		//write data code and matrix type: 
@@ -154,18 +165,24 @@
 	else if (format == 'IntMat'){ // {{{
 
-		//Get size
-		var s=[data.length,1];
-		if(IsArray(data[0]))s[1]=data[0].length;
+		//Get size (TODO: use into matlab.js::size)
+		var s=[data.length,1]; //vector
+		if (IsArray(data[0])) { //matrix
+			s[1]=data[0].length;
+        } else if (typeof data == 'number') { //scalar
+        	s[0]=1; s[1]=1
+        } else if (data.length == 0) { //empty matrix/vector
+            s[1]=0;
+        }
 
 		//if matrix = NaN, then do not write anything
-		if (s[0]==1 & s[1]==1 & isNaN(data)){
-			s[0]=0; s[1]=0;
-		}
-		if (s[0]==1 & s[1]==1 & isNaN(data[0])){
-			s[0]=0; s[1]=0;
-		}
-
-		//first write length of record
-		fid.fwrite(4+4+8*s[0]*s[1]+4+4,'int');  //2 integers (32 bits) + the double matrix + code + matrix type
+		if (s[0]==1 && s[1]==1 && isNaN(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (typeof data != 'number' && s[0]==1 && s[1]==1 && isNaN(data[0])){
+			s[0]=0; s[1]=0;
+		}
+
+		//first write length of record
+		fid.fwrite(4+4+8*s[0]*s[1]+4+4,recordlengthtype);  //2 integers (32 bits) + the double matrix + code + matrix type
 
 		//write data code and matrix type: 
@@ -181,14 +198,19 @@
 	else if (format == 'DoubleMat'){ // {{{
 
-		//Get size
-		var s=[data.length,1];
-		if(IsArray(data[0]))s[1]=data[0].length;
-		if(typeof data == 'number'){s[0]=1; s[1]=1}
-
+		//Get size (TODO: use into matlab.js::size)
+		var s=[data.length,1]; //vector
+		if (IsArray(data[0])) { //matrix
+			s[1]=data[0].length;
+        } else if (typeof data == 'number') { //scalar
+        	s[0]=1; s[1]=1
+        } else if (data.length == 0) { //empty matrix/vector
+            s[1]=0;
+        }
+        
 		//if matrix = NaN, then do not write anything
-		if (s[0]==1 & s[1]==1 & isNaN(data)){
-			s[0]=0; s[1]=0;
-		}
-		if (s[0]==1 & s[1]==1 & isNaN(data[0])){
+		if (s[0]==1 && s[1]==1 && isNaN(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (typeof data != 'number' && s[0]==1 && s[1]==1 && isNaN(data[0])){
 			s[0]=0; s[1]=0;
 		}
@@ -197,5 +219,5 @@
 		var recordlength=4+4+8*s[0]*s[1]+4+4; //2 integers (32 bits) + the double matrix + code + matrix type
 		if (recordlength>Math.pow(2,31)) throw Error(sprintf("field '%s' cannot be marshalled because it is larger than 2^31 bytes!",name));
-		fid.fwrite(recordlength,'int');
+		fid.fwrite(recordlength,recordlengthtype);
 
 		//write data code and matrix type: 
@@ -224,5 +246,5 @@
 
 		//write length of record
-		fid.fwrite(recordlength,'int'); 
+		fid.fwrite(recordlength,recordlengthtype); 
 
 		//write data code: 
@@ -247,5 +269,5 @@
 		//first get length of string array: 
 		num=data.length;
-		if ((typeof data[0] == 'numeric') & num==1 & isNaN(data[0])){
+		if ((typeof data[0] == 'number') & num==1 & isNaN(data[0])){
 			num = 0;
 		}
@@ -259,5 +281,5 @@
 
 		//write length of record
-		fid.fwrite(recordlength,'int'); 
+		fid.fwrite(recordlength,recordlengthtype); 
 
 		//write data code: 
@@ -278,6 +300,5 @@
 					format.toString(),name));
 	}
-}
-
+} //}}}
 function FormatToCode(format){ // {{{
 	//This routine takes the format string, and hardcodes it into an integer, which 
Index: issm/trunk/src/m/solve/WriteData.py
===================================================================
--- issm/trunk/src/m/solve/WriteData.py	(revision 25994)
+++ issm/trunk/src/m/solve/WriteData.py	(revision 26744)
@@ -67,5 +67,10 @@
                 #We scale everything but the last line that holds time
                 data[:-1, :] = scale * data[:-1, :]
-            else:
+            elif type(data) is list: # Deal with "TypeError: can't multiply sequence by non-int of type 'float'" for type list
+                scaleddata = []
+                for i in range(len(data)):
+                    scaleddata.append(scale * data[i])
+                data = scaleddata
+            else: #
                 data = scale * data
         if np.ndim(data) > 1 and data.shape[0] == timeserieslength:
Index: issm/trunk/src/m/solve/loadresultfromdisk.m
===================================================================
--- issm/trunk/src/m/solve/loadresultfromdisk.m	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultfromdisk.m	(revision 26744)
@@ -49,4 +49,9 @@
 					N=fread(fid,1,'int');
 					field=fread(fid,[N M],'int')';
+				elseif type==5,
+					N=fread(fid,1,'int');
+					fieldr=fread(fid,[N M],'double')';
+					fieldi=fread(fid,[N M],'double')';
+					field=complex(fieldr,fieldi);
 				else
 					error(['cannot read data of type ' num2str(type) ]);
Index: issm/trunk/src/m/solve/loadresultfromdisk.py
===================================================================
--- issm/trunk/src/m/solve/loadresultfromdisk.py	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultfromdisk.py	(revision 26744)
@@ -4,16 +4,14 @@
 
 def loadresultfromdisk(filename, step, name, *args):  # {{{
-    """
-    LOADRESULTFROMDISK - load specific result of solution sequence from disk
+    """LOADRESULTFROMDISK - load specific result of solution sequence from disk
     file "filename"
 
-        Usage:
-            variable = loadresultsfromdisk(filename, step, name)
+    Usage:
+        variable = loadresultsfromdisk(filename, step, name)
 
-        TODO:
-        - Test this module against output of src/m/solve/loadresultsfromdisk.m
+    TODO:
+    - Test this module against output of src/m/solve/loadresultsfromdisk.m
     """
-    print('Got hwrwefew')
-    exit()
+
     # Open file
     try:
@@ -59,4 +57,17 @@
                 for i in range(M):
                     field[i, :] = struct.unpack('{}i'.format(N), fid.read(N * struct.calcsize('i')))
+            elif datatype == 5:
+                # TODO:
+                # - Check that the following results in the same output as 
+                # MATLAB
+                #
+                N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
+                fieldr = np.zeros(shape=(M, N), dtype=float)
+                fieldi = np.zeros(shape=(M, N), dtype=float)
+                for i in range(M):
+                    fieldr[i, :] = struct.unpack('{}d'.format(N), fid.read(N * struct.calcsize('d')))
+                    fieldi[i, :] = struct.unpack('{}d'.format(N), fid.read(N * struct.calcsize('d')))
+                field = np.vectorize(complex)(fieldr, fieldi)
+                print(field)
             else:
                 raise TypeError("cannot read data of type {}".format(datatype))
Index: issm/trunk/src/m/solve/loadresultsfromcluster.m
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromcluster.m	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultsfromcluster.m	(revision 26744)
@@ -4,7 +4,9 @@
 %   Usage:
 %      md=loadresultsfromcluster(md,varargin);
-%      options include:
-%         - runtimename
-%         - nolog.
+%
+%      Options include: 'runtimename', 'nolog'
+%
+%   Example:
+%     md=loadresultsfromcluster(md,'runtimename','test101-06-15-2021-13-24-18-4883');
 
 %process options: 
Index: issm/trunk/src/m/solve/loadresultsfromcluster.py
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromcluster.py	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultsfromcluster.py	(revision 26744)
@@ -1,19 +1,20 @@
 import os
-import socket
+import subprocess
 
 from helpers import *
 from loadresultsfromdisk import loadresultsfromdisk
-from MatlabFuncs import ispc
+from MatlabFuncs import *
 from pairoptions import pairoptions
 
 
-def remove(filename):
+def remove(filename):  #{{{
     try:
         os.remove(filename)
     except OSError:
         print(('WARNING: ' + filename + ' does not exist'))
+# }}}
 
 
-def loadresultsfromcluster(md, *args):
+def loadresultsfromcluster(md, *args):  #{{{
     """LOADRESULTSFROMCLUSTER - load results of solution sequence from cluster
 
@@ -21,4 +22,9 @@
         md = loadresultsfromcluster(md)
         md = loadresultsfromcluster(md, 'runtimename', runtimename)
+
+        Options include: 'runtimename', 'nolog'
+
+    Example:
+        md = loadresultsfromcluster(md, 'runtimename', 'test101-06-15-2021-13-24-18-4883')
     """
 
@@ -63,5 +69,5 @@
 
     # Erase input file if run was carried out on same platform
-    hostname = socket.gethostname()
+    hostname = oshostname()
     if hostname == cluster.name:
         remove(md.miscellaneous.name + '.bin')
@@ -75,2 +81,3 @@
 
     return md
+# }}}
Index: issm/trunk/src/m/solve/loadresultsfromdisk.m
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromdisk.m	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultsfromdisk.m	(revision 26744)
@@ -12,5 +12,4 @@
 
 if ~md.qmu.isdakota,
-
 	%Check that file exists
 	if ~exist(filename,'file'),
Index: issm/trunk/src/m/solve/loadresultsfromdisk.py
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromdisk.py	(revision 25994)
+++ issm/trunk/src/m/solve/loadresultsfromdisk.py	(revision 26744)
@@ -16,5 +16,5 @@
     # Check number of inputs/outputs
     if not md or not filename:
-        raise ValueError("loadresultsfromdisk: error message.")
+        raise ValueError('loadresultsfromdisk: error message.')
 
     if not md.qmu.isdakota:
@@ -31,5 +31,5 @@
             return
 
-        # Initialize md.results if not a structure yet
+        # Initialize md.results if it is not a structure yet
         if not isinstance(md.results, results):
             md.results = results()
@@ -38,5 +38,5 @@
         structure = parseresultsfromdisk(md, filename, not md.settings.io_gather)
         if not structure:
-            raise RuntimeError("No result found in binary file '{}'. Check for solution crash.".format(filename))
+            raise RuntimeError('No result found in binary file \'{}\'. Check for solution crash.'.format(filename))
         if not hasattr(structure[0], 'SolutionType'):
             if hasattr(structure[-1], 'SolutionType'):
@@ -64,5 +64,5 @@
 
         if getattr(md.results, structure[0].SolutionType)[0].errlog:
-            print("loadresultsfromdisk info message: error during solution. Check your errlog and outlog model fields.")
+            print('loadresultsfromdisk info message: error during solution. Check your errlog and outlog model fields.')
 
         # If only one solution, extract it from list for user friendliness
Index: issm/trunk/src/m/solve/marshall.m
===================================================================
--- issm/trunk/src/m/solve/marshall.m	(revision 25994)
+++ issm/trunk/src/m/solve/marshall.m	(revision 26744)
@@ -44,9 +44,9 @@
 st=fclose(fid);
 
-% Uncomment the following to make a copy of the binary input file for debugging 
-% purposes (can be fed into scripts/ReadBin.py).
-% copyfile([md.miscellaneous.name '.bin'], [md.miscellaneous.name '.m.bin'])
-
 if st==-1,
 	error(['marshall error message: could not close file ' [md.miscellaneous.name '.bin']]);
 end
+
+% Uncomment the following to make a copy of the binary input file for debugging 
+% purposes (can be fed into scripts/BinRead.py).
+% copyfile([md.miscellaneous.name '.bin'], [md.miscellaneous.name '.m.bin'])
Index: issm/trunk/src/m/solve/marshall.py
===================================================================
--- issm/trunk/src/m/solve/marshall.py	(revision 25994)
+++ issm/trunk/src/m/solve/marshall.py	(revision 26744)
@@ -17,5 +17,5 @@
         print("marshalling file {}.bin".format(md.miscellaneous.name))
 
-    #open file for binary writing
+    # Open file for binary writing
     try:
         fid = open(md.miscellaneous.name + '.bin', 'wb')
@@ -26,15 +26,15 @@
     fields.sort() # sort fields so that comparison of binary files is easier
     for field in fields:
-        #Some properties do not need to be marshalled
+        # Some properties do not need to be marshalled
         if field in ['results', 'radaroverlay', 'toolkits', 'cluster', 'private']:
             continue
 
-        #Check that current field is an object
+        # Check that current field is an object
         if not hasattr(getattr(md, field), 'marshall'):
             raise TypeError("field '{}' is not an object.".format(field))
 
-        #Marshall current object
-        #print "marshalling %s ..." % field #Uncomment for debugging
-        exec("md.{}.marshall('md.{}', md, fid)".format(field, field))
+        # Marshall current object
+        #print('marshalling {} ...'.format(field) # Uncomment for debugging
+        exec('md.{}.marshall(\'md.{}\', md, fid)'.format(field, field))
 
     #Last, write "md.EOF" to make sure that the binary file is not corrupt
@@ -45,9 +45,9 @@
         fid.close()
 
-        # Uncomment the following to make a copy of the binary input file for 
-        # debugging purposes (can be fed into scripts/ReadBin.py).
-        # copy_cmd = "cp {}.bin {}.py.bin".format(md.miscellaneous.name, md.miscellaneous.name)
-        # subprocess.call(copy_cmd, shell=True)
+    except IOError as e:
+        print('marshall error message: could not close file \'{}.bin\' due to:'.format(md.miscellaneous.name), e)
 
-    except IOError as e:
-        print("marshall error message: could not close file '{}.bin' due to:".format(md.miscellaneous.name), e)
+    # Uncomment the following to make a copy of the binary input file for 
+    # debugging purposes (can be fed into scripts/BinRead.py).
+    # copy_cmd = 'cp {}.bin {}.py.bin'.format(md.miscellaneous.name, md.miscellaneous.name)
+    # subprocess.call(copy_cmd, shell=True)
Index: issm/trunk/src/m/solve/parseresultsfromdisk.m
===================================================================
--- issm/trunk/src/m/solve/parseresultsfromdisk.m	(revision 25994)
+++ issm/trunk/src/m/solve/parseresultsfromdisk.m	(revision 26744)
@@ -225,4 +225,20 @@
 	elseif strcmp(fieldname,'Vel'),
 		field = field*yts;
+	elseif strcmp(fieldname,'VxShear'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VyShear'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VxBase'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VyBase'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VxSurface'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VySurface'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VxAverage'),
+		field = field*yts;
+	elseif strcmp(fieldname,'VyAverage'),
+		field = field*yts;
 	elseif strcmp(fieldname,'BasalforcingsGroundediceMeltingRate'),
 		field = field*yts;
@@ -251,4 +267,6 @@
 	elseif strcmp(fieldname,'SmbPrecipitation'),
 		field = field*yts;
+	elseif strcmp(fieldname,'SmbRain'),
+		field = field*yts;
 	elseif strcmp(fieldname,'SmbRunoff'),
 		field = field*yts;
@@ -266,4 +284,6 @@
 		field = field*yts;
 	elseif strcmp(fieldname,'SmbMAdd'),
+		field = field*yts;
+	elseif strcmp(fieldname,'SmbWAdd'),
 		field = field*yts;
 	elseif strcmp(fieldname,'CalvingCalvingrate'),
Index: issm/trunk/src/m/solve/parseresultsfromdisk.py
===================================================================
--- issm/trunk/src/m/solve/parseresultsfromdisk.py	(revision 25994)
+++ issm/trunk/src/m/solve/parseresultsfromdisk.py	(revision 26744)
@@ -80,5 +80,5 @@
         fid = open(filename, 'rb')
     except IOError as e:
-        raise IOError("parseresultsfromdisk error message: could not open {} for binary reading".format(filename))
+        raise IOError('parseresultsfromdisk error message: could not open {} for binary reading'.format(filename))
 
     # Collect all results in a list
@@ -127,9 +127,9 @@
     """
 
-    #read field
+    # Read field
     try:
         length = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
         fieldname = struct.unpack('{}s'.format(length), fid.read(length))[0][:-1]
-        fieldname = fieldname.decode()  #strings are binaries when stored so need to be converted back
+        fieldname = fieldname.decode() # strings are binaries when stored so need to be converted back
         time = struct.unpack('d', fid.read(struct.calcsize('d')))[0]
         step = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
@@ -145,5 +145,5 @@
         elif datatype == 3:
             N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
-    #field = transpose(fread(fid, [N M], 'double'))
+            #field = transpose(fread(fid, [N M], 'double'))
             field = np.zeros(shape=(M, N), dtype=float)
             for i in range(M):
@@ -152,5 +152,5 @@
         elif datatype == 4:
             N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
-    # field = transpose(fread(fid, [N M], 'int'))
+            #field = transpose(fread(fid, [N M], 'int'))
             field = np.zeros(shape=(M, N), dtype=int)
             for i in range(M):
@@ -158,7 +158,7 @@
 
         else:
-            raise TypeError("cannot read data of datatype {}".format(datatype))
-
-        #Process units here FIXME: this should not be done here!
+            raise TypeError('cannot read data of datatype {}'.format(datatype))
+
+        # Process units here FIXME: this should not be done here!
         yts = md.constants.yts
         if fieldname == 'BalancethicknessThickeningRate':
@@ -176,4 +176,20 @@
         elif fieldname == 'Vel':
             field = field * yts
+        elif fieldname == 'VxShear':
+            field = field * yts
+        elif fieldname == 'VyShear':
+            field = field * yts
+        elif fieldname == 'VxBase':
+            field = field * yts
+        elif fieldname == 'VyBase':
+            field = field * yts
+        elif fieldname == 'VxSurface':
+            field = field * yts
+        elif fieldname == 'VySurface':
+            field = field * yts
+        elif fieldname == 'VxAverage':
+            field = field * yts
+        elif fieldname == 'VyAverage':
+            field = field * yts
         elif fieldname == 'BasalforcingsGroundediceMeltingRate':
             field = field * yts
@@ -181,25 +197,27 @@
             field = field * yts
         elif fieldname == 'TotalFloatingBmb':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'TotalFloatingBmbScaled':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'TotalGroundedBmb':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'TotalGroundedBmbScaled':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'TotalSmb':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'TotalSmbScaled':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'GroundinglineMassFlux':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'IcefrontMassFlux':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'IcefrontMassFluxLevelset':
-            field = field / 10.**12 * yts  #(GigaTon/year)
+            field = field / pow(10.0, 12) * yts # (GigaTon/year)
         elif fieldname == 'SmbMassBalance':
             field = field * yts
         elif fieldname == 'SmbPrecipitation':
             field = field * yts
+        elif fieldname == 'SmbRain':
+            field = field * yts
         elif fieldname == 'SmbRunoff':
             field = field * yts
@@ -217,4 +235,6 @@
             field = field * yts
         elif fieldname == 'SmbMAdd':
+            field = field * yts
+        elif fieldname == 'SmbWAdd':
             field = field * yts
         elif fieldname == 'CalvingCalvingrate':
Index: issm/trunk/src/m/solve/solve.js
===================================================================
--- issm/trunk/src/m/solve/solve.js	(revision 25994)
+++ issm/trunk/src/m/solve/solve.js	(revision 26744)
@@ -1,90 +1,116 @@
-function solve(md, solutionstring) {//{{{
-/**
- * SOLVE - apply solution sequence for this model
- *
- *	Usage:
- *		solve(md, solutionstring, varargin);
- *		where varargin is a list of paired arguments of string OR enums
- *
- *	solution types available comprise:
- *		- 'Stressbalance'		or 'sb'
- *		- 'Masstransport'		or 'mt'
- *		- 'Thermal'				or 'th'
- *		- 'Steadystate'			or 'ss'
- *		- 'Transient'			or 'tr'
- *		- 'Balancethickness'	or 'mc'
- *		- 'Balancevelocity'		or 'bv'
- *		- 'BedSlope'			or 'bsl'
- *		- 'SurfaceSlope'		or 'ssl'
- *		- 'Hydrology'			or 'hy'
- *		- 'DamageEvolution'		or 'da'
- *		- 'Gia'					or 'gia'
- *		- 'Sealevelrise'		or 'slr'
- *
- *	extra options:
- *		- loadonly    		: do not solve, only load results
- *		- runtimename 		: true or false (default is true), makes name unique
- *		- checkconsistency 	: 'yes' or 'no' (default is 'yes'), ensures checks on consistency of model
- *		- restart			: directory name (relative to the execution directory) where the restart file is located
- *		- successCallback	: callback function to be called on success
- *		- errorCallback		: callback function to be called on error
- *
- *	reporting:
- *		With no optional arguments for reporting, progress and error reporting is written to the DOM element with ID 'solve-button'.
- *		- solveButtonId		: overrides default solve button ID
- *		- callout			: Callout to report progress/errors to; overrides reporting to solve button
- *		- withProgressBar	: reports progress of certain solution stages with a progress bar; will not display if a Callout has not been provided
- *
- *	Examples:
- *		md = solve(md, 'Stressbalance');
- *		md = solve(md, 'sb');
- */
-	if (typeof solutionstring !== 'string') {
-		throw Error(sprintf("%s\n", "ISSM's solve function only accepts strings for solution sequences. Type help solve to get a list of supported solutions."));
-	}
-
-	//recover and process solve options
-	let solutionStringLowerCase = solutionstring.toLowerCase();
-	
-	if ((solutionStringLowerCase === 'sb') || (solutionStringLowerCase === 'stressbalance')) {
+async function solve(md, solutionstring, ...varargin) { //{{{
+/*
+SOLVE - apply solution sequence for this model
+
+Usage:
+	solve(md, solutionstring[, ...]);
+
+where varargin is a list of paired arguments of string OR enums
+
+Solution types available comprise:
+- 'Stressbalance'			or 'sb'
+- 'Masstransport'			or 'mt'
+- 'Oceantransport'			or 'oceant'
+- 'Thermal'					or 'th'
+- 'Steadystate'				or 'ss'
+- 'Transient'				or 'tr'
+- 'Balancethickness'		or 'mc'
+- 'BalancethicknessSoft'	or 'mcsoft'
+- 'Balancevelocity'			or 'bv'
+- 'BedSlope'				or 'bsl'
+- 'SurfaceSlope'			or 'ssl'
+- 'Hydrology'				or 'hy'
+- 'DamageEvolution'			or 'da'
+- 'Gia'						or 'gia'
+- 'Love'					or 'lv'
+- 'Esa'						or 'esa'
+- 'Sampling'				or 'smp'
+- 'Gmsh'
+
+Extra options (these all need to be passed in via the third parameter, which is 
+a rest parameter):
+- loadonly    		: do not solve, only load results
+- runtimename 		: true or false (default is true); makes name unique
+- checkconsistency 	: true or false (default is true); checks consistency of model
+- restart			: directory name (relative to the execution directory) where the restart file is located
+
+Examples:
+	md = solve(md, 'Stressbalance');
+	md = solve(md, 'sb');
+	
+NOTE:
+- We do not strictly need to return md as objects are passed by reference in 
+JavaScript, but we do so to mirror MATLAB and Python APIs.
+
+TODO:
+- Refactor UI reporting structure so we do not have to check if it is defined
+*/	
+ 
+/*
+	// Check that md exists and that it is a model
+ 	if (md === null || md === undefined || md.constructor.name !== 'model') {
+ 		throw new Error('md needs to be an instance of the model class');
+ 	}
+*/
+	
+	if (typeof(solutionstring) !== 'string') {
+		throw new Error('ISSM\'s solve function only accepts strings for solution sequences. Type help solve to get a list of supported solutions.');
+	}
+
+	// Recover and process solve options
+	if (vesl.strings.strcmpi(solutionstring, 'sb') || vesl.strings.strcmpi(solutionstring, 'Stressbalance')) {
 		solutionstring = 'StressbalanceSolution';
-	} else if ((solutionStringLowerCase === 'mt') || (solutionStringLowerCase === 'masstransport')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'mt') || vesl.strings.strcmpi(solutionstring, 'Masstransport')) {
 		solutionstring = 'MasstransportSolution';	
-	} else if ((solutionStringLowerCase === 'th') || (solutionStringLowerCase === 'thermal')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'oceant') || vesl.strings.strcmpi(solutionstring, 'Oceantransport')) {
+		solutionstring = 'OceantransportSolution';	
+	} else if (vesl.strings.strcmpi(solutionstring, 'th') || vesl.strings.strcmpi(solutionstring, 'Thermal')) {
 		solutionstring = 'ThermalSolution';
-	} else if ((solutionStringLowerCase === 'st') || (solutionStringLowerCase === 'steadystate')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'st') || vesl.strings.strcmpi(solutionstring, 'Steadystate')) {
 		solutionstring = 'SteadystateSolution';
-	} else if ((solutionStringLowerCase === 'tr') || (solutionStringLowerCase === 'transient')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'tr') || vesl.strings.strcmpi(solutionstring, 'Transient')) {
 		solutionstring = 'TransientSolution';
-	} else if ((solutionStringLowerCase === 'mc') || (solutionStringLowerCase === 'balancethickness')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'mc') || vesl.strings.strcmpi(solutionstring, 'Balancethickness')) {
 		solutionstring = 'BalancethicknessSolution';
-	} else if ((solutionStringLowerCase === 'bv') || (solutionStringLowerCase === 'balancevelocity')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'mcsoft') || vesl.strings.strcmpi(solutionstring, 'BalancethicknessSoft')) {
+		solutionstring = 'BalancethicknessSoftSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'bv') || vesl.strings.strcmpi(solutionstring, 'Balancevelocity')) {
 		solutionstring = 'BalancevelocitySolution';
-	} else if ((solutionStringLowerCase === 'bsl') || (solutionStringLowerCase === 'bedslope')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'bsl') || vesl.strings.strcmpi(solutionstring, 'BedSlope')) {
 		solutionstring = 'BedSlopeSolution';
-	} else if ((solutionStringLowerCase === 'ssl') || (solutionStringLowerCase === 'surfaceslope')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'ssl') || vesl.strings.strcmpi(solutionstring, 'SurfaceSlope')) {
 		solutionstring = 'SurfaceSlopeSolution';
-	} else if ((solutionStringLowerCase === 'hy') || (solutionStringLowerCase === 'hydrology')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'hy') || vesl.strings.strcmpi(solutionstring, 'Hydrology')) {
 		solutionstring = 'HydrologySolution';
-	} else if ((solutionStringLowerCase === 'da') || (solutionStringLowerCase === 'damageevolution')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'da') || vesl.strings.strcmpi(solutionstring, 'DamageEvolution')) {
 		solutionstring = 'DamageEvolutionSolution';
-	} else if ((solutionStringLowerCase === 'gia') || (solutionStringLowerCase === 'gia')) {
+	} else if (vesl.strings.strcmpi(solutionstring, 'gia') || vesl.strings.strcmpi(solutionstring, 'Gia')) {
 		solutionstring = 'GiaSolution';
-	} else if ((solutionStringLowerCase === 'slr') || (solutionStringLowerCase === 'sealevelrise')) {
-		solutionstring = 'SealevelriseSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'lv') || vesl.strings.strcmpi(solutionstring, 'Love')) {
+		solutionstring = 'LoveSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'Esa')) {
+		solutionstring = 'EsaSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'smp') || vesl.strings.strcmpi(solutionstring, 'Sampling')) {
+		solutionstring = 'SamplingSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'gmsh')) {
+		solutionstring = 'GmshSolution';
+	} else if (vesl.strings.strcmpi(solutionstring, 'gmt')) {
+		solutionstring = 'GmtSolution';
 	} else {
-		throw Error(sprintf("%s%s%s\n",'solutionstring ',solutionstring,' not supported!'));
-	}
-	
-	// Process options
-	let args 	= Array.prototype.slice.call(arguments);
-	let options = new pairoptions(args.slice(2, args.length));
-	options.addfield('solutionstring', solutionstring);
-
-	// recover some fields
+		throw new Error('solutionstring ' + solutionstring + ' not supported!');
+	}
+	let options = new pairoptions(varargin, 'solutionstring', solutionstring);
+	
+	// Recover some fields
 	md.priv.solution 	= solutionstring;
-	cluster 			= md.cluster;
-
-	//check model consistency
+	let cluster 		= md.cluster;
+	
+	// NOTE: Batch scripts are not currently implemented
+	let batch = 0; 
+	if (options.getfieldvalue('batch', 'no') === 'yes') {
+		batch = 1;
+	}
+	
+	// Check model consistency
 	if (options.getfieldvalue('checkconsistency', 'yes') === 'yes') {
 		if (md.verbose.solution) {
@@ -94,28 +120,30 @@
 		ismodelselfconsistent(md);
 	}
-
+	
 	// If we are restarting, actually use the provided runtime name:
 	restart = options.getfieldvalue('restart', '');
 
 	// First, build a runtime name that is unique
-	if (restart === 1 ) {
+	if (restart === 1) {
 		// Leave the runtimename as is
 	} else {
-		if (!(restart === '')) {
-			md.priv.runtimename=restart;
-		} else if (options.getfieldvalue('runtimename',true)) {
-			let c = new Date().getTime();
-			md.priv.runtimename = sprintf('%s-%g', md.miscellaneous.name, c);
+		if (restart !== '') {
+			md.priv.runtimename = restart;
 		} else {
-			md.priv.runtimename = md.miscellaneous.name;
-		}
-	}
-
-	// If running qmu analysis, some preprocessing of dakota files using models fields needs to be carried out
+			if (options.getfieldvalue('runtimename', true)) {
+				let c = new Date().getTime();
+				md.priv.runtimename = sprintf('%s-%g', md.miscellaneous.name, c);
+			} else {
+				md.priv.runtimename = md.miscellaneous.name;
+			}
+		}
+	}
+
+	// If running QMU analysis, some preprocessing of Dakota files using model fields needs to be carried out
 	if (md.qmu.isdakota) {
-		throw Error("solve error message: qmu runs not supported yet!");
-		//md.preqmu(options);
-	}
-
+		throw new Error("QMU not supported yet!");
+		//md = preqmu(md, options);
+	}
+	
 	// Do we load results only?
 	if (options.getfieldvalue('loadonly', false)){
@@ -124,97 +152,53 @@
 	}
 
-	// Marshall into a binary array (fid) all the fields of model
-	let fid = marshall(md); // bin file
-	
-	//deal with toolkits options: 
-	toolkitsstring = md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
-
-
 	/*
-		Set success callback function
-		
-		Default: do nothing if no success callback function requested
+	Write all input arrays (as opposed to, under MATLAB/Python, input binary 
+	files)
+	
+	NOTE: The JavaScript implementation diverges significantly from the 
+		  MATLAB/Python APIs here.
 	*/
-	//{{{
-	function successCallbackDefault() {
-		solving = false;
-	}; 
-	
-	let successCallback = options.getfieldvalue('successCallback', successCallbackDefault);
-	//}}}
-	
-	
-	/*
-		Set error callback function
-		
-		Default: do nothing if no error callback function requested
-	*/
-	//{{{ 
-	function errorCallbackDefault() {
-		solving = false;
-	}; 
-	
-	let errorCallback = options.getfieldvalue('errorCallback', errorCallbackDefault);
-	//}}}
-	
-	
-	/*
-		Set solve button ID
-		
-		Default: update #solve-button element with progress updates
-	*/
-	//{{{
-	let solveButtonId = options.getfieldvalue('solveButtonId', '#solve-button');
-	//}}}
-	
-	
-	/*
-		Set Callout
-	*/
-	//{{{
-	var callout = {};
-	
-	// Default: Callout is an empty object
-	callout = options.getfieldvalue('callout', {});
-	//}}}
-	
-	
-	/*
-		Set progress bar display boolean
-		
-		Default: no progress bar
-		
-		NOTE: must have supplied a callout for progress bar to display
-	*/
-	//{{{
-	let withProgressBar = options.getfieldvalue('withProgressBar', false);
-	//}}}
-
+	let fid = null; // bin file equivalent
+	//TODO: FIND A BETTER WAY TO DO THIS! (IE, SYNC UP WRITEDATA AND HAVE A FULL DEMARSHALL/READMODEL IN PYTHON
+	if (solutionstring === 'GmshSolution') {
+		//open file for binary writing
+		fid = new fileptr('mode','w');
+	} else if (solutionstring === 'GmtSolution') {
+		//open file for binary writing
+		fid = new fileptr('mode','w');
+		let prefix='md.mesh';
+		WriteData(fid,prefix,'object',md.mesh,'fieldname','lat','format','DoubleMat','mattype',1);
+		WriteData(fid,prefix,'object',md.mesh,'fieldname','long','format','DoubleMat','mattype',1);
+	} else {
+		// Marshall into a binary array (fid) all the fields of model
+		fid = marshall(md); // bin file
+	}
+	let toolkitsstring = md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file equivalent
 
 	if (cluster.classname() === 'local') {//{{{
 
-		// We are running locally on the machine, using the issm module
+		// We are running locally on the machine, using the ISSM module
 		console.log('running issm locally');
 		
-		// Call issm
+		// Call ISSM
 		let outputs = issm(fid, toolkitsstring, solutionstring, md.miscellaneous.name); 
 		
-		// Recover output arguments:
+		// Recover output
 		let outputbuffer 		= outputs[0]; 
 		let outputbuffersize 	= outputs[1];
 			
 		// Load results 
-		md = loadresultsfrombuffer(md, outputbuffer, outputbuffersize); 
-		
-		// Call success callback 
-		successCallback();
-
-		return md;
+		md = loadresultsfrombuffer(md, outputbuffer, outputbuffersize); // TODO: Pass reporting construct to loadresultsfrombuffer
+		
+		// Call success callback
+		if (vesl.helpers.isFunction(vesl.ui.reporting.success_callback)) {
+			vesl.ui.reporting.success_callback();
+		}
 	//}}}
-	} else {//{{{
+	} else { //{{{
 		// We are running somewhere else on a computational server. Send the buffer to that server and retrieve output.
 		console.log('running issm remotely');
 		
-		cluster.UploadAndRun(
+		await cluster.uploadandrun(
 			md, 
 			fid, 
@@ -223,13 +207,23 @@
 			md.miscellaneous.name, 
 			md.priv.runtimename,
-			successCallback, 
-			errorCallback, 
-			solveButtonId, 
-			callout, 
-			withProgressBar
-		);
-
+			options
+		);/*
+.catch(function(e) {
+			if (vesl.helpers.isDefined(vesl.ui) && vesl.helpers.isDefined(vesl.ui.reporting) && vesl.helpers.isFunction(vesl.ui.reporting.error_callback)) {
+				vesl.ui.reporting.error_callback(e);
+			}
+		}).catch(function(e) {
+			// Handle unexpected errors (source: http://thecodebarbarian.com/async-await-error-handling-in-javascript.html)
+			console.log(e);
+		});
+			
+		if (vesl.helpers.isDefined(vesl.ui) && vesl.helpers.isDefined(vesl.ui.reporting) && vesl.helpers.isFunction(vesl.ui.reporting.success_callback)) {
+			vesl.ui.reporting.success_callback(md);
+		}
+*/
+		
+		// Why is md undefined at vesl.ui.reporting.success_callback(md)? See issm-refactor
+		
 		return md;
-	}//}}}
-}//}}}
-
+	} //}}}
+} //}}}
Index: issm/trunk/src/m/solve/solve.m
===================================================================
--- issm/trunk/src/m/solve/solve.m	(revision 25994)
+++ issm/trunk/src/m/solve/solve.m	(revision 26744)
@@ -8,26 +8,28 @@
 %
 %   Solution types available comprise:
-%   - 'Stressbalance'      or 'sb'
-%   - 'Masstransport'      or 'mt'
-%   - 'Thermal'            or 'th'
-%   - 'Steadystate'        or 'ss'
-%   - 'Transient'          or 'tr'
-%   - 'Balancethickness'   or 'mc'
-%   - 'Balancevelocity'    or 'bv'
-%   - 'BedSlope'           or 'bsl'
-%   - 'SurfaceSlope'       or 'ssl'
-%   - 'Hydrology'          or 'hy'
-%   - 'DamageEvolution'    or 'da'
-%   - 'Gia'                or 'gia'
-%   - 'Love'               or 'lv'
-%   - 'Esa'                or 'esa'
-%   - 'Sealevelrise'       or 'slr'
+%   - 'Stressbalance'        or 'sb'
+%   - 'Masstransport'        or 'mt'
+%   - 'Oceantransport'       or 'oceant'
+%   - 'Thermal'              or 'th'
+%   - 'Steadystate'          or 'ss'
+%   - 'Transient'            or 'tr'
+%   - 'Balancethickness'     or 'mc'
+%   - 'Balancethickness2'
+%   - 'BalancethicknessSoft' or 'mcsoft'
+%   - 'Balancevelocity'      or 'bv'
+%   - 'BedSlope'             or 'bsl'
+%   - 'SurfaceSlope'         or 'ssl'
+%   - 'Hydrology'            or 'hy'
+%   - 'DamageEvolution'      or 'da'
+%   - 'Gia'                  or 'gia'
+%   - 'Love'                 or 'lv'
+%   - 'Esa'                  or 'esa'
+%   - 'Sampling'             or 'smp'
 %
 %   Extra options:
-%   - loadonly         : does not solve. only load results
-%   - runtimename      : true or false (default is true), makes name unique
-%   - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on 
-%                        consistency of model
-%   - restart          : 'directory name (relative to the execution directory) 
+%   - loadonly         : do not solve, only load results
+%   - runtimename      : true or false (default is true); makes name unique
+%   - checkconsistency : 'yes' or 'no' (default is 'yes'); checks consistency of model
+%   - restart          : directory name (relative to the execution directory) 
 %                        where the restart file is located
 %
@@ -45,4 +47,6 @@
 elseif strcmpi(solutionstring,'mt') || strcmpi(solutionstring,'Masstransport')
 	solutionstring = 'MasstransportSolution';
+elseif strcmpi(solutionstring,'oceant') || strcmpi(solutionstring,'Oceantransport')
+	solutionstring = 'OceantransportSolution';
 elseif strcmpi(solutionstring,'th') || strcmpi(solutionstring,'Thermal')
 	solutionstring = 'ThermalSolution';
@@ -73,6 +77,6 @@
 elseif strcmpi(solutionstring,'esa') || strcmpi(solutionstring,'Esa')
 	solutionstring = 'EsaSolution';
-elseif strcmpi(solutionstring,'slr') || strcmpi(solutionstring,'Sealevelrise')
-	solutionstring = 'SealevelriseSolution';
+elseif strcmpi(solutionstring,'smp') || strcmpi(solutionstring,'Sampling')
+	solutionstring = 'SamplingSolution';    
 else
 	error(['solutionstring ' solutionstring ' not supported!']);
@@ -113,5 +117,5 @@
 end
 
-%if running QMU analysis, some preprocessing of Dakota files using models fields needs to be carried out. 
+%if running QMU analysis, some preprocessing of Dakota files using model fields needs to be carried out. 
 if md.qmu.isdakota,
 	md=preqmu(md,options);
@@ -169,5 +173,5 @@
 	end
 elseif md.settings.waitonlock>0,
-	%we wait for the done file
+	%wait for done file
 	done=waitonlock(md);
 	if md.verbose.solution,
Index: issm/trunk/src/m/solve/solve.py
===================================================================
--- issm/trunk/src/m/solve/solve.py	(revision 25994)
+++ issm/trunk/src/m/solve/solve.py	(revision 26744)
@@ -1,5 +1,4 @@
 from datetime import datetime
 import os
-import shutil
 
 from ismodelselfconsistent import ismodelselfconsistent
@@ -16,29 +15,31 @@
     Usage:
         md = solve(md, solutionstring, varargin)
-    
+
     where varargin is a list of paired arguments of string OR enums
 
     Solution types available comprise:
-    - 'Stressbalance'      or 'sb'
-    - 'Masstransport'      or 'mt'
-    - 'Thermal'            or 'th'
-    - 'Steadystate'        or 'ss'
-    - 'Transient'          or 'tr'
-    - 'Balancethickness'   or 'mc'
-    - 'Balancevelocity'    or 'bv'
-    - 'BedSlope'           or 'bsl'
-    - 'SurfaceSlope'       or 'ssl'
-    - 'Hydrology'          or 'hy'
-    - 'DamageEvolution'    or 'da'
-    - 'Gia'                or 'gia'
-    - 'Esa'                or 'esa'
-    - 'Sealevelrise'       or 'slr'
-    - 'Love'               or 'lv'
+    - 'Stressbalance'        or 'sb'
+    - 'Masstransport'        or 'mt'
+    - 'Oceantransport'       or 'oceant'
+    - 'Thermal'              or 'th'
+    - 'Steadystate'          or 'ss'
+    - 'Transient'            or 'tr'
+    - 'Balancethickness'     or 'mc'
+    - 'BalancethicknessSoft' or 'mcsoft'
+    - 'Balancevelocity'      or 'bv'
+    - 'BedSlope'             or 'bsl'
+    - 'SurfaceSlope'         or 'ssl'
+    - 'Hydrology'            or 'hy'
+    - 'DamageEvolution'      or 'da'
+    - 'Gia'                  or 'gia'
+    - 'Love'                 or 'lv'
+    - 'Esa'                  or 'esa'
+    - 'Sampling'             or 'smp'
 
     Extra options:
-    - loadonly         : does not solve. only load results
-    - runtimename      : true or false (default is true), makes name unique
-    - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on 
-                         consistency of model
+    - loadonly         : do not solve, only load results
+    - runtimename      : true or false (default is true); makes name unique
+    - checkconsistency : 'yes' or 'no' (default is 'yes'); checks consistency 
+                         of model
     - restart          : directory name (relative to the execution directory) 
                          where the restart file is located
@@ -54,4 +55,6 @@
     elif solutionstring.lower() == 'mt' or solutionstring.lower() == 'masstransport':
         solutionstring = 'MasstransportSolution'
+    elif solutionstring.lower() == 'oceant' or solutionstring.lower() == 'oceantransport':
+        solutionstring = 'OceantransportSolution'
     elif solutionstring.lower() == 'th' or solutionstring.lower() == 'thermal':
         solutionstring = 'ThermalSolution'
@@ -78,8 +81,8 @@
     elif solutionstring.lower() == 'esa':
         solutionstring = 'EsaSolution'
-    elif solutionstring.lower() == 'slr' or solutionstring.lower() == 'sealevelrise':
-        solutionstring = 'SealevelriseSolution'
+    elif solutionstring.lower() == 'smp' or solutionstring.lower() == 'sampling':
+        solutionstring = 'SamplingSolution'
     else:
-        raise ValueError("solutionstring '%s' not supported!" % solutionstring)
+        raise ValueError('solutionstring {} not supported!'.format(solutionstring))
     options = pairoptions('solutionstring', solutionstring, *args)
 
@@ -98,10 +101,11 @@
         ismodelselfconsistent(md)
 
+    # If we are restarting, actually use the provided runtime name
+    restart = options.getfieldvalue('restart', '')
     # First, build a runtime name that is unique
-    restart = options.getfieldvalue('restart', '')
     if restart == 1:
-        pass  # do nothing
+        pass # Leave the runtimename as is
     else:
-        if restart:
+        if not isempty(restart):
             md.private.runtimename = restart
         else:
@@ -112,5 +116,5 @@
                 md.private.runtimename = md.miscellaneous.name
 
-    # If running QMU analysis, some preprocessing of Dakota files using models 
+    # If running QMU analysis, some preprocessing of Dakota files using model 
     # fields needs to be carried out
     if md.qmu.isdakota:
@@ -127,17 +131,17 @@
     cluster.BuildQueueScript(md.private.runtimename, md.miscellaneous.name, md.private.solution, md.settings.io_gather, md.debug.valgrind, md.debug.gprof, md.qmu.isdakota, md.transient.isoceancoupling) # queue file
 
-    # Stop here if batch mode
-    if options.getfieldvalue('batch', 'no') == 'yes':
-        print('batch mode requested: not launching job interactively')
-        print('launch solution sequence on remote cluster by hand')
-        return md
+    # Upload all required files
+    modelname = md.miscellaneous.name
+    filelist = [modelname + '.bin', modelname + '.toolkits']
 
-    # Upload all required files:
-    modelname = md.miscellaneous.name
-    filelist = [modelname + '.bin ', modelname + '.toolkits ', modelname + '.queue ']
+    if ispc():
+        filelist.append(modelname + '.bat')
+    else:
+        filelist.append(modelname + '.queue')
+
     if md.qmu.isdakota:
         filelist.append(modelname + '.qmu.in')
-        
-    if not restart:
+
+    if isempty(restart):
         cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist)
 
@@ -145,13 +149,20 @@
     cluster.LaunchQueueJob(md.miscellaneous.name, md.private.runtimename, filelist, restart, batch)
 
+    # Return if batch
+    if batch:
+        if md.verbose.solution:
+            print('batch mode requested: not launching job interactively')
+            print('launch solution sequence on remote cluster by hand')
+        return md
+
     # Wait on lock
     if md.settings.waitonlock > 0:
-        islock = waitonlock(md)
-        if islock == 0:  # no results to be loaded
-            print('The results must be loaded manually with md = loadresultsfromcluster(md).')
-        else:  # load results
-            if md.verbose.solution:
-                print('loading results from cluster')
-            md = loadresultsfromcluster(md)
+        # Wait for done file
+        done = waitonlock(md)
+        if md.verbose.solution:
+            print('loading results from cluster')
+        md = loadresultsfromcluster(md)
+    elif md.settings.waitonlock == 0:
+        print('Model results must be loaded manually with md = loadresultsfromcluster(md).')
 
     return md
Index: issm/trunk/src/m/solve/solveslm.m
===================================================================
--- issm/trunk/src/m/solve/solveslm.m	(revision 25994)
+++ issm/trunk/src/m/solve/solveslm.m	(revision 26744)
@@ -1,23 +1,20 @@
 function slm=solveslm(slm,solutionstringi,varargin)
-%SOLVESLR - apply solution sequence for this sealevel model
+%SOLVESLM - apply solution sequence for this sealevel model
 %
 %   Usage:
-%      slm=solve(slm,solutionstring,varargin)
+%      slm=solveslm(slm,solutionstring,varargin)
 %      where varargin is a lit of paired arguments of string OR enums
 %
 %   solution types available comprise:
-%      - 'Sealevelrise'
 %      - 'Transient'
 %
-%  extra options:
+%   extra options:
 %
 %   Examples:
-%      slm=solve(slm,'Transient');
+%      slm=solveslm(slm,'Transient');
 
 %recover and process solve options
 if strcmpi(solutionstringi,'tr') || strcmpi(solutionstringi,'Transient')
 	solutionstring = 'TransientSolution';
-elseif strcmpi(solutionstringi,'slr') || strcmpi(solutionstringi,'Sealevelrise')
-	solutionstring = 'SealevelriseSolution';
 else
 	error(['solutionstring ' solutionstringi ' not supported!']);
@@ -46,5 +43,5 @@
 cluster=slm.cluster;
 batch=0;
-%now, go through icecaps, glacies and earth, and upload all the data independently: 
+%now, go through icecaps, glaciers and earth, and upload all the data independently: 
 disp('solving ice caps first');
 for i=1:length(slm.icecaps),
@@ -54,5 +51,5 @@
 slm.earth=solve(slm.earth,solutionstringi,'batch','yes');
 
-%Firs, build a runtime name that is unique
+%First, build a runtime name that is unique
 c=clock;
 slm.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',slm.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
Index: issm/trunk/src/m/solve/solveslm.py
===================================================================
--- issm/trunk/src/m/solve/solveslm.py	(revision 26744)
+++ issm/trunk/src/m/solve/solveslm.py	(revision 26744)
@@ -0,0 +1,98 @@
+from datetime import datetime
+import os
+
+import numpy as np
+
+from loadresultsfromcluster import loadresultsfromcluster
+from pairoptions import pairoptions
+from waitonlock import waitonlock
+
+
+def solveslm(slm, solutionstringi, *args):
+    """SOLVESLM - apply solution sequence for this sealevel model
+
+    Usage:
+        slm=solveslm(slm,solutionstring,varargin)
+        where varargin is a lit of paired arguments of string OR enums
+
+    solution types available comprise:
+        - 'Transient'
+
+    extra options:
+
+    Examples:
+        slm=solveslm(slm,'Transient');
+    """
+
+    print('Yep')
+    exit()
+
+    # Recover and process solve options
+    if solutionstringi.lower() == 'tr' or solutionstringi.lower() == 'transient':
+        solutionstring = 'TransientSolution'
+    else:
+        raise RuntimeError('solutionstring {} not supported!'.format(solutionstringi))
+
+    # Default settings for debugging
+    valgrind = 0
+    #slm.cluster.interactive = 0
+    #valgrind = 1
+
+    # Check consistency
+    slm.checkconsistency(solutionstring)
+
+    # Process options
+    options = pairoptions('solutionstring', solutionstring, *args)
+
+    # Make sure we request sum of cluster processors
+    totalnp = 0
+    for i in range(len(slm.icecaps)):
+        totalnp = totalnp + slm.icecaps[i].cluster.np
+    totalnp = totalnp + slm.earth.cluster.np
+    if totalnp != slm.cluster.np:
+        raise RuntimeError('sum of all icecaps and earch cluster processors requestes should be equal to slm.cluster.np')
+
+    # Recover some fields
+    slm.private.solution = solutionstring
+    cluster = slm.cluster
+    batch = 0
+    # Now, go through icecaps, glaciers and earth, and upload all the data independently
+    print('solving ice caps first')
+    for i in range(len(slm.icecaps)):
+        slm.icecaps[i] = solve(slm.icecaps[i], solutionastringi,'batch','yes')
+    print('solving earth now')
+    slm.earth = solve(slm.earth, solutionstringi, 'batch', 'yes')
+
+    # First, build a runtime name that is unique
+    c = datetime.now()
+    md.private.runtimename = "%s-%02i-%02i-%04i-%02i-%02i-%02i-%i" % (md.miscellaneous.name, c.month, c.day, c.year, c.hour, c.minute, c.second, os.getpid())
+
+    # Write all input files
+    privateruntimenames = []
+    miscellaneousnames = []
+    nps = []
+    for i in range(len(slm.icecaps)):
+        privateruntimenames.append(slm.icecaps[i],private.runtimename)
+        miscellaneousnames.append(slm.earth.miscellaneous.name)
+        nps.append(slm.earth.cluster.np)
+
+    BuildQueueScriptMultipleModels(cluster, slm.private.runtimename, slm.miscellaneous.name, slm.private.solution, valgrind, privateruntimenames, miscellaneousnames, nps)
+
+    # Upload all required files, given that each individual solution for icecaps and earth model already did
+    filelist = [slm.miscellaneous.name + '.queue']
+    UploadQueueJob(cluster, slm.miscellaneous.name, slm.private.runtimename, filelist)
+
+    # Launch queue job
+    LaunchQueueJob(cluster, slm.miscellaneous.name, slm.private.runtimename, filelist, '', batch)
+
+    # Wait on lock
+    if slm.settings.waitonlock > 0:
+        islock = waitonlock(slm)
+        if islock == 0:  # no results to be loaded
+            print('The results must be loaded manually with md = loadresultsfromcluster(md).')
+        else: # load results
+            if slm.verbose.solution:
+                print('loading results from cluster')
+            slm = loadresultsfromcluster(slm)
+
+    return slm
Index: issm/trunk/src/m/solve/waitonlock.m
===================================================================
--- issm/trunk/src/m/solve/waitonlock.m	(revision 25994)
+++ issm/trunk/src/m/solve/waitonlock.m	(revision 26744)
@@ -2,7 +2,8 @@
 %WAITONLOCK - wait for a file
 %
-%   This routine will return when a file named 'lockfilename' is written to disk.
-%   Also check for outlog file be cause it might bewritten several seconds
-%   after the lock file.
+%   This routine will return when a file named 'lockfilename' is written to 
+%   disk. Also check for outlog file be cause it might be written several 
+%   seconds after the lock file.
+%
 %   If the time limit given in input is exceeded, return 0
 %
@@ -37,5 +38,5 @@
 
 %initialize time and file presence test flag
-time=0; ispresent=0; time0=clock;
+elapsedtime=0; ispresent=0; starttime=clock;
 disp(['waiting for ' lockfilename ' hold on... (Ctrl+C to exit)'])
 
@@ -58,14 +59,14 @@
 
 %loop till file .lock exist or time is up
-while (ispresent==0 & time<timelimit)
+while (ispresent==0 & elapsedtime<timelimit)
 	if strcmpi(oshostname(),cluster.name),
 		pause(1);
 		ispresent=(exist(lockfilename,'file') & exist(logfilename,'file'));
-		time=etime(clock,time0)/60;
+		elapsedtime=etime(clock,starttime)/60;
 	else
 		pause(5);
-		time=etime(clock,time0);
-		fprintf('\rchecking for job completion (time: %i min %i sec)      ',floor(time/60),floor(rem(time,60)));
-		time=time/60; %converts time from sec to min
+		elapsedtime=etime(clock,starttime);
+		fprintf('\rchecking for job completion (time: %i min %i sec)      ',floor(elapsedtime/60),floor(rem(elapsedtime,60)));
+		elapsedtime=elapsedtime/60; %converts time from sec to min
 		ispresent=~system(command);
 		if ispresent, fprintf('\n'); end
@@ -74,5 +75,5 @@
 
 %build output
-if (time>timelimit),
+if (elapsedtime>timelimit),
 	disp('Time limit exceeded. Increase md.settings.waitonlock');
 	disp('The results must be loaded manually with md=loadresultsfromcluster(md).');
Index: issm/trunk/src/m/solve/waitonlock.py
===================================================================
--- issm/trunk/src/m/solve/waitonlock.py	(revision 25994)
+++ issm/trunk/src/m/solve/waitonlock.py	(revision 26744)
@@ -1,62 +1,99 @@
-import os
-from socket import gethostname
+import subprocess
+import sys
 import time
-import MatlabFuncs as m
-
+from generic import *
+from generic_static import *
+# from localpfe import *
+from MatlabFuncs import *
+from pfe import *
 
 def waitonlock(md):
-    """
-    WAITONLOCK - wait for a file
+    """WAITONLOCK - wait for a file
 
-       This routine will return when a file named 'filename' is written to disk.
-       If the time limit given in input is exceeded, return 0
+    This routine will return when a file named 'lockfilename' is written to 
+    disk. Also check for outlog file because it might be written several 
+    seconds after the lock file.
 
-       Usage:
-          flag = waitonlock(md)
+    If the time limit given in input is exceeded, return 0.
+
+    Usage:
+        flag = waitonlock(md)
+
+    TODO:
+    - Uncomment import of localpfe and check on cluster type once localpfe.py 
+    has been translated from localpfe.m.
     """
 
-    #Get filename (lock file) and options
+    # Get lockfilename (lock file) and options
     executionpath = md.cluster.executionpath
-    cluster = md.cluster.name
     timelimit = md.settings.waitonlock
-    filename = os.path.join(executionpath, md.private.runtimename, md.miscellaneous.name + '.lock')
+    cluster = md.cluster
 
-    #waitonlock will work if the lock is on the same machine only:
-    if not m.strcmpi(gethostname(), cluster):
+    if isa(cluster, pfe) and cluster.interactive > 1:
+        lockfilename = '{}/Interactive{}/{}.lock'.format(executionpath, cluster.interactive, md.miscellaneous.name)
+        logfilename = '{}/Interactive{}/{}.outlog'.format(executionpath, cluster.interactive, md.miscellaneous.name)
+    # elif isa(cluster, localpfe):
+    #     lockfilename = '{}/{}.lock'.format(executionpath, md.miscellaneous.name)
+    #     logfilename = '{}/{}.outlog'.format(executionpath, md.miscellaneous.name)
+    else:
+        lockfilename = '{}/{}/{}.lock'.format(executionpath, md.private.runtimename, md.miscellaneous.name)
+        logfilename = '{}/{}/{}.outlog'.format(executionpath, md.private.runtimename, md.miscellaneous.name)
 
-        print('solution launched on remote cluster. log in to detect job completion.')
-        choice = eval(input('Is the job successfully completed? (y / n) '))
-        if not m.strcmp(choice, 'y'):
-            print('Results not loaded... exiting')
-            flag = 0
+    # If we are using the generic cluster in interactive mode, job is already complete
+    if (isa(cluster, generic) and cluster.interactive) or (isa(cluster, generic_static)):
+        # We are in interactive mode, no need to check for job completion
+        return 1
+
+    # Initialize time and file presence test flag
+    elapsedtime = 0
+    ispresent = 0
+    starttime = time.time()
+    print('waiting for {} hold on... (Ctrl+C to exit)'.format(lockfilename))
+
+    # Prepare command if the job is not running on the local machine
+    if not strcmpi(oshostname(), cluster.name):
+        if cluster.name == 'cloud':
+            command = '[ -f {} ] && [ -f {} ] 2>/dev/null'.format(lockfilename, logfilename)
+            command = '{} sshmaster {} --user {} \'{}\''.format(starcluster(), cluster.name, cluster.login, command)
         else:
-            flag = 1
+            command = 'ssh -l {}'.format(cluster.login)
+            if isprop(cluster, 'idfile') and cluster.idfile != '':
+                command += ' -i {}'.format(cluster.idfile)
+            port = 0
+            if isprop(cluster, 'port'):
+                port = cluster.port
+            if port: # Check if port is non-zero
+                command += ' -p {} localhost'.format(port)
+            else:
+                command += ' {}'.format(cluster.name)
+            command += ' "[ -f {} ] && [ -f {} ]" 2>/dev/null'.format(lockfilename, logfilename)
 
-    #job is running on the same machine
-    else:
+    while not ispresent and elapsedtime < timelimit:
+        if strcmpi(oshostname(), cluster.name):
+            pause(1)
+            ispresent = (isfile(lockfilename) and isfile(logfilename))
+            elapsedtime = etime(time.time(), starttime) / 60
+        else:
+            pause(5)
+            elapsedtime = etime(time.time(), starttime)
+            sys.stdout.write('\rchecking for job completion (time: {} min {} sec)      '.format(floor(elapsedtime / 60), floor(rem(elapsedtime, 60)))) # TODO: After Python 2 is deprecated, we can change this call to print([...], end='')
+            elapsedtime = elapsedtime / 60 # Converts time from sec to min
+            subproc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            outs, errs = subproc.communicate() # NOTE: Need to consume output before checking return code
 
-        if 'interactive' in vars(md.cluster) and md.cluster.interactive:
-            #We are in interactive mode, no need to check for job completion
-            flag = 1
-            return flag
-        #initialize time and file presence test flag
-        etime = 0
-        ispresent = 0
-        print(("waiting for '%s' hold on... (Ctrl + C to exit)" % filename))
+            # TODO: Debug the following check under Linux (exits after first iteration with errs = "b")
+            # UPDATE: Works in testing under Debian Linux system. Leaving comment for now so that it is easier to backtrace this issue if someone else encounters it.
+            #
+            #if errs != '':
+            #    raise Exception('waitonlock: check for existence of files failed: {}'.format(errs))
+            ispresent = not subproc.returncode
+            if ispresent:
+                print('')
 
-        #loop till file .lock exist or time is up
-        while ispresent == 0 and etime < timelimit:
-            ispresent = os.path.exists(filename)
-            time.sleep(1)
-            etime += 1 / 60
+    # Build output
+    if elapsedtime > timelimit:
+        print('Time limit exceeded. Increase md.settings.waitonlock')
+        print('The results must be loaded manually with md = loadresultsfromcluster(md).')
+        raise RuntimeError('waitonlock error message: time limit exceeded.')
 
-        #build output
-        if etime > timelimit:
-            print('Time limit exceeded. Increase md.settings.waitonlock')
-            print('The results must be loaded manually with md = loadresultsfromcluster(md).')
-            raise RuntimeError('waitonlock error message: time limit exceeded.')
-            flag = 0
-        else:
-            flag = 1
-
-    return flag
+    return ispresent
Index: issm/trunk/src/m/solvers/asmoptions.m
===================================================================
--- issm/trunk/src/m/solvers/asmoptions.m	(revision 25994)
+++ issm/trunk/src/m/solvers/asmoptions.m	(revision 26744)
@@ -1,4 +1,4 @@
 function asm=asmoptions(varargin)
-%ASMOPTIONS - return Additive Shwartz Method petsc options
+%ASMOPTIONS - return Additive Schwartz Method PETSc options
 %
 %   Usage:
Index: issm/trunk/src/m/solvers/asmoptions.py
===================================================================
--- issm/trunk/src/m/solvers/asmoptions.py	(revision 25994)
+++ issm/trunk/src/m/solvers/asmoptions.py	(revision 26744)
@@ -1,24 +1,27 @@
+from collections import OrderedDict
 from pairoptions import pairoptions
 
+def asmoptions(*args):
+    """ASMOPTIONS - Return Additive Schwartz Method PETSc options
 
-def asmoptions(*args):
-    #ASMOPTIONS - return ASM petsc options
-    #
-    #   Usage:
-    #      options = asmoptions
+    Usage:
+        options = asmoptions
+    """
 
-    #retrieve options provided in *args
+    # Retrieve options provided in *args
     arguments = pairoptions(*args)
 
-    options = [['toolkit', 'petsc'],
-               ['mat_type', 'mpiaij'],
-               ['ksp_type', 'gmres'],
-               ['pc_type', 'asm'],
-               ['sub_pc_type', 'lu'],
-               ['pc_asm_overlap', 3],
-               ['ksp_max_it', 100],
-               ['ksp_rtol', 1e-30]]
+    options = [
+        ['toolkit', 'petsc'],
+        ['mat_type', 'mpiaij'],
+        ['ksp_type', 'gmres'],
+        ['pc_type', 'asm'],
+        ['sub_pc_type', 'lu'],
+        ['pc_asm_overlap', 3],
+        ['ksp_max_it', 100],
+        ['ksp_rtol', 1e-30]
+    ]
 
-    #now, go through our arguments, and write over default options.
+    # Now, go through our arguments, and write over default options
     for i in range(len(arguments.list)):
         arg1 = arguments.list[i][0]
@@ -33,5 +36,10 @@
                 break
         if not found:
-            #this option did not exist, add it:
+            # This option did not exist; add it
             options.append([arg1, arg2])
-    return options
+
+    asmoptions = OrderedDict()
+    for j in range(len(options)):
+        asmoptions[options[j][0]]=options[j][1]
+
+    return asmoptions
Index: issm/trunk/src/m/solvers/asmstokesoptions.m
===================================================================
--- issm/trunk/src/m/solvers/asmstokesoptions.m	(revision 26744)
+++ issm/trunk/src/m/solvers/asmstokesoptions.m	(revision 26744)
@@ -0,0 +1,20 @@
+function asm=asmstokesoptions(varargin)
+%ASMSTOKESOPTIONS - return Additive Schwartz Method Stokes PETSc options
+%
+%   Usage:
+%      options=asmstokesoptions;
+
+%retrieve options provided in varargin
+options=pairoptions(varargin{:});
+asm=struct();
+
+%default asm options
+asm.toolkit='petsc';
+asm.mat_type=getfieldvalue(options,'mat_type','mpiaij');
+asm.ksp_type=getfieldvalue(options,'ksp_type','gmres');
+asm.pc_type=getfieldvalue(options,'pc_type','asm');
+asm.sub_pc_type=getfieldvalue(options,'sub_pc_type','lu');
+asm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',1); % COMSOL's default
+asm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
+asm.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-7);  %tuned for best performance and to fit ISMIP-HOM-C 5km with MUMPS
+asm.ksp_atol=getfieldvalue(options,'ksp_atol',1e-10); %tuned for best performance and to fit ISMIP-HOM-C 5km with MUMPS
Index: issm/trunk/src/m/solvers/asmstokesoptions.py
===================================================================
--- issm/trunk/src/m/solvers/asmstokesoptions.py	(revision 26744)
+++ issm/trunk/src/m/solvers/asmstokesoptions.py	(revision 26744)
@@ -0,0 +1,46 @@
+from collections import OrderedDict
+from pairoptions import pairoptions
+
+def asmstokesoptions(*args):
+    """ASMSTOKESOPTIONS - Return Additive Schwartz Method Stokes PETSc options
+
+    Usage:
+        options = asmstokesoptions
+    """
+
+    # Retrieve options provided in *args
+    arguments = pairoptions(*args)
+
+    options = [
+        ['toolkit', 'petsc'],
+        ['mat_type', 'mpiaij'],
+        ['ksp_type', 'gmres'],
+        ['pc_type', 'asm'],
+        ['sub_pc_type', 'lu'],
+        ['pc_asm_overlap', 1], # COMSOL's default
+        ['ksp_max_it', 100],
+        ['ksp_rtol', 1e-7], # Tuned for best performance and to fit ISMIP-HOM-C 5km with MUMPS
+        ['ksp_atol', 1e-10] # Tuned for best performance and to fit ISMIP-HOM-C 5km with MUMPS
+    ]
+
+    # Now, go through our arguments, and write over default options
+    for i in range(len(arguments.list)):
+        arg1 = arguments.list[i][0]
+        arg2 = arguments.list[i][1]
+        found = 0
+        for j in range(len(options)):
+            joption = options[j][0]
+            if joption == arg1:
+                joption[1] = arg2
+                options[j] = joption
+                found = 1
+                break
+        if not found:
+            # This option did not exist; add it
+            options.append([arg1, arg2])
+
+    asmoptions = OrderedDict()
+    for j in range(len(options)):
+        asmoptions[options[j][0]]=options[j][1]
+
+    return asmoptions
Index: issm/trunk/src/m/solvers/mumpsnoneoptions.py
===================================================================
--- issm/trunk/src/m/solvers/mumpsnoneoptions.py	(revision 25994)
+++ issm/trunk/src/m/solvers/mumpsnoneoptions.py	(revision 26744)
@@ -1,4 +1,5 @@
 from pairoptions import pairoptions
 from collections import OrderedDict
+from IssmConfig import IssmConfig
 
 
@@ -14,27 +15,25 @@
 
     #default mumps options
-    PETSC_MAJOR = IssmConfig('_PETSC_MAJOR_')
-    PETSC_MINOR = IssmConfig('_PETSC_MINOR_')
+    PETSC_MAJOR = IssmConfig('_PETSC_MAJOR_')[0]
+    PETSC_MINOR = IssmConfig('_PETSC_MINOR_')[0]
     if PETSC_MAJOR == 2:
-        mumps.toolkit = 'petsc'
-        mumps.mat_type = getfieldvalue(options, 'mat_type', 'aijmumps')
-        mumps.ksp_type = getfieldvalue(options, 'ksp_type', 'preonly')
-        mumps.pc_type = getfieldvalue(options, 'pc_type', 'lu')
-        mumps.mat_mumps_icntl_14 = getfieldvalue(options, 'mat_mumps_icntl_14', 120)
-    end
+        mumps['toolkit'] = 'petsc'
+        mumps['mat_type'] = options.getfieldvalue(options, 'mat_type', 'aijmumps')
+        mumps['ksp_type'] = options.getfieldvalue(options, 'ksp_type', 'preonly')
+        mumps['pc_type'] = options.getfieldvalue(options, 'pc_type', 'lu')
+        mumps['mat_mumps_icntl_14'] = options.getfieldvalue(options, 'mat_mumps_icntl_14', 120)
 
     if PETSC_MAJOR == 3:
-        mumps.toolkit = 'petsc'
-        mumps.mat_type = getfieldvalue(options, 'mat_type', 'mpiaij')
-        mumps.ksp_type = getfieldvalue(options, 'ksp_type', 'preonly')
-        mumps.pc_type = getfieldvalue(options, 'pc_type', 'lu')
+        mumps['toolkit'] = 'petsc'
+        mumps['mat_type'] = options.getfieldvalue(options, 'mat_type', 'mpiaij')
+        mumps['ksp_type'] = options.getfieldvalue(options, 'ksp_type', 'preonly')
+        mumps['pc_type'] = options.getfieldvalue(options, 'pc_type', 'lu')
         if PETSC_MINOR > 8:
-            mumps.pc_factor_mat_solver_type = getfieldvalue(options, 'pc_factor_mat_solver_type', 'mumps')
+            mumps['pc_factor_mat_solver_type'] = options.getfieldvalue(options, 'pc_factor_mat_solver_type', 'mumps')
         else:
-            mumps.pc_factor_mat_solver_package = getfieldvalue(options, 'pc_factor_mat_solver_package', 'mumps')
-        end
-        mumps.mat_mumps_icntl_14 = getfieldvalue(options, 'mat_mumps_icntl_14', 120)
-        mumps.mat_mumps_icntl_28 = 2; #1 = serial, 2 = parallel
-        mumps.mat_mumps_icntl_29 = 2; #parallel ordering 1 = ptscotch, 2 = parmetis
-    end
-    return solverOptions
+            mumps['pc_factor_mat_solver_package'] = options.getfieldvalue(options, 'pc_factor_mat_solver_package', 'mumps')
+        mumps['mat_mumps_icntl_14'] = options.getfieldvalue(options, 'mat_mumps_icntl_14', 120)
+        mumps['mat_mumps_icntl_28'] = 2  #1 = serial, 2 = parallel
+        mumps['mat_mumps_icntl_29'] = 2  #parallel ordering 1 = ptscotch, 2 = parmetis
+
+    return mumps
Index: issm/trunk/src/m/solvers/mumpsoptions.js
===================================================================
--- issm/trunk/src/m/solvers/mumpsoptions.js	(revision 26744)
+++ issm/trunk/src/m/solvers/mumpsoptions.js	(revision 26744)
@@ -0,0 +1,25 @@
+function mumpsoptions(){
+//MUMPSOPTIONS - 
+//
+//   Usage:
+//      options=mumpsoptions(varargin);
+
+	//Retrieve options provided in varargin. First convert arguments to array:
+	var args = Array.prototype.slice.call(arguments);
+
+	//Then process options
+	var  options = new pairoptions(args.slice(1,args.length));
+
+	//default issmoptions options
+	var mumpsoptions={};
+	mumpsoptions['toolkit']='petsc';
+	mumpsoptions['mat_type']=options.getfieldvalue('mat_type','mpiaij');
+	mumpsoptions['ksp_type']=options.getfieldvalue('ksp_type','preonly');
+	mumpsoptions['pc_type']=options.getfieldvalue('pc_type','lu');
+	mumpsoptions['pc_factor_mat_solver_type']=options.getfieldvalue('pc_factor_mat_solver_type','mumps');
+	mumpsoptions['mat_mumps_icntl_14']=options.getfieldvalue('mat_mumps_icntl_14',120);
+	mumpsoptions['mat_mumps_icntl_28']=options.getfieldvalue('mat_mumps_icntl_28',2);
+	mumpsoptions['mat_mumps_icntl_29']=options.getfieldvalue('mat_mumps_icntl_29',2);
+
+	return mumpsoptions;
+}
Index: issm/trunk/src/m/solvers/mumpsoptions.py
===================================================================
--- issm/trunk/src/m/solvers/mumpsoptions.py	(revision 25994)
+++ issm/trunk/src/m/solvers/mumpsoptions.py	(revision 26744)
@@ -1,4 +1,4 @@
 from collections import OrderedDict
-import pairoptions
+from pairoptions import pairoptions
 from IssmConfig import IssmConfig
 
@@ -13,5 +13,5 @@
 
     #retrieve options provided in varargin
-    options = pairoptions.pairoptions(*args)
+    options = pairoptions(*args)
     mumps = OrderedDict()
 
@@ -24,5 +24,5 @@
         mumps['ksp_type'] = options.getfieldvalue('ksp_type', 'preonly')
         mumps['pc_type'] = options.getfieldvalue('pc_type', 'lu')
-        mumps['mat_mumps_icntl_14'] = options.getfieldvalue('mat_mumps_icntl_14', 120)
+        mumps['mat_mumps_icntl_14'] = options.options.getfieldvalue('mat_mumps_icntl_14', 120)
     if PETSC_MAJOR == 3.:
         mumps['toolkit'] = 'petsc'
@@ -36,3 +36,7 @@
         mumps['mat_mumps_icntl_14'] = options.getfieldvalue('mat_mumps_icntl_14', 120)
 
+        #These 2 lines make raijin break (ptwgts error during solver with PETSc 3.3)
+        mumps['mat_mumps_icntl_28'] = options.getfieldvalue('mat_mumps_icntl_28', 1)  #1=serial, 2=parallel
+        mumps['mat_mumps_icntl_29'] = options.getfieldvalue('mat_mumps_icntl_29', 2)  #parallel ordering 1 = ptscotch, 2 = parmetis
+
     return mumps
Index: issm/trunk/src/wrappers/CoordTransform/CoordTransform.cpp
===================================================================
--- issm/trunk/src/wrappers/CoordTransform/CoordTransform.cpp	(revision 25994)
+++ issm/trunk/src/wrappers/CoordTransform/CoordTransform.cpp	(revision 26744)
@@ -3,69 +3,104 @@
  */
 
+/*Header files*/
 #include "./CoordTransform.h"
-#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
-#include <proj_api.h>
+#include <proj.h>
 
-void CoordTransformUsage(void){/*{{{*/
-	_printf_(" type help CoordTransform\n");
-}/*}}}*/
-WRAPPER(CoordTransform_python){
-	
-	/*intermediary: */
-	double *xin     = NULL;
-   double *yin     = NULL;
-   char   *projin  = NULL;
-   char   *projout = NULL;
-   int     M,N;
-   int     test1,test2;
+/*
+NOTE:
+- Compilation of this module is fenced in Makefile.am, so we do not have to 
+check again if _HAVE_PROJ_ is defined
+*/
+#if defined(PROJ_VERSION_MAJOR) && PROJ_VERSION_MAJOR >= 6
+	/*
+	Converts an array of longitude (x_src) and array of latitude (y_src) in the 
+	projection described by str_src to the projection described by str_dest.
 
-	printf("%i %i %i %i\n",NLHS,nlhs,NRHS,nrhs);
+	NOTE:
+	- API types and calls have been migrated from PROJ 4 to PROJ 6. See SVN 
+	revision history for changes.
 
-	/*Boot module: */
-	MODULEBOOT();
+	Sources:
+	- https://proj.org/development/migration.html
+	- https://www.gaia-gis.it/fossil/libspatialite/wiki?name=PROJ.6
+	*/
 
-	/*checks on arguments: */
-	CHECKARGUMENTS(NLHS,NRHS,&CoordTransformUsage);
+	void CoordTransformUsage(void){/*{{{*/
+		_printf_(" type help CoordTransform\n");
+	}/*}}}*/
+	WRAPPER(CoordTransform_python){
+		/*intermediary: */
+		double *xin     = NULL;
+		double *yin     = NULL;
+		char   *projin  = NULL;
+		char   *projout = NULL;
+		int     M,N;
+		int     test1,test2;
 
-	/*Fetch data needed for meshing: */
-	FetchData(&xin,&M,&N,XIN);
-   FetchData(&yin,&test1,&test2,YIN);
-   if(!M*N)     _error_("no coordinate provided");
-   if(test1!=M) _error_("x and y do not have the same size");
-   if(test2!=N) _error_("x and y do not have the same size");
-   FetchData(&projin,PROJIN);
-   FetchData(&projout,PROJOUT);
+		/*Boot module: */
+		MODULEBOOT();
 
-	/*Initialize output*/
-	double* xout = xNew<double>(M*N);
-	double* yout = xNew<double>(M*N);
+		/*checks on arguments: */
+		CHECKARGUMENTS(NLHS,NRHS,&CoordTransformUsage);
 
-	/*Initialize projections*/
-	projPJ pj_src = pj_init_plus(projin);
-	projPJ pj_dst = pj_init_plus(projout);
-	if(!pj_src) _error_("Failed to initialize PROJ with source projection\n");
-	if(!pj_dst) _error_("Failed to initialize PROJ with destination projection\n");
+		/*Fetch data needed for meshing: */
+		FetchData(&xin,&M,&N,XIN);
+		FetchData(&yin,&test1,&test2,YIN);
+		if(!M*N)     _error_("no coordinate provided");
+		if(test1!=M) _error_("x and y do not have the same size");
+		if(test2!=N) _error_("x and y do not have the same size");
+		FetchData(&projin,PROJIN);
+		FetchData(&projout,PROJOUT);
 
-	/*Transform coordinates*/
-	int p = pj_transform(pj_src,pj_dst,M*N,1,xout,yout,NULL);
-	if(p!=0){
-		_error_("PROJ failed with error code: "<<p);
+		/*Calculate size once*/
+		int size = M*N;
+
+		/*Initialize output*/
+		double* xout = xNew<double>(size);
+		double* yout = xNew<double>(size);
+
+		for(int i=0;i<size;i++){
+			xout[i] = xin[i];
+			yout[i] = yin[i];
+		}
+
+		PJ *P;
+		size_t sx = sizeof(double);
+		size_t sy = sizeof(double);
+		size_t nx = size;
+		size_t ny = size;
+
+		P = proj_create_crs_to_crs(PJ_DEFAULT_CTX,projin,projout,NULL);
+
+		if ( 0 == P ) {
+			proj_destroy(P);
+			_error_("failed to initialize CRS transformation object");
+		}
+
+		int p = proj_trans_generic(P, PJ_FWD, xout, sx, nx, yout, sy, ny, 0, 0, 0, 0, 0, 0);
+
+		if ( 0 == p ){
+			proj_destroy(P);
+			_error_("no successful transformations");
+		}
+
+		proj_destroy(P);
+
+		/*write outputs: */
+		WriteData(XOUT,xout,M,N);
+		WriteData(YOUT,yout,M,N);
+
+		/*Clean-up and return*/
+		xDelete<double>(xin);
+		xDelete<double>(yin);
+		xDelete<double>(xout);
+		xDelete<double>(yout);
+		xDelete<char>(projin);
+		xDelete<char>(projout);
+
+		/*end module: */
+		MODULEEND();
 	}
-
-	/*write outputs: */
-	WriteData(XOUT,xout,M,N);
-	WriteData(YOUT,yout,M,N);
-
-	/*Clean-up and return*/
-   mxFree(projin);
-   mxFree(projout);
-	xDelete<double>(xin);
-	xDelete<double>(yin);
-	xDelete<double>(xout);
-	xDelete<double>(yout);
-	xDelete<char>(projin);
-	xDelete<char>(projout);
-
-	/*end module: */
-	MODULEEND();
-}
+#else
+	_error_("PROJ version >= 6 required");
+#endif
Index: issm/trunk/src/wrappers/CoordTransform/CoordTransform.h
===================================================================
--- issm/trunk/src/wrappers/CoordTransform/CoordTransform.h	(revision 25994)
+++ issm/trunk/src/wrappers/CoordTransform/CoordTransform.h	(revision 26744)
@@ -17,13 +17,9 @@
 #endif
 
-#ifdef _HAVE_JAVASCRIPT_MODULES_
-#undef _DO_NOT_LOAD_GLOBALS_ /*only module where this needs to be undefined, so as to 
-							   not include IssmComm several times in the javascript Modle construct.*/
-#endif
-
 /*Header files: */
 #include "../bindings.h"
+#include "../../c/main/globals.h"
+#include "../../c/modules/modules.h"
 #include "../../c/shared/shared.h"
-#include "../../c/shared/io/io.h"
 
 #undef __FUNCT__ 
Index: issm/trunk/src/wrappers/ShpRead/ShpRead.cpp
===================================================================
--- issm/trunk/src/wrappers/ShpRead/ShpRead.cpp	(revision 25994)
+++ issm/trunk/src/wrappers/ShpRead/ShpRead.cpp	(revision 26744)
@@ -67,9 +67,12 @@
 
 		switch(psShape->nSHPType){
+			case SHPT_POINTZ:
+				contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false);
+				break;
 			case SHPT_ARC:
 				contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false);
 				break;
 			default:
-				_printf_("Shape type "<<SHPTypeName(psShape->nSHPType)<<"not supported yet, skipping...\n");
+				_printf_("Shape type "<<SHPTypeName(psShape->nSHPType)<<" not supported yet, skipping...\n");
 		}
 
Index: issm/trunk/src/wrappers/javascript/Makefile.am
===================================================================
--- issm/trunk/src/wrappers/javascript/Makefile.am	(revision 25994)
+++ issm/trunk/src/wrappers/javascript/Makefile.am	(revision 26744)
@@ -1,3 +1,3 @@
-AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @CODIPACKINCL@
+AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @CODIPACKINCL@
 AUTOMAKE_OPTIONS = subdir-objects
 
@@ -8,5 +8,5 @@
 
 js_scripts = ${ISSM_DIR}/src/wrappers/BamgMesher/BamgMesher.js \
-             ${ISSM_DIR}/src/wrappers/Triangle/Triangle.js  \
+			 ${ISSM_DIR}/src/wrappers/Triangle/Triangle.js \
 			 ${ISSM_DIR}/src/wrappers/NodeConnectivity/NodeConnectivity.js\
 			 ${ISSM_DIR}/src/wrappers/ContourToMesh/ContourToMesh.js\
@@ -67,5 +67,5 @@
 # Module sources and dependencies {{{
 if !WINDOWS
-libISSMJavascript_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(MPILIB) $(PETSCLIB) $(MKLLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB) 
+libISSMJavascript_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(MPILIB) $(PETSCLIB) $(MKLLIB) $(GSLLIB) $(MATHLIB)
 endif
 
@@ -76,5 +76,5 @@
 
 if !WINDOWS
-libISSMApi_la_LIBADD = $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB) $(MEXLIB)
+libISSMApi_la_LIBADD = $(MPILIB) $(PETSCLIB) $(GSLLIB) $(MATHLIB) $(MEXLIB)
 endif
 
Index: issm/trunk/src/wrappers/matlab/Makefile.am
===================================================================
--- issm/trunk/src/wrappers/matlab/Makefile.am	(revision 25994)
+++ issm/trunk/src/wrappers/matlab/Makefile.am	(revision 26744)
@@ -1,3 +1,3 @@
-AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @CODIPACKINCL@ @PROJINCL@
+AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @CODIPACKINCL@ @PROJINCL@
 AUTOMAKE_OPTIONS = subdir-objects
 
@@ -20,8 +20,15 @@
 	./io/WriteMatlabData.cpp
 
-ALLCXXFLAGS= -fPIC -D_WRAPPERS_ $(CXXFLAGS) $(CXXOPTFLAGS)
+ALL_CXXFLAGS = -fPIC -D_WRAPPERS_
+
+if MSYS2
+ALL_CXXFLAGS += -D_DO_NOT_LOAD_GLOBALS_ # Cannot have undefined symbols under MSYS2
+ALL_CXXFLAGS += -D_USE_MATH_DEFINES # Need to open fence to math.h definitions when --std=c++ is used (which is the default)
+endif
+
+ALL_CXXFLAGS += $(CXXOPTFLAGS) $(CXXFLAGS)
 
 libISSMMatlab_la_SOURCES = $(io_sources)
-libISSMMatlab_la_CXXFLAGS= $(ALLCXXFLAGS)
+libISSMMatlab_la_CXXFLAGS = ${ALL_CXXFLAGS}
 #}}}
 #api io{{{
@@ -32,8 +39,10 @@
 endif
 
+if !MSYS2
 api_sources= ./io/ApiPrintf.cpp
 
 libISSMApi_la_SOURCES = $(api_sources)
-libISSMApi_la_CXXFLAGS= $(ALLCXXFLAGS)
+libISSMApi_la_CXXFLAGS = ${ALL_CXXFLAGS}
+endif
 #}}}
 #Wrappers {{{
@@ -70,5 +79,5 @@
 lib_LTLIBRARIES += Kriging_matlab.la
 endif
-if KML
+if SHP
 lib_LTLIBRARIES += ShpRead_matlab.la
 endif
@@ -82,8 +91,19 @@
 
 #Triangle library
-AM_CXXFLAGS =  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER -D_WRAPPERS_
+CXXFLAGS_FOR_TRI = -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
 
 #Matlab part
-AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT} --export-dynamic -rdynamic -no-undefined
+CXXFLAGS_FOR_MEX = -D_HAVE_MATLAB_MODULES_ $(MEXOPTFLAGS) $(MEXCXXFLAGS)
+CPPFLAGS_FOR_MEX = $(MATLABINCL)
+LDFLAGS_FOR_MEX = -module -shrext $(MEXEXT) -no-undefined
+LIBADD_FOR_MEX = $(MEXLINKFLAGS) $(MEXLIB)
+
+AM_CPPFLAGS += ${CXXFLAGS_FOR_MEX}
+AM_CXXFLAGS = ${CXXFLAGS_FOR_TRI} ${CPPFLAGS_FOR_MEX}
+AM_LDFLAGS = ${LDFLAGS_FOR_MEX}
+
+if !MSYS2
+AM_LDFLAGS += --export-dynamic -rdynamic
+endif
 
 if !VERSION
@@ -106,11 +126,15 @@
 endif
 
-AM_CXXFLAGS += -D_HAVE_MATLAB_MODULES_ -fPIC
-
-deps += ./libISSMMatlab.la ../../c/libISSMModules.la ../../c/libISSMCore.la ./libISSMApi.la
-
-if WINDOWS
-deps += $(METISLIB)
-endif
+AM_CXXFLAGS += -fPIC -D_WRAPPERS_
+
+deps += ./libISSMMatlab.la ../../c/libISSMCore.la ../../c/libISSMModules.la
+
+if !MSYS2
+deps += ./libISSMApi.la
+endif
+
+# if WINDOWS
+# deps += $(METISLIB)
+# endif
 
 if ADOLC
@@ -122,6 +146,5 @@
 endif
 
-#MEXLIB needs to be the last (undefined references on larsen)
-deps += ${MEXLIB}
+deps += ${LIBADD_FOR_MEX}
 
 #Optimization flags:
@@ -130,129 +153,111 @@
 # Module sources and dependencies {{{
 if !WINDOWS
-libISSMMatlab_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(MKLLIB) $(GSLLIB) $(PROJLIB) $(MATHLIB) $(MEXLIB)
+libISSMMatlab_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(MKLLIB) $(GSLLIB) $(PROJLIB) $(MATHLIB) $(MEXLIB)
+endif
+
+if VERSION
+libISSMMatlab_la_LDFLAGS =
+libISSMApi_la_LDFLAGS =
+else
+libISSMMatlab_la_LDFLAGS = -avoid-version
+libISSMApi_la_LDFLAGS = -avoid-version
 endif
 
 if STANDALONE_LIBRARIES
-libISSMMatlab_la_LDFLAGS = -static
-libISSMApi_la_LDFLAGS = -static
-deps += $(PETSCLIB) $(HDF5LIB) $(TAOLIB) $(NEOPZLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
-endif
-
-if !WINDOWS
-libISSMApi_la_LIBADD = $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB) $(MATHLIB) $(MEXLIB)
+libISSMMatlab_la_LDFLAGS += -static
+libISSMApi_la_LDFLAGS += -static
+deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(OSLIBS) ${LIBADD_FOR_MEX}
+endif
+
+if !WINDOWS
+libISSMApi_la_LIBADD = $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB) $(MATHLIB) $(MEXLIB)
 endif
 
 BamgConvertMesh_matlab_la_SOURCES = ../BamgConvertMesh/BamgConvertMesh.cpp
-BamgConvertMesh_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgConvertMesh_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+BamgConvertMesh_matlab_la_LIBADD = ${deps}
 
 BamgMesher_matlab_la_SOURCES = ../BamgMesher/BamgMesher.cpp
-BamgMesher_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgMesher_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+BamgMesher_matlab_la_LIBADD = ${deps}
 
 BamgTriangulate_matlab_la_SOURCES = ../BamgTriangulate/BamgTriangulate.cpp
-BamgTriangulate_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgTriangulate_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+BamgTriangulate_matlab_la_LIBADD = ${deps}
 
 if CHACO
 Chaco_matlab_la_SOURCES = ../Chaco/Chaco.cpp
-Chaco_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-Chaco_matlab_la_LIBADD = ${deps} $(CHACOLIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+Chaco_matlab_la_LIBADD = ${deps} $(CHACOLIB)
 endif
 
 ContourToMesh_matlab_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp
-ContourToMesh_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ContourToMesh_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+ContourToMesh_matlab_la_LIBADD = ${deps}
 
 ContourToNodes_matlab_la_SOURCES = ../ContourToNodes/ContourToNodes.cpp
-ContourToNodes_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ContourToNodes_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
-
+ContourToNodes_matlab_la_LIBADD = ${deps}
+
+if PROJ
 CoordTransform_matlab_la_SOURCES = ../CoordTransform/CoordTransform.cpp
-CoordTransform_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-CoordTransform_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+CoordTransform_matlab_la_LIBADD = ${deps}
+endif
 
 DistanceToMaskBoundary_matlab_la_SOURCES = ../DistanceToMaskBoundary/DistanceToMaskBoundary.cpp
-DistanceToMaskBoundary_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-DistanceToMaskBoundary_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+DistanceToMaskBoundary_matlab_la_LIBADD = ${deps}
 
 ElementConnectivity_matlab_la_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp
-ElementConnectivity_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ElementConnectivity_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+ElementConnectivity_matlab_la_LIBADD = ${deps}
 
 ExpToLevelSet_matlab_la_SOURCES = ../ExpToLevelSet/ExpToLevelSet.cpp
-ExpToLevelSet_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ExpToLevelSet_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+ExpToLevelSet_matlab_la_LIBADD = ${deps}
 
 ExpSimplify_matlab_la_SOURCES = ../ExpSimplify/ExpSimplify.cpp
-ExpSimplify_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ExpSimplify_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB) $(NEOPZLIB)
+ExpSimplify_matlab_la_LIBADD = ${deps}
 
 InterpFromGridToMesh_matlab_la_SOURCES = ../InterpFromGridToMesh/InterpFromGridToMesh.cpp
-InterpFromGridToMesh_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromGridToMesh_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+InterpFromGridToMesh_matlab_la_LIBADD = ${deps}
 
 InterpFromMesh2d_matlab_la_SOURCES = ../InterpFromMesh2d/InterpFromMesh2d.cpp
-InterpFromMesh2d_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMesh2d_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+InterpFromMesh2d_matlab_la_LIBADD = ${deps}
 
 InterpFromMeshToGrid_matlab_la_SOURCES = ../InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
-InterpFromMeshToGrid_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToGrid_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+InterpFromMeshToGrid_matlab_la_LIBADD = ${deps}
 
 InterpFromMeshToMesh2d_matlab_la_SOURCES = ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
-InterpFromMeshToMesh2d_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToMesh2d_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+InterpFromMeshToMesh2d_matlab_la_LIBADD = ${deps}
 
 InterpFromMeshToMesh3d_matlab_la_SOURCES = ../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
-InterpFromMeshToMesh3d_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToMesh3d_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+InterpFromMeshToMesh3d_matlab_la_LIBADD = ${deps}
 
 IssmConfig_matlab_la_SOURCES = ../IssmConfig/IssmConfig.cpp
-IssmConfig_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-IssmConfig_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB)
+IssmConfig_matlab_la_LIBADD = ${deps}
 
 Kriging_matlab_la_SOURCES = ../Kriging/Kriging.cpp
-Kriging_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-Kriging_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(PROJLIB)
+Kriging_matlab_la_LIBADD = ${deps}
 
 M1qn3_matlab_la_SOURCES = ../M1qn3/M1qn3.cpp
-M1qn3_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-M1qn3_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(METISLIB) $(M1QN3LIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+M1qn3_matlab_la_LIBADD = ${deps}
 
 MeshPartition_matlab_la_SOURCES = ../MeshPartition/MeshPartition.cpp
-MeshPartition_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-MeshPartition_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(METISLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+MeshPartition_matlab_la_LIBADD = ${deps}
 
 MeshProfileIntersection_matlab_la_SOURCES = ../MeshProfileIntersection/MeshProfileIntersection.cpp
-MeshProfileIntersection_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-MeshProfileIntersection_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+MeshProfileIntersection_matlab_la_LIBADD = ${deps}
 
 NodeConnectivity_matlab_la_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp
-NodeConnectivity_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-NodeConnectivity_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+NodeConnectivity_matlab_la_LIBADD = ${deps}
 
 PointCloudFindNeighbors_matlab_la_SOURCES = ../PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
-PointCloudFindNeighbors_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-PointCloudFindNeighbors_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+PointCloudFindNeighbors_matlab_la_LIBADD = ${deps}
 
 PropagateFlagsFromConnectivity_matlab_la_SOURCES = ../PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
-PropagateFlagsFromConnectivity_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-PropagateFlagsFromConnectivity_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+PropagateFlagsFromConnectivity_matlab_la_LIBADD = ${deps}
 
 Scotch_matlab_la_SOURCES = ../Scotch/Scotch.cpp
-Scotch_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-Scotch_matlab_la_LIBADD = ${deps}  $(PETSCLIB) $(HDF5LIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(BLASLAPACKLIB)
+Scotch_matlab_la_LIBADD = ${deps}
 
 ShpRead_matlab_la_SOURCES = ../ShpRead/ShpRead.cpp
-ShpRead_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ShpRead_matlab_la_LIBADD = ${deps} $(SHAPELIBLIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+ShpRead_matlab_la_LIBADD = ${deps} $(SHAPELIBLIB)
 
 Triangle_matlab_la_SOURCES = ../Triangle/Triangle.cpp
-Triangle_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-Triangle_matlab_la_LIBADD = ${deps} $(TRIANGLELIB) $(PETSCLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
+Triangle_matlab_la_LIBADD = ${deps} $(TRIANGLELIB)
 
 ProcessRifts_matlab_la_SOURCES = ../ProcessRifts/ProcessRifts.cpp
-ProcessRifts_matlab_la_CXXFLAGS = ${AM_CXXFLAGS}
-ProcessRifts_matlab_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB)
-#}}}
+ProcessRifts_matlab_la_LIBADD = ${deps}
+#}}}
Index: issm/trunk/src/wrappers/python/Makefile.am
===================================================================
--- issm/trunk/src/wrappers/python/Makefile.am	(revision 25994)
+++ issm/trunk/src/wrappers/python/Makefile.am	(revision 26744)
@@ -1,3 +1,3 @@
-AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @CODIPACKINCL@
+AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ @AMPIINCL@ @ADJOINTMPIINCL@ @MEDIPACKINCL@ @CODIPACKINCL@ @PROJINCL@
 AUTOMAKE_OPTIONS = subdir-objects
 
@@ -101,67 +101,67 @@
 #}}}
 # Module sources and dependencies {{{
-libISSMPython_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(PETSCLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(MKLLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB)
+libISSMPython_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(PETSCLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(MKLLIB) $(GSLLIB) $(MATHLIB)
 
 if STANDALONE_LIBRARIES
 libISSMPython_la_LDFLAGS = -static
 libISSMApi_la_LDFLAGS = -static
-deps += $(DAKOTALIB) $(PETSCLIB) $(HDF5LIB) $(TAOLIB) $(NEOPZLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
+deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(NEOPZLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(CHACOLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(OSLIBS)
 endif
 
-libISSMApi_la_LIBADD = $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB)
+libISSMApi_la_LIBADD = $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(MATHLIB)
 
 BamgConvertMesh_python_la_SOURCES = ../BamgConvertMesh/BamgConvertMesh.cpp
 BamgConvertMesh_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgConvertMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+BamgConvertMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 BamgMesher_python_la_SOURCES = ../BamgMesher/BamgMesher.cpp
 BamgMesher_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgMesher_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+BamgMesher_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 BamgTriangulate_python_la_SOURCES = ../BamgTriangulate/BamgTriangulate.cpp
 BamgTriangulate_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-BamgTriangulate_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+BamgTriangulate_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 if CHACO
 Chaco_python_la_SOURCES = ../Chaco/Chaco.cpp
 Chaco_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-Chaco_python_la_LIBADD = ${deps} $(CHACOLIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+Chaco_python_la_LIBADD = ${deps} $(CHACOLIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 endif
 
 ContourToMesh_python_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp
 ContourToMesh_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-ContourToMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+ContourToMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB)
 
 ContourToNodes_python_la_SOURCES = ../ContourToNodes/ContourToNodes.cpp
 ContourToNodes_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-ContourToNodes_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+ContourToNodes_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 ElementConnectivity_python_la_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp
 ElementConnectivity_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-ElementConnectivity_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+ElementConnectivity_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 ExpToLevelSet_python_la_SOURCES = ../ExpToLevelSet/ExpToLevelSet.cpp
 ExpToLevelSet_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-ExpToLevelSet_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB) $(NEOPZLIB)
+ExpToLevelSet_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(NEOPZLIB)
 
 InterpFromMesh2d_python_la_SOURCES = ../InterpFromMesh2d/InterpFromMesh2d.cpp
 InterpFromMesh2d_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMesh2d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+InterpFromMesh2d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB)
 
 InterpFromGridToMesh_python_la_SOURCES = ../InterpFromGridToMesh/InterpFromGridToMesh.cpp
 InterpFromGridToMesh_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromGridToMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+InterpFromGridToMesh_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB)
 
 InterpFromMeshToGrid_python_la_SOURCES = ../InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
 InterpFromMeshToGrid_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToGrid_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+InterpFromMeshToGrid_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(NEOPZLIB) $(GSLLIB)
 
 InterpFromMeshToMesh2d_python_la_SOURCES = ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
 InterpFromMeshToMesh2d_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToMesh2d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(GSLLIB) $(PROJ4LIB)
+InterpFromMeshToMesh2d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(GSLLIB)
 
 InterpFromMeshToMesh3d_python_la_SOURCES = ../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
 InterpFromMeshToMesh3d_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-InterpFromMeshToMesh3d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(GSLLIB) $(PROJ4LIB)
+InterpFromMeshToMesh3d_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(MULTITHREADINGLIB) $(GSLLIB)
 
 IssmConfig_python_la_SOURCES = ../IssmConfig/IssmConfig.cpp
@@ -171,20 +171,20 @@
 MeshPartition_python_la_SOURCES = ../MeshPartition/MeshPartition.cpp
 MeshPartition_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-MeshPartition_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(METISLIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+MeshPartition_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(METISLIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 MeshProfileIntersection_python_la_SOURCES = ../MeshProfileIntersection/MeshProfileIntersection.cpp
 MeshProfileIntersection_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-MeshProfileIntersection_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+MeshProfileIntersection_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 NodeConnectivity_python_la_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp
 NodeConnectivity_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-NodeConnectivity_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+NodeConnectivity_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 Triangle_python_la_SOURCES = ../Triangle/Triangle.cpp
 Triangle_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-Triangle_python_la_LIBADD = ${deps} $(TRIANGLELIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+Triangle_python_la_LIBADD = ${deps} $(TRIANGLELIB) $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 
 ProcessRifts_python_la_SOURCES = ../ProcessRifts/ProcessRifts.cpp
 ProcessRifts_python_la_CXXFLAGS = ${AM_CXXFLAGS}
-ProcessRifts_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJ4LIB)
+ProcessRifts_python_la_LIBADD = ${deps} $(PETSCLIB) $(HDF5LIB) $(BLASLAPACKLIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB)
 #}}}
Index: issm/trunk/src/wrappers/python/io/FetchPythonData.cpp
===================================================================
--- issm/trunk/src/wrappers/python/io/FetchPythonData.cpp	(revision 25994)
+++ issm/trunk/src/wrappers/python/io/FetchPythonData.cpp	(revision 26744)
@@ -189,4 +189,5 @@
 	long* lmatrix=NULL;
 	bool* bmatrix=NULL;
+	float* smatrix=NULL;
 	int i;
 	PyObject* py_matrix2=NULL;
@@ -212,5 +213,14 @@
 			}
 
-			if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) {
+			if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_FLOAT) {
+				/*retrieve internal value: */
+				smatrix=(float*)PyArray_DATA((PyArrayObject*)py_matrix);
+
+				/*transform into double matrix: */
+				matrix=xNew<double>(M*N);
+				for(i=0;i<M*N;i++)matrix[i]=(double)smatrix[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) {
 				/*retrieve internal value: */
 				dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
@@ -558,4 +568,5 @@
 	long* lvector=NULL;
 	bool* bvector=NULL;
+	float* svector=NULL;
 	int i;
 	PyObject* py_vector2=NULL;
@@ -584,5 +595,13 @@
 			}
 
-			if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
+			if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_FLOAT) {
+				/*retrieve internal value: */
+				svector=(float*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into double matrix: */
+				vector=xNew<double>(M);
+				for(i=0;i<M;i++)vector[i]=(double)svector[i];
+			}
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
 				/*retrieve internal value: */
 				dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
